You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2014/05/30 10:59:14 UTC
svn commit: r1598506 [1/2] - in /aries/trunk/subsystem: subsystem-core/
subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/
subsystem-itests/
subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/
subsystem-itests/src/...
Author: cschneider
Date: Fri May 30 08:59:13 2014
New Revision: 1598506
URL: http://svn.apache.org/r1598506
Log:
ARIES-1199 Upgrade subsystem tests to pax exam 3
Added:
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/Header.java
Removed:
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/IntegrationTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/ops4j/pax/runner/platform/equinox/internal/SsActivator.java
aries/trunk/subsystem/subsystem-itests/src/test/resources/ss-runner.properties
Modified:
aries/trunk/subsystem/subsystem-core/pom.xml
aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleResource.java
aries/trunk/subsystem/subsystem-itests/pom.xml
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependencyTestBase.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4ATest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4BTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4CTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4DTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4E1Test.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4E2Test.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ApplicationTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/AriesSubsystemTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/AutostartTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BasicTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BlueprintTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BundleEventHookTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BundleStartLevelTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/CompositeTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DependencyLifeCycleTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DynamicImportTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ModelledResourceManagerTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/NoRequirementFilterTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/OptionalDependenciesTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ProvisionPolicyTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ResolutionTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/RootSubsystemTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ServiceDependencyTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SharedResourceTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/UnmanagedBundleTest.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/obr/felix/FelixCapabilityAdapter.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/obr/felix/OsgiResourceAdapter.java
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/util/RepositoryGenerator.java
Modified: aries/trunk/subsystem/subsystem-core/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/pom.xml?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/pom.xml (original)
+++ aries/trunk/subsystem/subsystem-core/pom.xml Fri May 30 08:59:13 2014
@@ -60,45 +60,21 @@
<groupId>org.apache.aries.subsystem</groupId>
<artifactId>org.apache.aries.subsystem.api</artifactId>
<version>1.0.0</version>
- <exclusions>
- <exclusion>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.apache.aries</groupId>
<artifactId>org.apache.aries.util</artifactId>
<version>1.1.0</version>
- <exclusions>
- <exclusion>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.apache.aries.application</groupId>
<artifactId>org.apache.aries.application.api</artifactId>
<version>1.0.0</version>
- <exclusions>
- <exclusion>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.apache.aries.application</groupId>
<artifactId>org.apache.aries.application.utils</artifactId>
<version>1.0.0</version>
- <exclusions>
- <exclusion>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
Modified: aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleResource.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleResource.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleResource.java (original)
+++ aries/trunk/subsystem/subsystem-core/src/main/java/org/apache/aries/subsystem/core/internal/BundleResource.java Fri May 30 08:59:13 2014
@@ -41,9 +41,7 @@ import org.apache.aries.subsystem.core.a
import org.apache.aries.util.filesystem.IDirectory;
import org.apache.aries.util.filesystem.IFile;
import org.apache.aries.util.io.IOUtils;
-import org.osgi.namespace.service.ServiceNamespace;
import org.osgi.resource.Capability;
-import org.osgi.resource.Namespace;
import org.osgi.resource.Requirement;
import org.osgi.resource.Resource;
import org.osgi.service.repository.RepositoryContent;
Modified: aries/trunk/subsystem/subsystem-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/pom.xml?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/pom.xml (original)
+++ aries/trunk/subsystem/subsystem-itests/pom.xml Fri May 30 08:59:13 2014
@@ -26,6 +26,11 @@
Integration tests using the subsystem api, core for the implementation
and subsystem-sample for the subsystem to be tested.
</description>
+
+ <properties>
+ <exam.version>3.4.0</exam.version>
+ <url.version>1.6.0</url.version>
+ </properties>
<dependencies>
<dependency>
@@ -126,17 +131,7 @@
<groupId>org.apache.aries.testsupport</groupId>
<artifactId>org.apache.aries.testsupport.unit</artifactId>
<scope>test</scope>
- <version>1.0.0</version>
- <exclusions>
- <exclusion>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.ops4j.pax.runner</groupId>
- <artifactId>pax-runner-no-jcl</artifactId>
- </exclusion>
- </exclusions>
+ <version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
@@ -219,12 +214,6 @@
<version>3.0</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <scope>test</scope>
- <version>5.0.0</version>
- </dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.event</artifactId>
@@ -237,53 +226,84 @@
<scope>test</scope>
<version>5.0.0</version>
</dependency>
+
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm-all</artifactId>
+ <version>4.0</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <!-- pax exam -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.7</version>
+ </dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam</artifactId>
+ <version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-container-default</artifactId>
+ <artifactId>pax-exam-container-native</artifactId>
+ <version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-junit</artifactId>
+ <artifactId>pax-exam-junit4</artifactId>
+ <version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-junit-extender-impl</artifactId>
+ <artifactId>pax-exam-link-mvn</artifactId>
+ <version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.ops4j.pax.logging</groupId>
- <artifactId>pax-logging-api</artifactId>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-aether</artifactId>
+ <version>${url.version}</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.ops4j.pax.logging</groupId>
- <artifactId>pax-logging-service</artifactId>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>0.9.29</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.ops4j.pax.runner</groupId>
- <artifactId>pax-runner-no-jcl</artifactId>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>0.9.29</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.ops4j.pax.url</groupId>
- <artifactId>pax-url-mvn</artifactId>
+ <groupId>org.ops4j.pax.tinybundles</groupId>
+ <artifactId>tinybundles</artifactId>
+ <version>2.0.0</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>org.osgi.core</artifactId>
+ <groupId>org.osgi</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-all</artifactId>
- <version>4.0</version>
- <scope>test</scope>
- </dependency>
-
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ <version>3.8.0.v20120529-1548</version>
+ </dependency>
</dependencies>
<build>
<plugins>
@@ -597,36 +617,27 @@
</executions>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <forkMode>pertest</forkMode>
- <excludes>
- <exclude>**/*$*</exclude>
- <exclude>**/Abstract*.java</exclude>
- </excludes>
- <includes>
- <include>**/*Test.java</include>
- </includes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>maven-paxexam-plugin</artifactId>
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
<executions>
<execution>
- <id>generate-config</id>
+ <id>generate-depends-file</id>
<goals>
<goal>generate-depends-file</goal>
- <goal>generate-config</goal>
</goals>
- <configuration>
- <outputFile>${project.build.directory}/test-classes/META-INF/maven/dependencies.properties</outputFile>
- </configuration>
</execution>
</executions>
</plugin>
- </plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ </configuration>
+ </plugin>
+ </plugins>
</build>
<profiles>
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependencyTestBase.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependencyTestBase.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependencyTestBase.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependencyTestBase.java Fri May 30 08:59:13 2014
@@ -7,16 +7,14 @@ import static org.junit.Assert.fail;
import static org.osgi.framework.namespace.BundleNamespace.BUNDLE_NAMESPACE;
import static org.osgi.framework.namespace.PackageNamespace.PACKAGE_NAMESPACE;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
+import org.apache.aries.subsystem.itests.Header;
import org.apache.aries.subsystem.itests.SubsystemTest;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
+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 org.osgi.framework.Constants;
@@ -54,7 +52,7 @@ import org.osgi.service.subsystem.Subsys
- Bundle E
*/
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
+@ExamReactorStrategy(PerMethod.class)
public abstract class SubsystemDependencyTestBase extends SubsystemTest
{
protected static String BUNDLE_A = "sdt_bundle.a.jar";
@@ -65,95 +63,69 @@ public abstract class SubsystemDependenc
protected static String BUNDLE_F = "sdt_bundle.f.jar";
protected static String BUNDLE_G = "sdt_bundle.g.jar";
- private static boolean _staticResourcesCreated = false;
- @Before
- public void setUp() throws Exception
- {
- super.setUp();
-
+ @Override
+ protected void createApplications() throws Exception {
// We'd like to do this in an @BeforeClass method, but files written in @BeforeClass
// go into the project's target/ directory whereas those written in @Before go into
// paxexam's temp directory, which is where they're needed.
- if (!_staticResourcesCreated) {
- createBundleA();
- createBundleB();
- createBundleC();
- createBundleD();
- createBundleE();
- createBundleF();
- createBundleG();
- _staticResourcesCreated = true;
- }
+ createBundleA();
+ createBundleB();
+ createBundleC();
+ createBundleD();
+ createBundleE();
+ createBundleF();
+ createBundleG();
}
- private static void createBundleA() throws Exception
+ private void createBundleA() throws Exception
{
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.BUNDLE_VERSION, "1.0.0");
- headers.put(Constants.EXPORT_PACKAGE, "x");
- createBundle(BUNDLE_A, headers);
- }
-
- private static void createBundleB() throws Exception
- {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.BUNDLE_VERSION, "1.0.0");
- headers.put(Constants.PROVIDE_CAPABILITY, "y;y=randomNamespace"); // TODO: see comment below about bug=true
- createBundle(BUNDLE_B, headers);
- }
-
- private static void createBundleC() throws Exception
- {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.BUNDLE_VERSION, "1.0.0");
- headers.put(Constants.IMPORT_PACKAGE, "x");
- createBundle(BUNDLE_C, headers);
- }
-
- private static void createBundleD() throws Exception
- {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.BUNDLE_VERSION, "1.0.0");
- headers.put(Constants.REQUIRE_BUNDLE, BUNDLE_A);
- createBundle(BUNDLE_D, headers);
- }
-
- private static void createBundleE() throws Exception
- {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.BUNDLE_VERSION, "1.0.0");
- headers.put(Constants.REQUIRE_CAPABILITY, "y");
- // TODO:
- /*
- * According to the OSGi Core Release 5 spec section 3.3.6 page 35,
- * "A filter is optional, if no filter directive is specified the requirement always matches."
- *
- * If omitted, we first get an NPE in DependencyCalculator.MissingCapability.initializeAttributes().
- * If that's fixed, we get exceptions of the form,
- *
- * Caused by: java.lang.IllegalArgumentException: The filter must not be null.
- * at org.eclipse.equinox.internal.region.StandardRegionFilterBuilder.allow(StandardRegionFilterBuilder.java:49)
- * at org.apache.aries.subsystem.core.internal.SubsystemResource.setImportIsolationPolicy(SubsystemResource.java:655)
- *
- * This looks to be an Equinox defect - at least in the level of 3.8.0 currently being used by these tests.
- */
- createBundle(BUNDLE_E, headers);
+ createBundle(name(BUNDLE_A), version("1.0.0"), exportPackage("x"));
+ }
+
+ private void createBundleB() throws Exception
+ {
+ // TODO: see comment below about bug=true
+ createBundle(name(BUNDLE_B), version("1.0.0"), new Header(Constants.PROVIDE_CAPABILITY, "y;y=randomNamespace"));
+ }
+
+ private void createBundleC() throws Exception
+ {
+ createBundle(name(BUNDLE_C), version("1.0.0"), importPackage("x"));
+ }
+
+ private void createBundleD() throws Exception
+ {
+ createBundle(name(BUNDLE_D), version("1.0.0"), requireBundle(BUNDLE_A));
+ }
+
+ // TODO:
+ /*
+ * According to the OSGi Core Release 5 spec section 3.3.6 page 35,
+ * "A filter is optional, if no filter directive is specified the requirement always matches."
+ *
+ * If omitted, we first get an NPE in DependencyCalculator.MissingCapability.initializeAttributes().
+ * If that's fixed, we get exceptions of the form,
+ *
+ * Caused by: java.lang.IllegalArgumentException: The filter must not be null.
+ * at org.eclipse.equinox.internal.region.StandardRegionFilterBuilder.allow(StandardRegionFilterBuilder.java:49)
+ * at org.apache.aries.subsystem.core.internal.SubsystemResource.setImportIsolationPolicy(SubsystemResource.java:655)
+ *
+ * This looks to be an Equinox defect - at least in the level of 3.8.0 currently being used by these tests.
+ */
+ private void createBundleE() throws Exception
+ {
+ createBundle(name(BUNDLE_E), version("1.0.0"), new Header(Constants.REQUIRE_CAPABILITY, "y"));
}
- private static void createBundleF() throws Exception
+ private void createBundleF() throws Exception
{
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.BUNDLE_VERSION, "1.0.0");
- headers.put(Constants.EXPORT_PACKAGE, "x");
- createBundle(BUNDLE_F, headers);
+ createBundle(name(BUNDLE_F), version("1.0.0"), exportPackage("x"));
}
- private static void createBundleG() throws Exception
+ // TODO: see comment above about bug=true
+ private void createBundleG() throws Exception
{
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.BUNDLE_VERSION, "1.0.0");
- headers.put(Constants.PROVIDE_CAPABILITY, "y;y=randomNamespace"); // TODO: see comment above about bug=true
- createBundle(BUNDLE_G, headers);
+ createBundle(name(BUNDLE_G), version("1.0.0"), new Header(Constants.PROVIDE_CAPABILITY, "y;y=randomNamespace"));
}
protected void registerRepositoryR1() throws Exception
@@ -188,7 +160,7 @@ public abstract class SubsystemDependenc
*/
protected void verifySinglePackageWiring (Subsystem s, String wiredBundleName, String expectedPackage, String expectedProvidingBundle)
{
- Bundle wiredBundle = getBundle(s, wiredBundleName);
+ Bundle wiredBundle = context(s).getBundleByName(wiredBundleName);
assertNotNull ("Bundle not found", wiredBundleName);
BundleWiring wiring = wiredBundle.adapt(BundleWiring.class);
@@ -212,7 +184,7 @@ public abstract class SubsystemDependenc
*/
protected void verifyRequireBundleWiring (Subsystem s, String wiredBundleName, String expectedProvidingBundleName)
{
- Bundle wiredBundle = getBundle(s, BUNDLE_D);
+ Bundle wiredBundle = context(s).getBundleByName(BUNDLE_D);
assertNotNull ("Target bundle " + wiredBundleName + " not found", wiredBundle);
BundleWiring wiring = wiredBundle.adapt(BundleWiring.class);
@@ -238,7 +210,7 @@ public abstract class SubsystemDependenc
protected void verifyCapabilityWiring (Subsystem s, String wiredBundleName,
String namespace, String expectedProvidingBundleName)
{
- Bundle wiredBundle = getBundle(s, wiredBundleName);
+ Bundle wiredBundle = context(s).getBundleByName(wiredBundleName);
assertNotNull ("Targt bundle " + wiredBundleName + " not found", wiredBundleName);
BundleWiring wiring = wiredBundle.adapt(BundleWiring.class);
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4ATest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4ATest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4ATest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4ATest.java Fri May 30 08:59:13 2014
@@ -5,7 +5,6 @@ import static org.junit.Assert.assertTru
import java.util.HashMap;
import java.util.Map;
-import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.service.subsystem.Subsystem;
@@ -30,16 +29,11 @@ A) Test a transitively closed subsystem
public class SubsystemDependency_4ATest extends SubsystemDependencyTestBase
{
protected static String APPLICATION_A="sdt_application.a.esa";
- private static boolean _testAppCreated = false;
- @Before
- public void setUp() throws Exception
- {
- super.setUp();
- if (!_testAppCreated) {
- createTestApplicationA();
- _testAppCreated = true;
- }
+ @Override
+ public void createApplications() throws Exception {
+ super.createApplications();
+ createTestApplicationA();
registerRepositoryR1();
}
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4BTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4BTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4BTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4BTest.java Fri May 30 08:59:13 2014
@@ -30,16 +30,14 @@ public class SubsystemDependency_4BTest
protected static String APPLICATION_B="sdt_application.b.esa";
- private static boolean appCreated = false;
+ @Override
+ public void createApplications() throws Exception {
+ super.createApplications();
+ createTestApplicationB();
+ }
@Before
- public void setUp() throws Exception
- {
- super.setUp();
- if (!appCreated) {
- createTestApplicationB();
- appCreated = true;
- }
+ public void registerRepo() throws Exception {
registerRepositoryR2();
}
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4CTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4CTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4CTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4CTest.java Fri May 30 08:59:13 2014
@@ -3,8 +3,9 @@ package org.apache.aries.subsystem.ctt.i
import java.util.HashMap;
import java.util.Map;
-import org.junit.Before;
import org.junit.Test;
+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.Constants;
import org.osgi.service.subsystem.Subsystem;
@@ -21,25 +22,20 @@ C) Test with pre-installed transitive re
- Verify no new bundles are installed into the Root or S1 subsystems
*/
+@ExamReactorStrategy(PerMethod.class)
public class SubsystemDependency_4CTest extends SubsystemDependencyTestBase
{
private static final String SUBSYSTEM_S1 = "sdt_composite.s1.esa";
private static final String SUBSYSTEM_S2 = "sdt_composite.s2.esa";
- private static boolean _testSubsystemCreated = false;
private Subsystem s1;
private Subsystem s2;
- @Before
- public void setUp() throws Exception
- {
- super.setUp();
- if (!_testSubsystemCreated) {
- createSubsystemS1();
- createSubsystemS2();
- _testSubsystemCreated = true;
- }
+ @Override
+ protected void createApplications() throws Exception {
+ super.createApplications();
+ createSubsystemS1();
+ createSubsystemS2();
registerRepositoryR1();
-
}
// doing this within @Before doesn't work :(
@@ -55,8 +51,8 @@ public class SubsystemDependency_4CTest
{
stopSubsystem(s2);
stopSubsystem(s1);
- uninstallSubsystem(s2);
- uninstallSubsystem(s1);
+ //uninstallSubsystem(s2);
+ //uninstallSubsystem(s1);
}
// Using the subsystem S1, install a composite S2 that
@@ -66,29 +62,15 @@ public class SubsystemDependency_4CTest
// - Verify the wiring of C, D and E wire to A->x, A, B->y respectively
@Test
- public void verifyCinS1WiresToAxInS2() throws Exception
+ public void verify() throws Exception
{
startSubsystems();
verifySinglePackageWiring (s2, BUNDLE_C, "x", BUNDLE_A);
- stopSubsystems();
- }
-
- @Test
- public void verifyBundleDWiredToBundleA() throws Exception
- {
- startSubsystems();
verifyRequireBundleWiring (s2, BUNDLE_D, BUNDLE_A);
- stopSubsystems();
- }
-
- @Test
- public void verifyBundleEWiredToCapability_yFromBundleB() throws Exception
- {
- startSubsystems();
verifyCapabilityWiring (s2, BUNDLE_E, "y", BUNDLE_B);
stopSubsystems();
}
-
+
@Test
public void verifyNoUnexpectedBundlesProvisioned() throws Exception
{
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4DTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4DTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4DTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4DTest.java Fri May 30 08:59:13 2014
@@ -5,7 +5,6 @@ import static org.junit.Assert.assertTru
import java.util.HashMap;
import java.util.Map;
-import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.service.subsystem.Subsystem;
@@ -28,16 +27,12 @@ import org.osgi.service.subsystem.Subsys
public class SubsystemDependency_4DTest extends SubsystemDependencyTestBase
{
private static final String SUBSYSTEM_4D = "sdt_application4d.esa";
- private static boolean _testSubsystemCreated = false;
private Subsystem subsystem;
- @Before
- public void setUp() throws Exception
- {
- super.setUp();
- if (!_testSubsystemCreated) {
- createApplication4d();
- }
+ @Override
+ public void createApplications() throws Exception {
+ super.createApplications();
+ createApplication4d();
registerRepositoryR2();
}
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4E1Test.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4E1Test.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4E1Test.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4E1Test.java Fri May 30 08:59:13 2014
@@ -11,7 +11,6 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Constants;
import org.osgi.framework.namespace.IdentityNamespace;
@@ -42,18 +41,15 @@ public class SubsystemDependency_4E1Test
private static final String SUBSYSTEM_4E_S2_APP = "sdt_application4e_s2.esa";
private static final String SUBSYSTEM_4E_S2_COMP = "sdt_composite4e_s2.esa";
private static final String SUBSYSTEM_4E_S2_FEATURE = "sdt_feature4e_s2.esa";
- private static boolean _testSubsystemsCreated = false;
- @Before
- public void setUp() throws Exception
+ @Override
+ public void createApplications() throws Exception
{
- super.setUp();
- if (!_testSubsystemsCreated) {
- createComposite4E_S1();
- createApplication4E_S2();
- createComposite4E_S2();
- createFeature4E_S2();
- }
+ super.createApplications();
+ createComposite4E_S1();
+ createApplication4E_S2();
+ createComposite4E_S2();
+ createFeature4E_S2();
registerRepositoryR2();
}
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4E2Test.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4E2Test.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4E2Test.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/ctt/itests/SubsystemDependency_4E2Test.java Fri May 30 08:59:13 2014
@@ -11,7 +11,6 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Constants;
import org.osgi.framework.namespace.IdentityNamespace;
@@ -53,22 +52,18 @@ import org.osgi.service.subsystem.Subsys
*/
public class SubsystemDependency_4E2Test extends SubsystemDependencyTestBase
{
- private static final boolean _testSubsystemsCreated = false;
private static final String SUBSYSTEM_4E2_S1_COMP = "sdt_composite4e2_s1.esa";
private static final String SUBSYSTEM_4E2_S2_APP = "sdt_application4e2_s2.esa";
private static final String SUBSYSTEM_4E2_S2_COMP = "sdt_composite4e2_s2.esa";
private static final String SUBSYSTEM_4E2_S2_FEATURE = "sdt_feature4e2_s2.esa";
- @Before
- public void setUp() throws Exception
- {
- super.setUp();
- if (!_testSubsystemsCreated) {
- createComposite4E2_S1();
- createApplication4E2_S2();
- createComposite4E2_S2();
- createFeature4E2_S2();
- }
+ @Override
+ public void createApplications() throws Exception {
+ super.createApplications();
+ createComposite4E2_S1();
+ createApplication4E2_S2();
+ createComposite4E2_S2();
+ createFeature4E2_S2();
registerRepositoryR2();
}
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ApplicationTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ApplicationTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ApplicationTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ApplicationTest.java Fri May 30 08:59:13 2014
@@ -33,8 +33,6 @@ import org.apache.aries.subsystem.itests
import org.apache.aries.subsystem.itests.util.TestRepositoryContent;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
@@ -45,7 +43,6 @@ import org.osgi.service.repository.Repos
import org.osgi.service.subsystem.Subsystem;
import org.osgi.service.subsystem.SubsystemConstants;
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
public class ApplicationTest extends SubsystemTest {
/*
* Subsystem-SymbolicName: application.a.esa
@@ -76,7 +73,7 @@ public class ApplicationTest extends Sub
private static boolean createdTestFiles;
@Before
- public static void createTestFiles() throws Exception {
+ public void createTestFiles() throws Exception {
if (createdTestFiles)
return;
createBundleA();
@@ -87,55 +84,47 @@ public class ApplicationTest extends Sub
createdTestFiles = true;
}
- private static void createBundleA() throws IOException {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.REQUIRE_CAPABILITY, "foo; filter:=\"(foo=bar)\"");
- createBundle(BUNDLE_A, "1.0.0", headers);
+ private void createBundleA() throws IOException {
+ createBundle(name(BUNDLE_A), version("1.0.0"),
+ new Header(Constants.REQUIRE_CAPABILITY, "foo; filter:=\"(foo=bar)\""));
}
- private static void createBundleB() throws IOException {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.PROVIDE_CAPABILITY, "foo; foo=bar");
- createBundle(BUNDLE_B, "1.0.0", headers);
+ private void createBundleB() throws IOException {
+ createBundle(name(BUNDLE_B), version("1.0.0"),
+ new Header(Constants.PROVIDE_CAPABILITY, "foo; foo=bar"));
}
- private static void createBundleC() throws IOException {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.REQUIRE_BUNDLE, BUNDLE_B);
- createBundle(BUNDLE_C, "1.0.0", headers);
+ private void createBundleC() throws IOException {
+ createBundle(name(BUNDLE_C), version("1.0.0"), requireBundle(BUNDLE_B));
}
- private static void createApplicationA() throws IOException {
+ private void createApplicationA() throws IOException {
createApplicationAManifest();
createSubsystem(APPLICATION_A, BUNDLE_A);
}
- private static void createApplicationB() throws IOException {
+ private void createApplicationB() throws IOException {
createApplicationBManifest();
createSubsystem(APPLICATION_B, BUNDLE_C);
}
- private static void createApplicationAManifest() throws IOException {
+ private void createApplicationAManifest() throws IOException {
Map<String, String> attributes = new HashMap<String, String>();
attributes.put(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME, APPLICATION_A);
attributes.put(SubsystemConstants.SUBSYSTEM_CONTENT, BUNDLE_A);
createManifest(APPLICATION_A + ".mf", attributes);
}
- private static void createApplicationBManifest() throws IOException {
+ private void createApplicationBManifest() throws IOException {
Map<String, String> attributes = new HashMap<String, String>();
attributes.put(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME, APPLICATION_B);
attributes.put(SubsystemConstants.SUBSYSTEM_CONTENT, BUNDLE_C);
createManifest(APPLICATION_B + ".mf", attributes);
}
- @Before
- public static void createApplications() throws Exception {
- if (createdApplications) {
- return;
- }
- createApplication("application1", new String[]{"tb1.jar"});
- createdApplications = true;
+ @Override
+ public void createApplications() throws Exception {
+ createApplication("application1", "tb1.jar");
}
public void setUp() throws Exception {
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/AriesSubsystemTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/AriesSubsystemTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/AriesSubsystemTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/AriesSubsystemTest.java Fri May 30 08:59:13 2014
@@ -18,10 +18,9 @@ import org.apache.aries.util.filesystem.
import org.easymock.EasyMock;
import org.eclipse.equinox.region.Region;
import org.eclipse.equinox.region.RegionFilter;
-import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
import org.osgi.framework.namespace.IdentityNamespace;
@@ -33,7 +32,7 @@ import org.osgi.service.subsystem.Subsys
import org.osgi.service.subsystem.SubsystemConstants;
import org.osgi.service.subsystem.SubsystemException;
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
+@ExamReactorStrategy(PerMethod.class)
public class AriesSubsystemTest extends SubsystemTest {
/*
* Subsystem-SymbolicName: application.a.esa
@@ -61,46 +60,42 @@ public class AriesSubsystemTest extends
*/
private static final String COMPOSITE_A = "composite.a.esa";
- private static void createApplicationA() throws IOException {
+ private void createApplicationA() throws IOException {
createApplicationAManifest();
createSubsystem(APPLICATION_A, BUNDLE_A);
}
- private static void createApplicationB() throws IOException {
+ private void createApplicationB() throws IOException {
createApplicationBManifest();
createSubsystem(APPLICATION_B, BUNDLE_B);
}
- private static void createApplicationAManifest() throws IOException {
+ private void createApplicationAManifest() throws IOException {
Map<String, String> attributes = new HashMap<String, String>();
attributes.put(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME, APPLICATION_A);
createManifest(APPLICATION_A + ".mf", attributes);
}
- private static void createApplicationBManifest() throws IOException {
+ private void createApplicationBManifest() throws IOException {
Map<String, String> attributes = new HashMap<String, String>();
attributes.put(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME, APPLICATION_B);
createManifest(APPLICATION_B + ".mf", attributes);
}
- private static void createBundleA() throws IOException {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.IMPORT_PACKAGE, "org.osgi.framework,org.osgi.resource");
- createBundle(BUNDLE_A, headers);
+ private void createBundleA() throws IOException {
+ createBundle(name(BUNDLE_A), importPackage("org.osgi.framework,org.osgi.resource"));
}
- private static void createBundleB() throws IOException {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.IMPORT_PACKAGE, "org.osgi.resource");
- createBundle(BUNDLE_B, headers);
+ private void createBundleB() throws IOException {
+ createBundle(name(BUNDLE_B), importPackage("org.osgi.resource"));
}
- private static void createCompositeA() throws IOException {
+ private void createCompositeA() throws IOException {
createCompositeAManifest();
createSubsystem(COMPOSITE_A, BUNDLE_B, APPLICATION_B);
}
- private static void createCompositeAManifest() throws IOException {
+ private void createCompositeAManifest() throws IOException {
Map<String, String> attributes = new HashMap<String, String>();
attributes.put(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME, COMPOSITE_A);
attributes.put(SubsystemConstants.SUBSYSTEM_TYPE, SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE);
@@ -111,21 +106,13 @@ public class AriesSubsystemTest extends
createManifest(COMPOSITE_A + ".mf", attributes);
}
- private static boolean createdTestFiles;
- @Before
- public static void createTestFiles() throws Exception {
- if (createdTestFiles)
- return;
+ @Override
+ public void createApplications() throws Exception {
createBundleA();
createBundleB();
createApplicationA();
createApplicationB();
createCompositeA();
- createdTestFiles = true;
- }
-
- public void setUp() throws Exception {
- super.setUp();
}
/*
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/AutostartTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/AutostartTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/AutostartTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/AutostartTest.java Fri May 30 08:59:13 2014
@@ -17,18 +17,13 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
import org.osgi.framework.namespace.IdentityNamespace;
import org.osgi.service.subsystem.Subsystem;
import org.osgi.service.subsystem.SubsystemConstants;
-import aQute.lib.osgi.Constants;
-
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
public class AutostartTest extends SubsystemTest {
/*
* Subsystem-SymbolicName: application.a.esa
@@ -95,36 +90,32 @@ public class AutostartTest extends Subsy
createManifest(APPLICATION_A + ".mf", attributes);
}
- private static void createApplicationB() throws IOException {
+ private void createApplicationB() throws IOException {
createApplicationBManifest();
createSubsystem(APPLICATION_B, BUNDLE_A, APPLICATION_A);
}
- private static void createApplicationBManifest() throws IOException {
+ private void createApplicationBManifest() throws IOException {
Map<String, String> attributes = new HashMap<String, String>();
attributes.put(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME, APPLICATION_B);
attributes.put(SubsystemConstants.SUBSYSTEM_CONTENT, BUNDLE_A + ',' + APPLICATION_A + ';' + IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE + '=' + SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION);
createManifest(APPLICATION_B + ".mf", attributes);
}
- private static void createBundleA() throws IOException {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.EXPORT_PACKAGE, "x");
- createBundle(BUNDLE_A, headers);
+ private void createBundleA() throws IOException {
+ createBundle(name(BUNDLE_A), exportPackage("x"));
}
- private static void createBundleB() throws IOException {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.IMPORT_PACKAGE, "x");
- createBundle(BUNDLE_B, headers);
+ private void createBundleB() throws IOException {
+ createBundle(name(BUNDLE_B), importPackage("x"));
}
- private static void createCompositeA() throws IOException {
+ private void createCompositeA() throws IOException {
createCompositeAManifest();
createSubsystem(COMPOSITE_A, BUNDLE_A);
}
- private static void createCompositeAManifest() throws IOException {
+ private void createCompositeAManifest() throws IOException {
Map<String, String> attributes = new HashMap<String, String>();
attributes.put(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME, COMPOSITE_A);
attributes.put(SubsystemConstants.SUBSYSTEM_TYPE, SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE);
@@ -186,12 +177,9 @@ public class AutostartTest extends Subsy
attributes.put(SubsystemConstants.SUBSYSTEM_CONTENT, BUNDLE_A + ',' + FEATURE_A + ';' + IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE + '=' + SubsystemConstants.SUBSYSTEM_TYPE_FEATURE);
createManifest(FEATURE_C + ".mf", attributes);
}
-
- private static boolean createdTestFiles;
- @Before
- public static void createTestFiles() throws Exception {
- if (createdTestFiles)
- return;
+
+ @Override
+ public void createApplications() throws Exception {
createBundleA();
createBundleB();
createApplicationA();
@@ -201,11 +189,6 @@ public class AutostartTest extends Subsy
createFeatureA();
createFeatureB();
createFeatureC();
- createdTestFiles = true;
- }
-
- public void setUp() throws Exception {
- super.setUp();
}
@Test
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BasicTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BasicTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BasicTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BasicTest.java Fri May 30 08:59:13 2014
@@ -21,27 +21,19 @@ package org.apache.aries.subsystem.itest
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.Version;
import org.osgi.service.subsystem.Subsystem;
import org.osgi.service.subsystem.SubsystemConstants;
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
public class BasicTest extends SubsystemTest {
- @Before
- public static void createApplications() throws Exception {
- if (createdApplications) {
- return;
- }
+ @Override
+ public void createApplications() throws Exception {
createApplication("emptyFeature", new String[]{});
createApplication("emptySubsystem", new String[]{});
- createdApplications = true;
}
/*
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BlueprintTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BlueprintTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BlueprintTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BlueprintTest.java Fri May 30 08:59:13 2014
@@ -1,34 +1,21 @@
package org.apache.aries.subsystem.itests;
import static org.junit.Assert.assertEquals;
-import static org.ops4j.pax.exam.CoreOptions.options;
+import org.apache.aries.itest.RichBundleContext;
import org.apache.aries.subsystem.itests.hello.api.Hello;
-import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.Configuration;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
import org.osgi.framework.BundleContext;
import org.osgi.service.subsystem.Subsystem;
/*
* iTest for blueprint with subsystems
*/
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
public class BlueprintTest extends SubsystemTest
{
- private static boolean _testAppCreated = false;
-
- @Before
- public void setUp() throws Exception
- {
- super.setUp();
- if (!_testAppCreated) {
- createApplication("blueprint", new String[]{"blueprint.jar"});
- _testAppCreated = true;
- }
+ @Override
+ public void createApplications() throws Exception {
+ createApplication("blueprint", "blueprint.jar");
}
@Test
@@ -38,7 +25,7 @@ public class BlueprintTest extends Subsy
try {
startSubsystem(subsystem);
BundleContext bc = subsystem.getBundleContext();
- Hello h = getOsgiService(bc, Hello.class, null, DEFAULT_TIMEOUT);
+ Hello h = new RichBundleContext(bc).getService(Hello.class);
String message = h.saySomething();
assertEquals("Wrong message back", "messageFromBlueprint", message);
} finally {
@@ -47,15 +34,4 @@ public class BlueprintTest extends Subsy
}
}
- @Configuration
- public static Option[] extraBundles()
- {
- return options(
- mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.itest.interfaces"),
- mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"),
- mavenBundle("org.ow2.asm", "asm-all"),
- mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy")
-// org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7777")
- );
- }
}
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BundleEventHookTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BundleEventHookTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BundleEventHookTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BundleEventHookTest.java Fri May 30 08:59:13 2014
@@ -31,10 +31,7 @@ import java.util.concurrent.TimeoutExcep
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
-import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.ServiceEvent;
@@ -42,7 +39,6 @@ import org.osgi.framework.ServiceListene
import org.osgi.framework.ServiceReference;
import org.osgi.service.subsystem.Subsystem;
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
public class BundleEventHookTest extends SubsystemTest {
/*
* Bundle-SymbolicName: bundle.a.jar
@@ -53,22 +49,18 @@ public class BundleEventHookTest extends
*/
private static final String BUNDLE_B = "bundle.b.jar";
- @Before
- public static void createApplications() throws Exception {
- if (createdApplications) {
- return;
- }
+ @Override
+ public void createApplications() throws Exception {
createBundleA();
createBundleB();
- createdApplications = true;
}
- private static void createBundleA() throws IOException {
- createBundle(BUNDLE_A);
+ private void createBundleA() throws IOException {
+ createBundle(name(BUNDLE_A));
}
- private static void createBundleB() throws IOException {
- createBundle(BUNDLE_B);
+ private void createBundleB() throws IOException {
+ createBundle(name(BUNDLE_B));
}
/*
@@ -151,6 +143,7 @@ public class BundleEventHookTest extends
final AtomicReference<Bundle> a = new AtomicReference<Bundle>();
bundleContext.addServiceListener(
new ServiceListener() {
+ @SuppressWarnings("unchecked")
@Override
public void serviceChanged(ServiceEvent event) {
if ((event.getType() & (ServiceEvent.REGISTERED | ServiceEvent.MODIFIED)) == 0)
@@ -159,7 +152,7 @@ public class BundleEventHookTest extends
// We've been here before and already done what needs doing.
return;
ServiceReference<Subsystem> sr = (ServiceReference<Subsystem>)event.getServiceReference();
- Subsystem s = bundleContext.getService(sr);
+ bundleContext.getService(sr);
try {
// Queue up the installed event.
a.set(core.getBundleContext().installBundle(BUNDLE_A, new FileInputStream(BUNDLE_A)));
@@ -204,6 +197,7 @@ public class BundleEventHookTest extends
final AtomicReference<Bundle> a = new AtomicReference<Bundle>();
bundleContext.addServiceListener(
new ServiceListener() {
+ @SuppressWarnings("unchecked")
@Override
public void serviceChanged(ServiceEvent event) {
if ((event.getType() & (ServiceEvent.REGISTERED | ServiceEvent.MODIFIED)) == 0)
@@ -212,7 +206,7 @@ public class BundleEventHookTest extends
// We've been here before and already done what needs doing.
return;
ServiceReference<Subsystem> sr = (ServiceReference<Subsystem>)event.getServiceReference();
- Subsystem s = bundleContext.getService(sr);
+ bundleContext.getService(sr);
try {
// Queue up the installed event for bundle A using B's context.
a.set(b.getBundleContext().installBundle(BUNDLE_A, new FileInputStream(BUNDLE_A)));
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BundleStartLevelTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BundleStartLevelTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BundleStartLevelTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/BundleStartLevelTest.java Fri May 30 08:59:13 2014
@@ -22,17 +22,11 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
import org.osgi.framework.Bundle;
import org.osgi.service.subsystem.Subsystem;
import org.osgi.service.subsystem.SubsystemConstants;
-import aQute.lib.osgi.Constants;
-
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
public class BundleStartLevelTest extends SubsystemTest {
/*
* Subsystem-SymbolicName: application.a.esa
@@ -54,51 +48,39 @@ public class BundleStartLevelTest extend
*/
private static final String BUNDLE_C = "bundle.c.jar";
- @Before
- public static void createApplications() throws Exception {
- if (createdApplications) {
- return;
- }
+ @Override
+ public void createApplications() throws Exception {
createBundleA();
createBundleB();
createBundleC();
createApplicationA();
- createdApplications = true;
+ registerRepositoryService(BUNDLE_A, BUNDLE_B);
}
- private static void createApplicationA() throws IOException {
+ private void createApplicationA() throws IOException {
createApplicationAManifest();
createSubsystem(APPLICATION_A);
}
- private static void createApplicationAManifest() throws IOException {
+ private void createApplicationAManifest() throws IOException {
Map<String, String> attributes = new HashMap<String, String>();
attributes.put(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME, APPLICATION_A);
attributes.put(SubsystemConstants.SUBSYSTEM_CONTENT, BUNDLE_B);
createManifest(APPLICATION_A + ".mf", attributes);
}
- private static void createBundleA() throws IOException {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.EXPORT_PACKAGE, "x");
- createBundle(BUNDLE_A, headers);
- }
-
- private static void createBundleB() throws IOException {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.IMPORT_PACKAGE, "x");
- createBundle(BUNDLE_B, headers);
+ private void createBundleA() throws IOException {
+ createBundle(name(BUNDLE_A), exportPackage("x"));
}
- private static void createBundleC() throws IOException {
- createBundle(BUNDLE_C);
+ private void createBundleB() throws IOException {
+ createBundle(name(BUNDLE_B), importPackage("x"));
}
- public void setUp() throws Exception {
- super.setUp();
- registerRepositoryService(BUNDLE_A, BUNDLE_B);
+ private void createBundleC() throws IOException {
+ createBundle(name(BUNDLE_C));
}
-
+
/*
* Tests the start level of bundle constituents.
*
@@ -125,9 +107,9 @@ public class BundleStartLevelTest extend
startSubsystem(a);
try {
// Test managed bundles.
- assertStartLevel(getBundle(a, BUNDLE_B), 1);
+ assertStartLevel(context(a).getBundleByName(BUNDLE_B), 1);
assertStartLevel(getRegionContextBundle(a), 1);
- assertStartLevel(getBundle(getRootSubsystem(), BUNDLE_A), 1);
+ assertStartLevel(context(getRootSubsystem()).getBundleByName(BUNDLE_A), 1);
// Test unmanaged bundle.
Bundle c = installBundleFromFile(BUNDLE_C, a);
try {
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/CompositeTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/CompositeTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/CompositeTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/CompositeTest.java Fri May 30 08:59:13 2014
@@ -17,16 +17,12 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
import org.osgi.service.subsystem.Subsystem;
import org.osgi.service.subsystem.SubsystemConstants;
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
public class CompositeTest extends SubsystemTest {
private static final String BUNDLE_A = "bundle.a";
private static final String BUNDLE_B = "bundle.b";
@@ -39,12 +35,8 @@ public class CompositeTest extends Subsy
private static final String COMPOSITE_D = "composite.d";
private static final String PACKAGE_X = "x";
- private static boolean createdTestFiles;
-
- @Before
- public static void createTestFiles() throws Exception {
- if (createdTestFiles)
- return;
+ @Override
+ public void createApplications() throws Exception {
createBundleA();
createBundleB();
createBundleC();
@@ -54,37 +46,27 @@ public class CompositeTest extends Subsy
createCompositeB();
createCompositeC();
createCompositeD();
- createdTestFiles = true;
}
- private static void createBundleA() throws IOException {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.EXPORT_PACKAGE, PACKAGE_X + ";version=1.0");
- createBundle(BUNDLE_A, "1.0.0", headers);
+ private void createBundleA() throws IOException {
+ createBundle(name(BUNDLE_A), version("1.0.0"), exportPackage(PACKAGE_X + ";version=1.0"));
}
- private static void createBundleB() throws IOException {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.PROVIDE_CAPABILITY, "y; y=test; version:Version=1.0");
- createBundle(BUNDLE_B, "1.0.0", headers);
+ private void createBundleB() throws IOException {
+ createBundle(name(BUNDLE_B), version("1.0.0"),
+ new Header(Constants.PROVIDE_CAPABILITY, "y; y=test; version:Version=1.0"));
}
- private static void createBundleC() throws IOException {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.IMPORT_PACKAGE, PACKAGE_X + ";version=\"[1.0,2.0)\"");
- createBundle(BUNDLE_C, "1.0.0", headers);
+ private void createBundleC() throws IOException {
+ createBundle(name(BUNDLE_C), version("1.0.0"), importPackage(PACKAGE_X + ";version=\"[1.0,2.0)\""));
}
- private static void createBundleD() throws IOException {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.REQUIRE_BUNDLE, BUNDLE_A);
- createBundle(BUNDLE_D, headers);
+ private void createBundleD() throws IOException {
+ createBundle(name(BUNDLE_D), requireBundle(BUNDLE_A));
}
- private static void createBundleE() throws IOException {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.REQUIRE_CAPABILITY, "y; filter:=(y=test)");
- createBundle(BUNDLE_E, headers);
+ private void createBundleE() throws IOException {
+ createBundle(name(BUNDLE_E), new Header(Constants.REQUIRE_CAPABILITY, "y; filter:=(y=test)"));
}
private static void createCompositeA() throws IOException {
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DependencyLifeCycleTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DependencyLifeCycleTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DependencyLifeCycleTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DependencyLifeCycleTest.java Fri May 30 08:59:13 2014
@@ -18,16 +18,11 @@ import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
import org.osgi.service.subsystem.Subsystem;
import org.osgi.service.subsystem.SubsystemConstants;
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
public class DependencyLifeCycleTest extends SubsystemTest {
/*
* Subsystem-SymbolicName: application.a.esa
@@ -57,27 +52,19 @@ public class DependencyLifeCycleTest ext
createManifest(APPLICATION_A + ".mf", attributes);
}
- private static void createBundleA() throws IOException {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.IMPORT_PACKAGE, "x");
- createBundle(BUNDLE_A, headers);
- }
-
- private static void createBundleB() throws IOException {
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Constants.EXPORT_PACKAGE, "x");
- createBundle(BUNDLE_B, headers);
- }
-
- private static boolean createdTestFiles;
- @Before
- public static void createTestFiles() throws Exception {
- if (createdTestFiles)
- return;
+ private void createBundleA() throws IOException {
+ createBundle(name(BUNDLE_A), importPackage("x"));
+ }
+
+ private void createBundleB() throws IOException {
+ createBundle(name(BUNDLE_B), exportPackage("x"));
+ }
+
+ @Override
+ public void createApplications() throws Exception {
createBundleA();
createBundleB();
createApplicationA();
- createdTestFiles = true;
}
public void setUp() throws Exception {
@@ -132,7 +119,7 @@ public class DependencyLifeCycleTest ext
Subsystem subsystem = installSubsystemFromFile(APPLICATION_A);
try {
assertConstituent(root, BUNDLE_B);
- Bundle bundle = getBundle(root, BUNDLE_B);
+ Bundle bundle = context(root).getBundleByName(BUNDLE_B);
subsystem.uninstall();
assertBundleState(bundle, Bundle.UNINSTALLED);
assertNotConstituent(root, BUNDLE_B);
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DynamicImportTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DynamicImportTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DynamicImportTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/DynamicImportTest.java Fri May 30 08:59:13 2014
@@ -4,7 +4,6 @@ import static org.junit.Assert.assertEqu
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.options;
import java.io.FileInputStream;
import java.io.IOException;
@@ -14,19 +13,18 @@ import java.util.Hashtable;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.aries.itest.RichBundleContext;
import org.apache.aries.subsystem.itests.hello.api.Hello;
import org.apache.aries.unittest.fixture.ArchiveFixture;
import org.apache.aries.unittest.fixture.ArchiveFixture.JarFixture;
import org.apache.aries.unittest.fixture.ArchiveFixture.ManifestFixture;
-import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.Configuration;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
+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 org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.hooks.weaving.WeavingHook;
import org.osgi.framework.hooks.weaving.WovenClass;
@@ -34,30 +32,21 @@ import org.osgi.service.subsystem.Subsys
import org.osgi.service.subsystem.SubsystemConstants;
import org.osgi.service.subsystem.SubsystemException;
-import aQute.lib.osgi.Constants;
-
/*
* Simple iTest for dynamic imports. In the first instance we'll use a
* DynamicImport-Package header because it's the simplest to set up.
* _Hopefully_ if this works, then packages added by WeavingProxy services
* will also work. If not, we'll need extra tests :-/
*/
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
+@ExamReactorStrategy(PerMethod.class)
public class DynamicImportTest extends SubsystemTest
{
- private static boolean _testAppCreated = false;
-
- @Before
- public void setUp() throws Exception
- {
- super.setUp();
- if (!_testAppCreated) {
- createApplication("dynamicImport", new String[]{"dynamicImport.jar"});
- createEmptyClass();
- createBundleA();
- createApplicationA();
- _testAppCreated = true;
- }
+ @Override
+ protected void createApplications() throws Exception {
+ createApplication("dynamicImport", "dynamicImport.jar");
+ createEmptyClass();
+ createBundleA();
+ createApplicationA();
}
/*
@@ -99,7 +88,7 @@ public class DynamicImportTest extends S
startSubsystem(subsystem);
BundleContext bc = subsystem.getBundleContext();
- Hello h = getOsgiService(bc, Hello.class, null, DEFAULT_TIMEOUT);
+ Hello h = new RichBundleContext(bc).getService(Hello.class);
String message = h.saySomething();
assertEquals ("Wrong message back", "Hello, this is something", message); // DynamicImportHelloImpl.java
@@ -110,15 +99,6 @@ public class DynamicImportTest extends S
}
}
- @Configuration
- public static Option[] extraBundles()
- {
- return options(
- mavenBundle("org.apache.aries.subsystem", "org.apache.aries.subsystem.itest.interfaces")
-// org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7777")
- );
- }
-
/*
* Subsystem-SymbolicName: application.a.esa
* Subsystem-Content: bundle.a.jar
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/FeatureTest.java Fri May 30 08:59:13 2014
@@ -24,28 +24,23 @@ import junit.framework.AssertionFailedEr
import org.apache.aries.subsystem.core.internal.ResourceHelper;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
+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.Version;
import org.osgi.framework.namespace.IdentityNamespace;
import org.osgi.resource.Resource;
import org.osgi.service.subsystem.Subsystem;
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
+@ExamReactorStrategy(PerMethod.class)
public class FeatureTest extends SubsystemTest {
- @Before
- public static void createApplications() throws Exception {
- if (createdApplications) {
- return;
- }
+ @Override
+ public void createApplications() throws Exception {
createApplication("feature2", new String[]{"tb2.jar", "tb3.jar"});
createApplication("feature1", new String[]{"tb1.jar", "feature2.esa", "tb3.jar"});
createApplication("feature3", new String[]{"tb3.jar"});
- createdApplications = true;
}
@Test
Added: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/Header.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/Header.java?rev=1598506&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/Header.java (added)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/Header.java Fri May 30 08:59:13 2014
@@ -0,0 +1,11 @@
+package org.apache.aries.subsystem.itests;
+
+public class Header {
+ String key;
+ String value;
+
+ public Header(String key, String value) {
+ this.key = key;
+ this.value = value;
+ }
+}
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/HelloWorldTest.java Fri May 30 08:59:13 2014
@@ -8,29 +8,20 @@ import java.net.URI;
import java.util.Dictionary;
import java.util.Hashtable;
+import org.apache.aries.itest.RichBundleContext;
import org.apache.aries.subsystem.itests.hello.api.Hello;
import org.apache.aries.util.filesystem.FileSystem;
import org.apache.aries.util.filesystem.IDirectory;
import org.apache.aries.util.filesystem.IDirectoryFinder;
-import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Inject;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.subsystem.Subsystem;
import org.osgi.service.subsystem.SubsystemException;
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
public class HelloWorldTest extends SubsystemTest
{
- // Get the root subsystem bundle context.
- @Inject
- protected BundleContext bundleContext;
- private static boolean _testAppCreated = false;
-
/*
* An implementation of the IDirectoryFinder interface that provides the
* IDirectory that corresponds to some id URI. In practice this could come
@@ -56,20 +47,16 @@ public class HelloWorldTest extends Subs
}
}
- @Before
- public void installTestApp() throws Exception
- {
- if (!_testAppCreated) {
- createApplication("hello", new String[]{"helloImpl.jar"});
- _testAppCreated = true;
- }
+ @Override
+ public void createApplications() throws Exception {
+ createApplication("hello", "helloImpl.jar");
}
void checkHelloSubsystem(Subsystem helloSubsystem) throws Exception
{
helloSubsystem.start();
BundleContext bc = helloSubsystem.getBundleContext();
- Hello h = getOsgiService(bc, Hello.class, null, DEFAULT_TIMEOUT);
+ Hello h = new RichBundleContext(bc).getService(Hello.class);
String message = h.saySomething();
assertEquals ("Wrong message back", "something", message);
helloSubsystem.stop();
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/InstallTest.java Fri May 30 08:59:13 2014
@@ -23,8 +23,10 @@ import static org.junit.Assert.assertTru
import static org.junit.Assert.fail;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
@@ -34,57 +36,50 @@ import org.apache.aries.unittest.fixture
import org.apache.aries.util.filesystem.FileSystem;
import org.apache.aries.util.filesystem.IDirectory;
import org.apache.aries.util.io.IOUtils;
-import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
+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.Version;
import org.osgi.service.subsystem.Subsystem;
import org.osgi.service.subsystem.SubsystemConstants;
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
+@ExamReactorStrategy(PerMethod.class)
public class InstallTest extends SubsystemTest {
- @Before
- public static void createApplications() throws Exception {
- if (createdApplications) {
- return;
- }
+ public InputStream getResourceAsStream(String path) {
+ return SubsystemTest.class.getClassLoader().getResourceAsStream(path);
+ }
+
+ @Override
+ public void createApplications() throws Exception {
+ createCompositeDirEsa();
+ createApplication("feature3", "tb3.jar");
+ createApplication("feature2", "tb3.jar", "tb2.jar");
+ createBundleA();
+ createBundleB();
+ createApplicationA();
+ createCompositeA();
+ createFeatureA();
+ }
+
+ private void createCompositeDirEsa() throws IOException,
+ FileNotFoundException {
ZipFixture feature = ArchiveFixture
.newZip()
- .binary("OSGI-INF/SUBSYSTEM.MF",
- SubsystemTest.class.getClassLoader().getResourceAsStream(
- "compositeDir" + "/OSGI-INF/SUBSYSTEM.MF"))
- .binary("a.jar/META-INF/MANIFEST.MF",
- SubsystemTest.class.getClassLoader().getResourceAsStream(
- "compositeDir" + "/a.jar/META-INF/MANIFEST.MF"))
- .binary("a.jar/a/A.class",
- SubsystemTest.class.getClassLoader().getResourceAsStream(
- "a/A.class"))
- .binary("applicationDir.esa/OSGI-INF/SUBSYSTEM.MF",
- SubsystemTest.class.getClassLoader().getResourceAsStream(
- "compositeDir" + "/applicationDir/OSGI-INF/SUBSYSTEM.MF"))
- .binary("applicationDir.esa/b.jar/META-INF/MANIFEST.MF",
- SubsystemTest.class.getClassLoader().getResourceAsStream(
- "compositeDir" + "/applicationDir/b.jar/META-INF/MANIFEST.MF"))
- .binary("applicationDir.esa/b.jar/b/B.class",
- SubsystemTest.class.getClassLoader().getResourceAsStream(
- "b/B.class"))
- .binary("applicationDir.esa/featureDir.esa/OSGI-INF/SUBSYSTEM.MF",
- SubsystemTest.class.getClassLoader().getResourceAsStream(
+ .binary("OSGI-INF/SUBSYSTEM.MF", getResourceAsStream("compositeDir" + "/OSGI-INF/SUBSYSTEM.MF"))
+ .binary("a.jar/META-INF/MANIFEST.MF", getResourceAsStream("compositeDir" + "/a.jar/META-INF/MANIFEST.MF"))
+ .binary("a.jar/a/A.class", getResourceAsStream("a/A.class"))
+ .binary("applicationDir.esa/OSGI-INF/SUBSYSTEM.MF", getResourceAsStream("compositeDir" + "/applicationDir/OSGI-INF/SUBSYSTEM.MF"))
+ .binary("applicationDir.esa/b.jar/META-INF/MANIFEST.MF", getResourceAsStream("compositeDir" + "/applicationDir/b.jar/META-INF/MANIFEST.MF"))
+ .binary("applicationDir.esa/b.jar/b/B.class", getResourceAsStream("b/B.class"))
+ .binary("applicationDir.esa/featureDir.esa/OSGI-INF/SUBSYSTEM.MF", getResourceAsStream(
"compositeDir" + "/applicationDir/featureDir/OSGI-INF/SUBSYSTEM.MF"))
- .binary("applicationDir.esa/featureDir.esa/a.jar/META-INF/MANIFEST.MF",
- SubsystemTest.class.getClassLoader().getResourceAsStream(
+ .binary("applicationDir.esa/featureDir.esa/a.jar/META-INF/MANIFEST.MF", getResourceAsStream(
"compositeDir" + "/applicationDir/featureDir/a.jar/META-INF/MANIFEST.MF"))
- .binary("applicationDir.esa/featureDir.esa/a.jar/a/A.class",
- SubsystemTest.class.getClassLoader().getResourceAsStream(
- "a/A.class"))
- .binary("applicationDir.esa/featureDir.esa/b.jar/META-INF/MANIFEST.MF",
- SubsystemTest.class.getClassLoader().getResourceAsStream(
+ .binary("applicationDir.esa/featureDir.esa/a.jar/a/A.class", getResourceAsStream("a/A.class"))
+ .binary("applicationDir.esa/featureDir.esa/b.jar/META-INF/MANIFEST.MF", getResourceAsStream(
"compositeDir" + "/applicationDir/featureDir/b.jar/META-INF/MANIFEST.MF"))
- .binary("applicationDir.esa/featureDir.esa/b.jar/b/B.class",
- SubsystemTest.class.getClassLoader().getResourceAsStream(
- "b/B.class"));
+ .binary("applicationDir.esa/featureDir.esa/b.jar/b/B.class", getResourceAsStream("b/B.class"));
feature.end();
FileOutputStream fos = new FileOutputStream("compositeDir" + ".esa");
try {
@@ -92,25 +87,14 @@ public class InstallTest extends Subsyst
} finally {
Utils.closeQuietly(fos);
}
- createApplication("feature3", new String[]{"tb3.jar"});
- createApplication("feature2", new String[]{"tb3.jar", "tb2.jar"});
- createBundleA();
- createBundleB();
- createApplicationA();
- createCompositeA();
- createFeatureA();
- createdApplications = true;
- }
-
- public void setUp() throws Exception {
- super.setUp();
+
File userDir = new File(System.getProperty("user.dir"));
IDirectory idir = FileSystem.getFSRoot(userDir);
File compositeDir = new File(userDir, "compositeDir");
compositeDir.mkdir();
IOUtils.unpackZip(idir.getFile("compositeDir.esa"), compositeDir);
}
-
+
@Test
public void testReturnExistingSubsystemWithSameLocation() throws Exception {
Subsystem subsystem1 = installSubsystemFromFile("feature3.esa");
@@ -191,8 +175,8 @@ public class InstallTest extends Subsyst
*/
private static final String BUNDLE_A = "bundle.a.jar";
- private static void createBundleA() throws IOException {
- createBundle(BUNDLE_A);
+ private void createBundleA() throws IOException {
+ createBundle(name(BUNDLE_A));
}
/*
@@ -200,12 +184,12 @@ public class InstallTest extends Subsyst
*/
private static final String APPLICATION_A = "application.a.esa";
- private static void createApplicationA() throws IOException {
+ private void createApplicationA() throws IOException {
createApplicationAManifest();
createSubsystem(APPLICATION_A, BUNDLE_A);
}
- private static void createApplicationAManifest() throws IOException {
+ private void createApplicationAManifest() throws IOException {
File manifest = new File(APPLICATION_A + ".mf");
if (manifest.exists())
assertTrue("Could not delete manifest", manifest.delete());
@@ -260,8 +244,8 @@ public class InstallTest extends Subsyst
*/
private static final String BUNDLE_B = "bundle.b.war";
- private static void createBundleB() throws IOException {
- createBundle(BUNDLE_B);
+ private void createBundleB() throws IOException {
+ createBundle(name(BUNDLE_B));
}
/*
Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ModelledResourceManagerTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ModelledResourceManagerTest.java?rev=1598506&r1=1598505&r2=1598506&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ModelledResourceManagerTest.java (original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ModelledResourceManagerTest.java Fri May 30 08:59:13 2014
@@ -2,56 +2,28 @@ package org.apache.aries.subsystem.itest
import static org.junit.Assert.assertNull;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.junit.Before;
+import org.apache.aries.itest.RichBundleContext;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.MavenConfiguredJUnit4TestRunner;
-import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
import org.osgi.service.subsystem.Subsystem;
-@RunWith(MavenConfiguredJUnit4TestRunner.class)
public class ModelledResourceManagerTest extends SubsystemTest {
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
- List<Option> options = new ArrayList<Option>(Arrays.asList(defineOptions()));
- for (Iterator<Option> i = options.iterator(); i.hasNext();) {
- Option option = i.next();
- if (option instanceof MavenArtifactProvisionOption) {
- MavenArtifactProvisionOption mapo = (MavenArtifactProvisionOption)option;
- String url = mapo.getURL();
- if (url.contains("org.apache.aries.application.modeller")
- || url.contains("org.apache.aries.blueprint")
- || url.contains("org.apache.aries.proxy")) {
- i.remove();
- }
- }
- }
- Option[] result = options.toArray(new Option[options.size()]);
- result = updateOptions(result);
- return result;
+
+ public ModelledResourceManagerTest() {
+ super(false);
}
- @Before
- public static void createApplications() throws Exception {
- if (createdApplications) {
- return;
- }
+ @Override
+ public void createApplications() throws Exception {
createApplication("feature3", new String[]{"tb3.jar"});
createApplication("application1", new String[]{"tb1.jar"});
- createdApplications = true;
}
public void setUp() throws Exception {
super.setUp();
- assertNull("Modeller is installed", getBundle(getRootSubsystem(), "org.apache.aries.application.modeller"));
- assertNull("Blueprint is installed", getBundle(getRootSubsystem(), "org.apache.aries.blueprint"));
- assertNull("Proxy is installed", getBundle(getRootSubsystem(), "org.apache.aries.proxy"));
+ RichBundleContext rootContext = context(getRootSubsystem());
+ assertNull("Modeller is installed", rootContext.getBundleByName("org.apache.aries.application.modeller"));
+ assertNull("Blueprint is installed", rootContext.getBundleByName("org.apache.aries.blueprint"));
+ assertNull("Proxy is installed", rootContext.getBundleByName("org.apache.aries.proxy"));
}
@Test