Java Code Examples for javax.naming.CompositeName#add()

The following examples show how to use javax.naming.CompositeName#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultDirObjectFactoryTest.java    From spring-ldap with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetObjectInstance_CompositeName() throws Exception {
       Attributes expectedAttributes = new NameAwareAttributes();
	expectedAttributes.put("someAttribute", "someValue");

	CompositeName name = new CompositeName();
	name.add(DN_STRING);
	
	DirContextAdapter adapter = (DirContextAdapter) tested.getObjectInstance(contextMock, name, null,
			new Hashtable(), expectedAttributes);

       verify(contextMock).close();

	assertThat(adapter.getDn()).isEqualTo(DN);
	assertThat(adapter.getAttributes()).isEqualTo(expectedAttributes);
}
 
Example 2
Source File: ResolveResult.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Adds a single component to the end of remaining name.
  *
  * @param name The component to add. Can be null.
  * @see #getRemainingName
  * @see #appendRemainingName
  */
public void appendRemainingComponent(String name) {
    if (name != null) {
        CompositeName rname = new CompositeName();
        try {
            rname.add(name);
        } catch (InvalidNameException e) {
            // ignore; shouldn't happen for empty composite name
        }
        appendRemainingName(rname);
    }
}
 
Example 3
Source File: DefaultDirObjectFactoryTest.java    From spring-ldap with Apache License 2.0 5 votes vote down vote up
@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");
}
 
Example 4
Source File: DefaultDirObjectFactoryTest.java    From spring-ldap with Apache License 2.0 5 votes vote down vote up
@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");
}
 
Example 5
Source File: DirContextAdapterTest.java    From spring-ldap with Apache License 2.0 5 votes vote down vote up
/**
 * Test for LDAP-109, since also DirContextAdapter may get an invalid
 * CompositeName sent to it.
 */
   @Test
public void testConstructorUsingCompositeNameWithBackslashes()
		throws Exception {
	CompositeName compositeName = new CompositeName();
	compositeName.add("cn=Some\\\\Person6,ou=company1,c=Sweden");
	DirContextAdapter adapter = new DirContextAdapter(compositeName);
	assertThat(adapter.getDn().toString()).isEqualTo("cn=Some\\\\Person6,ou=company1,c=Sweden");
}
 
Example 6
Source File: ResolveResult.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Adds a single component to the end of remaining name.
  *
  * @param name The component to add. Can be null.
  * @see #getRemainingName
  * @see #appendRemainingName
  */
public void appendRemainingComponent(String name) {
    if (name != null) {
        CompositeName rname = new CompositeName();
        try {
            rname.add(name);
        } catch (InvalidNameException e) {
            // ignore; shouldn't happen for empty composite name
        }
        appendRemainingName(rname);
    }
}
 
Example 7
Source File: ResolveResult.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Adds a single component to the end of remaining name.
  *
  * @param name The component to add. Can be null.
  * @see #getRemainingName
  * @see #appendRemainingName
  */
public void appendRemainingComponent(String name) {
    if (name != null) {
        CompositeName rname = new CompositeName();
        try {
            rname.add(name);
        } catch (InvalidNameException e) {
            // ignore; shouldn't happen for empty composite name
        }
        appendRemainingName(rname);
    }
}
 
Example 8
Source File: ResolveResult.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Adds a single component to the end of remaining name.
  *
  * @param name The component to add. Can be null.
  * @see #getRemainingName
  * @see #appendRemainingName
  */
public void appendRemainingComponent(String name) {
    if (name != null) {
        CompositeName rname = new CompositeName();
        try {
            rname.add(name);
        } catch (InvalidNameException e) {
            // ignore; shouldn't happen for empty composite name
        }
        appendRemainingName(rname);
    }
}
 
Example 9
Source File: DefaultDirObjectFactoryTest.java    From spring-ldap with Apache License 2.0 5 votes vote down vote up
@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");
}
 
Example 10
Source File: DefaultDirObjectFactoryTest.java    From spring-ldap with Apache License 2.0 5 votes vote down vote up
@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");
}
 
Example 11
Source File: ResolveResult.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
  * Adds a single component to the end of remaining name.
  *
  * @param name The component to add. Can be null.
  * @see #getRemainingName
  * @see #appendRemainingName
  */
public void appendRemainingComponent(String name) {
    if (name != null) {
        CompositeName rname = new CompositeName();
        try {
            rname.add(name);
        } catch (InvalidNameException e) {
            // ignore; shouldn't happen for empty composite name
        }
        appendRemainingName(rname);
    }
}
 
