You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2018/10/14 12:51:54 UTC

svn commit: r1843831 - in /webservices/axiom/trunk: ./ systests/eclipse-tests/ systests/eclipse-tests/src/it/ systests/eclipse-tests/src/test/ systests/eclipse-tests/src/test/java/

Author: veithen
Date: Sun Oct 14 12:51:54 2018
New Revision: 1843831

URL: http://svn.apache.org/viewvc?rev=1843831&view=rev
Log:
Rewrite eclipse-tests to use Pax Exam.

Added:
    webservices/axiom/trunk/systests/eclipse-tests/src/test/
    webservices/axiom/trunk/systests/eclipse-tests/src/test/java/
    webservices/axiom/trunk/systests/eclipse-tests/src/test/java/EclipseTest.java
      - copied, changed from r1843830, webservices/axiom/trunk/systests/eclipse-tests/src/it/project/src/EclipseTest.java
Removed:
    webservices/axiom/trunk/systests/eclipse-tests/src/it/
Modified:
    webservices/axiom/trunk/pom.xml
    webservices/axiom/trunk/systests/eclipse-tests/   (props changed)
    webservices/axiom/trunk/systests/eclipse-tests/pom.xml

Modified: webservices/axiom/trunk/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/pom.xml?rev=1843831&r1=1843830&r2=1843831&view=diff
==============================================================================
--- webservices/axiom/trunk/pom.xml (original)
+++ webservices/axiom/trunk/pom.xml Sun Oct 14 12:51:54 2018
@@ -860,6 +860,7 @@
                                  the build stability. -->
                             <allowedRepositories>
                                 <allowedRepository>kepler</allowedRepository>
+                                <allowedRepository>oxygen</allowedRepository>
                             </allowedRepositories>
                             <banPluginRepositories>true</banPluginRepositories>
                             <!-- We still need to allow the Apache snapshot repository -->

Propchange: webservices/axiom/trunk/systests/eclipse-tests/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Oct 14 12:51:54 2018
@@ -1,3 +1,4 @@
 target
+.classpath
 .settings
 .project

Modified: webservices/axiom/trunk/systests/eclipse-tests/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/systests/eclipse-tests/pom.xml?rev=1843831&r1=1843830&r2=1843831&view=diff
==============================================================================
--- webservices/axiom/trunk/systests/eclipse-tests/pom.xml (original)
+++ webservices/axiom/trunk/systests/eclipse-tests/pom.xml Sun Oct 14 12:51:54 2018
@@ -27,139 +27,103 @@
     </parent>
 
     <artifactId>eclipse-tests</artifactId>
-    <packaging>pom</packaging>
 
     <name>Eclipse Tests</name>
     <description>Contains test cases that verify that the Axiom OSGi bundles are usable out of the box by Eclipse plug-ins.</description>
 
     <properties>
-        <tycho-version>1.2.0</tycho-version>
+        <!-- TODO -->
+        <hermeticTests>false</hermeticTests>
     </properties>
 
+    <repositories>
+        <repository>
+            <id>oxygen</id>
+            <layout>p2</layout>
+            <!-- Note that http://download.eclipse.org/releases/xyz is a combined repository that
+                 also contains the services releases. It is therefore not stable, i.e. its content
+                 may change over time. To avoid that, we use the repository that contains the
+                 original release artifacts. -->
+            <url>http://download.eclipse.org/releases/oxygen/201712201001</url>
+        </repository>
+    </repositories>
+
     <dependencies>
-        <!-- We declare dependencies here to guarantee that the build order is correct.
-             The dependencies will be inherited by the test project (src/it/project). -->
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>axiom-api</artifactId>
             <version>${project.version}</version>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>axiom-impl</artifactId>
             <version>${project.version}</version>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>axiom-dom</artifactId>
             <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>osgi.bundle</groupId>
+            <artifactId>org.eclipse.osgi</artifactId>
+            <version>3.12.50.v20170928-1321</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-container-native</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-junit4</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-link-assembly</artifactId>
+            <scope>test</scope>
         </dependency>
     </dependencies>
 
     <build>
         <plugins>
             <plugin>
