@Test
 public void testCreateInstance() {
   try {
     InstanceElement ie = applicationElement.createInstance("new_instance");
     assertEquals(83, ODSHelper.asJLong(ie.getId()));
     InstanceElement ie1 = applicationElement.createInstance("ni1");
     assertEquals(84, ODSHelper.asJLong(ie1.getId()));
     applicationElement.removeInstance(ie.getId(), false);
     InstanceElement ie2 = applicationElement.createInstance("ni2");
     assertEquals(85, ODSHelper.asJLong(ie2.getId()));
     applicationElement.removeInstance(ie1.getId(), false);
     applicationElement.removeInstance(ie2.getId(), false);
   } catch (AoException e) {
     fail(e.reason);
   }
 }
  @Test
  public void testRemoveInstance() {
    try {
      assertEquals(3, applicationElement.getInstances("*").getCount());

      InstanceElement ie = applicationElement.createInstance("new_instance");
      assertEquals(4, applicationElement.getInstances("*").getCount());
      assertEquals(ie.getName(), applicationElement.getInstanceByName("new_instance").getName());

      applicationElement.removeInstance(ie.getId(), false);
      assertEquals(3, applicationElement.getInstances("*").getCount());
      assertEquals(null, applicationElement.getInstanceByName("new_instance"));
    } catch (AoException e) {
      fail(e.reason);
    }
    // non existing instance
    try {
      applicationElement.removeInstance(ODSHelper.asODSLongLong(999), false);
      fail("AoException expected");
    } catch (AoException e) {
    }
  }