felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1531642 - in /felix/trunk/dependencymanager: test/src/test/java/org/apache/felix/dm/test/ test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/
Date Sun, 13 Oct 2013 09:01:44 GMT
Author: pderop
Date: Sun Oct 13 09:01:43 2013
New Revision: 1531642

URL: http://svn.apache.org/r1531642
Log:
pax-exam 3.0.0 migration ...

Added:
    felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/ConfigurationDependencyTest.java
      - copied, changed from r1531247, felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java
    felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/FELIX2696_ConfigurationAndServiceDependencyTest.java
      - copied, changed from r1531247, felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/FELIX2696_ConfigurationAndServiceDependencyTest.java
    felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/FELIX2955_ShellCommandTest.java
      - copied, changed from r1531247, felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/FELIX2955_ShellCommandTest.java
    felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/FELIX3337_UpdatedConfigurationDependencyWithPropagationTest.java
      - copied, changed from r1531247, felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/FELIX3337_UpdatedConfigurationDependencyWithPropagationTest.java
    felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/ServiceTrackerTest.java
      - copied, changed from r1531247, felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ServiceTrackerTest.java
    felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/SharingDependenciesWithMultipleServicesTest.java
      - copied, changed from r1531247, felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/SharingDependenciesWithMultipleServicesTest.java
Removed:
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/FELIX2696_ConfigurationAndServiceDependencyTest.java
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/FELIX2955_ShellCommandTest.java
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/FELIX3337_UpdatedConfigurationDependencyWithPropagationTest.java
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ServiceTrackerTest.java
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/SharingDependenciesWithMultipleServicesTest.java

Copied: felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/ConfigurationDependencyTest.java
(from r1531247, felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java)
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/ConfigurationDependencyTest.java?p2=felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/ConfigurationDependencyTest.java&p1=felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java&r1=1531247&r2=1531642&rev=1531642&view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java
(original)
+++ felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/ConfigurationDependencyTest.java
Sun Oct 13 09:01:43 2013
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.dm.test;
+package org.apache.felix.dependencymanager.test2.integration.api;
 
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 import static org.ops4j.pax.exam.CoreOptions.options;
@@ -24,37 +24,30 @@ import static org.ops4j.pax.exam.CoreOpt
 
 import java.io.IOException;
 import java.util.Dictionary;
+import java.util.Hashtable;
 import java.util.Properties;
 
 import junit.framework.Assert;
 
+import org.apache.felix.dependencymanager.test2.components.Ensure;
+import org.apache.felix.dependencymanager.test2.integration.common.TestBase;
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.DependencyManager;
 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.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.cm.ManagedService;
 
