| | |
| | | } |
| | | |
| | | void setDryRun(final boolean dryRun) { |
| | | this.dryRun = true; |
| | | this.dryRun = dryRun; |
| | | } |
| | | |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.requests; |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | | import org.forgerock.util.Reject; |
| | | |
| | | /** |
| | |
| | | final class AnonymousSASLBindRequestImpl extends AbstractSASLBindRequest<AnonymousSASLBindRequest> |
| | | implements AnonymousSASLBindRequest { |
| | | private static final class Client extends SASLBindClientImpl { |
| | | private Client(final AnonymousSASLBindRequestImpl initialBindRequest, |
| | | final String serverName) { |
| | | private Client(final AnonymousSASLBindRequestImpl initialBindRequest) { |
| | | super(initialBindRequest); |
| | | setNextSASLCredentials(ByteString.valueOfUtf8(initialBindRequest.getTraceString())); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public BindClient createBindClient(final String serverName) { |
| | | return new Client(this, serverName); |
| | | return new Client(this); |
| | | } |
| | | |
| | | @Override |
| | |
| | | * <p> |
| | | * This implementation first reads the {@code subschemaSubentry} attribute |
| | | * of the entry in order to identify the schema and then invokes |
| | | * {@link #readSchemaAsync(Connection, DN, ResultHandler)} to read the |
| | | * schema. |
| | | * {@link #readSchemaAsync(Connection, DN)} to read the schema. |
| | | * |
| | | * @param connection |
| | | * A connection to the Directory Server whose schema is to be |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.testng.annotations.DataProvider; |
| | | |
| | | /** |
| | | * Test the CaseExactIA5SubstringMatchingRule. |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | /** Test the CaseExactIA5SubstringMatchingRule. */ |
| | | public class CaseExactIA5SubstringMatchingRuleTest extends SubstringMatchingRuleTest { |
| | | |
| | | @Override |
| | |
| | | return new Object[][] { { "12345678\uFFFD" }, }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | @DataProvider(name = "substringFinalMatchData") |
| | | public Object[][] createSubstringFinalMatchData() { |
| | |
| | | { "end with space ", "space", ConditionResult.TRUE }, }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | @DataProvider(name = "substringInitialMatchData") |
| | | public Object[][] createSubstringInitialMatchData() { |
| | |
| | | { "this is a value", "THIS", ConditionResult.FALSE }, }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | @DataProvider(name = "substringMiddleMatchData") |
| | | public Object[][] createSubstringMiddleMatchData() { |
| | |
| | | { "this is a value", strings(" "), ConditionResult.TRUE }, }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected MatchingRule getRule() { |
| | | return Schema.getCoreSchema().getMatchingRule(SMR_CASE_EXACT_IA5_OID); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.testng.annotations.DataProvider; |
| | | |
| | | /** |
| | | * Test the CaseExactSubstringMatchingRule class. |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | /** Test the CaseExactSubstringMatchingRule class. */ |
| | | public class CaseExactSubstringMatchingRuleTest extends SubstringMatchingRuleTest { |
| | | |
| | | @Override |
| | |
| | | return new Object[][] {}; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | @DataProvider(name = "substringFinalMatchData") |
| | | public Object[][] createSubstringFinalMatchData() { |
| | |
| | | { "end with space ", "space", ConditionResult.TRUE }, }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | @DataProvider(name = "substringInitialMatchData") |
| | | public Object[][] createSubstringInitialMatchData() { |
| | |
| | | { "this is a value", "THIS", ConditionResult.FALSE }, }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | @DataProvider(name = "substringMiddleMatchData") |
| | | public Object[][] createSubstringMiddleMatchData() { |
| | |
| | | { "this is a value", strings(" "), ConditionResult.TRUE }, }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected MatchingRule getRule() { |
| | | return Schema.getCoreSchema().getMatchingRule(SMR_CASE_EXACT_OID); |
| | |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.testng.annotations.DataProvider; |
| | | |
| | | /** |
| | | * Test the CaseIgnoreIA5SubstringMatchingRule. |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | /** Test the CaseIgnoreIA5SubstringMatchingRule. */ |
| | | public class CaseIgnoreIA5SubstringMatchingRuleTest extends SubstringMatchingRuleTest { |
| | | |
| | | @Override |
| | |
| | | return new Object[][] { { "12345678\uFFFD" }, }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | @DataProvider(name = "substringFinalMatchData") |
| | | public Object[][] createSubstringFinalMatchData() { |
| | |
| | | { "end with space ", "SPACE", ConditionResult.TRUE }, }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | @DataProvider(name = "substringInitialMatchData") |
| | | public Object[][] createSubstringInitialMatchData() { |
| | |
| | | { "this is a value", "THIS", ConditionResult.TRUE }, }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | @DataProvider(name = "substringMiddleMatchData") |
| | | public Object[][] createSubstringMiddleMatchData() { |
| | |
| | | { "this is a value", strings(" "), ConditionResult.TRUE }, }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected MatchingRule getRule() { |
| | | return Schema.getCoreSchema().getMatchingRule(SMR_CASE_IGNORE_IA5_OID); |
| | |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.testng.annotations.DataProvider; |
| | | |
| | | /** |
| | | * Test the CaseIgnoreSubstringMatchingRule. |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | /** Test the CaseIgnoreSubstringMatchingRule. */ |
| | | public class CaseIgnoreSubstringMatchingRuleTest extends SubstringMatchingRuleTest { |
| | | |
| | | @Override |
| | |
| | | return new Object[][] {}; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | @DataProvider(name = "substringFinalMatchData") |
| | | public Object[][] createSubstringFinalMatchData() { |
| | |
| | | { "end with space ", "SPACE", ConditionResult.TRUE }, }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | @DataProvider(name = "substringInitialMatchData") |
| | | public Object[][] createSubstringInitialMatchData() { |
| | |
| | | { "this is a value", "THIS", ConditionResult.TRUE }, }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | @DataProvider(name = "substringMiddleMatchData") |
| | | public Object[][] createSubstringMiddleMatchData() { |
| | |
| | | { "this is a value", strings(" "), ConditionResult.TRUE }, }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected MatchingRule getRule() { |
| | | return Schema.getCoreSchema().getMatchingRule(SMR_CASE_IGNORE_OID); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | /** |
| | | * Test the NumericStringSubstringMatchingRule. |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | /** Test the NumericStringSubstringMatchingRule. */ |
| | | @Test |
| | | public class NumericStringSubstringMatchingRuleTest extends SubstringMatchingRuleTest { |
| | | |
| | |
| | | }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | @DataProvider(name = "substringFinalMatchData") |
| | | public Object[][] createSubstringFinalMatchData() { |
| | |
| | | }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | @DataProvider(name = "substringInitialMatchData") |
| | | public Object[][] createSubstringInitialMatchData() { |
| | |
| | | }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | @DataProvider(name = "substringMiddleMatchData") |
| | | public Object[][] createSubstringMiddleMatchData() { |
| | |
| | | }; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected MatchingRule getRule() { |
| | | return Schema.getCoreSchema().getMatchingRule(SMR_NUMERIC_STRING_OID); |
| | |
| | | * |
| | | * |
| | | * Copyright 2011 ForgeRock AS |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldif; |
| | | |
| | | import org.forgerock.opendj.ldap.Connection; |
| | |
| | | @Test |
| | | public final void testConnectionEntryWriterWritesEntry() throws Exception { |
| | | Connection connection = mock(Connection.class); |
| | | ConnectionEntryWriter writer = null; |
| | | |
| | | final Entry entry = |
| | | new LinkedHashMapEntry("cn=scarter,dc=example,dc=com").addAttribute("objectclass", |
| | |
| | | } |
| | | }); |
| | | |
| | | try { |
| | | writer = new ConnectionEntryWriter(connection); |
| | | try (ConnectionEntryWriter writer = new ConnectionEntryWriter(connection)) { |
| | | writer.writeComment("This is a test for the ConnectionEntryWriter"); |
| | | writer.writeEntry(entry); |
| | | verify(connection, times(1)).add(any(Entry.class)); |
| | | } finally { |
| | | writer.close(); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | @Test(expectedExceptions = NullPointerException.class) |
| | | public final void testConnectionEntryWriterDoesntAllowNullComment() throws Exception { |
| | | ConnectionEntryWriter writer = null; |
| | | try { |
| | | writer = new ConnectionEntryWriter(null); |
| | | try (ConnectionEntryWriter writer = new ConnectionEntryWriter(null)) { |
| | | writer.writeComment(null); |
| | | } finally { |
| | | writer.close(); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | @Test(expectedExceptions = NullPointerException.class) |
| | | public final void testConnectionEntryWriterDoesntAllowNull() throws Exception { |
| | | ConnectionEntryWriter writer = null; |
| | | try { |
| | | writer = new ConnectionEntryWriter(null); |
| | | } finally { |
| | | writer.close(); |
| | | try (ConnectionEntryWriter writer = new ConnectionEntryWriter(null)) { |
| | | // nothing to do |
| | | } |
| | | } |
| | | |
| | |
| | | @Test |
| | | public final void testConnectionEntryWriterClose() throws Exception { |
| | | Connection connection = mock(Connection.class); |
| | | ConnectionEntryWriter writer = null; |
| | | try { |
| | | writer = new ConnectionEntryWriter(connection); |
| | | try (ConnectionEntryWriter writer = new ConnectionEntryWriter(connection)) { |
| | | // nothing to do |
| | | } finally { |
| | | writer.close(); |
| | | verify(connection, times(1)).close(); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldif; |
| | | |
| | | import java.io.File; |
| | |
| | | */ |
| | | @Test(expectedExceptions = NullPointerException.class) |
| | | public final void testLdifNewEntryCollectionDoesntAllowNull() throws Exception { |
| | | |
| | | EntryReader resultReader = null; |
| | | try { |
| | | resultReader = LDIF.newEntryCollectionReader(null); |
| | | try (EntryReader resultReader = LDIF.newEntryCollectionReader(null)) { |
| | | resultReader.readEntry(); |
| | | } finally { |
| | | resultReader.close(); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | @Test(expectedExceptions = NullPointerException.class) |
| | | public final void testLdifNewEntryIteratorReaderDoesntAllowsNull() throws Exception { |
| | | |
| | | EntryReader resultReader = null; |
| | | try { |
| | | resultReader = LDIF.newEntryIteratorReader(null); |
| | | try (EntryReader resultReader = LDIF.newEntryIteratorReader(null)) { |
| | | resultReader.readEntry(); |
| | | } finally { |
| | | resultReader.close(); |
| | | } |
| | | } |
| | | |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2015 ForgeRock AS. |
| | | * Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.maven.doc; |
| | | |
| | |
| | | |
| | | /** |
| | | * The path to the directory where the configuration reference should be written. |
| | | * This path must be under {@code ${project.build.directory} }. |
| | | * This path must be under <code>${project.build.directory}</code>. |
| | | */ |
| | | @Parameter(defaultValue = "${project.build.directory}/site/configref") |
| | | private String outputDirectory; |
| | |
| | | |
| | | /** |
| | | * Creates the output directory where the configuration reference is written. |
| | | * @throws MojoExecutionException The output directory is not under {@code ${project.build.directory} } |
| | | * @throws MojoExecutionException The output directory is not under <code>${project.build.directory}</code> |
| | | * or could not be created. |
| | | */ |
| | | private void createOutputDirectory() throws MojoExecutionException { |
| | |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * Copyright 2015 ForgeRock AS. |
| | | * Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.maven.doc; |
| | | |
| | |
| | | @Parameter(defaultValue = "${project.build.directory}/docbkx-sources/shared") |
| | | private File outputDirectory; |
| | | |
| | | /** Holds descriptions for ACIs. */ |
| | | private Map<String, String> descriptions; |
| | | |
| | | /** Holds documentation for an ACI. */ |
| | | private class Aci { |
| | | String name; |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.maven.doc; |
| | | |
| | |
| | | |
| | | private void createOutputDirectory() throws IOException { |
| | | File outputDir = new File(outputDirectory); |
| | | if (outputDir != null && !outputDir.exists()) { |
| | | if (!outputDir.mkdirs()) { |
| | | throw new IOException("Failed to create output directory."); |
| | | } |
| | | if (!outputDir.exists() && !outputDir.mkdirs()) { |
| | | throw new IOException("Failed to create output directory."); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.examples; |
| | | |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | |
| | | * client connection. The following code illustrates how this may be achieved: |
| | | * |
| | | * <pre> |
| | | * {@code |
| | | * final RequestHandlerFactory<LDAPClientContext, RequestContext> proxyFactory = |
| | | * new RequestHandlerFactory<LDAPClientContext, RequestContext>() { |
| | | * @Override |