Package org.opentides.bean

Examples of org.opentides.bean.SystemCodes


 
  // fails due to findByExample bug where the column name generated for SystemCodes.key is KEY
  // which should be KEY_ and also as a note KEY is a reserved word in MySQL
    @Test
  public void testFindBykey(){   
    SystemCodes sc = new SystemCodes();
    sc.setDisableProtection(true);
    sc.setCategory("COUNTRY");
    sc.setKey("PH");
    sc.setValue("Philippines");
   
    SystemCodes actual = systemCodesService.findByKey(sc);
   
    assertEquals(sc.getKey(), actual.getKey());
    assertEquals(sc.getCategory(), actual.getCategory());
    assertEquals(sc.getValue(), actual.getValue());
  }
View Full Code Here


    this.systemCodesService = systemCodesService;
  }
 
  private static final class SystemCodesMapper implements RowMapper {
      public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
          SystemCodes sc = new SystemCodes();
          sc.setCategory(rs.getString("category_"));
          sc.setKey(rs.getString("key_"));
          sc.setValue(rs.getString("value_"));
          return sc;
      }
View Full Code Here

    assertEquals(scs1.size(), scs2.size());
    Assert.assertArrayEquals(scs1.toArray(), scs2.toArray());
  }
 
  public void testFindByExample(){
    SystemCodes example = new SystemCodes();
    example.setDisableProtection(true);
    example.setCategory("COUNTRY");
   
    List<SystemCodes> expected = jdbcTemplate.query("SELECT * FROM SYSTEM_CODES WHERE CATEGORY_='COUNTRY'", new SystemCodesMapper());
    List<SystemCodes> actual = systemCodesService.findByExample(example);
    assertEquals(expected.size(), actual.size());
    Assert.assertArrayEquals(expected.toArray(), actual.toArray());
View Full Code Here

    assertEquals(expected.size(), actual.size());
    Assert.assertArrayEquals(expected.toArray(), actual.toArray());
  }
 
  public void testFindByExamplePaging(){
    SystemCodes example = new SystemCodes();
    example.setDisableProtection(true);
    example.setCategory("COUNTRY");
   
    List<SystemCodes> expected = jdbcTemplate.query("SELECT * FROM SYSTEM_CODES WHERE CATEGORY_ LIKE '%COUNTRY%' limit 4,7", new SystemCodesMapper());
    List<SystemCodes> actual = systemCodesService.findByExample(example, 4, 5);
    _log.debug("Size not exact match: "+expected.size());
    assertEquals(expected.size(), actual.size());
View Full Code Here

    assertEquals(expected.size(), actual.size());
    Assert.assertArrayEquals(expected.toArray(), actual.toArray());
  }
 
  public void testFindByExampleExactMatch(){
    SystemCodes example = new SystemCodes();
    example.setDisableProtection(true);
    example.setCategory("COUNTRY");
   
    List<SystemCodes> expected = jdbcTemplate.query("SELECT * FROM SYSTEM_CODES WHERE CATEGORY_='COUNTRY'", new SystemCodesMapper());
    List<SystemCodes> actual = systemCodesService.findByExample(example,true);
    _log.debug("Size exact match: "+expected.size());
    assertEquals(expected.size(), actual.size());
View Full Code Here

    assertEquals(expected.size(), actual.size());
    Assert.assertArrayEquals(expected.toArray(), actual.toArray());
  }
 
  public void testFindByExampleExactMatchPaging(){
    SystemCodes example = new SystemCodes();
    example.setDisableProtection(true);
    example.setCategory("OFFICE");
   
    List<SystemCodes> expected = jdbcTemplate.query("SELECT * FROM SYSTEM_CODES WHERE CATEGORY_='OFFICE' limit 4,5", new SystemCodesMapper());
    List<SystemCodes> actual = systemCodesService.findByExample(example,true,4,5);
    _log.debug("Size exact match: "+expected.size());
    assertEquals(expected.size(), actual.size());
View Full Code Here

    long currCount = systemCodesService.countAll()
    assertEquals(prevCount+1, currCount);
  }
 
  public void testCountAllByExample(){
    SystemCodes example = new SystemCodes();
    example.setDisableProtection(true);
    example.setCategory("COUNTRY");
   
    long expected = jdbcTemplate.queryForLong("SELECT count(*) FROM SYSTEM_CODES WHERE CATEGORY_ LIKE '%COUNTRY%'");
    long actual = systemCodesService.countByExample(example);
    assertEquals(expected, actual);
   
View Full Code Here

    long currCount = systemCodesService.countAll()
    assertEquals(prevCount+1, currCount);
  }
 
  public void testCountAllByExampleExactMatch(){
    SystemCodes example = new SystemCodes();
    example.setDisableProtection(true);
    example.setCategory("O");
   
    long expected = jdbcTemplate.queryForLong("SELECT count(*) FROM SYSTEM_CODES WHERE CATEGORY_ = 'O'");
    long actual = systemCodesService.countByExample(example,true);
    _log.debug("Count exact match: "+expected);
    assertEquals(expected, actual);
View Full Code Here

  public void testLoad(){
    assertNotNull(systemCodesService.load(9001L));
  }
 
  public void testSave(){
    SystemCodes sc = new SystemCodes();
    sc.setDisableProtection(true);
    sc.setCategory("OFFICE");
    sc.setKey("ED");
    sc.setValue("Events Department");
   
    long prevCount = jdbcTemplate.queryForLong("SELECT count(*) FROM SYSTEM_CODES");
    systemCodesService.save(sc);
    long currCount = jdbcTemplate.queryForLong("SELECT count(*) FROM SYSTEM_CODES");
    assertEquals(prevCount+1, currCount);
View Full Code Here

  private SystemCodesService systemCodesService;
  private static final Logger _log = Logger.getLogger(BaseCrudServiceTest.class);
 
  private static final class SystemCodesMapper implements RowMapper {
      public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
          SystemCodes sc = new SystemCodes();
          sc.setCategory(rs.getString("category_"));
          sc.setKey(rs.getString("key_"));
          sc.setValue(rs.getString("value_"));
          return sc;
      }
View Full Code Here

TOP

Related Classes of org.opentides.bean.SystemCodes

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.