camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1006307 - in /camel/trunk: components/camel-ldap/ components/camel-ldap/src/test/java/org/apache/camel/component/ldap/ parent/
Date Sun, 10 Oct 2010 15:30:27 GMT
Author: davsclaus
Date: Sun Oct 10 15:30:27 2010
New Revision: 1006307

URL: http://svn.apache.org/viewvc?rev=1006307&view=rev
Log:
CAMEL-1102: Upgraded to ApacheDS 1.5.7. Damn they changed their test API alot in a non backward
comp.

Removed:
    camel/trunk/components/camel-ldap/src/test/java/org/apache/camel/component/ldap/LdapTestSupport.java
Modified:
    camel/trunk/components/camel-ldap/pom.xml
    camel/trunk/components/camel-ldap/src/test/java/org/apache/camel/component/ldap/LdapRouteTest.java
    camel/trunk/parent/pom.xml

Modified: camel/trunk/components/camel-ldap/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ldap/pom.xml?rev=1006307&r1=1006306&r2=1006307&view=diff
==============================================================================
--- camel/trunk/components/camel-ldap/pom.xml (original)
+++ camel/trunk/components/camel-ldap/pom.xml Sun Oct 10 15:30:27 2010
@@ -17,96 +17,82 @@
     limitations under the License.
 
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
-  <modelVersion>4.0.0</modelVersion>
+    <modelVersion>4.0.0</modelVersion>
 
-  <parent>
-    <groupId>org.apache.camel</groupId>
-    <artifactId>camel-parent</artifactId>
-    <version>2.5-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>camel-ldap</artifactId>
-  <packaging>bundle</packaging>
-  <name>Camel :: LDAP</name>
-  <description>Camel LDAP support</description>
-
-  <properties>
-    <camel.osgi.export.pkg>org.apache.camel.component.ldap.*</camel.osgi.export.pkg>
-
-    <!-- TODO we can remove this line when https://issues.apache.org/jira/browse/DIRSERVER-1279

