コード例 #1
0
  /** Testing selection of ServerEntity from Data Base by ID */
  @Test
  public void testFindAllById() {
    ServerEntity entity = new ServerEntity();
    ServerState serverState = ServerState.WARN;
    String serverStateString = ServerState.getStringFromEnum(serverState);
    entity.setServer_name("Test_Server");
    entity.setAddress("255.255.255.0");
    entity.setPort(8080);
    entity.setUrl("http://localhost/");
    entity.setState(serverState);
    entity.setResponse(serverStateString);
    entity.setCreated(timestamp);
    entity.setLastCheck(timestamp);
    entity.setActive(1);
    entity.setResponsible(null);
    serverDao.addServer(entity);

    ServerEntity entity2 = serverDao.findByServerName("Test_Server");
    assertNotNull("failure - Employee entity2 must not be null", entity2);

    // selecting by ID
    Long id = entity2.getId();
    List<ServerEntity> entityList2 = serverDao.findAllByResponsibleId(id);
    assertNotNull("failure - Server entity list must not be null", entityList2);
  }
コード例 #2
0
 /** termination of EmployeeEntity from Data Base */
 @After
 public void testDelete() {
   ServerEntity entity = serverDao.findByServerName("Test_Server");
   serverDao.deleteServer(entity.getId());
 }