You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/08/24 22:16:13 UTC

svn commit: r434504 - in /directory/branches/apacheds/1.0/testcase-archetype: ./ src/ src/main/ src/main/resources/ src/main/resources/META-INF/ src/main/resources/archetype-resources/ src/main/resources/archetype-resources/src/ src/main/resources/arch...

Author: akarasulu
Date: Thu Aug 24 13:16:12 2006
New Revision: 434504

URL: http://svn.apache.org/viewvc?rev=434504&view=rev
Log:
adding a new testcase project generating archetype

Added:
    directory/branches/apacheds/1.0/testcase-archetype/
    directory/branches/apacheds/1.0/testcase-archetype/apacheds-testcase-archetype.sh   (with props)
    directory/branches/apacheds/1.0/testcase-archetype/pom.xml
    directory/branches/apacheds/1.0/testcase-archetype/src/
    directory/branches/apacheds/1.0/testcase-archetype/src/main/
    directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/
    directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/META-INF/
    directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/META-INF/archetype.xml
    directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/
    directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/pom.xml
    directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/
    directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/main/
    directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/main/java/
    directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/main/java/Dummy.java
    directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/test/
    directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/test/java/
    directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/test/java/ApacheDSITest.java
    directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/test/resources/
    directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/test/resources/log4j.properties

Added: directory/branches/apacheds/1.0/testcase-archetype/apacheds-testcase-archetype.sh
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/testcase-archetype/apacheds-testcase-archetype.sh?rev=434504&view=auto
==============================================================================
--- directory/branches/apacheds/1.0/testcase-archetype/apacheds-testcase-archetype.sh (added)
+++ directory/branches/apacheds/1.0/testcase-archetype/apacheds-testcase-archetype.sh Thu Aug 24 13:16:12 2006
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+mvn archetype:create -DarchetypeGroupId=org.apache.directory.server -DarchetypeArtifactId=apacheds-testcase-archetype -DarchetypeVersion=1.0-RC4-SNAPSHOT -DgroupId=$1 -DartifactId=$2
+

Propchange: directory/branches/apacheds/1.0/testcase-archetype/apacheds-testcase-archetype.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: directory/branches/apacheds/1.0/testcase-archetype/pom.xml
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/testcase-archetype/pom.xml?rev=434504&view=auto
==============================================================================
--- directory/branches/apacheds/1.0/testcase-archetype/pom.xml (added)
+++ directory/branches/apacheds/1.0/testcase-archetype/pom.xml Thu Aug 24 13:16:12 2006
@@ -0,0 +1,12 @@
+<project>
+  <parent>
+    <groupId>org.apache.directory.server</groupId>
+    <artifactId>build</artifactId>
+    <version>1.0-RC4-SNAPSHOT</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>apacheds-testcase-archetype</artifactId>
+  <packaging>maven-plugin</packaging>
+  <name>ApacheDS Testcase Archetype</name>
+</project>

Added: directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/META-INF/archetype.xml
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/META-INF/archetype.xml?rev=434504&view=auto
==============================================================================
--- directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/META-INF/archetype.xml (added)
+++ directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/META-INF/archetype.xml Thu Aug 24 13:16:12 2006
@@ -0,0 +1,10 @@
+<archetype>
+  <id>apacheds-testcase-archetype</id>
+  <sources>
+    <source>src/main/java/Dummy.java</source>
+    <source>src/test/java/ApacheDSITest.java</source>
+  </sources>
+  <resources>
+    <resource>src/test/resources/log4j.properties</resource>
+  </resources>
+</archetype>

Added: directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/pom.xml?rev=434504&view=auto
==============================================================================
--- directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/pom.xml (added)
+++ directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/pom.xml Thu Aug 24 13:16:12 2006
@@ -0,0 +1,31 @@
+<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>
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <packaging>jar</packaging>
+  <version>${version}</version>
+  <name>Schema Project</name>
+  <url>http://directory.apache.org/</url>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-server-unit</artifactId>
+      <version>1.0-RC4-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>nlog4j</artifactId>
+      <version>1.2.25</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

Added: directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/main/java/Dummy.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/main/java/Dummy.java?rev=434504&view=auto
==============================================================================
--- directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/main/java/Dummy.java (added)
+++ directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/main/java/Dummy.java Thu Aug 24 13:16:12 2006
@@ -0,0 +1,28 @@
+/*
+ *  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 ${groupId};
+
+
+/**
+ * This class does nothing.  Makes sure maven builds and the archetype works.
+ */
+public class Dummy 
+{
+}

Added: directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/test/java/ApacheDSITest.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/test/java/ApacheDSITest.java?rev=434504&view=auto
==============================================================================
--- directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/test/java/ApacheDSITest.java (added)
+++ directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/test/java/ApacheDSITest.java Thu Aug 24 13:16:12 2006
@@ -0,0 +1,89 @@
+/*
+ *  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 ${groupId};
+
+
+import java.util.Hashtable;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+
+import org.apache.directory.server.unit.AbstractServerTest;
+
+
+
+/**
+ * An example ApacheDS integration test.  
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ApacheDSITest extends AbstractServerTest
+{
+    private DirContext ctx = null;
+
+
+    /**
+     * Get a connection to the embedded server using the SUN JNDI LDAP provider
+     * over the wire.
+     */
+    public void setUp() throws Exception
+    {
+        // Starts up the embedded ApacheDS instance.
+        super.setUp();
+
+        // -------------------------------------------------------------------
+        // Get a connection (JNDI context) to the LDAP server       
+        // -------------------------------------------------------------------
+
+        Hashtable env = new Hashtable();
+        env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" );
+        env.put( "java.naming.provider.url", "ldap://localhost:" + port + "/ou=system" );
+        env.put( "java.naming.security.principal", "uid=admin,ou=system" );
+        env.put( "java.naming.security.credentials", "secret" );
+        env.put( "java.naming.security.authentication", "simple" );
+        ctx = new InitialDirContext( env );
+    }
+
+
+    /**
+     * Closes our context before shuting down the server.
+     */
+    public void tearDown() throws Exception
+    {
+        ctx.close();
+        super.tearDown();
+    }
+
+
+    /**
+     * An example test reads and assert an attribute value in the ou=system
+     * context.
+     */
+    public void testExample() throws NamingException
+    {
+        Attributes system = ctx.getAttributes( "" );
+        assertNotNull( system );
+        assertEquals( "system", system.get( "ou" ).get() );
+    }
+}

Added: directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/test/resources/log4j.properties?rev=434504&view=auto
==============================================================================
--- directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/test/resources/log4j.properties (added)
+++ directory/branches/apacheds/1.0/testcase-archetype/src/main/resources/archetype-resources/src/test/resources/log4j.properties Thu Aug 24 13:16:12 2006
@@ -0,0 +1,23 @@
+log4j.rootCategory=ERROR, stdout, R
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+
+log4j.appender.R=org.apache.log4j.RollingFileAppender
+log4j.appender.R.File=apacheds-rolling.log
+
+log4j.appender.R.MaxFileSize=1024KB
+# Keep some backup files
+log4j.appender.R.MaxBackupIndex=5
+
+log4j.appender.R.layout=org.apache.log4j.PatternLayout
+log4j.appender.R.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
+
+log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
+
+# with these we'll not get innundated when switching to DEBUG
+log4j.logger.org.apache.directory.shared.ldap.name=ERROR
+log4j.logger.org.springframework=ERROR
+log4j.logger.org.apache.directory.shared.codec=ERROR
+log4j.logger.org.apache.directory.shared.asn1=ERROR
+