directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1730621 - in /directory/studio/trunk: plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/ tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/
Date Mon, 15 Feb 2016 23:12:25 GMT
Author: seelmann
Date: Mon Feb 15 23:12:24 2016
New Revision: 1730621

URL: http://svn.apache.org/viewvc?rev=1730621&view=rev
Log:
DIRSTUDIO-1085: Fix default schema loading

Added:
    directory/studio/trunk/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/SchemaTest.java
  (with props)
Modified:
    directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/Schema.java

Modified: directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/Schema.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/Schema.java?rev=1730621&r1=1730620&r2=1730621&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/Schema.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/Schema.java
Mon Feb 15 23:12:24 2016
@@ -169,7 +169,7 @@ public class Schema
         {
             LdifParser parser = new LdifParser();
             LdifEnumeration enumeration = parser.parse( reader );
-            if ( enumeration.hasNext() )
+            while ( enumeration.hasNext() )
             {
                 LdifContainer container = enumeration.next();
                 if ( container instanceof LdifContentRecord )

Added: directory/studio/trunk/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/SchemaTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/SchemaTest.java?rev=1730621&view=auto
==============================================================================
--- directory/studio/trunk/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/SchemaTest.java
(added)
+++ directory/studio/trunk/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/SchemaTest.java
Mon Feb 15 23:12:24 2016
@@ -0,0 +1,77 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.test.integration.core;
+
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.Collection;
+
+import org.apache.directory.api.ldap.model.schema.AttributeType;
+import org.apache.directory.api.ldap.model.schema.ObjectClass;
+import org.apache.directory.server.annotations.CreateLdapServer;
+import org.apache.directory.server.annotations.CreateTransport;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * Tests the {@link Schema}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+@RunWith(FrameworkRunner.class)
+@CreateLdapServer(transports =
+    { @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = "LDAPS") })
+public class SchemaTest extends AbstractLdapTestUnit
+{
+
+    /**
+     * Test that the default schema is properly loaded.
+     */
+    @Test
+    public void testDefaultSchema()
+    {
+        Schema defaultSchema = Schema.DEFAULT_SCHEMA;
+        assertNotNull( defaultSchema );
+
+        Collection<ObjectClass> ocds = defaultSchema.getObjectClassDescriptions();
+        assertNotNull( ocds );
+        assertFalse( ocds.isEmpty() );
+
+        assertNotNull( defaultSchema.getObjectClassDescription( "top" ) );
+        assertNotNull( defaultSchema.getObjectClassDescription( "inetOrgPerson" ) );
+        assertNotNull( defaultSchema.getObjectClassDescription( "groupOfNames" ) );
+
+        Collection<AttributeType> atds = defaultSchema.getAttributeTypeDescriptions();
+        assertNotNull( atds );
+        assertFalse( atds.isEmpty() );
+
+        assertNotNull( defaultSchema.getAttributeTypeDescription( "objectClass" ) );
+        assertNotNull( defaultSchema.getAttributeTypeDescription( "cn" ) );
+        assertNotNull( defaultSchema.getAttributeTypeDescription( "member" ) );
+    }
+
+}

Propchange: directory/studio/trunk/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/SchemaTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message