Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.JdbcTemplate


  }

  // Spring setters
 
  public void setDataSource(DataSource dataSource) {
    this.jdbcTemplate = new JdbcTemplate(dataSource);
  }
View Full Code Here


  }

  // Spring setters
 
  public void setDataSource(DataSource dataSource) {
    this.jdbcTemplate = new JdbcTemplate(dataSource);
  }
View Full Code Here

  }

  // Spring setters
 
  public void setDataSource(DataSource dataSource) {
    this.jdbcTemplate = new JdbcTemplate(dataSource);
  }
View Full Code Here

  }

  // Spring setters
 
  public void setDataSource(DataSource dataSource) {
    this.jdbcTemplate = new JdbcTemplate(dataSource);
  }
View Full Code Here

  }

  // Spring setters
 
  public void setDataSource(DataSource dataSource) {
    this.jdbcTemplate = new JdbcTemplate(dataSource);
  }
View Full Code Here

  }

  // Spring setters
 
  public void setDataSource(DataSource dataSource) {
    this.jdbcTemplate = new JdbcTemplate(dataSource);
  }
View Full Code Here

  public static HashMap<String,ConfigInfo> query(){
    com.taobao.tddl.jdbc.group.TGroupDataSource source=new com.taobao.tddl.jdbc.group.TGroupDataSource();
    source.setAppName("APP_PRM");
    source.setDbGroupKey("PRM_GROUP");
    source.init();
    JdbcTemplate tddlJT=new org.springframework.jdbc.core.JdbcTemplate(source);


   
      String sql="select * from pid_info_5 where warnDate is not null order by updatetime desc limit 0,3000";
    List re=tddlJT.queryForList(sql);
      System.out.println(re.size());
     
      HashMap<String,ConfigInfo> rtn=new HashMap<String, ConfigInfo>();
      for(int i=0;i<re.size();i++)
      {
View Full Code Here

        }
    }

    public static void createTable(Controller controller, String tableName) {
        DataSource dataSource = DatabaseTestUtil.getDatabaseConfig(controller, "insertAccount").getDataSource();
        JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
        SqlRowSet tables = jdbcTemplate.queryForRowSet("show tables");
        boolean tableExists = false;
        while (tables.next()) {
            if (tables.getString("TABLE_NAME").equals(tableName.toUpperCase())) {
                tableExists = true;
                break;
            }
        }
       
        // create table if it doesn't exist
        if (!tableExists) {
            StringBuilder createTableSql = new StringBuilder(50);
            createTableSql.append("create table ").append(tableName).append(" (");
            List<String> keys = new ArrayList<String>(ALL_COLS.keySet());
            for (int i = 0; i < keys.size(); i++ ) {
                createTableSql.append(keys.get(i)).append(" ").append(ALL_COLS.get(keys.get(i)));
                if (i == keys.size() - 1) {
                    createTableSql.append(")");
                } else {
                    createTableSql.append(", ");
                }
            }
            jdbcTemplate.execute(createTableSql.toString());
        }
    }
View Full Code Here

        userTO = userService3.submitForm(form);
        assertNotNull(userTO);
        assertEquals("rejected", userTO.getStatus());

        // 6. check that rejected user was not propagated to external resource (SYNCOPE-364)
        JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
        Exception exception = null;
        try {
            jdbcTemplate.queryForObject("SELECT id FROM test WHERE id=?",
                    new String[] {userTO.getUsername()}, Integer.class);
        } catch (EmptyResultDataAccessException e) {
            exception = e;
        }
        assertNotNull(exception);
View Full Code Here

        assertEquals("createApproval", userTO.getStatus());
        assertEquals(Collections.singleton(RESOURCE_NAME_TESTDB), userTO.getResources());

        assertTrue(userTO.getPropagationStatusTOs().isEmpty());

        JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);

        Exception exception = null;
        try {
            jdbcTemplate.queryForObject("SELECT id FROM test WHERE id=?",
                    new String[] {userTO.getUsername()}, Integer.class);
        } catch (EmptyResultDataAccessException e) {
            exception = e;
        }
        assertNotNull(exception);

        // 2. request if there is any pending form for user just created
        List<WorkflowFormTO> forms = userWorkflowService.getForms();
        assertNotNull(forms);
        assertEquals(1, forms.size());

        WorkflowFormTO form = userWorkflowService.getFormForUser(userTO.getId());
        assertNotNull(form);
        assertNotNull(form.getTaskId());
        assertNull(form.getOwner());

        // 4. claim task (from admin)
        form = userWorkflowService.claimForm(form.getTaskId());
        assertNotNull(form);
        assertNotNull(form.getTaskId());
        assertNotNull(form.getOwner());

        // 5. approve user (and verify that propagation occurred)
        Map<String, WorkflowFormPropertyTO> props = form.getPropertyMap();
        props.get("approve").setValue(Boolean.TRUE.toString());
        form.setProperties(props.values());
        userTO = userWorkflowService.submitForm(form);
        assertNotNull(userTO);
        assertEquals("active", userTO.getStatus());
        assertEquals(Collections.singleton(RESOURCE_NAME_TESTDB), userTO.getResources());

        exception = null;
        try {
            final String username = jdbcTemplate.queryForObject("SELECT id FROM test WHERE id=?", String.class,
                    userTO.getUsername());
            assertEquals(userTO.getUsername(), username);
        } catch (EmptyResultDataAccessException e) {
            exception = e;
        }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.JdbcTemplate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.