diff --git a/pom.xml b/pom.xml index ef9b37086..5adfaca26 100644 --- a/pom.xml +++ b/pom.xml @@ -263,6 +263,7 @@ xstream xstream-hibernate xstream-benchmark + xstream-its @@ -617,6 +618,70 @@ test + + + org.ops4j.pax.exam + pax-exam-junit4 + ${version.pax.exam} + test + + + + org.ops4j.pax.exam + pax-exam-invoker-junit + ${version.pax.exam} + test + + + + org.ops4j.pax.exam + pax-exam-container-native + ${version.pax.exam} + test + + + + org.ops4j.pax.exam + pax-exam-inject + ${version.pax.exam} + test + + + + org.ops4j.pax.exam + pax-exam-extender-service + ${version.pax.exam} + test + + + + + org.ops4j.pax.exam + pax-exam-link-mvn + ${version.pax.exam} + test + + + + org.apache.geronimo.specs + geronimo-atinject_1.0_spec + 1.0 + provided + + + + org.ops4j.pax.exam + pax-exam-link-assembly + ${version.pax.exam} + test + + + + org.apache.felix + org.apache.felix.framework + ${version.felix} + test + @@ -887,6 +952,10 @@ jacoco-maven-plugin ${version.plugin.jacoco} + + maven-failsafe-plugin + 2.22.0 + @@ -978,6 +1047,7 @@ 1.4 2.4 1.6.1 + 4.4.1 2.2.8 3.12.1.GA 1.1.1 @@ -996,6 +1066,7 @@ 20080701 1.21 1.6.1 + 4.4.0 1.2.0 1.0.1 2.8.1 diff --git a/xstream-its/pom.xml b/xstream-its/pom.xml new file mode 100644 index 000000000..0293a8690 --- /dev/null +++ b/xstream-its/pom.xml @@ -0,0 +1,150 @@ + + + + xstream-parent + com.thoughtworks.xstream + 1.4.12-SNAPSHOT + + 4.0.0 + + xstream-its + XStream ITs + + + + + junit + junit + 4.11 + test + + + + + + + com.thoughtworks.xstream + xstream + + + + org.ops4j.pax.exam + pax-exam-junit4 + test + + + + org.ops4j.pax.exam + pax-exam-invoker-junit + test + + + + org.ops4j.pax.exam + pax-exam-container-native + test + + + + org.ops4j.pax.exam + pax-exam-inject + test + + + + org.ops4j.pax.exam + pax-exam-extender-service + test + + + + + org.ops4j.pax.exam + pax-exam-link-mvn + test + + + + org.apache.geronimo.specs + geronimo-atinject_1.0_spec + 1.0 + provided + + + + org.ops4j.pax.exam + pax-exam-link-assembly + ${version.pax.exam} + test + + + + org.apache.felix + org.apache.felix.framework + test + + + + org.osgi + org.osgi.core + 4.3.1 + provided + + + + junit + junit + test + + + + org.slf4j + slf4j-simple + runtime + + + + + + + src/test-resources + true + + + + + maven-compiler-plugin + + 1.7 + 1.7 + + + + + + + + failsafe + + true + + + + + maven-failsafe-plugin + + + + integration-test + verify + + + + + + + + + diff --git a/xstream-its/src/test-resources/project.properties b/xstream-its/src/test-resources/project.properties new file mode 100644 index 000000000..afba2c572 --- /dev/null +++ b/xstream-its/src/test-resources/project.properties @@ -0,0 +1 @@ +project.version=${project.version} diff --git a/xstream-its/src/test/com/thoughtworks/xstream/XStreamIT.java b/xstream-its/src/test/com/thoughtworks/xstream/XStreamIT.java new file mode 100644 index 000000000..7f32f2af0 --- /dev/null +++ b/xstream-its/src/test/com/thoughtworks/xstream/XStreamIT.java @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2003, 2004, 2005, 2006 Joe Walnes. + * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 XStream Committers. + * All rights reserved. + * + * The software in this package is published under the terms of the BSD + * style license a copy of which has been included with this distribution in + * the LICENSE.txt file. + * + * Created on 26. September 2003 by Joe Walnes + */ +package com.thoughtworks.xstream; + +import java.io.InputStream; +import java.util.Properties; + +import javax.inject.Inject; + +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.PerMethod; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; + +import static java.lang.String.format; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.ops4j.pax.exam.CoreOptions.junitBundles; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; +import static org.ops4j.pax.exam.CoreOptions.options; + +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerMethod.class) +public class XStreamIT +{ + @Inject + BundleContext bundleContext; + + @Configuration + public Option[] config() throws Exception { + Properties properties = new Properties(); + try (InputStream is = getClass().getResourceAsStream("/project.properties")) { + properties.load(is); + } + String xstreamVersion = properties.getProperty("project.version"); + + return options( + junitBundles(), + mavenBundle().groupId("com.thoughtworks.xstream").artifactId("xstream").version(xstreamVersion) + ); + } + + @Test + public void smokeTest() { + assertNotNull("BundleContext was not injected", bundleContext); + + boolean xstreamBundleFound = false; + int xstreamBundleState = -1; + for (Bundle bundle : bundleContext.getBundles()) { + if ("xstream".equals(bundle.getSymbolicName())) { + xstreamBundleFound = true; + xstreamBundleState = bundle.getState(); + } + } + + assertTrue("XStream bundle was not loaded", xstreamBundleFound); + assertEquals( + format("XStream bundle was not active (was: %d)", xstreamBundleState), + xstreamBundleState, Bundle.ACTIVE + ); + } +}