示例#1
0
  @Test
  public void testRenameAndLookup() {
    final LdapName name1 =
        LdapUtils.createLdapName(
            RECORD.getNodeTypeName(), "TestEren3",
            IOC.getNodeTypeName(), "TestEcon2",
            COMPONENT.getNodeTypeName(), "TestEcom2",
            FACILITY.getNodeTypeName(), EFAN_NAME,
            UNIT.getNodeTypeName(), UNIT.getUnitTypeValue());

    final LdapName name2 =
        LdapUtils.createLdapName(
            RECORD.getNodeTypeName(), "NedFlanders",
            IOC.getNodeTypeName(), "TestEcon2",
            COMPONENT.getNodeTypeName(), "TestEcom2",
            FACILITY.getNodeTypeName(), EFAN_NAME,
            UNIT.getNodeTypeName(), UNIT.getUnitTypeValue());

    try {
      LDAP_SERVICE.rename(name1, name2);
      Assert.assertNotNull(LDAP_SERVICE.lookup(name2));
      LDAP_SERVICE.rename(name2, name1);
      Assert.assertNotNull(LDAP_SERVICE.lookup(name1));
    } catch (final NamingException e) {
      Assert.fail("Rename failed");
    }
  }
示例#2
0
  @Test
  public void testAttributeAccess() {
    final LdapName name =
        LdapUtils.createLdapName(
            IOC.getNodeTypeName(),
            "TestEcon2",
            COMPONENT.getNodeTypeName(),
            "TestEcom2",
            FACILITY.getNodeTypeName(),
            EFAN_NAME,
            UNIT.getNodeTypeName(),
            UNIT.getUnitTypeValue());

    try {
      Attributes attrs = LDAP_SERVICE.getAttributes(name);
      Assert.assertNotNull(attrs);
      Attribute attr = attrs.get(ATTR_FIELD_RESPONSIBLE_PERSON);
      Assert.assertNotNull(attr);
      String value = (String) attr.get();
      Assert.assertEquals("*****@*****.**", value);

      ModificationItem[] items =
          new ModificationItem[] {new ModificationItem(DirContext.REMOVE_ATTRIBUTE, attr)};
      LDAP_SERVICE.modifyAttributes(name, items);

      attrs = LDAP_SERVICE.getAttributes(name);
      Assert.assertNotNull(attrs);
      final Attribute attrNull = attrs.get(ATTR_FIELD_RESPONSIBLE_PERSON);
      Assert.assertNull(attrNull);

      items = new ModificationItem[] {new ModificationItem(DirContext.ADD_ATTRIBUTE, attr)};
      LDAP_SERVICE.modifyAttributes(name, items);

      attrs = LDAP_SERVICE.getAttributes(name);
      Assert.assertNotNull(attrs);
      attr = attrs.get(ATTR_FIELD_RESPONSIBLE_PERSON);
      Assert.assertNotNull(attr);
      value = (String) attr.get();
      Assert.assertEquals("*****@*****.**", value);

    } catch (final NamingException e) {
      Assert.fail("Unexpected Exception on attribute modification.");
    }
  }
示例#3
0
 ComponentTableModel(COMPONENT p_component, String[] p_columnNames) {
   o_component = p_component;
   o_columnNames = p_columnNames;
   o_component.addComponentChangeListener(this);
 }
 protected AbstractDescriptorBasedPageComponentJson(final COMPONENT component) {
   super(component);
   this.config =
       component.getConfig() != null ? new RootDataSetJson(component.getConfig()).getSet() : null;
 }