| | |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.forgerock.opendj.adapter.server2x.EmbeddedServerTestCaseUtils.CONFIG_PROPERTIES; |
| | | import static org.forgerock.opendj.adapter.server2x.TestCaseUtils.getLDAPTestOptions; |
| | | |
| | | /** |
| | | * This class defines a set of tests for the Adapters.class. |
| | |
| | | @DataProvider |
| | | public Object[][] anonymousConnectionFactories() { |
| | | return new Object[][] { |
| | | { new LDAPConnectionFactory("localhost", Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port")), |
| | | getLDAPTestOptions()) }, |
| | | { new LDAPConnectionFactory("localhost", |
| | | Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port"))) }, |
| | | { Adapters.newAnonymousConnectionFactory() } }; |
| | | } |
| | | |
| | |
| | | return new Object[][] { |
| | | { Connections.newAuthenticatedConnectionFactory( |
| | | new LDAPConnectionFactory("localhost", |
| | | Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port")), |
| | | getLDAPTestOptions()), |
| | | Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port"))), |
| | | Requests.newSimpleBindRequest("cn=directory manager", "password".toCharArray())) }, |
| | | { Adapters.newConnectionFactoryForUser(DN.valueOf("cn=directory manager")) } }; |
| | | } |
| | |
| | | @Test() |
| | | public void testSimpleLDAPConnectionFactorySimpleBind() throws ErrorResultException { |
| | | final LDAPConnectionFactory factory = |
| | | new LDAPConnectionFactory("localhost", Integer.valueOf(CONFIG_PROPERTIES |
| | | .getProperty("listen-port")), getLDAPTestOptions()); |
| | | new LDAPConnectionFactory("localhost", |
| | | Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port"))); |
| | | Connection connection = null; |
| | | try { |
| | | connection = factory.getConnection(); |
| | |
| | | public void testLDAPSASLBind() throws NumberFormatException, GeneralSecurityException, |
| | | ErrorResultException { |
| | | LDAPConnectionFactory factory = |
| | | new LDAPConnectionFactory("localhost", Integer.valueOf(CONFIG_PROPERTIES |
| | | .getProperty("listen-port")), getLDAPTestOptions()); |
| | | new LDAPConnectionFactory("localhost", |
| | | Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port"))); |
| | | |
| | | Connection connection = factory.getConnection(); |
| | | PlainSASLBindRequest request = |
| | |
| | | |
| | | // LDAP Connection |
| | | final LDAPConnectionFactory factory = |
| | | new LDAPConnectionFactory("localhost", Integer.valueOf(CONFIG_PROPERTIES |
| | | .getProperty("listen-port")), getLDAPTestOptions()); |
| | | new LDAPConnectionFactory("localhost", |
| | | Integer.valueOf(CONFIG_PROPERTIES.getProperty("listen-port"))); |
| | | Connection connection = null; |
| | | connection = factory.getConnection(); |
| | | connection.bind("cn=Directory Manager", "password".toCharArray()); |