@Before public void setUp() throws Exception { contextMock = mock(Context.class); contextMock2 = mock(Context.class); tested = new DefaultDirObjectFactory(); }
@Test public void testConstructAdapterFromName_OnlySlash() throws InvalidNameException { CompositeName name = new CompositeName(); name.add("ldap://localhost:389/"); DefaultDirObjectFactory tested = new DefaultDirObjectFactory(); DirContextAdapter result = tested.constructAdapterFromName(new BasicAttributes(), name, ""); assertThat(result.getDn().toString()).isEqualTo(""); assertThat(result.getReferralUrl().toString()).isEqualTo("ldap://localhost:389"); } }
@Test public void testConstructAdapterFromName_Ldaps() throws InvalidNameException { CompositeName name = new CompositeName(); name.add("ldaps://localhost:389/ou=People,o=JNDITutorial"); DefaultDirObjectFactory tested = new DefaultDirObjectFactory(); DirContextAdapter result = tested.constructAdapterFromName(new BasicAttributes(), name, ""); assertThat(result.getDn().toString()).isEqualTo("ou=People,o=JNDITutorial"); assertThat(result.getReferralUrl().toString()).isEqualTo("ldaps://localhost:389"); }
@Test public void testConstructAdapterFromName_EmptyName() throws InvalidNameException { CompositeName name = new CompositeName(); name.add("ldap://localhost:389"); DefaultDirObjectFactory tested = new DefaultDirObjectFactory(); DirContextAdapter result = tested.constructAdapterFromName(new BasicAttributes(), name, ""); assertThat(result.getDn().toString()).isEqualTo(""); assertThat(result.getReferralUrl().toString()).isEqualTo("ldap://localhost:389"); }
@Test public void testConstructAdapterFromName() throws InvalidNameException { CompositeName name = new CompositeName(); name.add("ldap://localhost:389/ou=People,o=JNDITutorial"); DefaultDirObjectFactory tested = new DefaultDirObjectFactory(); DirContextAdapter result = tested.constructAdapterFromName(new BasicAttributes(), name, ""); assertThat(result.getDn().toString()).isEqualTo("ou=People,o=JNDITutorial"); assertThat(result.getReferralUrl().toString()).isEqualTo("ldap://localhost:389"); }
public synchronized SecurityComponents createSecurityComponents() { DefaultDirObjectFactory factory = new DefaultDirObjectFactory(); DefaultSpringSecurityContextSource securityContextSource = new DefaultSpringSecurityContextSource(getLDAPURL()); if (managerDN != null){
public synchronized SecurityComponents createSecurityComponents() { DefaultDirObjectFactory factory = new DefaultDirObjectFactory(); DefaultSpringSecurityContextSource securityContextSource = new DefaultSpringSecurityContextSource(getLDAPURL()); if (managerDN != null) {