-@RunWith(JUnit4TestRunner.class)
-public class ConfigurationDependencyTest extends Base {
-    @Configuration
-    public static Option[] configuration() {
-        return options(
-            provision(
-                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version(Base.OSGI_SPEC_VERSION),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.configadmin").version("1.2.4"),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
-            )
-        );
-    }    
-    
+
+@RunWith(PaxExam.class)
+public class ConfigurationDependencyTest extends TestBase {
     @Test
-    public void testComponentWithRequiredConfigurationAndServicePropertyPropagation(BundleContext
context) {
+    public void testComponentWithRequiredConfigurationAndServicePropertyPropagation() {
         DependencyManager m = new DependencyManager(context);
         // helper class that ensures certain steps get executed in sequence
         Ensure e = new Ensure();
@@ -74,7 +67,7 @@ public class ConfigurationDependencyTest
     }
     
     @Test
-    public void testFELIX2987(BundleContext context) {
+    public void testFELIX2987() {
         // mimics testComponentWithRequiredConfigurationAndServicePropertyPropagation
         DependencyManager m = new DependencyManager(context);
         // helper class that ensures certain steps get executed in sequence
@@ -107,7 +100,7 @@ public class ConfigurationDependencyTest
             try {
                 m_ensure.step(1);
                 org.osgi.service.cm.Configuration conf = m_ca.getConfiguration("test", null);
-                Properties props = new Properties();
+                Hashtable props = new Properties();
                 props.put("testkey", "testvalue");
                 conf.update(props);
             }

Copied: felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/FELIX2696_ConfigurationAndServiceDependencyTest.java
(from r1531247, felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/FELIX2696_ConfigurationAndServiceDependencyTest.java)
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/FELIX2696_ConfigurationAndServiceDependencyTest.java?p2=felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/FELIX2696_ConfigurationAndServiceDependencyTest.java&p1=felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/FELIX2696_ConfigurationAndServiceDependencyTest.java&r1=1531247&r2=1531642&rev=1531642&view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/FELIX2696_ConfigurationAndServiceDependencyTest.java
(original)
+++ felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/FELIX2696_ConfigurationAndServiceDependencyTest.java
Sun Oct 13 09:01:43 2013
@@ -16,45 +16,30 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.dm.test;
-
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.provision;
+package org.apache.felix.dependencymanager.test2.integration.api;
 
 import java.io.IOException;
 import java.util.Dictionary;
-import java.util.Properties;
+import java.util.Hashtable;
 
 import junit.framework.Assert;
 
+import org.apache.felix.dependencymanager.test2.components.Ensure;
+import org.apache.felix.dependencymanager.test2.integration.common.TestBase;
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.DependencyManager;
 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.JUnit4TestRunner;
-import org.osgi.framework.BundleContext;
+import org.ops4j.pax.exam.junit.PaxExam;
 import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.cm.ManagedService;
 
-@RunWith(JUnit4TestRunner.class)
-public class FELIX2696_ConfigurationAndServiceDependencyTest extends Base {
-    @Configuration
-    public static Option[] configuration() {
-        return options(
-            provision(
-                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version(Base.OSGI_SPEC_VERSION),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.configadmin").version("1.2.4"),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
-            )
-        );
-    }    
-    
+
+@RunWith(PaxExam.class)
+public class FELIX2696_ConfigurationAndServiceDependencyTest extends TestBase {
     @Test
-    public void testComponentWithRequiredConfigurationAndServicePropertyPropagation(BundleContext
context) {
+    public void testComponentWithRequiredConfigurationAndServicePropertyPropagation() {
         DependencyManager m = new DependencyManager(context);
         // helper class that ensures certain steps get executed in sequence
         Ensure e = new Ensure();
@@ -95,7 +80,7 @@ public class FELIX2696_ConfigurationAndS
         public void init() {
             try {
                 org.osgi.service.cm.Configuration conf = m_ca.getConfiguration("test", null);
-                Properties props = new Properties();
+                Hashtable props = new Hashtable();
                 props.put("testkey", "testvalue");
                 conf.update(props);
             }

Copied: felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/FELIX2955_ShellCommandTest.java
(from r1531247, felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/FELIX2955_ShellCommandTest.java)
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/FELIX2955_ShellCommandTest.java?p2=felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/FELIX2955_ShellCommandTest.java&p1=felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/FELIX2955_ShellCommandTest.java&r1=1531247&r2=1531642&rev=1531642&view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/FELIX2955_ShellCommandTest.java
(original)
+++ felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/FELIX2955_ShellCommandTest.java
Sun Oct 13 09:01:43 2013
@@ -16,49 +16,30 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.dm.test;
-
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.provision;
+package org.apache.felix.dependencymanager.test2.integration.api;
 
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 
 import junit.framework.Assert;
 
+import org.apache.felix.dependencymanager.test2.components.Ensure;
+import org.apache.felix.dependencymanager.test2.integration.common.TestBase;
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.DependencyManager;
 import org.apache.felix.shell.ShellService;
 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.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
 import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
 
-@RunWith(JUnit4TestRunner.class)
-public class FELIX2955_ShellCommandTest extends Base {
+@RunWith(PaxExam.class)
+public class FELIX2955_ShellCommandTest extends TestBase {
     private long m_testBundleId;
     private Bundle m_deploymentAdmin;
 
-    @Configuration
-    public static Option[] configuration() {
-        return options(
-            provision(
-                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version(Base.OSGI_SPEC_VERSION),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.configadmin").version("1.2.4"),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.shell").version("1.4.2"),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.deploymentadmin").version("0.9.0").start(false),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject(),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager.shell").versionAsInProject()
-            )
-        );
-    }    
-    
     @Test
-    public void testShellCommands(BundleContext context) throws Throwable {
+    public void testShellCommands() throws Throwable {
         m_testBundleId = context.getBundle().getBundleId();
         for (Bundle b : context.getBundles()) {
             if (b.getSymbolicName().equals("org.apache.felix.deploymentadmin")) {
@@ -113,20 +94,20 @@ public class FELIX2955_ShellCommandTest 
             Thread t = new Thread("Shell Client") {
                 public void run() {
                     m_ensure.step(1);
-                    execute("dm",
+                    execute("dm " + m_testBundleId,
                         "[" + m_testBundleId + "] pax-exam-probe\n" +
                         "  ShellClient registered\n" +
                         "    org.apache.felix.shell.ShellService service required available\n",

                         "");
                     m_ensure.step(2);
                     // see if there's anything that's not available
-                    execute("dm notavail",
+                    execute("dm notavail " + m_testBundleId,
                         "", 
                         "");
                     m_ensure.step(3);
                     // check again, now there should be something missing
                     m_ensure.waitForStep(4, 5000);
-                    execute("dm notavail",
+                    execute("dm notavail " + m_testBundleId,
                         "[" + m_testBundleId + "] pax-exam-probe\n" + 
                         "  Object unregistered\n" + 
                         "    java.lang.Object service required unavailable\n", 
@@ -134,7 +115,7 @@ public class FELIX2955_ShellCommandTest 
                     m_ensure.step(5);
                     m_ensure.waitForStep(6, 5000);
                     // this next step actually triggers the bug in FELIX-2955
-                    execute("dm notavail",
+                    execute("dm notavail " + m_testBundleId,
                         "", 
                         "");
                     m_ensure.step(7);
@@ -152,8 +133,9 @@ public class FELIX2955_ShellCommandTest 
             try {
                 ByteArrayOutputStream output = new ByteArrayOutputStream();
                 ByteArrayOutputStream error = new ByteArrayOutputStream();
-                m_shell.executeCommand(command, new PrintStream(output), new PrintStream(error));
-                Assert.assertEquals(expectedOutput, output.toString());
+                m_shell.executeCommand(command, new PrintStream(output), new PrintStream(error));

+                // In pax-exam 3.0.0, we have to work around something like "[25] PAXEXAM-PROBE-3f88597d-4bc5-4bf4-affb-74db4e453e71
..." 
+                Assert.assertEquals(expectedOutput, output.toString().replaceAll("PAXEXAM-PROBE.*",
"pax-exam-probe"));
                 Assert.assertEquals(expectedError, error.toString());
             }
             catch (Throwable throwable) {

Copied: felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/FELIX3337_UpdatedConfigurationDependencyWithPropagationTest.java
(from r1531247, felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/FELIX3337_UpdatedConfigurationDependencyWithPropagationTest.java)
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/FELIX3337_UpdatedConfigurationDependencyWithPropagationTest.java?p2=felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/FELIX3337_UpdatedConfigurationDependencyWithPropagationTest.java&p1=felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/FELIX3337_UpdatedConfigurationDependencyWithPropagationTest.java&r1=1531247&r2=1531642&rev=1531642&view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/FELIX3337_UpdatedConfigurationDependencyWithPropagationTest.java
(original)
+++ felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/FELIX3337_UpdatedConfigurationDependencyWithPropagationTest.java
Sun Oct 13 09:01:43 2013
@@ -16,31 +16,27 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.dm.test;
-
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.provision;
+package org.apache.felix.dependencymanager.test2.integration.api;
 
 import java.io.IOException;
 import java.util.Dictionary;
-import java.util.Map;
+import java.util.Hashtable;
 import java.util.Properties;
 
 import junit.framework.Assert;
 
+import org.apache.felix.dependencymanager.test2.components.Ensure;
+import org.apache.felix.dependencymanager.test2.integration.common.TestBase;
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.DependencyManager;
 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.JUnit4TestRunner;
-import org.osgi.framework.BundleContext;
+import org.ops4j.pax.exam.junit.PaxExam;
 import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.cm.ManagedService;
 
+
 /**
  * This test validates the following scenario:
  * - Service S1 depends on a ConfigurationDependency with propagate = true
@@ -50,20 +46,8 @@ import org.osgi.service.cm.ManagedServic
  * - S1 is then called in its updated callback
  * - S2 is called in its "change" callback.
  */
-@RunWith(JUnit4TestRunner.class)
-public class FELIX3337_UpdatedConfigurationDependencyWithPropagationTest
-{
-    @Configuration
-    public static Option[] configuration() {
-        return options(
-            provision(
-                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version(Base.OSGI_SPEC_VERSION),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.configadmin").version("1.2.4"),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
-            )
-        );
-    }    
-    
+@RunWith(PaxExam.class)
+public class FELIX3337_UpdatedConfigurationDependencyWithPropagationTest extends TestBase
{    
     /*
      * This Pojo creates the configuration pid "test".
      */
@@ -74,7 +58,7 @@ public class FELIX3337_UpdatedConfigurat
         public void init() {
             try {
                 m_conf = m_ca.getConfiguration("test", null);
-                Properties props = new Properties();
+                Hashtable props = new Properties();
                 props.put("testkey", "testvalue");
                 m_conf.update(props);
             }
@@ -85,7 +69,7 @@ public class FELIX3337_UpdatedConfigurat
         
         public void update() {
             try {
-                Properties props = new Properties();
+                Hashtable props = new Properties();
                 props.put("testkey", "testvalue");
                 props.put("testkey2", "testvalue2");
                 m_conf.update(props);
@@ -131,7 +115,7 @@ public class FELIX3337_UpdatedConfigurat
     }
     
     @Test
-    public void testComponentWithRequiredUpdatedConfigurationAndServicePropertyPropagation(BundleContext
context) {
+    public void testComponentWithRequiredUpdatedConfigurationAndServicePropertyPropagation()
{
         DependencyManager m = new DependencyManager(context);
         // helper class that ensures certain steps get executed in sequence
         Ensure e = new Ensure();        

Copied: felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/ServiceTrackerTest.java
(from r1531247, felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ServiceTrackerTest.java)
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/ServiceTrackerTest.java?p2=felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/ServiceTrackerTest.java&p1=felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ServiceTrackerTest.java&r1=1531247&r2=1531642&rev=1531642&view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ServiceTrackerTest.java
(original)
+++ felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/ServiceTrackerTest.java
Sun Oct 13 09:01:43 2013
@@ -16,42 +16,26 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.dm.test;
+package org.apache.felix.dependencymanager.test2.integration.api;
 
-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 java.util.Properties;
+import java.util.Hashtable;
 
 import junit.framework.Assert;
 
+import org.apache.felix.dependencymanager.test2.integration.common.TestBase;
 import org.apache.felix.dm.DependencyManager;
 import org.apache.felix.dm.ServiceUtil;
 import org.apache.felix.dm.tracker.ServiceTracker;
 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.JUnit4TestRunner;
-import org.osgi.framework.BundleContext;
+import org.ops4j.pax.exam.junit.PaxExam;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceRegistration;
 
-@RunWith(JUnit4TestRunner.class)
-public class ServiceTrackerTest extends Base {
-    @Configuration
-    public static Option[] configuration() {
-        return options(
-            provision(
-                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version(Base.OSGI_SPEC_VERSION),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject()
-            )
-        );
-    }    
-
+@RunWith(PaxExam.class)
+public class ServiceTrackerTest extends TestBase {
     @Test
-    public void testPlainServiceTracker(BundleContext context) {
+    public void testPlainServiceTracker() {
         ServiceTracker st = new ServiceTracker(context, ServiceInterface.class.getName(),
null);
         st.open();
         ServiceRegistration sr = context.registerService(ServiceInterface.class.getName(),
new ServiceProvider(), null);
@@ -62,7 +46,7 @@ public class ServiceTrackerTest extends 
     }
     
     @Test
-    public void testAspectServiceTracker(BundleContext context) {
+    public void testAspectServiceTracker() {
         ServiceTracker st = new ServiceTracker(context, ServiceInterface.class.getName(),
null);
         st.open();
 
@@ -71,12 +55,12 @@ public class ServiceTrackerTest extends 
         
         final long sid = ServiceUtil.getServiceId(sr.getReference());
         ServiceRegistration asr = context.registerService(ServiceInterface.class.getName(),
new ServiceProvider(),
-            new Properties() {{ put(DependencyManager.ASPECT, sid); put(Constants.SERVICE_RANKING,
10); }});
+            new Hashtable() {{ put(DependencyManager.ASPECT, sid); put(Constants.SERVICE_RANKING,
10); }});
         Assert.assertEquals("There should be one service that matches the tracker", 1, st.getServices().length);
         Assert.assertEquals("Service ranking should be 10", Integer.valueOf(10), (Integer)
st.getServiceReference().getProperty(Constants.SERVICE_RANKING));
 
         ServiceRegistration asr2 = context.registerService(ServiceInterface.class.getName(),
new ServiceProvider(),
-            new Properties() {{ put(DependencyManager.ASPECT, sid); put(Constants.SERVICE_RANKING,
20); }});
+            new Hashtable() {{ put(DependencyManager.ASPECT, sid); put(Constants.SERVICE_RANKING,
20); }});
         Assert.assertEquals("There should be one service that matches the tracker", 1, st.getServices().length);
         Assert.assertEquals("Service ranking should be 20", Integer.valueOf(20), (Integer)
st.getServiceReference().getProperty(Constants.SERVICE_RANKING));
         
@@ -95,14 +79,14 @@ public class ServiceTrackerTest extends 
     }
     
     @Test
-    public void testExistingAspectServiceTracker(BundleContext context) {
+    public void testExistingAspectServiceTracker() {
         ServiceTracker st = new ServiceTracker(context, ServiceInterface.class.getName(),
null);
         ServiceRegistration sr = context.registerService(ServiceInterface.class.getName(),
new ServiceProvider(), null);
         final long sid = ServiceUtil.getServiceId(sr.getReference());
         ServiceRegistration asr = context.registerService(ServiceInterface.class.getName(),
new ServiceProvider(),
-            new Properties() {{ put(DependencyManager.ASPECT, sid); put(Constants.SERVICE_RANKING,
10); }});
+            new Hashtable() {{ put(DependencyManager.ASPECT, sid); put(Constants.SERVICE_RANKING,
10); }});
         ServiceRegistration asr2 = context.registerService(ServiceInterface.class.getName(),
new ServiceProvider(),
-            new Properties() {{ put(DependencyManager.ASPECT, sid); put(Constants.SERVICE_RANKING,
20); }});
+            new Hashtable() {{ put(DependencyManager.ASPECT, sid); put(Constants.SERVICE_RANKING,
20); }});
 
         st.open();
         Assert.assertEquals("There should be one service that matches the tracker", 1, st.getServices().length);

Copied: felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/SharingDependenciesWithMultipleServicesTest.java
(from r1531247, felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/SharingDependenciesWithMultipleServicesTest.java)
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/SharingDependenciesWithMultipleServicesTest.java?p2=felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/SharingDependenciesWithMultipleServicesTest.java&p1=felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/SharingDependenciesWithMultipleServicesTest.java&r1=1531247&r2=1531642&rev=1531642&view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/SharingDependenciesWithMultipleServicesTest.java
(original)
+++ felix/trunk/dependencymanager/test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/SharingDependenciesWithMultipleServicesTest.java
Sun Oct 13 09:01:43 2013
@@ -16,16 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.dm.test;
-
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.provision;
+package org.apache.felix.dependencymanager.test2.integration.api;
 
 import java.net.URL;
 import java.util.Dictionary;
-import java.util.Properties;
+import java.util.Hashtable;
 
+import org.apache.felix.dependencymanager.test2.components.Ensure;
+import org.apache.felix.dependencymanager.test2.integration.common.TestBase;
 import org.apache.felix.dm.BundleDependency;
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.ConfigurationDependency;
@@ -36,9 +34,7 @@ import org.apache.felix.dm.ResourceUtil;
 import org.apache.felix.dm.ServiceDependency;
 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.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Filter;
 import org.osgi.framework.InvalidSyntaxException;
@@ -47,21 +43,10 @@ import org.osgi.service.cm.Configuration
 import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.cm.ManagedService;
 
-@RunWith(JUnit4TestRunner.class)
-public class SharingDependenciesWithMultipleServicesTest extends Base {
-    @Configuration
-    public static Option[] configuration() {
-        return options(
-            provision(
-                mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version(Base.OSGI_SPEC_VERSION),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.dependencymanager").versionAsInProject(),
-                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.configadmin").version("1.2.8")
-            )
-        );
-    }    
-    
+@RunWith(PaxExam.class)
+public class SharingDependenciesWithMultipleServicesTest extends TestBase {
     @Test
-    public void testShareServiceDependencyWithMultipleServices(BundleContext context) {
+    public void testShareServiceDependencyWithMultipleServices() {
         DependencyManager m = new DependencyManager(context);
         // helper class that ensures certain steps get executed in sequence
         Ensure e = new Ensure();
@@ -82,7 +67,7 @@ public class SharingDependenciesWithMult
     }
     
     @Test
-    public void testShareConfigurationDependencyWithMultipleServices(BundleContext context)
{
+    public void testShareConfigurationDependencyWithMultipleServices() {
         DependencyManager m = new DependencyManager(context);
         // helper class that ensures certain steps get executed in sequence
         Ensure e = new Ensure();
@@ -109,7 +94,7 @@ public class SharingDependenciesWithMult
     }
     
     @Test
-    public void testShareBundleDependencyWithMultipleServices(BundleContext context) {
+    public void testShareBundleDependencyWithMultipleServices() {
         DependencyManager m = new DependencyManager(context);
         // helper class that ensures certain steps get executed in sequence
         Ensure e = new Ensure();
@@ -127,7 +112,7 @@ public class SharingDependenciesWithMult
     }
     
     @Test
-    public void testShareResourceDependencyWithMultipleServices(BundleContext context) throws
Exception {
+    public void testShareResourceDependencyWithMultipleServices() throws Exception {
         DependencyManager m = new DependencyManager(context);
         // helper class that ensures certain steps get executed in sequence
         Ensure e = new Ensure();
@@ -206,7 +191,7 @@ public class SharingDependenciesWithMult
         public void init() {
             try {
                 org.osgi.service.cm.Configuration conf = m_configAdmin.getConfiguration("test",
null);
-                conf.update(new Properties() {{ put("testkey", "testvalue"); }} );
+                conf.update(new Hashtable() {{ put("testkey", "testvalue"); }} );
                 m_ensure.step(1);
             }
             catch (Exception e) {



Mime
View raw message