directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r892265 - in /directory/sandbox/kayyagari/integ-test-framework: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/server/ src/main/java/org/a...
Date Fri, 18 Dec 2009 14:51:34 GMT
Author: kayyagari
Date: Fri Dec 18 14:51:30 2009
New Revision: 892265

URL: http://svn.apache.org/viewvc?rev=892265&view=rev
Log:
an experimental test framework for integration tests

Added:
    directory/sandbox/kayyagari/integ-test-framework/
    directory/sandbox/kayyagari/integ-test-framework/pom.xml
    directory/sandbox/kayyagari/integ-test-framework/src/
    directory/sandbox/kayyagari/integ-test-framework/src/main/
    directory/sandbox/kayyagari/integ-test-framework/src/main/java/
    directory/sandbox/kayyagari/integ-test-framework/src/main/java/org/
    directory/sandbox/kayyagari/integ-test-framework/src/main/java/org/apache/
    directory/sandbox/kayyagari/integ-test-framework/src/main/java/org/apache/directory/
    directory/sandbox/kayyagari/integ-test-framework/src/main/java/org/apache/directory/server/
    directory/sandbox/kayyagari/integ-test-framework/src/main/java/org/apache/directory/server/core/
    directory/sandbox/kayyagari/integ-test-framework/src/main/java/org/apache/directory/server/core/integ/
    directory/sandbox/kayyagari/integ-test-framework/src/test/
    directory/sandbox/kayyagari/integ-test-framework/src/test/java/
    directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/
    directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/
    directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/
    directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/
    directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/
    directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/
    directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/Factory.java
    directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/FrameworkRunner.java
    directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/FrameworkSuite.java
    directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassA.java
    directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/TestSuite.java

Added: directory/sandbox/kayyagari/integ-test-framework/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/kayyagari/integ-test-framework/pom.xml?rev=892265&view=auto
==============================================================================
--- directory/sandbox/kayyagari/integ-test-framework/pom.xml (added)
+++ directory/sandbox/kayyagari/integ-test-framework/pom.xml Fri Dec 18 14:51:30 2009
@@ -0,0 +1,18 @@
+<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>org.apache.directory.server.core.integ</groupId>
+  <artifactId>integ-test-framework</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>integ-test-framework</name>
+  <description>an experimental test framework for integration tests without depending
on the InheritableSettings</description>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.5</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

Added: directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/Factory.java
URL: http://svn.apache.org/viewvc/directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/Factory.java?rev=892265&view=auto
==============================================================================
--- directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/Factory.java
(added)
+++ directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/Factory.java
Fri Dec 18 14:51:30 2009
@@ -0,0 +1,14 @@
+
+package org.apache.directory.server.core.integ;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target( {ElementType.METHOD, ElementType.TYPE } )
+public @interface Factory
+{
+    String value();
+}

Added: directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/FrameworkRunner.java
URL: http://svn.apache.org/viewvc/directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/FrameworkRunner.java?rev=892265&view=auto
==============================================================================
--- directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/FrameworkRunner.java
(added)
+++ directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/FrameworkRunner.java
Fri Dec 18 14:51:30 2009
@@ -0,0 +1,97 @@
+/*
+ * 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.server.core.integ;
+
+
+import org.junit.Ignore;
+import org.junit.runner.Description;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.Statement;
+
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class FrameworkRunner extends BlockJUnit4ClassRunner
+{
+    private FrameworkSuite suite;
+    
+    public FrameworkRunner( Class<?> clazz ) throws InitializationError
+    {
+        super( clazz );
+    }
+
+
+    @Override
+    public void run( final RunNotifier notifier )
+    {
+        Factory fac = getDescription().getAnnotation( Factory.class );
+        if( fac != null )
+        {
+            System.out.println( fac.value() );
+        }
+        else
+        {
+            System.out.println( "no annotation found" );
+        }
+        super.run( notifier );
+    }
+
+
+    @Override
+    protected void runChild( FrameworkMethod method, RunNotifier notifier )
+    {
+        Description description = describeChild( method );
+        if ( method.getAnnotation( Ignore.class ) != null )
+        {
+            notifier.fireTestIgnored( description );
+            return;
+        }
+
+        Factory fac = description.getAnnotation( Factory.class );
+        if( fac != null )
+        {
+            System.out.println( fac.value() );
+        }
+        else
+        {
+            System.out.println( "no annotation found" );
+        }
+
+        Statement statement = methodBlock( method );
+        //test( getTestClass(), statement, notifier, new InheritableSettings( description,
getSettings() ) );
+    }
+
+
+    public void setSuite( FrameworkSuite suite )
+    {
+        System.out.println( "setting the suite" );
+        this.suite = suite;
+    }
+
+
+    public FrameworkSuite getSuite()
+    {
+        return suite;
+    }
+}

Added: directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/FrameworkSuite.java
URL: http://svn.apache.org/viewvc/directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/FrameworkSuite.java?rev=892265&view=auto
==============================================================================
--- directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/FrameworkSuite.java
(added)
+++ directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/FrameworkSuite.java
Fri Dec 18 14:51:30 2009
@@ -0,0 +1,58 @@
+/*
+ * 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.server.core.integ;
+
+
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.Suite;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.RunnerBuilder;
+
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class FrameworkSuite extends Suite
+{
+
+    public FrameworkSuite( Class<?> clazz, RunnerBuilder builder ) throws InitializationError
+    {
+        super( clazz, builder );
+    }
+
+
+    @Override
+    public void run( final RunNotifier notifier )
+    {
+        Factory fac = getDescription().getAnnotation( Factory.class );
+        if( fac != null )
+        {
+            System.out.println( fac.value() );
+        }
+        else
+        {
+            System.out.println( "no annotation found" );
+        }
+        
+        super.run( notifier );
+
+    }
+
+}

Added: directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassA.java
URL: http://svn.apache.org/viewvc/directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassA.java?rev=892265&view=auto
==============================================================================
--- directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassA.java
(added)
+++ directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/TestClassA.java
Fri Dec 18 14:51:30 2009
@@ -0,0 +1,17 @@
+package org.apache.directory.server.core.integ;
+
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith( FrameworkRunner.class )
+@Factory( "TestClassAFactory" )
+public class TestClassA
+{
+
+    @Test
+    @Factory( "testDummyFactory" )
+    public void testDummy()
+    {
+    }
+}

Added: directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/TestSuite.java
URL: http://svn.apache.org/viewvc/directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/TestSuite.java?rev=892265&view=auto
==============================================================================
--- directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/TestSuite.java
(added)
+++ directory/sandbox/kayyagari/integ-test-framework/src/test/java/org/apache/directory/server/core/integ/TestSuite.java
Fri Dec 18 14:51:30 2009
@@ -0,0 +1,11 @@
+package org.apache.directory.server.core.integ;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith( FrameworkSuite.class )
+@Suite.SuiteClasses({ TestClassA.class })
+@Factory( "suitlevelFactory" )
+public class TestSuite
+{
+}



Mime
View raw message