@Test // @Ignore public void testListSchema() throws Exception { SpmlConfiguration config = createConfiguration(); SpmlConnector info = createConnector(config); try { Schema schema = info.schema(); boolean personFound = false; boolean firstnameFound = false; for (ObjectClassInfo ocInfo : schema.getObjectClassInfo()) { if (ocInfo.is(ObjectClass.ACCOUNT_NAME)) { System.out.println("Schema for " + ocInfo.getType()); personFound = true; for (AttributeInfo attr : ocInfo.getAttributeInfo()) { System.out.println(" " + attr); if (attr.getName().equals("firstname")) { firstnameFound = true; } } } } Assert.assertTrue(personFound); Assert.assertTrue(firstnameFound); } finally { info.dispose(); } }
@Test public void testSyncSupported() throws NamingException { LdapConfiguration config = newConfiguration(); LdapConnection conn = newConnection(config); assertEquals(ServerType.SUN_DSEE, conn.getServerType()); Schema schema = newFacade(config).schema(); ObjectClassInfo accountInfo = schema.findObjectClassInfo(ObjectClass.ACCOUNT_NAME); assertTrue( schema.getSupportedObjectClassesByOperation().get(SyncApiOp.class).contains(accountInfo)); }
/** {@inheritDoc} */ @Override public boolean equals(Object obj) { if (obj instanceof Schema) { Schema other = (Schema) obj; if (!CollectionUtil.equals(getObjectClassInfo(), other.getObjectClassInfo())) { return false; } if (!CollectionUtil.equals(getOperationOptionInfo(), other.getOperationOptionInfo())) { return false; } if (!CollectionUtil.equals( _supportedObjectClassesByOperation, other._supportedObjectClassesByOperation)) { return false; } if (!CollectionUtil.equals( _supportedOptionsByOperation, other._supportedOptionsByOperation)) { return false; } return true; } return false; }