Example 12
Source File: ResolveResult.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
  * Adds a single component to the end of remaining name.
  *
  * @param name The component to add. Can be null.
  * @see #getRemainingName
  * @see #appendRemainingName
  */
public void appendRemainingComponent(String name) {
    if (name != null) {
        CompositeName rname = new CompositeName();
        try {
            rname.add(name);
        } catch (InvalidNameException e) {
            // ignore; shouldn't happen for empty composite name
        }
        appendRemainingName(rname);
    }
}
 
Example 13
Source File: ResolveResult.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Adds a single component to the end of remaining name.
  *
  * @param name The component to add. Can be null.
  * @see #getRemainingName
  * @see #appendRemainingName
  */
public void appendRemainingComponent(String name) {
    if (name != null) {
        CompositeName rname = new CompositeName();
        try {
            rname.add(name);
        } catch (InvalidNameException e) {
            // ignore; shouldn't happen for empty composite name
        }
        appendRemainingName(rname);
    }
}
 
Example 14
Source File: ResolveResult.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Adds a single component to the end of remaining name.
  *
  * @param name The component to add. Can be null.
  * @see #getRemainingName
  * @see #appendRemainingName
  */
public void appendRemainingComponent(String name) {
    if (name != null) {
        CompositeName rname = new CompositeName();
        try {
            rname.add(name);
        } catch (InvalidNameException e) {
            // ignore; shouldn't happen for empty composite name
        }
        appendRemainingName(rname);
    }
}
 
Example 15
Source File: ResolveResult.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Adds a single component to the end of remaining name.
  *
  * @param name The component to add. Can be null.
  * @see #getRemainingName
  * @see #appendRemainingName
  */
public void appendRemainingComponent(String name) {
    if (name != null) {
        CompositeName rname = new CompositeName();
        try {
            rname.add(name);
        } catch (InvalidNameException e) {
            // ignore; shouldn't happen for empty composite name
        }
        appendRemainingName(rname);
    }
}
 
Example 16
Source File: ResolveResult.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Adds a single component to the end of remaining name.
  *
  * @param name The component to add. Can be null.
  * @see #getRemainingName
  * @see #appendRemainingName
  */
public void appendRemainingComponent(String name) {
    if (name != null) {
        CompositeName rname = new CompositeName();
        try {
            rname.add(name);
        } catch (InvalidNameException e) {
            // ignore; shouldn't happen for empty composite name
        }
        appendRemainingName(rname);
    }
}
 
Example 17
Source File: ResolveResult.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
  * Adds a single component to the end of remaining name.
  *
  * @param name The component to add. Can be null.
  * @see #getRemainingName
  * @see #appendRemainingName
  */
public void appendRemainingComponent(String name) {
    if (name != null) {
        CompositeName rname = new CompositeName();
        try {
            rname.add(name);
        } catch (InvalidNameException e) {
            // ignore; shouldn't happen for empty composite name
        }
        appendRemainingName(rname);
    }
}
 
Example 18
Source File: ResolveResult.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Adds a single component to the end of remaining name.
  *
  * @param name The component to add. Can be null.
  * @see #getRemainingName
  * @see #appendRemainingName
  */
public void appendRemainingComponent(String name) {
    if (name != null) {
        CompositeName rname = new CompositeName();
        try {
            rname.add(name);
        } catch (InvalidNameException e) {
            // ignore; shouldn't happen for empty composite name
        }
        appendRemainingName(rname);
    }
}
 
Example 19
Source File: ResolveResult.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Adds a single component to the end of remaining name.
  *
  * @param name The component to add. Can be null.
  * @see #getRemainingName
  * @see #appendRemainingName
  */
public void appendRemainingComponent(String name) {
    if (name != null) {
        CompositeName rname = new CompositeName();
        try {
            rname.add(name);
        } catch (InvalidNameException e) {
            // ignore; shouldn't happen for empty composite name
        }
        appendRemainingName(rname);
    }
}
 
Example 20
Source File: ResolveResult.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Adds a single component to the end of remaining name.
  *
  * @param name The component to add. Can be null.
  * @see #getRemainingName
  * @see #appendRemainingName
  */
public void appendRemainingComponent(String name) {
    if (name != null) {
        CompositeName rname = new CompositeName();
        try {
            rname.add(name);
        } catch (InvalidNameException e) {
            // ignore; shouldn't happen for empty composite name
        }
        appendRemainingName(rname);
    }
}