-         appears in a Apache DS release.
-
-         janstey: Version 1.5.4.0-fuse of ApacheDS is a patched version of 1.5.4 that I needed
to create
-         to get around a bug on IBM's JDK. The next release of ApacheDS should contain this
fix. 
-     -->
-    <apacheds-version>1.5.4.0-fuse</apacheds-version>
-  </properties>
-
-  <repositories>
-    <!-- TODO we can remove this when we depend again on a Apache release of Apache DS
-->
-    <repository>
-      <id>fusesource.m2</id>
-      <name>Fusesource Release Repository</name>
-      <url>http://repo.fusesource.com/maven2</url>
-      <snapshots>
-        <enabled>true</enabled>
-      </snapshots>
-      <releases>
-        <enabled>true</enabled>
-      </releases>
-    </repository>
-  </repositories>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-core</artifactId>
-    </dependency>
-    
-    <!-- test dependencies -->
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-core</artifactId>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-server-unit</artifactId>
-      <version>${apacheds-version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-server-jndi</artifactId>
-      <version>${apacheds-version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-bootstrap-partition</artifactId>
-      <version>${apacheds-version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-      <version>${slf4j-version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <version>${slf4j-version}</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
+    <parent>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-parent</artifactId>
+        <version>2.5-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-ldap</artifactId>
+    <packaging>bundle</packaging>
+    <name>Camel :: LDAP</name>
+    <description>Camel LDAP support</description>
+
+    <properties>
+        <camel.osgi.export.pkg>org.apache.camel.component.ldap.*</camel.osgi.export.pkg>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-core</artifactId>
+        </dependency>
+
+        <!-- test dependencies -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.directory.server</groupId>
+            <artifactId>apacheds-server-jndi</artifactId>
+            <version>${apacheds-version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.directory.server</groupId>
+            <artifactId>apacheds-server-integ</artifactId>
+            <version>${apacheds-version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.directory.server</groupId>
+            <artifactId>apacheds-core-integ</artifactId>
+            <version>${apacheds-version}</version>
+            <scope>test</scope>
+        </dependency>
+        <!-- Apache DS uses Nina 2.0.0 for testing -->
+        <dependency>
+            <groupId>org.apache.mina</groupId>
+            <artifactId>mina-core</artifactId>
+            <version>2.0.0</version>
+            <scope>test</scope>
+        </dependency>
+        <!-- Apache DS uses slf4j 1.5.x -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.5.10</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>1.5.10</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
 
 </project>

Modified: camel/trunk/components/camel-ldap/src/test/java/org/apache/camel/component/ldap/LdapRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ldap/src/test/java/org/apache/camel/component/ldap/LdapRouteTest.java?rev=1006307&r1=1006306&r2=1006307&view=diff
==============================================================================
--- camel/trunk/components/camel-ldap/src/test/java/org/apache/camel/component/ldap/LdapRouteTest.java
(original)
+++ camel/trunk/components/camel-ldap/src/test/java/org/apache/camel/component/ldap/LdapRouteTest.java
Sun Oct 10 15:30:27 2010
@@ -17,21 +17,55 @@
 package org.apache.camel.component.ldap;
 
 import java.util.Collection;
-
 import javax.naming.directory.SearchResult;
+import javax.naming.ldap.LdapContext;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.SimpleRegistry;
+import org.apache.directory.server.annotations.CreateLdapServer;
+import org.apache.directory.server.annotations.CreateTransport;
+import org.apache.directory.server.core.annotations.ApplyLdifFiles;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.server.ldap.LdapServer;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContext;
+
+@RunWith(FrameworkRunner.class)
+@CreateLdapServer(transports = {@CreateTransport(protocol = "LDAP")})
+public class LdapRouteTest extends AbstractLdapTestUnit {
+
+    private CamelContext camel;
+    private ProducerTemplate template;
+    private int port;
+    public static LdapServer ldapServer;
+
+    @ApplyLdifFiles("org/apache/camel/component/ldap/LdapRouteTest.ldif")
+    @Test
+    public void testLdapRoute() throws Exception {
+        // you can assign port number in the @CreateTransport annotation
+        port = ldapServer.getPort();
 
+        LdapContext ctx = getWiredContext(ldapServer);
 
-public class LdapRouteTest extends LdapTestSupport {
+        SimpleRegistry reg = new SimpleRegistry();
+        reg.put("localhost:" + port, ctx);
+        camel = new DefaultCamelContext(reg);
+
+        template = camel.createProducerTemplate();
+        camel.addRoutes(createRouteBuilder());
+        camel.start();
 
-    @SuppressWarnings("unchecked")
-    public void testLdapRoute() throws Exception {
         // START SNIPPET: invoke
-        Endpoint endpoint = context.getEndpoint("direct:start");
+        Endpoint endpoint = camel.getEndpoint("direct:start");
         Exchange exchange = endpoint.createExchange();
         // then we set the LDAP filter on the in body
         exchange.getIn().setBody("(!(ou=test1))");
@@ -40,28 +74,30 @@ public class LdapRouteTest extends LdapT
         Exchange out = template.send(endpoint, exchange);
 
         // assertions of the response
-        assertNotNull(out);
-        assertNotNull(out.getOut());
+        Assert.assertNotNull(out);
+        Assert.assertNotNull(out.getOut());
         Collection<SearchResult> data = out.getOut().getBody(Collection.class);
-        assertNotNull("out body could not be converted to a Collection - was: " + out.getOut().getBody(),
data);
+        Assert.assertNotNull("out body could not be converted to a Collection - was: " +
out.getOut().getBody(), data);
 
-        assertFalse(contains("uid=test1,ou=test,ou=system", data));
-        assertTrue(contains("uid=test2,ou=test,ou=system", data));
-        assertTrue(contains("uid=testNoOU,ou=test,ou=system", data));
-        assertTrue(contains("uid=tcruise,ou=actors,ou=system", data));
+        Assert.assertFalse(contains("uid=test1,ou=test,ou=system", data));
+        Assert.assertTrue(contains("uid=test2,ou=test,ou=system", data));
+        Assert.assertTrue(contains("uid=testNoOU,ou=test,ou=system", data));
+        Assert.assertTrue(contains("uid=tcruise,ou=actors,ou=system", data));
         // START SNIPPET: invoke
+
+        camel.stop();
     }
 
-    @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        // START SNIPPET: register
-        JndiRegistry reg = super.createRegistry();
-        reg.bind("localhost:" + port, getWiredContext());
-        return reg;
-        // END SNIPPET: register
+    protected boolean contains(String dn, Collection<SearchResult> results) {
+        for (SearchResult result : results) {
+            if (result.getNameInNamespace().equals(dn)) {
+                return true;
+            }
+        }
+
+        return false;
     }
 
-    @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             // START SNIPPET: route

Modified: camel/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=1006307&r1=1006306&r2=1006307&view=diff
==============================================================================
--- camel/trunk/parent/pom.xml (original)
+++ camel/trunk/parent/pom.xml Sun Oct 10 15:30:27 2010
@@ -36,7 +36,7 @@
     <compiler.fork>false</compiler.fork>
     <!-- Note that activemq dependency is only used for testing! -->
     <activemq-version>5.4.1</activemq-version>
-    <apacheds-version>1.5.4</apacheds-version>
+    <apacheds-version>1.5.7</apacheds-version>
     <aries-blueprint-version>0.2-incubating</aries-blueprint-version>
     <axiom-version>1.2.8</axiom-version>
     <bouncycastle-version>140</bouncycastle-version>



Mime
View raw message