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

Jean-Noel Rouvignac
18.55.2014 c2371257396d52a53ea9427f1d74c81049a773ce
OPENDJ-1308 Migrate schema support

opendj-server3x-adapter:
Updated after changes on opendj3-server-dev branch: switched to ModificationType and SearchScope SDK types.
3 files modified
81 ■■■■■ changed files
opendj-server3x-adapter/src/main/java/org/forgerock/opendj/adapter/server3x/Adapters.java 2 ●●● patch | view | raw | blame | history
opendj-server3x-adapter/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java 50 ●●●●● patch | view | raw | blame | history
opendj-server3x-adapter/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java 29 ●●●● patch | view | raw | blame | history
opendj-server3x-adapter/src/main/java/org/forgerock/opendj/adapter/server3x/Adapters.java
@@ -225,7 +225,7 @@
                };
                final InternalSearchOperation internalSO =
                        icc.processSearch(valueOf(request.getName()), to(request.getScope()),
                        icc.processSearch(valueOf(request.getName()), request.getScope(),
                                to(request.getDereferenceAliasesPolicy()), request.getSizeLimit(),
                                request.getTimeLimit(), request.isTypesOnly(), to(request
                                        .getFilter()), new LinkedHashSet<String>(request
opendj-server3x-adapter/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java
@@ -142,22 +142,6 @@
    }
    /**
     * Converts from OpenDJ LDAP SDK {@link org.forgerock.opendj.ldap.SearchScope}
     * to OpenDJ server {@link org.opends.server.types.SearchScope}.
     *
     * @param searchScope
     *          value to convert
     * @return the converted value
     */
    public static org.opends.server.types.SearchScope to(
            final org.forgerock.opendj.ldap.SearchScope searchScope) {
        if (searchScope == null) {
            return null;
        }
        return org.opends.server.types.SearchScope.values()[searchScope.intValue()];
    }
    /**
     * Converts from OpenDJ LDAP SDK {@link org.forgerock.opendj.ldap.Filter} to
     * OpenDJ server {@link org.opends.server.types.RawFilter}.
     *
@@ -268,7 +252,7 @@
     */
    public static org.opends.server.types.RawModification to(
            final org.forgerock.opendj.ldap.Modification modification) {
        return new LDAPModification(to(modification.getModificationType()), to(modification
        return new LDAPModification(modification.getModificationType(), to(modification
                .getAttribute()));
    }
@@ -340,7 +324,7 @@
     */
    public static org.opends.server.types.Modification toModification(
            final org.forgerock.opendj.ldap.Modification modification) {
        return new org.opends.server.types.Modification(to(modification.getModificationType()),
        return new org.opends.server.types.Modification(modification.getModificationType(),
            toAttribute(modification.getAttribute()));
    }
@@ -365,36 +349,6 @@
    }
    /**
     * Converts from OpenDJ LDAP SDK
     * {@link org.forgerock.opendj.ldap.ModificationType} to OpenDJ server
     * {@link org.opends.server.types.ModificationType}.
     *
     * @param modificationType
     *          value to convert
     * @return the converted value
     */
    public static org.opends.server.types.ModificationType to(
            final org.forgerock.opendj.ldap.ModificationType modificationType) {
        return org.opends.server.types.ModificationType.values()[modificationType.intValue()];
    }
    /**
     * Converts from OpenDJ server {@link org.opends.server.types.SearchScope}. to
     * OpenDJ LDAP SDK {@link org.forgerock.opendj.ldap.SearchScope}.
     *
     * @param searchScope
     *          value to convert
     * @return the converted value
     */
    public static org.forgerock.opendj.ldap.SearchScope from(
            final org.opends.server.types.SearchScope searchScope) {
        if (searchScope == null) {
            return null;
        }
        return org.forgerock.opendj.ldap.SearchScope.values().get(searchScope.intValue());
    }
    /**
     * Converts from OpenDJ server
     * {@link org.opends.server.protocols.ldap.LDAPControl} to OpenDJ LDAP SDK
     * {@link Control}.
opendj-server3x-adapter/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java
@@ -28,7 +28,6 @@
import static org.fest.assertions.Assertions.*;
import static org.forgerock.opendj.adapter.server3x.Converters.*;
import static org.mockito.Mockito.*;
import static org.testng.Assert.*;
import java.net.InetAddress;
import java.util.Iterator;
@@ -364,13 +363,13 @@
        Modification mod = new Modification(ModificationType.ADD, attribute);
        org.opends.server.types.RawModification srvModification = to(mod);
        assertThat(srvModification.getModificationType().toString()).isEqualTo("Add");
        assertThat(srvModification.getModificationType()).isEqualTo(ModificationType.ADD);
        assertThat(srvModification.getAttribute().getAttributeType()).isEqualTo("test");
        assertThat(srvModification.getAttribute().getValues().size()).isEqualTo(2);
        mod = new Modification(ModificationType.INCREMENT, attribute);
        srvModification = to(mod);
        assertThat(srvModification.getModificationType().toString()).isEqualTo("Increment");
        assertThat(srvModification.getModificationType()).isEqualTo(ModificationType.INCREMENT);
    }
    @Test
@@ -382,13 +381,13 @@
        Modification mod = new Modification(ModificationType.ADD, attribute);
        org.opends.server.types.Modification srvModification = toModification(mod);
        assertThat(srvModification.getModificationType().toString()).isEqualTo("Add");
        assertThat(srvModification.getModificationType()).isEqualTo(ModificationType.ADD);
        assertThat(srvModification.getAttribute().getAttributeType().getNameOrOID()).isEqualTo("test");
        assertThat(srvModification.getAttribute().size()).isEqualTo(2);
        mod = new Modification(ModificationType.INCREMENT, attribute);
        srvModification = toModification(mod);
        assertThat(srvModification.getModificationType().toString()).isEqualTo("Increment");
        assertThat(srvModification.getModificationType()).isEqualTo(ModificationType.INCREMENT);
    }
    /**
@@ -519,26 +518,6 @@
                ByteString.empty());
    }
    @Test
    public static void testToSearchScope() {
        org.opends.server.types.SearchScope[] expected = org.opends.server.types.SearchScope.values();
        List<org.forgerock.opendj.ldap.SearchScope> actual = org.forgerock.opendj.ldap.SearchScope.values();
        for (int i = 0; i < expected.length; i++) {
            assertEquals(to(actual.get(i)), expected[i]);
        }
        assertNull(to((org.forgerock.opendj.ldap.SearchScope) null));
    }
    @Test
    public static void testFromSearchScope() {
        org.opends.server.types.SearchScope[] actual = org.opends.server.types.SearchScope.values();
        List<org.forgerock.opendj.ldap.SearchScope> expected = org.forgerock.opendj.ldap.SearchScope.values();
        for (int i = 0; i < actual.length; i++) {
            assertEquals(from(actual[i]), expected.get(i));
        }
        assertNull(from((org.opends.server.types.SearchScope) null));
    }
    @DataProvider(name = "operation result type")
    public Object[][] getOperationResultTypes() {
        return new Object[][] {