You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2014/12/14 01:37:52 UTC
svn commit: r1645374 - in /directory/sandbox/seelmann/osgi-testing: ./
mavibot-paxexam-osgi-test/ mavibot-paxexam-osgi-test/src/
mavibot-paxexam-osgi-test/src/main/ mavibot-paxexam-osgi-test/src/main/java/
mavibot-paxexam-osgi-test/src/main/resources/ ...
Author: seelmann
Date: Sun Dec 14 00:37:51 2014
New Revision: 1645374
URL: http://svn.apache.org/r1645374
Log:
Added first paxexam test for mavibot
Added:
directory/sandbox/seelmann/osgi-testing/README.md
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/pom.xml
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/main/
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/main/java/
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/main/resources/
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/java/
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/java/org/
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/java/org/apache/
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/java/org/apache/directory/
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/java/org/apache/directory/mavibot/
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/java/org/apache/directory/mavibot/osgi/
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/java/org/apache/directory/mavibot/osgi/MavibotOsgiTest.java
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/resources/
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/resources/exam.properties
directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/resources/logback.xml
directory/sandbox/seelmann/osgi-testing/pom.xml
Added: directory/sandbox/seelmann/osgi-testing/README.md
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/osgi-testing/README.md?rev=1645374&view=auto
==============================================================================
--- directory/sandbox/seelmann/osgi-testing/README.md (added)
+++ directory/sandbox/seelmann/osgi-testing/README.md Sun Dec 14 00:37:51 2014
@@ -0,0 +1,7 @@
+
+Sources:
+
+* <http://docs.peergreen.com/peergreen_server/latest/reference/xhtml-single/peergreen-server-osgi-paxexam-junit-guide.xhtml>
+* <http://veithen.blogspot.de/2013/09/using-pax-exam-in-maven-builds.html>
+* <https://svn.apache.org/repos/asf/webservices/axiom/trunk/systests/>
+
Added: directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/pom.xml?rev=1645374&view=auto
==============================================================================
--- directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/pom.xml (added)
+++ directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/pom.xml Sun Dec 14 00:37:51 2014
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.directory.osgitesting</groupId>
+ <artifactId>osgitesting-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>mavibot-paxexam-osgi-test</artifactId>
+
+ <properties>
+ <exam.version>3.4.0</exam.version>
+ <url.version>1.6.0</url.version>
+ <logback.version>1.0.6</logback.version>
+ <felix.version>3.2.2</felix.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.directory.mavibot</groupId>
+ <artifactId>mavibot</artifactId>
+ <version>${mavibot.version}</version>
+ </dependency>
+
+ <!-- Test and PAX dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>${logback.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-native</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit4</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-link-mvn</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-aether</artifactId>
+ <version>${url.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>${felix.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>list</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ <configuration>
+ <includeScope>runtime</includeScope>
+ <outputFile>${project.build.directory}/test-classes/deps.txt</outputFile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.apache.maven.plugins
+ </groupId>
+ <artifactId>
+ maven-dependency-plugin
+ </artifactId>
+ <versionRange>
+ [2.8,)
+ </versionRange>
+ <goals>
+ <goal>list</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+</project>
Added: directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/java/org/apache/directory/mavibot/osgi/MavibotOsgiTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/java/org/apache/directory/mavibot/osgi/MavibotOsgiTest.java?rev=1645374&view=auto
==============================================================================
--- directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/java/org/apache/directory/mavibot/osgi/MavibotOsgiTest.java (added)
+++ directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/java/org/apache/directory/mavibot/osgi/MavibotOsgiTest.java Sun Dec 14 00:37:51 2014
@@ -0,0 +1,132 @@
+/*
+ * 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.mavibot.osgi;
+
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.inject.Inject;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.directory.mavibot.btree.BTree;
+import org.apache.directory.mavibot.btree.BTreeFactory;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.ops4j.pax.exam.util.PathUtils;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class MavibotOsgiTest
+{
+
+ @Inject
+ private BundleContext context;
+
+
+ @Configuration
+ public Option[] config() throws IOException
+ {
+ // read mavibot transitive dependencies from file which was generated by maven-dependency-plugin
+ Pattern pattern = Pattern.compile( "\\s*(.+?)\\:(.+?)\\:jar\\:(.+?)\\:compile" );
+ List<String> lines = IOUtils.readLines( getClass().getResourceAsStream( "/deps.txt" ) );
+ List<Option> mavibotDependencies = new ArrayList<Option>();
+ for ( String line : lines )
+ {
+ Matcher matcher = pattern.matcher( line );
+ if ( matcher.matches() )
+ {
+ String group = matcher.group( 1 );
+ String artifactId = matcher.group( 2 );
+ String version = matcher.group( 3 );
+ mavibotDependencies.add( mavenBundle( group, artifactId, version ) );
+ }
+ }
+
+ return options(
+ systemProperty( "org.ops4j.pax.logging.DefaultServiceLog.level" ).value( "WARN" ),
+ systemProperty( "logback.configurationFile" ).value(
+ "file:" + PathUtils.getBaseDir() + "/src/test/resources/logback.xml" ),
+ mavenBundle( "ch.qos.logback", "logback-classic", "1.0.6" ),
+ mavenBundle( "ch.qos.logback", "logback-core", "1.0.6" ),
+ junitBundles(),
+ composite( mavibotDependencies.toArray( new Option[0] ) )
+ );
+ }
+
+
+ @Test
+ public void testInjectContext()
+ {
+ assertNotNull( context );
+ }
+
+
+ @Test
+ public void testBundleActivation()
+ {
+ boolean bundleFound = false;
+ boolean bundleActive = false;
+ Bundle[] bundles = context.getBundles();
+ for ( Bundle bundle : bundles )
+ {
+ //System.out.println( "### bundle=" + bundle );
+ if ( bundle != null && bundle.getSymbolicName().equals( "org.apache.directory.mavibot.mavibot" ) )
+ {
+ bundleFound = true;
+ if ( bundle.getState() == Bundle.ACTIVE )
+ {
+ bundleActive = true;
+ }
+ }
+ }
+
+ assertTrue( bundleFound );
+ assertTrue( bundleActive );
+ }
+
+
+ @Test
+ public void testUseMavibotClasses() throws Exception
+ {
+ BTree<String, String> inMemoryBTree = BTreeFactory.createInMemoryBTree();
+ inMemoryBTree.close();
+ }
+
+}
Added: directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/resources/exam.properties
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/resources/exam.properties?rev=1645374&view=auto
==============================================================================
--- directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/resources/exam.properties (added)
+++ directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/resources/exam.properties Sun Dec 14 00:37:51 2014
@@ -0,0 +1,18 @@
+#############################################################################
+# 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.
+#############################################################################
+
+pax.exam.logging = none
Added: directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/resources/logback.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/resources/logback.xml?rev=1645374&view=auto
==============================================================================
--- directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/resources/logback.xml (added)
+++ directory/sandbox/seelmann/osgi-testing/mavibot-paxexam-osgi-test/src/test/resources/logback.xml Sun Dec 14 00:37:51 2014
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <root level="error">
+ <appender-ref ref="STDOUT" />
+ </root>
+</configuration>
\ No newline at end of file
Added: directory/sandbox/seelmann/osgi-testing/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/osgi-testing/pom.xml?rev=1645374&view=auto
==============================================================================
--- directory/sandbox/seelmann/osgi-testing/pom.xml (added)
+++ directory/sandbox/seelmann/osgi-testing/pom.xml Sun Dec 14 00:37:51 2014
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<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>
+
+ <parent>
+ <groupId>org.apache.directory.project</groupId>
+ <artifactId>project</artifactId>
+ <version>33</version>
+ <relativePath />
+ </parent>
+
+ <organization>
+ <name>Apache Directory Project</name>
+ <url>http://directory.apache.org/</url>
+ </organization>
+
+ <groupId>org.apache.directory.osgitesting</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ <artifactId>osgitesting-parent</artifactId>
+ <name>Apache Directory OSGI Testing</name>
+ <packaging>pom</packaging>
+
+ <prerequisites>
+ <maven>3.0.0</maven>
+ </prerequisites>
+
+ <url>http://directory.apache.org/</url>
+ <inceptionYear>2014</inceptionYear>
+
+ <issueManagement>
+ <system>jira</system>
+ <url>http://issues.apache.org/jira/browse/DIR</url>
+ </issueManagement>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/directory/TODO</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/directory/TODO</developerConnection>
+ <url>http://svn.apache.org/viewvc/directory/TODO</url>
+ </scm>
+
+ <ciManagement>
+ <notifiers>
+ <notifier>
+ <type>mail</type>
+ <address>dev@directory.apache.org</address>
+ </notifier>
+ </notifiers>
+ </ciManagement>
+
+ <description>Apache Directory OSGi Testing</description>
+
+ <licenses>
+ <license>
+ <name>Apache 2.0 License</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+
+ <properties>
+ <!-- Dependencies versions ========================================== -->
+ <junit.version>4.11</junit.version>
+<!-- <commons.collections.version>3.2.1</commons.collections.version> -->
+<!-- <slf4j.version>1.7.7</slf4j.version> -->
+<!-- <slf4j.api.version>1.7.7</slf4j.api.version> -->
+<!-- <slf4j.log4j12.version>1.7.7</slf4j.log4j12.version> -->
+
+ <mavibot.version>1.0.0-M7-SNAPSHOT</mavibot.version>
+ </properties>
+
+ <modules>
+ <module>mavibot-paxexam-osgi-test</module>
+ <module>eclipse-test</module>
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+ <!-- Testing -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <optimize>true</optimize>
+ <debug>true</debug>
+ <showDeprecations>true</showDeprecations>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+</project>
+