You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2013/04/08 16:01:45 UTC
svn commit: r1465642 - in /sling/trunk/installer/it: ./
src/test/java/org/apache/sling/installer/it/
Author: bdelacretaz
Date: Mon Apr 8 14:01:44 2013
New Revision: 1465642
URL: http://svn.apache.org/r1465642
Log:
SLING-2815 - use pax exam 3.0.3
Modified:
sling/trunk/installer/it/pom.xml
sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleDependenciesTest.java
sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleInstallStressTest.java
sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleInstallUpgradeDowngradeTest.java
sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundlePrioritiesTest.java
sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleSnapshotUpdateTest.java
sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleStatePreservedTest.java
sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigInstallTest.java
sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigPrioritiesTest.java
sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ContextBundleUpdateTest.java
sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/FragmentInstallTest.java
sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/InvalidBundlesTest.java
sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/OsgiInstallerTestBase.java
sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/RegisterResourcesTest.java
sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/RemovedResourceDetectionTest.java
Modified: sling/trunk/installer/it/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/installer/it/pom.xml?rev=1465642&r1=1465641&r2=1465642&view=diff
==============================================================================
--- sling/trunk/installer/it/pom.xml (original)
+++ sling/trunk/installer/it/pom.xml Mon Apr 8 14:01:44 2013
@@ -33,9 +33,9 @@
<description>Integration tests of the Sling installer bundle</description>
<properties>
+ <exam.version>3.0.3</exam.version>
+ <url.version>1.5.2</url.version>
<pax.exam.log.level>INFO</pax.exam.log.level>
- <!-- This can be set to activate remote debugging of the Pax Exam tests -->
- <pax.exam.debug.port />
<!-- BundleInstallStressTest parameters -->
<BundleInstallStressTest.default.bundles.folder>${project.build.directory}/bundle-install-stress-test-bundles</BundleInstallStressTest.default.bundles.folder>
@@ -50,23 +50,6 @@
<url>http://svn.apache.org/viewvc/sling/installer/it</url>
</scm>
- <repositories>
- <repository>
- <id>ops4j.releases</id>
- <url>http://repository.ops4j.org/maven2</url>
- </repository>
- <repository>
- <id>ops4j.profiles</id>
- <url>http://scm.ops4j.org/repos/ops4j/projects/pax/runner-repository</url>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>ops4j.releases</id>
- <url>http://repository.ops4j.org/maven2</url>
- </pluginRepository>
- </pluginRepositories>
-
<build>
<plugins>
<plugin>
@@ -79,10 +62,6 @@
<value>${pax.exam.log.level}</value>
</property>
<property>
- <name>pax.exam.debug.port</name>
- <value>${pax.exam.debug.port}</value>
- </property>
- <property>
<name>osgi.installer.pom.version</name>
<value>${project.version}</value>
</property>
@@ -150,7 +129,7 @@
<include name="META-INF/**" />
</fileset>
<manifest>
- <attribute name="Manifest-Version" value="2" />
+ <attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-Name" value="OSGi controller test bundle" />
<attribute name="Bundle-SymbolicName" value="osgi-installer-testbundle" />
<attribute name="Bundle-Version" value="1.0" />
@@ -172,7 +151,7 @@
<include name="META-INF/**" />
</fileset>
<manifest>
- <attribute name="Manifest-Version" value="2" />
+ <attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-Name" value="OSGi controller test bundle" />
<attribute name="Bundle-SymbolicName" value="osgi-installer-testbundle" />
<attribute name="Bundle-Version" value="1.1" />
@@ -194,10 +173,11 @@
<include name="META-INF/**" />
</fileset>
<manifest>
- <attribute name="Manifest-Version" value="2" />
+ <attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-Name" value="OSGi controller test bundle" />
<attribute name="Bundle-SymbolicName" value="osgi-installer-testbundle" />
<attribute name="Bundle-Version" value="1.2" />
+ <attribute name="Export-Package" value="com.example.testbundle.somepackage" />
</manifest>
</jar>
</tasks>
@@ -216,7 +196,7 @@
<include name="META-INF/**" />
</fileset>
<manifest>
- <attribute name="Manifest-Version" value="2" />
+ <attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-Name" value="OSGi controller test bundle" />
<attribute name="Bundle-SymbolicName" value="osgi-installer-testA" />
<attribute name="Bundle-Version" value="1.0" />
@@ -239,7 +219,7 @@
<include name="META-INF/**" />
</fileset>
<manifest>
- <attribute name="Manifest-Version" value="2" />
+ <attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-Name" value="OSGi controller test bundle" />
<attribute name="Bundle-SymbolicName" value="osgi-installer-testB" />
<attribute name="Export-Package" value="org.apache.sling.installer.it.a;version="1.0"" />
@@ -263,7 +243,7 @@
<include name="META-INF/**" />
</fileset>
<manifest>
- <attribute name="Manifest-Version" value="2" />
+ <attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-Name" value="OSGi controller test bundle" />
<attribute name="Bundle-SymbolicName" value="osgi-installer-needsB" />
<attribute name="Bundle-Version" value="1.0" />
@@ -287,7 +267,7 @@
<include name="META-INF/**" />
</fileset>
<manifest>
- <attribute name="Manifest-Version" value="2" />
+ <attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-Name" value="OSGi controller test bundle" />
<attribute name="Bundle-SymbolicName" value="osgi-installer-snapshot-test" />
<!--
@@ -315,7 +295,7 @@
<include name="META-INF/**" />
</fileset>
<manifest>
- <attribute name="Manifest-Version" value="2" />
+ <attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-Name" value="OSGi controller test bundle" />
<attribute name="Bundle-SymbolicName" value="osgi-installer-snapshot-test" />
<!--
@@ -343,7 +323,7 @@
<include name="META-INF/**" />
</fileset>
<manifest>
- <attribute name="Manifest-Version" value="2" />
+ <attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-Name" value="OSGi controller test bundle" />
<attribute name="Bundle-SymbolicName" value="osgi-installer-snapshot-test" />
<!--
@@ -370,7 +350,7 @@
<include name="META-INF/**" />
</fileset>
<manifest>
- <attribute name="Manifest-Version" value="2" />
+ <attribute name="Bundle-ManifestVersion" value="2" />
</manifest>
</jar>
</tasks>
@@ -389,11 +369,12 @@
<include name="META-INF/**" />
</fileset>
<manifest>
- <attribute name="Manifest-Version" value="2" />
+ <attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-Name" value="OSGi controller test fragment bundle" />
<attribute name="Fragment-Host" value="osgi-installer-testbundle" />
<attribute name="Bundle-Version" value="1.0" />
<attribute name="Bundle-SymbolicName" value="osgi-installer-testfragment" />
+ <attribute name="Export-Package" value="com.example.testfragment.fragmentpackage" />
</manifest>
</jar>
</tasks>
@@ -412,7 +393,7 @@
<include name="META-INF/**" />
</fileset>
<manifest>
- <attribute name="Manifest-Version" value="2" />
+ <attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-Name" value="OSGi controller test bundle, invalid version number" />
<attribute name="Bundle-SymbolicName" value="osgi-installer-invalid-version-test" />
<!--
@@ -474,30 +455,38 @@
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>4.2.0</version>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<version>4.2.0</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam</artifactId>
- <version>1.2.1</version>
+ <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>
- <version>1.2.1</version>
+ <artifactId>pax-exam-junit4</artifactId>
+ <version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-container-default</artifactId>
- <version>1.2.1</version>
+ <artifactId>pax-exam-link-mvn</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-aether</artifactId>
+ <version>${url.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>4.2.1</version>
<scope>test</scope>
</dependency>
<dependency>
Modified: sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleDependenciesTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleDependenciesTest.java?rev=1465642&r1=1465641&r2=1465642&view=diff
==============================================================================
--- sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleDependenciesTest.java (original)
+++ sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleDependenciesTest.java Mon Apr 8 14:01:44 2013
@@ -24,17 +24,17 @@ 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.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
public class BundleDependenciesTest extends OsgiInstallerTestBase {
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
- return defaultConfiguration();
+ @org.ops4j.pax.exam.Configuration
+ public Option[] config() {
+ return defaultConfiguration();
}
-
+
@Before
public void setUp() {
setupInstaller();
Modified: sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleInstallStressTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleInstallStressTest.java?rev=1465642&r1=1465641&r2=1465642&view=diff
==============================================================================
--- sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleInstallStressTest.java (original)
+++ sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleInstallStressTest.java Mon Apr 8 14:01:44 2013
@@ -31,7 +31,7 @@ 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.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.service.log.LogService;
/** Repeatedly install/remove/reinstall semi-random sets
@@ -43,7 +43,7 @@ import org.osgi.service.log.LogService;
* system properties, see pom.xml) the test can be turned into a
* long-running stress test.
*/
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
public class BundleInstallStressTest extends OsgiInstallerTestBase {
public static final String PROP_BUNDLES_FOLDER = "osgi.installer.BundleInstallStressTest.bundles.folder";
@@ -70,11 +70,11 @@ public class BundleInstallStressTest ext
private EventsDetector eventsDetector;
public static final long MSEC_WITHOUT_EVENTS = 1000L;
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
- return defaultConfiguration();
+ @org.ops4j.pax.exam.Configuration
+ public Option[] config() {
+ return defaultConfiguration();
}
-
+
@Before
public void setUp() {
setupInstaller();
Modified: sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleInstallUpgradeDowngradeTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleInstallUpgradeDowngradeTest.java?rev=1465642&r1=1465641&r2=1465642&view=diff
==============================================================================
--- sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleInstallUpgradeDowngradeTest.java (original)
+++ sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleInstallUpgradeDowngradeTest.java Mon Apr 8 14:01:44 2013
@@ -24,17 +24,17 @@ 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.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
public class BundleInstallUpgradeDowngradeTest extends OsgiInstallerTestBase {
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
- return defaultConfiguration();
+ @org.ops4j.pax.exam.Configuration
+ public Option[] config() {
+ return defaultConfiguration();
}
-
+
@Before
public void setUp() {
setupInstaller();
Modified: sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundlePrioritiesTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundlePrioritiesTest.java?rev=1465642&r1=1465641&r2=1465642&view=diff
==============================================================================
--- sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundlePrioritiesTest.java (original)
+++ sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundlePrioritiesTest.java Mon Apr 8 14:01:44 2013
@@ -25,17 +25,17 @@ 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.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
public class BundlePrioritiesTest extends OsgiInstallerTestBase {
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
+ @org.ops4j.pax.exam.Configuration
+ public Option[] config() {
return defaultConfiguration();
}
-
+
@Before
public void setUp() {
setupInstaller();
Modified: sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleSnapshotUpdateTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleSnapshotUpdateTest.java?rev=1465642&r1=1465641&r2=1465642&view=diff
==============================================================================
--- sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleSnapshotUpdateTest.java (original)
+++ sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleSnapshotUpdateTest.java Mon Apr 8 14:01:44 2013
@@ -24,7 +24,7 @@ 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.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
/** Verify that snapshot bundles are updated even if
@@ -32,14 +32,14 @@ import org.osgi.framework.Bundle;
* TODO: digests should be taken into account, i.e. no action
* if digest does not change
*/
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
public class BundleSnapshotUpdateTest extends OsgiInstallerTestBase {
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
+ @org.ops4j.pax.exam.Configuration
+ public Option[] config() {
return defaultConfiguration();
}
-
+
@Before
public void setUp() {
setupInstaller();
Modified: sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleStatePreservedTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleStatePreservedTest.java?rev=1465642&r1=1465641&r2=1465642&view=diff
==============================================================================
--- sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleStatePreservedTest.java (original)
+++ sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/BundleStatePreservedTest.java Mon Apr 8 14:01:44 2013
@@ -24,17 +24,17 @@ 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.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
public class BundleStatePreservedTest extends OsgiInstallerTestBase {
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
- return defaultConfiguration();
+ @org.ops4j.pax.exam.Configuration
+ public Option[] config() {
+ return defaultConfiguration();
}
-
+
@Before
public void setUp() {
setupInstaller();
Modified: sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigInstallTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigInstallTest.java?rev=1465642&r1=1465641&r2=1465642&view=diff
==============================================================================
--- sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigInstallTest.java (original)
+++ sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigInstallTest.java Mon Apr 8 14:01:44 2013
@@ -31,7 +31,7 @@ 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.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.cm.Configuration;
@@ -39,7 +39,7 @@ import org.osgi.service.cm.Configuration
import org.osgi.service.cm.ConfigurationEvent;
import org.osgi.service.cm.ConfigurationListener;
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
public class ConfigInstallTest extends OsgiInstallerTestBase implements ConfigurationListener {
@@ -47,11 +47,11 @@ public class ConfigInstallTest extends O
private List<ConfigurationEvent> events = new LinkedList<ConfigurationEvent>();
private ServiceRegistration serviceRegistration;
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
+ @org.ops4j.pax.exam.Configuration
+ public Option[] config() {
return defaultConfiguration();
}
-
+
@Before
public void setUp() {
setupInstaller();
Modified: sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigPrioritiesTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigPrioritiesTest.java?rev=1465642&r1=1465641&r2=1465642&view=diff
==============================================================================
--- sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigPrioritiesTest.java (original)
+++ sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ConfigPrioritiesTest.java Mon Apr 8 14:01:44 2013
@@ -24,21 +24,23 @@ import java.util.Hashtable;
import org.apache.sling.installer.api.InstallableResource;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.service.cm.Configuration;
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
public class ConfigPrioritiesTest extends OsgiInstallerTestBase {
private final static long TIMEOUT = 5000L;
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
+ @org.ops4j.pax.exam.Configuration
+ public Option[] config() {
return defaultConfiguration();
}
-
+
@Before
public void setUp() {
setupInstaller();
@@ -66,6 +68,8 @@ public class ConfigPrioritiesTest extend
}
}
+ @Test
+ @Ignore("waiting for foo=b times out")
public void testOverrideConfig() throws Exception {
final String pid = getClass().getSimpleName() + "." + System.currentTimeMillis();
final Dictionary<String, Object> data = new Hashtable<String, Object>();
Modified: sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ContextBundleUpdateTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ContextBundleUpdateTest.java?rev=1465642&r1=1465641&r2=1465642&view=diff
==============================================================================
--- sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ContextBundleUpdateTest.java (original)
+++ sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/ContextBundleUpdateTest.java Mon Apr 8 14:01:44 2013
@@ -26,21 +26,21 @@ 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.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
/** Test the second SLING-1106 scenario: if a bundle is updated
* via the BundleContext, the installer should not downgrade it
* back to its own version.
*/
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
public class ContextBundleUpdateTest extends OsgiInstallerTestBase {
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
+ @org.ops4j.pax.exam.Configuration
+ public Option[] config() {
return defaultConfiguration();
}
-
+
@Before
public void setUp() {
setupInstaller();
Modified: sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/FragmentInstallTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/FragmentInstallTest.java?rev=1465642&r1=1465641&r2=1465642&view=diff
==============================================================================
--- sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/FragmentInstallTest.java (original)
+++ sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/FragmentInstallTest.java Mon Apr 8 14:01:44 2013
@@ -16,30 +16,25 @@
*/
package org.apache.sling.installer.it;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.ops4j.pax.exam.CoreOptions.equinox;
import org.junit.After;
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.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
-import org.osgi.service.packageadmin.PackageAdmin;
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
public class FragmentInstallTest extends OsgiInstallerTestBase {
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
- Option[] options = defaultConfiguration();
- options[0] = equinox();
- return options;
+ @org.ops4j.pax.exam.Configuration
+ public Option[] config() {
+ return defaultConfiguration();
}
-
+
@Before
public void setUp() {
setupInstaller();
@@ -50,7 +45,6 @@ public class FragmentInstallTest extends
super.tearDown();
}
-
@Test
public void testInstallFragment() throws Exception {
final String hostSymbolicName = "osgi-installer-testbundle";
@@ -69,22 +63,15 @@ public class FragmentInstallTest extends
listener = this.startObservingBundleEvents();
installer.updateResources(URL_SCHEME, getInstallableResource(
- getTestBundle(BUNDLE_BASE_NAME + "-testfragment-1.0.jar"), "digest1"), null);
+ getTestBundle(BUNDLE_BASE_NAME + "-testfragment-1.0.jar"), "digest2"), null);
this.waitForBundleEvents("Fragment bundle 1.0 must be found after waitForInstallerAction", listener,
- new BundleEvent(fragmentSymbolicName, "1.0", org.osgi.framework.BundleEvent.INSTALLED),
+ new BundleEvent(fragmentSymbolicName, "1.0", org.osgi.framework.BundleEvent.RESOLVED),
new BundleEvent(hostSymbolicName, "1.2", org.osgi.framework.BundleEvent.STARTED));
- this.assertBundle("Bundle version 1.2 must be still be active.", hostSymbolicName, "1.2", Bundle.ACTIVE);
+ this.assertBundle("Host bundle must be still be active.", hostSymbolicName, "1.2", Bundle.ACTIVE);
- Bundle host = findBundle(hostSymbolicName);
- Bundle[] fragments = getService(PackageAdmin.class).getFragments(host);
- assertNotNull("Bundle should have attached fragments", fragments);
- boolean hadFragment = false;
- for (Bundle fragment : fragments) {
- if (fragmentSymbolicName.equals(fragment.getSymbolicName())) {
- hadFragment = true;
- }
- }
- assertTrue("Bundle should have fragment bundle attached", hadFragment);
+ // Verify that package provided by fragment is exported by host
+ final Bundle host = findBundle(hostSymbolicName);
+ assertTrue("Expecting host bundle to export its own package", isPackageExported(host, "com.example.testbundle.somepackage"));
+ assertTrue("Expecting host bundle to export the fragment's package", isPackageExported(host, "com.example.testfragment.fragmentpackage"));
}
-
}
Modified: sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/InvalidBundlesTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/InvalidBundlesTest.java?rev=1465642&r1=1465641&r2=1465642&view=diff
==============================================================================
--- sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/InvalidBundlesTest.java (original)
+++ sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/InvalidBundlesTest.java Mon Apr 8 14:01:44 2013
@@ -27,17 +27,17 @@ 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.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
public class InvalidBundlesTest extends OsgiInstallerTestBase {
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
- return defaultConfiguration();
+ @org.ops4j.pax.exam.Configuration
+ public Option[] config() {
+ return defaultConfiguration();
}
-
+
@Before
public void setUp() {
setupInstaller();
Modified: sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/OsgiInstallerTestBase.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/OsgiInstallerTestBase.java?rev=1465642&r1=1465641&r2=1465642&view=diff
==============================================================================
--- sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/OsgiInstallerTestBase.java (original)
+++ sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/OsgiInstallerTestBase.java Mon Apr 8 14:01:44 2013
@@ -18,15 +18,13 @@ package org.apache.sling.installer.it;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.felix;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.provision;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-import static org.ops4j.pax.exam.CoreOptions.waitForFrameworkStartup;
-import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.logProfile;
-import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
import java.io.File;
import java.io.FileInputStream;
@@ -36,10 +34,12 @@ import java.util.ArrayList;
import java.util.Dictionary;
import java.util.List;
+import javax.inject.Inject;
+
import org.apache.sling.installer.api.InstallableResource;
import org.apache.sling.installer.api.OsgiInstaller;
-import org.ops4j.pax.exam.Inject;
import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.options.ProvisionOption;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -49,6 +49,9 @@ import org.osgi.framework.FrameworkListe
import org.osgi.framework.ServiceReference;
import org.osgi.framework.SynchronousBundleListener;
import org.osgi.framework.Version;
+import org.osgi.framework.namespace.PackageNamespace;
+import org.osgi.framework.wiring.BundleCapability;
+import org.osgi.framework.wiring.BundleWiring;
import org.osgi.service.cm.Configuration;
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.log.LogService;
@@ -359,7 +362,7 @@ class OsgiInstallerTestBase implements F
log.log(level, msg);
}
- public static Option[] defaultConfiguration() {
+ protected Option[] defaultConfiguration() {
String vmOpt = "-Dosgi.installer.testing";
// This runs in the VM that runs the build, but the tests run in another one.
@@ -378,14 +381,9 @@ class OsgiInstallerTestBase implements F
vmOpt += " -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=" + paxDebugPort;
}
- return options(
- felix(),
- vmOption(vmOpt),
- waitForFrameworkStartup(),
-
- logProfile(),
+ return options(
+ junitBundles(),
systemProperty( "org.ops4j.pax.logging.DefaultServiceLog.level" ).value(paxDebugLevel),
-
provision(
mavenBundle("org.apache.felix", "org.apache.felix.scr", "1.6.0"),
mavenBundle("org.apache.felix", "org.apache.felix.configadmin", "1.2.8"),
@@ -397,7 +395,7 @@ class OsgiInstallerTestBase implements F
)
);
}
-
+
protected Object startObservingBundleEvents() {
final BundleEventListener listener = new BundleEventListener();
this.bundleContext.addBundleListener(listener);
@@ -453,7 +451,18 @@ class OsgiInstallerTestBase implements F
this.bundleContext.removeBundleListener(listener);
}
}
-
+
+ protected boolean isPackageExported(Bundle b, String packageName) {
+ final BundleWiring wiring = b.adapt(BundleWiring.class);
+ assertNotNull("Expecting non-null BundleWiring for bundle " + b, wiring);
+ for(BundleCapability c : wiring.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE)) {
+ if(packageName.equals(c.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE))) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public void logInstalledBundles() {
for(Bundle b : bundleContext.getBundles()) {
log(LogService.LOG_DEBUG, "Installed bundle: " + b.getSymbolicName());
Modified: sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/RegisterResourcesTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/RegisterResourcesTest.java?rev=1465642&r1=1465641&r2=1465642&view=diff
==============================================================================
--- sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/RegisterResourcesTest.java (original)
+++ sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/RegisterResourcesTest.java Mon Apr 8 14:01:44 2013
@@ -29,20 +29,20 @@ 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.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
/** Test the {@link OsgiInstaller.registerResources} method, which lets a client
* supply a new list of resources.
*/
public class RegisterResourcesTest extends OsgiInstallerTestBase {
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
+ @org.ops4j.pax.exam.Configuration
+ public Option[] config() {
return defaultConfiguration();
}
-
+
@Before
public void setUp() {
setupInstaller();
@@ -149,8 +149,11 @@ public class RegisterResourcesTest exten
assertNull("Bundle testB must be gone", findBundle("osgi-installer-testB"));
final Bundle b = assertBundle("Bundle needsB must still be present",
"osgi-installer-needsB", "1.0", -1);
+
+ refreshPackages();
final int state = b.getState();
- assertFalse("Bundle needsB must be stopped as testB is gone (" + state + ")", Bundle.ACTIVE == state);
+ assertFalse("Bundle needsB must not be active anymore, as testB is gone (" + state + ")", Bundle.ACTIVE == state);
+
assertBundle("Testbundle must be back to 1.0 as 1.1 and 1.2 is gone",
"osgi-installer-testbundle", "1.0", Bundle.ACTIVE);
assertBundle("testA bundle should still be present", "osgi-installer-testA", "1.0", Bundle.ACTIVE);
Modified: sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/RemovedResourceDetectionTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/RemovedResourceDetectionTest.java?rev=1465642&r1=1465641&r2=1465642&view=diff
==============================================================================
--- sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/RemovedResourceDetectionTest.java (original)
+++ sling/trunk/installer/it/src/test/java/org/apache/sling/installer/it/RemovedResourceDetectionTest.java Mon Apr 8 14:01:44 2013
@@ -27,20 +27,20 @@ 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.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
/** Verify that the removal of resources is detected even if
* the OsgiController was stopped when resource was removed.
*/
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
public class RemovedResourceDetectionTest extends OsgiInstallerTestBase {
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
+ @org.ops4j.pax.exam.Configuration
+ public Option[] config() {
return defaultConfiguration();
}
-
+
@Before
public void setUp() {
setupInstaller();