コード例 #1
0
  @Test
  public void testRemoveAttribute() {
    try {
      assertEquals(6, applicationElement.listAttributes("*").length);

      BaseAttribute ba = applicationElement.getBaseElement().getAttributes("description")[0];
      ApplicationAttribute aa = applicationElement.createAttribute();
      aa.setName("new_attribute");
      aa.setBaseAttribute(ba);

      assertEquals("new_attribute", aa.getName());
      assertEquals(7, applicationElement.listAttributes("*").length);
      assertNotNull(applicationElement.getAttributeByBaseName("description"));

      applicationElement.removeAttribute(aa);
      assertEquals(6, applicationElement.listAttributes("*").length);
    } catch (AoException e) {
      fail(e.reason);
    }
    // try to access removed base attribute
    try {
      applicationElement.getAttributeByBaseName("description");
      fail("AoException expected");
    } catch (AoException e) {
      assertEquals(ErrorCode.AO_NOT_FOUND, e.errCode);
    }
  }
コード例 #2
0
 @Test
 public void testGetBaseElement() {
   try {
     assertEquals("AoMeasurement", applicationElement.getBaseElement().getType());
   } catch (AoException e) {
     fail(e.reason);
   }
 }