@Test public void testLdapReaderJob() { final LdapName name = LdapUtils.createLdapName( FACILITY.getNodeTypeName(), EFAN_NAME, UNIT.getNodeTypeName(), UNIT.getUnitTypeValue()); final Holder<Boolean> read = new Holder<Boolean>(Boolean.FALSE); final ILdapReaderJob job = LDAP_SERVICE.createLdapReaderJob( new LdapSearchParams(name, LdapUtils.any(RECORD.getNodeTypeName())), new ILdapReadCompletedCallback() { @Override public void onLdapReadComplete() { read.setValue(Boolean.TRUE); } }); job.schedule(); try { job.join(); } catch (final InterruptedException e) { Assert.fail("Not supposed to be interrupted."); } Assert.assertTrue(read.getValue()); Assert.assertEquals(4, job.getSearchResult().getAnswerSet().size()); }
@Test public void testLdapContentModelBuilder() { final LdapName name = LdapUtils.createLdapName( FACILITY.getNodeTypeName(), EFAN_NAME, UNIT.getNodeTypeName(), UNIT.getUnitTypeValue()); final ILdapSearchResult result = LDAP_SERVICE.retrieveSearchResultSynchronously( name, LdapUtils.any(RECORD.getNodeTypeName()), SearchControls.SUBTREE_SCOPE); Assert.assertNotNull(result); try { final ILdapContentModelBuilder<LdapEpicsControlsConfiguration> builder = LDAP_SERVICE.getLdapContentModelBuilder(VIRTUAL_ROOT, result); Assert.assertNotNull(builder); builder.build(); final ContentModel<LdapEpicsControlsConfiguration> model = builder.getModel(); final Map<String, INodeComponent<LdapEpicsControlsConfiguration>> records = model.getByType(RECORD); Assert.assertEquals(4, records.size()); } catch (final CreateContentModelException e) { Assert.fail("Content model could not be created."); } catch (LdapServiceException e) { Assert.fail("Content model could not be created."); } }