예제 #1
0
  /** Test the create method. */
  @Test
  public void testEnvironmentNoTiers() throws Exception {

    int num = environmentDao.findAll().size();
    Environment environment = new Environment();
    environment.setName(ENVIRONMENT_NAME);
    environment.setOrg(ORG);
    environment.setDescription("description");
    environment = environmentDao.create(environment);
    assertNotNull(environment);
    assertNotNull(environment.getId());
    assertEquals(environmentDao.findAll().size(), num + 1);
  }
예제 #2
0
  /** Test the load method. */
  @Test
  public void testLoadNoTiers() throws Exception {

    Environment environment = new Environment();
    environment.setName(ENVIRONMENT_NAME);
    environment.setOrg(ORG);
    environment.setVdc("vdc");
    environment.setDescription("description");
    environment = environmentDao.create(environment);
    environment = environmentDao.findByEnvironmentNameVdc(environment.getName(), "vdc");
    assertNotNull(environment);
    assertNotNull(environment.getId());
  }
예제 #3
0
  /**
   * Test the load method.
   *
   * @throws AlreadyExistsEntityException
   * @throws InvalidEntityException
   */
  @Test
  public void testDeleteNoTiers() throws InvalidEntityException, AlreadyExistsEntityException {

    Environment environment = new Environment();
    environment.setName(ENVIRONMENT_NAME);
    environment.setDescription("description");
    environment.setOrg(ORG);
    environment.setVdc("vdc");
    environment = environmentDao.create(environment);
    environmentDao.remove(environment);
    try {
      environmentDao.findByEnvironmentNameVdc(ENVIRONMENT_NAME, "vdc");
      fail("Should have thrown an EntityNotFoundException because the environment does not exit!");
    } catch (EntityNotFoundException e) {

    }
  }
예제 #4
0
  @Test
  public void shouldFindEnvironmentByOrg() throws AlreadyExistsEntityException {
    // given
    Environment environment = new Environment();
    environment.setOrg("myorg123");
    environment.setName("myname");
    environmentDao.create(environment);

    // when
    List<Environment> list = environmentDao.findByOrg("myorg123");

    // then
    assertNotNull(list);
    assertEquals(1, list.size());
    assertEquals("myname", list.get(0).getName());
    assertEquals("myorg123", list.get(0).getOrg());
  }