-                <groupId>org.codehaus.gmavenplus</groupId>
-                <artifactId>gmavenplus-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <!-- Need this to pass information to the hook scripts. Once maven-invoker-plugin 1.9 is released,
-                             we no longer need this; see MINVOKER-119. -->
-                        <id>generate-invoker-script-properties</id>
-                        <phase>pre-integration-test</phase>
-                        <goals>
-                            <goal>execute</goal>
-                        </goals>
-                        <inherited>false</inherited>
-                        <configuration>
-                            <scripts>
-                                <script>
-                                    import java.io.*
-                                    import java.util.*
-                                    
-                                    dir = new File(project.build.directory, "it")
-                                    dir.mkdirs()
-                                    props = new Properties()
-                                    props.setProperty("version", project.version)
-                                    stream = new FileOutputStream(new File(dir, "script.properties"))
-                                    props.store(stream, null)
-                                    stream.close()
-                                </script>
-                            </scripts>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <artifactId>maven-invoker-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <!-- Instead of executing the Tycho eclipse-test-plugin project directly, we use the invoker plugin.
-                             There are multiple reasons for that:
-                              * The test project depends on axiom-api, axiom-impl and axiom-dom. If they are executed
-                                in the same reactor, then Tycho will fail because axiom-api, axiom-impl and axiom-dom are
-                                plain Maven projects. The reason is that the P2 resolver has no way to know the packages
-                                exported by these projects.
-                              * In a Tycho project, the Bundle-Version in the manifest must match the POM version.
-                                On the other hand, maven-release-plugin only updates the POM. That would break
-                                the automated release process.
-                              * It prevents maven-eclipse-plugin from messing with the test project.
-                          -->
-                        <id>integration-test</id>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
-                        <inherited>false</inherited>
-                        <configuration>
-                            <streamLogs>true</streamLogs>
-                            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
-                            <goals>
-                                <goal>integration-test</goal>
-                            </goals>
-                            <skipInvocation>${skipTests}</skipInvocation>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>build-helper-maven-plugin</artifactId>
+                <groupId>com.github.veithen.alta</groupId>
+                <artifactId>alta-maven-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>attach-jacoco-exec</id>
-                        <phase>post-integration-test</phase>
                         <goals>
-                            <goal>attach-artifact</goal>
+                            <goal>generate-test-resources</goal>
                         </goals>
-                        <inherited>false</inherited>
                         <configuration>
-                            <skipAttach>${skipJacoco}</skipAttach>
-                            <artifacts>
-                                <artifact>
-                                    <file>${project.build.directory}/it/project/target/jacoco.exec</file>
-                                    <classifier>jacoco</classifier>
-                                    <type>exec</type>
-                                </artifact>
-                            </artifacts>
+                            <name>%bundle.symbolicName%.link</name>
+                            <value>%url%</value>
+                            <dependencySet>
+                                <scope>test</scope>
+                            </dependencySet>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>
             <plugin>
-                <groupId>org.apache.rat</groupId>
-                <artifactId>apache-rat-plugin</artifactId>
+                <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
-                    <excludes>
-                        <!-- Don't need license headers for Eclipse project files -->
-                        <exclude>src/it/*/.project</exclude>
-                        <exclude>src/it/*/.classpath</exclude>
-                        <exclude>src/it/*/.settings/**</exclude>
-                        <exclude>src/it/*/build.properties</exclude>
-                        <!-- Manifests can't contain comments -->
-                        <exclude>src/it/*/META-INF/MANIFEST.MF</exclude>
-                    </excludes>
-                </configuration> 
+                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
+                </configuration>
             </plugin>
         </plugins>
+        <extensions>
+            <extension>
+                <groupId>com.github.veithen.cosmos</groupId>
+                <artifactId>p2-maven-connector</artifactId>
+                <version>0.3</version>
+            </extension>
+        </extensions>
     </build>
 </project>

Copied: webservices/axiom/trunk/systests/eclipse-tests/src/test/java/EclipseTest.java (from r1843830, webservices/axiom/trunk/systests/eclipse-tests/src/it/project/src/EclipseTest.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/systests/eclipse-tests/src/test/java/EclipseTest.java?p2=webservices/axiom/trunk/systests/eclipse-tests/src/test/java/EclipseTest.java&p1=webservices/axiom/trunk/systests/eclipse-tests/src/it/project/src/EclipseTest.java&r1=1843830&r2=1843831&rev=1843831&view=diff
==============================================================================
--- webservices/axiom/trunk/systests/eclipse-tests/src/it/project/src/EclipseTest.java (original)
+++ webservices/axiom/trunk/systests/eclipse-tests/src/test/java/EclipseTest.java Sun Oct 14 12:51:54 2018
@@ -17,6 +17,9 @@
  * under the License.
  */
 import static org.junit.Assert.assertEquals;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.url;
 
 import java.io.StringReader;
 
@@ -27,13 +30,32 @@ import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.dom.DOMMetaFactory;
 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.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 /**
  * Tests that Axiom works out of the box in an Eclipse platform.
  */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
 public class EclipseTest {
+    @Configuration
+    public static Option[] configuration() {
+        return options(
+                // Don't start bundles. We expect Equinox to start them lazily.
+                url("link:classpath:org.apache.james.apache-mime4j-core.link").start(false),
+                url("link:classpath:org.apache.ws.commons.axiom.axiom-impl.link").start(false),
+                url("link:classpath:org.apache.ws.commons.axiom.axiom-dom.link").start(false),
+                url("link:classpath:org.apache.ws.commons.axiom.axiom-api.link").start(false),
+                junitBundles());
+    }
+    
     @Test
     public void testLLOM() {
         OMElement element = OMXMLBuilderFactory.createOMBuilder(new StringReader("<ns:test xmlns:ns='urn:ns'>test</ns:test>")).getDocumentElement();