mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
21.17.2014 82071bddff5fae0935749b4012f2c62c92b11085
Preparatory work for OPENDJ-1477: Constant re-allocation of DN per-schema caches

* rename SchemaTestCase to AbstractSchemaTestCase
* add SchemaTestCase with disabled unit tests for OPENDJ-1477.
1 files added
18 files modified
99 ■■■■ changed files
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaElementTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaTestCase.java 37 ●●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImplTest.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ApproximateMatchingRuleTest.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateExactMatchingRuleImplTest.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxTest.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CoreSchemaTest.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/EntrySchemaCheckingTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTest.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NameFormTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/OrderingMatchingRuleTest.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaCompatTest.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java 28 ●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaUtilsTest.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SubstringMatchingRuleTest.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SyntaxTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaElementTestCase.java
@@ -39,7 +39,7 @@
 * Abstract schema element tests.
 */
@SuppressWarnings("javadoc")
public abstract class AbstractSchemaElementTestCase extends SchemaTestCase {
public abstract class AbstractSchemaElementTestCase extends AbstractSchemaTestCase {
    protected static final Map<String, List<String>> EMPTY_PROPS = Collections.emptyMap();
    protected static final List<String> EMPTY_NAMES = Collections.emptyList();
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaTestCase.java
New file
@@ -0,0 +1,37 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
 * or http://forgerock.org/license/CDDLv1.0.html.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at legal-notices/CDDLv1_0.txt.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
import org.forgerock.testng.ForgeRockTestCase;
import org.testng.annotations.Test;
/**
 * An abstract class that all schema unit test should extend.
 */
@Test(groups = { "precommit", "schema", "sdk" })
public abstract class AbstractSchemaTestCase extends ForgeRockTestCase {
}
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImplTest.java
@@ -50,7 +50,7 @@
 * Tests all generic code of AbstractSubstringMatchingRuleImpl.
 */
@SuppressWarnings("javadoc")
public class AbstractSubstringMatchingRuleImplTest extends SchemaTestCase {
public class AbstractSubstringMatchingRuleImplTest extends AbstractSchemaTestCase {
    private static class FakeSubstringMatchingRuleImpl extends AbstractSubstringMatchingRuleImpl {
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxTestCase.java
@@ -38,7 +38,7 @@
 * Syntax tests.
 */
@SuppressWarnings("javadoc")
public abstract class AbstractSyntaxTestCase extends SchemaTestCase {
public abstract class AbstractSyntaxTestCase extends AbstractSchemaTestCase {
    /**
     * Create data for the testAcceptableValues test. This should be a table of
     * tables with 2 elements. The first one should be the value to test, the
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ApproximateMatchingRuleTest.java
@@ -37,7 +37,7 @@
 * Approximate matching rule tests.
 */
@SuppressWarnings("javadoc")
public class ApproximateMatchingRuleTest extends SchemaTestCase {
public class ApproximateMatchingRuleTest extends AbstractSchemaTestCase {
    MatchingRule metaphone = Schema.getCoreSchema().getMatchingRule(AMR_DOUBLE_METAPHONE_NAME);
    /**
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateExactMatchingRuleImplTest.java
@@ -39,7 +39,7 @@
 * This class tests the certificateExactMatch matching rule.
 */
@SuppressWarnings("javadoc")
public class CertificateExactMatchingRuleImplTest extends SchemaTestCase {
public class CertificateExactMatchingRuleImplTest extends AbstractSchemaTestCase {
    /**
     * Generate data for the certificateExactMatch matching rule test.
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxTest.java
@@ -38,7 +38,7 @@
/**
 * Certificate syntax tests.
 */
public class CertificateSyntaxTest extends SchemaTestCase {
public class CertificateSyntaxTest extends AbstractSchemaTestCase {
    /**
     * Create data for the testAcceptableValues test. This should be a table of
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CoreSchemaTest.java
@@ -32,7 +32,7 @@
 * Core schema tests
 */
@SuppressWarnings("javadoc")
public class CoreSchemaTest extends SchemaTestCase {
public class CoreSchemaTest extends AbstractSchemaTestCase {
    @Test
    public final void testCoreSchemaWarnings() {
        // Make sure core schema doesn't have any warnings.
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/EntrySchemaCheckingTestCase.java
@@ -46,7 +46,7 @@
 * Test schema validation using {@link Schema#validateEntry}.
 */
@Test
public class EntrySchemaCheckingTestCase extends SchemaTestCase {
public class EntrySchemaCheckingTestCase extends AbstractSchemaTestCase {
    /**
     * Tests schema checking for an entry covered by a DIT content rule to
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTest.java
@@ -38,7 +38,7 @@
 * Test The equality matching rules and the equality matching rule api.
 */
@SuppressWarnings("javadoc")
public abstract class MatchingRuleTest extends SchemaTestCase {
public abstract class MatchingRuleTest extends AbstractSchemaTestCase {
    /**
     * Generate invalid assertion values for the Matching Rule test.
     *
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTestCase.java
@@ -43,7 +43,7 @@
 * This class tests the MatchingRule class. The matching rule builder can be only used with the schema builder.
 */
@SuppressWarnings("javadoc")
public class MatchingRuleTestCase extends SchemaTestCase {
public class MatchingRuleTestCase extends AbstractSchemaTestCase {
    @Test()
    public final void testCreatesBasicMatchingRule() {
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NameFormTestCase.java
@@ -42,7 +42,7 @@
 * with the schema builder.
 */
@SuppressWarnings("javadoc")
public class NameFormTestCase extends SchemaTestCase {
public class NameFormTestCase extends AbstractSchemaTestCase {
    /**
     * Creates a new form using the required parameters only (oid, structural
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/OrderingMatchingRuleTest.java
@@ -38,7 +38,7 @@
 * Ordering matching rule tests.
 */
@SuppressWarnings("javadoc")
public abstract class OrderingMatchingRuleTest extends SchemaTestCase {
public abstract class OrderingMatchingRuleTest extends AbstractSchemaTestCase {
    /**
     * Create data for the OrderingMatchingRulesInvalidValues test.
     *
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTestCase.java
@@ -55,7 +55,7 @@
 * Test SchemaBuilder.
 */
@SuppressWarnings("javadoc")
public class SchemaBuilderTestCase extends SchemaTestCase {
public class SchemaBuilderTestCase extends AbstractSchemaTestCase {
    /**
     * Tests that schema validation resolves dependencies between parent/child
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaCompatTest.java
@@ -33,7 +33,7 @@
/**
 * Tests schema compatibility options.
 */
public class SchemaCompatTest extends SchemaTestCase {
public class SchemaCompatTest extends AbstractSchemaTestCase {
    /**
     * Returns test data for valid attribute descriptions.
     *
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java
@@ -21,17 +21,33 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Copyright 2014 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
import org.forgerock.testng.ForgeRockTestCase;
import static org.fest.assertions.Assertions.assertThat;
import org.testng.annotations.Test;
/**
 * An abstract class that all schema unit test should extend.
 * Tests the Schema class.
 */
@Test(groups = { "precommit", "schema", "sdk" })
public abstract class SchemaTestCase extends ForgeRockTestCase {
@SuppressWarnings("javadoc")
public class SchemaTestCase extends AbstractSchemaTestCase {
    @Test(description = "Unit test for OPENDJ-1477", enabled = false)
    public void asNonStrictSchemaAlwaysReturnsSameInstance() {
        final Schema schema = Schema.getCoreSchema();
        final Schema nonStrictSchema1 = schema.asNonStrictSchema();
        final Schema nonStrictSchema2 =
                schema.asNonStrictSchema().asStrictSchema().asNonStrictSchema();
        assertThat(nonStrictSchema1).isSameAs(nonStrictSchema2);
    }
    @Test(description = "Unit test for OPENDJ-1477", enabled = false)
    public void asStrictSchemaAlwaysReturnsSameInstance() {
        final Schema schema = Schema.getCoreSchema();
        final Schema strictSchema1 = schema.asStrictSchema();
        final Schema strictSchema2 = schema.asStrictSchema().asNonStrictSchema().asStrictSchema();
        assertThat(strictSchema1).isSameAs(strictSchema2);
    }
}
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaUtilsTest.java
@@ -39,7 +39,7 @@
 * Test schema utilities.
 */
@SuppressWarnings("javadoc")
public class SchemaUtilsTest extends SchemaTestCase {
public class SchemaUtilsTest extends AbstractSchemaTestCase {
    @DataProvider(name = "invalidOIDs")
    public Object[][] createInvalidOIDs() {
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SubstringMatchingRuleTest.java
@@ -42,7 +42,7 @@
 * is intended to be extended by one class for each substring matching rules.
 */
@SuppressWarnings("javadoc")
public abstract class SubstringMatchingRuleTest extends SchemaTestCase {
public abstract class SubstringMatchingRuleTest extends AbstractSchemaTestCase {
    /**
     * Generate invalid assertion values for the Matching Rule test.
     *
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SyntaxTestCase.java
@@ -36,7 +36,7 @@
 * This class tests the Syntax class.
 */
@SuppressWarnings("javadoc")
public class SyntaxTestCase extends SchemaTestCase {
public class SyntaxTestCase extends AbstractSchemaTestCase {
    @Test()
    public final void testCreatesANewSyntax() {