Update the OSGi test support stuff to add some methods to make it easier to use the testutils
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/95c38653 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/95c38653 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/95c38653 Branch: refs/heads/3.0.x-fixes Commit: 95c38653d9bb3cbfd3ee2883782ca63ab33eaf35 Parents: 013abc6 Author: Daniel Kulp <dk...@apache.org> Authored: Thu Sep 4 12:42:25 2014 -0400 Committer: Daniel Kulp <dk...@apache.org> Committed: Fri Sep 12 13:57:13 2014 -0400 ---------------------------------------------------------------------- .../cxf/osgi/itests/CXFOSGiTestSupport.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/95c38653/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java ---------------------------------------------------------------------- diff --git a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java index 4249dff..e98ca8e 100644 --- a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java +++ b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java @@ -63,6 +63,7 @@ import org.osgi.util.tracker.ServiceTracker; import static org.ops4j.pax.exam.CoreOptions.composite; import static org.ops4j.pax.exam.CoreOptions.maven; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; import static org.ops4j.pax.exam.CoreOptions.systemProperty; import static org.ops4j.pax.exam.CoreOptions.when; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut; @@ -124,12 +125,13 @@ public class CXFOSGiTestSupport { * * @return */ - protected Option cxfBaseConfig() { + protected Option cxfBaseConfig(boolean testUtils) { karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf").version(getKarafVersion()) .type("tar.gz"); cxfUrl = maven().groupId("org.apache.cxf.karaf").artifactId("apache-cxf").versionAsInProject() .type("xml").classifier("features"); String localRepo = System.getProperty("localRepository"); + Object urp = System.getProperty("cxf.useRandomFirstPort"); return composite(karafDistributionConfiguration() .frameworkUrl(karafUrl) .karafVersion(getKarafVersion()) @@ -138,12 +140,23 @@ public class CXFOSGiTestSupport { .unpackDirectory(new File("target/paxexam/")), features(cxfUrl, "cxf-core", "cxf-jaxws"), systemProperty("java.awt.headless").value("true"), + when(testUtils).useOptions(mavenBundle() + .groupId("org.apache.cxf") + .artifactId("cxf-testutils") + .versionAsInProject()), when(localRepo != null) .useOptions(editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", - localRepo))); + localRepo)), + when(urp != null).useOptions(systemProperty("cxf.useRandomFirstPort").value("true"))); } - + protected Option cxfBaseConfig() { + return cxfBaseConfig(false); + } + protected Option cxfBaseConfigWithTestUtils() { + return cxfBaseConfig(true); + } + /** * Executes a shell command and returns output as a String. Commands have a default timeout of 10 seconds. *