aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mahrw...@apache.org
Subject svn commit: r1144949 [2/5] - in /aries/trunk: application/application-itests/ application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/ blueprint/blueprint-annotation-itest/ blueprint/blueprint-annotation-itest/src/test/...
Date Sun, 10 Jul 2011 20:05:10 GMT
Modified: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerTest.java (original)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerTest.java Sun Jul 10 20:05:08 2011
@@ -19,11 +19,9 @@
 package org.apache.aries.blueprint.itests;
 
 import static org.junit.Assert.assertNotNull;
+
 import static org.junit.Assert.assertTrue;
 import static org.ops4j.pax.exam.CoreOptions.equinox;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
@@ -32,6 +30,7 @@ import java.util.Hashtable;
 import java.util.HashSet;
 import java.util.List;
 
+import org.apache.aries.itest.AbstractIntegrationTest;
 import org.apache.aries.unittest.fixture.ArchiveFixture;
 import org.apache.aries.unittest.fixture.ArchiveFixture.Fixture;
 import org.junit.Test;
@@ -42,25 +41,27 @@ import org.osgi.framework.Bundle;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
 
+import static org.apache.aries.itest.ExtraOptions.*;
+
 @RunWith(JUnit4TestRunner.class)
 public class BlueprintContainerTest extends AbstractIntegrationTest {
 
     @Test
     public void test() throws Exception {
         // Create a config to check the property placeholder
-        ConfigurationAdmin ca = getOsgiService(ConfigurationAdmin.class);
+        ConfigurationAdmin ca = context().getService(ConfigurationAdmin.class);
         Configuration cf = ca.getConfiguration("blueprint-sample-placeholder", null);
         Hashtable props = new Hashtable();
         props.put("key.b", "10");
         cf.update(props);
 
-        Bundle bundle = getInstalledBundle("org.apache.aries.blueprint.sample");
+        Bundle bundle = context().getBundleByName("org.apache.aries.blueprint.sample");
         assertNotNull(bundle);
 
         bundle.start();
         
         // do the test
-        testBlueprintContainer(bundle);
+        Helper.testBlueprintContainer(context(), bundle);
     }
     
     @Test
@@ -75,7 +76,7 @@ public class BlueprintContainerTest exte
         
         // every blueprint container should be up
         for (Bundle b : bundles) {
-          assertNotNull(getBlueprintContainerForBundle(b.getSymbolicName()));
+          assertNotNull(Helper.getBlueprintContainerForBundle(context(), b.getSymbolicName()));
         }
     }
     
@@ -124,12 +125,12 @@ public class BlueprintContainerTest exte
     public void testDeadlock() throws Exception {
       bundleContext.registerService("java.util.Set",new HashSet<Object>(), null);
       
-      Bundle bundle = getInstalledBundle("org.apache.aries.blueprint.sample");
+      Bundle bundle = context().getBundleByName("org.apache.aries.blueprint.sample");
       assertNotNull(bundle);
 
       bundle.start();
       
-      getBlueprintContainerForBundle(bundleContext, "org.apache.aries.blueprint.sample",DEFAULT_TIMEOUT);
+      Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.blueprint.sample");
       
       // no actual assertions, we just don't want to deadlock
     }
@@ -169,33 +170,14 @@ public class BlueprintContainerTest exte
 
     @org.ops4j.pax.exam.junit.Configuration
     public static Option[] configuration() {
-        Option[] options = options(
-            // Log
-            mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
-            mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
-            // Felix Config Admin
-            mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
-            // Felix mvn url handler
-            mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
-
-
-            // this is how you set the default log level when using pax logging (logProfile)
-            systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
-
-            // Bundles
-            mavenBundle("org.apache.aries", "org.apache.aries.util"),
-            mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
-            mavenBundle("asm", "asm-all"),
-            mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"),
+        return testOptions(
+            paxLogging("INFO"),
+            Helper.blueprintBundles(),
+                
             mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample").noStart(),
-            mavenBundle("org.osgi", "org.osgi.compendium"),
-            mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit"),
-            //org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
 
             equinox().version("3.5.0")
         );
-        options = updateOptions(options);
-        return options;
     }
 
 }

Modified: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/FragmentTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/FragmentTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/FragmentTest.java (original)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/FragmentTest.java Sun Jul 10 20:05:08 2011
@@ -20,9 +20,7 @@ package org.apache.aries.blueprint.itest
 
 import static org.junit.Assert.assertNotNull;
 import static org.ops4j.pax.exam.CoreOptions.equinox;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-
+import org.apache.aries.itest.AbstractIntegrationTest;
 import org.apache.aries.unittest.fixture.ArchiveFixture;
 import org.apache.aries.unittest.fixture.ArchiveFixture.ZipFixture;
 import org.junit.Test;
@@ -32,6 +30,8 @@ import org.ops4j.pax.exam.junit.JUnit4Te
 import org.osgi.framework.Constants;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 
+import static org.apache.aries.itest.ExtraOptions.*;
+
 @RunWith(JUnit4TestRunner.class)
 public class FragmentTest extends AbstractIntegrationTest
 {
@@ -49,9 +49,9 @@ public class FragmentTest extends Abstra
     bundleContext.installBundle("fragment", fragmentJar.getInputStream());
     bundleContext.installBundle("host", hostJar.getInputStream()).start();
     
-    Runnable r = getOsgiService(Runnable.class);
+    Runnable r = context().getService(Runnable.class);
     assertNotNull("Could not find blueprint registered service", r);
-    BlueprintContainer bc = getBlueprintContainerForBundle("org.apache.aries.test.host");
+    BlueprintContainer bc = Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.test.host");
     assertNotNull("Could not find blueprint container for bundle", bc);
   }
   
@@ -70,41 +70,21 @@ public class FragmentTest extends Abstra
     bundleContext.installBundle("fragment", fragmentJar.getInputStream());
     bundleContext.installBundle("host", hostJar.getInputStream()).start();
     
-    Runnable r = getOsgiService(Runnable.class);
+    Runnable r = context().getService(Runnable.class);
     assertNotNull("Could not find blueprint registered service", r);
-    BlueprintContainer bc = getBlueprintContainerForBundle("org.apache.aries.test.host");
+    BlueprintContainer bc = Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.test.host");
     assertNotNull("Could not find blueprint container for bundle", bc);
   }
   
   @org.ops4j.pax.exam.junit.Configuration
   public static Option[] configuration() {
-      Option[] options = options(
-          // Log
-          mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
-          mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
-          // Felix Config Admin
-          mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
-          // Felix mvn url handler
-          mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
-
-
-          // this is how you set the default log level when using pax logging (logProfile)
-          systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
-
-          // Bundles
-          mavenBundle("org.apache.aries", "org.apache.aries.util"),
-          mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
-          mavenBundle("asm", "asm-all"),
-          mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"),
+      return testOptions(
+          paxLogging("DEBUG"),
+          Helper.blueprintBundles(),
+          
           mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample").noStart(),
-          mavenBundle("org.osgi", "org.osgi.compendium"),
-          mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit"),
-//          org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
-
           equinox().version("3.5.0")
       );
-      options = updateOptions(options);
-      return options;
   }
 
 }
\ No newline at end of file

Added: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/Helper.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/Helper.java?rev=1144949&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/Helper.java (added)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/Helper.java Sun Jul 10 20:05:08 2011
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.itests;
+
+import java.text.SimpleDateFormat;
+import java.util.Currency;
+
+import org.apache.aries.blueprint.sample.Account;
+import org.apache.aries.blueprint.sample.AccountFactory;
+import org.apache.aries.blueprint.sample.Bar;
+import org.apache.aries.blueprint.sample.Foo;
+import org.apache.aries.itest.RichBundleContext;
+
+import org.ops4j.pax.exam.Option;
+import org.osgi.framework.Bundle;
+import org.osgi.service.blueprint.container.BlueprintContainer;
+import static org.apache.aries.itest.ExtraOptions.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+public class Helper {
+    public static BlueprintContainer getBlueprintContainerForBundle(RichBundleContext context, String symbolicName) {
+        return context.getService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=" + symbolicName + ")");
+    }
+
+    public static BlueprintContainer getBlueprintContainerForBundle(RichBundleContext context, String symbolicName, long timeout) {
+        return context.getService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=" + symbolicName + ")", timeout);
+    }
+    
+    public static Option[] blueprintBundles() {
+        return blueprintBundles(true);
+    }
+    
+    public static Option[] blueprintBundles(boolean startBlueprint) {
+        return flatOptions(
+                bundles(
+                    // Felix Config Admin
+                    "org.apache.felix/org.apache.felix.configadmin",
+                    // Felix mvn url handler
+                    "org.ops4j.pax.url/pax-url-mvn",
+                    
+                    "org.apache.aries/org.apache.aries.util",
+                    "org.apache.aries.proxy/org.apache.aries.proxy",
+                    "asm/asm-all",
+                    "org.osgi/org.osgi.compendium"),
+                    
+                ((startBlueprint) ? mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint") :
+                    mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint").noStart())
+        );
+    }
+    
+    public static void testBlueprintContainer(RichBundleContext context, Bundle bundle) throws Exception {
+        BlueprintContainer blueprintContainer = getBlueprintContainerForBundle(context, "org.apache.aries.blueprint.sample");
+        assertNotNull(blueprintContainer);
+
+        Object obj = blueprintContainer.getComponentInstance("bar");
+        assertNotNull(obj);
+        assertEquals(Bar.class, obj.getClass());
+        Bar bar = (Bar) obj;
+        assertNotNull(bar.getContext());
+        assertEquals("Hello FooBar", bar.getValue());
+        assertNotNull(bar.getList());
+        assertEquals(2, bar.getList().size());
+        assertEquals("a list element", bar.getList().get(0));
+        assertEquals(Integer.valueOf(5), bar.getList().get(1));
+        obj = blueprintContainer.getComponentInstance("foo");
+        assertNotNull(obj);
+        assertEquals(Foo.class, obj.getClass());
+        Foo foo = (Foo) obj;
+        assertEquals(5, foo.getA());
+        assertEquals(10, foo.getB());
+        assertSame(bar, foo.getBar());
+        assertEquals(Currency.getInstance("PLN"), foo.getCurrency());
+        assertEquals(new SimpleDateFormat("yyyy.MM.dd").parse("2009.04.17"),
+                foo.getDate());
+
+        assertTrue(foo.isInitialized());
+        assertFalse(foo.isDestroyed());
+
+        obj = context.getService(Foo.class);
+        assertNotNull(obj);
+        assertEquals(obj, foo);
+        
+        obj = blueprintContainer.getComponentInstance("accountOne");
+        assertNotNull(obj);
+        Account account = (Account)obj;
+        assertEquals(1, account.getAccountNumber());
+     
+        obj = blueprintContainer.getComponentInstance("accountTwo");
+        assertNotNull(obj);
+        account = (Account)obj;
+        assertEquals(2, account.getAccountNumber());
+        
+        obj = blueprintContainer.getComponentInstance("accountThree");
+        assertNotNull(obj);
+        account = (Account)obj;
+        assertEquals(3, account.getAccountNumber());
+        
+        obj = blueprintContainer.getComponentInstance("accountFactory");
+        assertNotNull(obj);
+        AccountFactory accountFactory = (AccountFactory)obj;
+        assertEquals("account factory", accountFactory.getFactoryName());
+        
+        bundle.stop();
+
+        Thread.sleep(1000);
+
+        try {
+            blueprintContainer = getBlueprintContainerForBundle(context, "org.apache.aries.blueprint.sample", 1);
+            fail("BlueprintContainer should have been unregistered");
+        } catch (Exception e) {
+            // Expected, as the module container should have been unregistered
+        }
+
+        assertTrue(foo.isInitialized());
+        assertTrue(foo.isDestroyed());
+    }
+}

Modified: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/QuiesceBlueprintTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/QuiesceBlueprintTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/QuiesceBlueprintTest.java (original)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/QuiesceBlueprintTest.java Sun Jul 10 20:05:08 2011
@@ -16,14 +16,7 @@
 package org.apache.aries.blueprint.itests;
 
 import static org.junit.Assert.assertNotNull;
-import static org.ops4j.pax.exam.CoreOptions.bootDelegationPackages;
 import static org.ops4j.pax.exam.CoreOptions.equinox;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
-import static org.ops4j.pax.exam.OptionUtils.combine;
-import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -32,29 +25,24 @@ import java.util.Arrays;
 import junit.framework.Assert;
 
 import org.apache.aries.blueprint.testquiescebundle.TestBean;
+import org.apache.aries.itest.AbstractIntegrationTest;
 import org.apache.aries.quiesce.manager.QuiesceCallback;
 import org.apache.aries.quiesce.participant.QuiesceParticipant;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.CoreOptions;
-import org.ops4j.pax.exam.Inject;
 import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.container.def.options.VMOption;
 import org.ops4j.pax.exam.junit.JUnit4TestRunner;
 import org.ops4j.pax.exam.options.BootDelegationOption;
 import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
 import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.Version;
-import org.osgi.util.tracker.ServiceTracker;
+import static org.apache.aries.itest.ExtraOptions.*;
 
 @RunWith(JUnit4TestRunner.class)
-public class QuiesceBlueprintTest extends AbstractIntegrationTest{
+public class QuiesceBlueprintTest extends AbstractIntegrationTest {
 
   private static class TestQuiesceCallback implements QuiesceCallback
   {
@@ -70,10 +58,6 @@ public class QuiesceBlueprintTest extend
   	}
   }
   
-  @Inject
-  protected BundleContext bundleContext;
- 
-  
   private QuiesceParticipant getParticipant(String bundleName) throws InvalidSyntaxException {
     ServiceReference[] refs = bundleContext.getServiceReferences(QuiesceParticipant.class.getName(), null);
     
@@ -91,41 +75,17 @@ public class QuiesceBlueprintTest extend
 
   @org.ops4j.pax.exam.junit.Configuration
   public static Option[] configuration() {
-    Option[] options = options(
-        bootDelegationPackages("javax.transaction", "javax.transaction.*"),
-        vmOption("-Dorg.osgi.framework.system.packages=javax.accessibility,javax.activation,javax.activity,javax.annotation,javax.annotation.processing,javax.crypto,javax.crypto.interfaces,javax.crypto.spec,javax.imageio,javax.imageio.event,javax.imageio.metadata,javax.imageio.plugins.bmp,javax.imageio.plugins.jpeg,javax.imageio.spi,javax.imageio.stream,javax.jws,javax.jws.soap,javax.lang.model,javax.lang.model.element,javax.lang.model.type,javax.lang.model.util,javax.management,javax.management.loading,javax.management.modelmbean,javax.management.monitor,javax.management.openmbean,javax.management.relation,javax.management.remote,javax.management.remote.rmi,javax.management.timer,javax.naming,javax.naming.directory,javax.naming.event,javax.naming.ldap,javax.naming.spi,javax.net,javax.net.ssl,javax.print,javax.print.attribute,javax.print.attribute.standard,javax.print.event,javax.rmi,javax.rmi.CORBA,javax.rmi.ssl,javax.script,javax.security.auth,javax.security.auth.callback,
 javax.security.auth.kerberos,javax.security.auth.login,javax.security.auth.spi,javax.security.auth.x500,javax.security.cert,javax.security.sasl,javax.sound.midi,javax.sound.midi.spi,javax.sound.sampled,javax.sound.sampled.spi,javax.sql,javax.sql.rowset,javax.sql.rowset.serial,javax.sql.rowset.spi,javax.swing,javax.swing.border,javax.swing.colorchooser,javax.swing.event,javax.swing.filechooser,javax.swing.plaf,javax.swing.plaf.basic,javax.swing.plaf.metal,javax.swing.plaf.multi,javax.swing.plaf.synth,javax.swing.table,javax.swing.text,javax.swing.text.html,javax.swing.text.html.parser,javax.swing.text.rtf,javax.swing.tree,javax.swing.undo,javax.tools,javax.xml,javax.xml.bind,javax.xml.bind.annotation,javax.xml.bind.annotation.adapters,javax.xml.bind.attachment,javax.xml.bind.helpers,javax.xml.bind.util,javax.xml.crypto,javax.xml.crypto.dom,javax.xml.crypto.dsig,javax.xml.crypto.dsig.dom,javax.xml.crypto.dsig.keyinfo,javax.xml.crypto.dsig.spec,javax.xml.datatype,javax.xml.name
 space,javax.xml.parsers,javax.xml.soap,javax.xml.stream,javax.xml.stream.events,javax.xml.stream.util,javax.xml.transform,javax.xml.transform.dom,javax.xml.transform.sax,javax.xml.transform.stax,javax.xml.transform.stream,javax.xml.validation,javax.xml.ws,javax.xml.ws.handler,javax.xml.ws.handler.soap,javax.xml.ws.http,javax.xml.ws.soap,javax.xml.ws.spi,javax.xml.xpath,org.ietf.jgss,org.omg.CORBA,org.omg.CORBA.DynAnyPackage,org.omg.CORBA.ORBPackage,org.omg.CORBA.TypeCodePackage,org.omg.CORBA.portable,org.omg.CORBA_2_3,org.omg.CORBA_2_3.portable,org.omg.CosNaming,org.omg.CosNaming.NamingContextExtPackage,org.omg.CosNaming.NamingContextPackage,org.omg.Dynamic,org.omg.DynamicAny,org.omg.DynamicAny.DynAnyFactoryPackage,org.omg.DynamicAny.DynAnyPackage,org.omg.IOP,org.omg.IOP.CodecFactoryPackage,org.omg.IOP.CodecPackage,org.omg.Messaging,org.omg.PortableInterceptor,org.omg.PortableInterceptor.ORBInitInfoPackage,org.omg.PortableServer,org.omg.PortableServer.CurrentPackage,org.omg.
 PortableServer.POAManagerPackage,org.omg.PortableServer.POAPackage,org.omg.PortableServer.ServantLocatorPackage,org.omg.PortableServer.portable,org.omg.SendingContext,org.omg.stub.java.rmi,org.w3c.dom,org.w3c.dom.bootstrap,org.w3c.dom.css,org.w3c.dom.events,org.w3c.dom.html,org.w3c.dom.ls,org.w3c.dom.ranges,org.w3c.dom.stylesheets,org.w3c.dom.traversal,org.w3c.dom.views,org.xml.sax,org.xml.sax.ext,org.xml.sax.helpers,javax.transaction;partial=true;mandatory:=partial,javax.transaction.xa;partial=true;mandatory:=partial"),
+    return testOptions(
+            paxLogging("DEBUG"),
+            transactionBootDelegation(),
+            Helper.blueprintBundles(),
         
-        // Log
-        mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
-        mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
-        // Felix Config Admin
-        mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
-        // Felix mvn url handler
-        mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
-
-        // this is how you set the default log level when using pax
-        // logging (logProfile)
-        systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
+            mavenBundle("org.apache.aries.quiesce", "org.apache.aries.quiesce.api"),
+            mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testbundlea").noStart(),
+            mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testbundleb").noStart(),
+            mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testquiescebundle"),
 
-        // Bundles
-        mavenBundle("asm","asm-all"),
-        
-        mavenBundle("org.apache.aries.quiesce", "org.apache.aries.quiesce.api"),
-        mavenBundle("org.apache.aries", "org.apache.aries.util"),
-        mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
-        mavenBundle("asm", "asm-all"),
-        mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"), 
-        mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testbundlea").noStart(),
-        mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testbundleb").noStart(),
-        mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testquiescebundle"),
-        //mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.cm"),
-        mavenBundle("org.osgi", "org.osgi.compendium"),
-        
-//        new VMOption( "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000" ),
-        
-        equinox().version("3.5.0"));
-    options = updateOptions(options);
-    return options;
+            equinox().version("3.5.0"));
   }
   
   
@@ -165,7 +125,7 @@ public class QuiesceBlueprintTest extend
 	  //request is completed. 
 	  
 	System.out.println("In testBasicQuieseEmptyCounter");
-	Object obj = getOsgiService(TestBean.class);
+	Object obj = context().getService(TestBean.class);
 	
 	if (obj != null)
 	{
@@ -224,7 +184,7 @@ public class QuiesceBlueprintTest extend
    //services. It should be quiesced immediately.
 	  
    System.out.println("In testNoServicesQuiesce");
-	Object obj = getOsgiService(TestBean.class);
+	Object obj = context().getService(TestBean.class);
 	
 	if (obj != null)
 	{    
@@ -245,7 +205,7 @@ public class QuiesceBlueprintTest extend
 	        assertNotNull(bundleb);
 	        bundleb.start();
 	        
-	        getBlueprintContainerForBundle(bundleContext, "org.apache.aries.blueprint.testbundleb", DEFAULT_TIMEOUT);
+	        Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.blueprint.testbundleb");
 	        
 			participant.quiesce(callbackB, Collections.singletonList(getBundle(
 				"org.apache.aries.blueprint.testbundleb")));
@@ -285,7 +245,7 @@ public class QuiesceBlueprintTest extend
    //request has completed.
 	  
    System.out.println("In testMultiBundleQuiesce");
-	Object obj = getOsgiService(TestBean.class);
+	Object obj = context().getService(TestBean.class);
 	
 	if (obj != null)
 	{    
@@ -342,7 +302,7 @@ public class QuiesceBlueprintTest extend
    //the bundle is being quiesced.
 	  
    System.out.println("In testMultiRequestQuiesce");
-	Object obj = getOsgiService(TestBean.class);
+	Object obj = context().getService(TestBean.class);
 	
 	if (obj != null)
 	{    
@@ -388,8 +348,8 @@ public class QuiesceBlueprintTest extend
   
   private class TestBeanClient implements Runnable
   {
-    private TestBean myService;
-    private int time;
+    private final TestBean myService;
+    private final int time;
     
     public TestBeanClient(TestBean myService, int time)
     {

Modified: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestConfigAdmin.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestConfigAdmin.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestConfigAdmin.java (original)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestConfigAdmin.java Sun Jul 10 20:05:08 2011
@@ -21,13 +21,11 @@ package org.apache.aries.blueprint.itest
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.ops4j.pax.exam.CoreOptions.equinox;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-
 import java.util.Currency;
 import java.util.Hashtable;
 
 import org.apache.aries.blueprint.sample.Foo;
+import org.apache.aries.itest.AbstractIntegrationTest;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Option;
@@ -37,23 +35,25 @@ import org.osgi.service.blueprint.contai
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
 
+import static org.apache.aries.itest.ExtraOptions.*;
+
 @RunWith(JUnit4TestRunner.class)
 public class TestConfigAdmin extends AbstractIntegrationTest {
 
     @Test
     public void testStrategyNone() throws Exception {
-        ConfigurationAdmin ca = getOsgiService(ConfigurationAdmin.class);
+        ConfigurationAdmin ca = context().getService(ConfigurationAdmin.class);
         Configuration cf = ca.getConfiguration("blueprint-sample-managed.none", null);
         Hashtable<String,String> props = new Hashtable<String,String>();
         props.put("a", "5");
         props.put("currency", "PLN");
         cf.update(props);
 
-        Bundle bundle = getInstalledBundle("org.apache.aries.blueprint.sample");
+        Bundle bundle = context().getBundleByName("org.apache.aries.blueprint.sample");
         assertNotNull(bundle);
         bundle.start();
 
-        BlueprintContainer blueprintContainer = getBlueprintContainerForBundle("org.apache.aries.blueprint.sample", DEFAULT_TIMEOUT);
+        BlueprintContainer blueprintContainer = Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.blueprint.sample");
         assertNotNull(blueprintContainer);
 
         Foo foo = (Foo) blueprintContainer.getComponentInstance("none-managed");
@@ -76,18 +76,18 @@ public class TestConfigAdmin extends Abs
 
     @Test
     public void testStrategyContainer() throws Exception {
-        ConfigurationAdmin ca = getOsgiService(ConfigurationAdmin.class);
+        ConfigurationAdmin ca = context().getService(ConfigurationAdmin.class);
         Configuration cf = ca.getConfiguration("blueprint-sample-managed.container", null);
         Hashtable<String,String> props = new Hashtable<String,String>();
         props.put("a", "5");
         props.put("currency", "PLN");
         cf.update(props);
 
-        Bundle bundle = getInstalledBundle("org.apache.aries.blueprint.sample");
+        Bundle bundle = context().getBundleByName("org.apache.aries.blueprint.sample");
         assertNotNull(bundle);
         bundle.start();
 
-        BlueprintContainer blueprintContainer = getBlueprintContainerForBundle("org.apache.aries.blueprint.sample", DEFAULT_TIMEOUT);
+        BlueprintContainer blueprintContainer = Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.blueprint.sample");
         assertNotNull(blueprintContainer);
 
         Foo foo = (Foo) blueprintContainer.getComponentInstance("container-managed");
@@ -109,18 +109,18 @@ public class TestConfigAdmin extends Abs
 
     @Test
     public void testStrategyComponent() throws Exception {
-        ConfigurationAdmin ca = getOsgiService(ConfigurationAdmin.class);
+        ConfigurationAdmin ca = context().getService(ConfigurationAdmin.class);
         Configuration cf = ca.getConfiguration("blueprint-sample-managed.component", null);
         Hashtable<String,String> props = new Hashtable<String,String>();
         props.put("a", "5");
         props.put("currency", "PLN");
         cf.update(props);
 
-        Bundle bundle = getInstalledBundle("org.apache.aries.blueprint.sample");
+        Bundle bundle = context().getBundleByName("org.apache.aries.blueprint.sample");
         assertNotNull(bundle);
         bundle.start();
 
-        BlueprintContainer blueprintContainer = getBlueprintContainerForBundle("org.apache.aries.blueprint.sample", DEFAULT_TIMEOUT);
+        BlueprintContainer blueprintContainer = Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.blueprint.sample");
         assertNotNull(blueprintContainer);
 
         Foo foo = (Foo) blueprintContainer.getComponentInstance("component-managed");
@@ -145,18 +145,18 @@ public class TestConfigAdmin extends Abs
 
     @Test
     public void testManagedServiceFactory() throws Exception {
-        ConfigurationAdmin ca = getOsgiService(ConfigurationAdmin.class);
+        ConfigurationAdmin ca = context().getService(ConfigurationAdmin.class);
         Configuration cf = ca.createFactoryConfiguration("blueprint-sample-managed-service-factory", null);
         Hashtable<String,String> props = new Hashtable<String,String>();
         props.put("a", "5");
         props.put("currency", "PLN");
         cf.update(props);
 
-        Bundle bundle = getInstalledBundle("org.apache.aries.blueprint.sample");
+        Bundle bundle = context().getBundleByName("org.apache.aries.blueprint.sample");
         assertNotNull(bundle);
         bundle.start();
 
-        BlueprintContainer blueprintContainer = getBlueprintContainerForBundle("org.apache.aries.blueprint.sample", DEFAULT_TIMEOUT);
+        BlueprintContainer blueprintContainer = Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.blueprint.sample");
         assertNotNull(blueprintContainer);
 
         Thread.sleep(5000);
@@ -164,32 +164,13 @@ public class TestConfigAdmin extends Abs
 
     @org.ops4j.pax.exam.junit.Configuration
     public static Option[] configuration() {
-        Option[] options = options(
-            // Log
-            mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
-            mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
-            // Felix Config Admin
-            mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
-            // Felix mvn url handler
-            mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
-
-
-            // this is how you set the default log level when using pax logging (logProfile)
-            systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
-
-            // Bundles
-            mavenBundle("org.apache.aries", "org.apache.aries.util"),
-            mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
-            mavenBundle("asm", "asm-all"),
-            mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"),
+        return testOptions(
+            Helper.blueprintBundles(),
+            paxLogging("DEBUG"),
             mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample").noStart(),
-            mavenBundle("org.osgi","org.osgi.compendium"),
-//            org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
 
             equinox().version("3.5.0")
         );
-        options = updateOptions(options);
-        return options;
     }
 
 }

Modified: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestReferences.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestReferences.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestReferences.java (original)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestReferences.java Sun Jul 10 20:05:08 2011
@@ -24,9 +24,6 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.ops4j.pax.exam.CoreOptions.equinox;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-
 import java.util.Hashtable;
 import java.util.List;
 
@@ -34,6 +31,7 @@ import org.apache.aries.blueprint.sample
 import org.apache.aries.blueprint.sample.DefaultRunnable;
 import org.apache.aries.blueprint.sample.DestroyTest;
 import org.apache.aries.blueprint.sample.InterfaceA;
+import org.apache.aries.itest.AbstractIntegrationTest;
 import org.apache.aries.unittest.mocks.MethodCall;
 import org.apache.aries.unittest.mocks.Skeleton;
 import org.junit.Test;
@@ -46,12 +44,14 @@ import org.osgi.framework.ServiceRegistr
 import org.osgi.service.blueprint.container.BlueprintContainer;
 import org.osgi.service.blueprint.container.ServiceUnavailableException;
 
+import static org.apache.aries.itest.ExtraOptions.*;
+
 @RunWith(JUnit4TestRunner.class)
 public class TestReferences extends AbstractIntegrationTest {
 
     @Test
     public void testUnaryReference() throws Exception {
-        BlueprintContainer blueprintContainer = getBlueprintContainerForBundle("org.apache.aries.blueprint.sample");
+        BlueprintContainer blueprintContainer = Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.blueprint.sample");
         assertNotNull(blueprintContainer);
 
         BindingListener listener = (BindingListener) blueprintContainer.getComponentInstance("bindingListener");
@@ -105,7 +105,7 @@ public class TestReferences extends Abst
 
     @Test
     public void testListReferences() throws Exception {
-        BlueprintContainer blueprintContainer = getBlueprintContainerForBundle("org.apache.aries.blueprint.sample");
+        BlueprintContainer blueprintContainer = Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.blueprint.sample");
         assertNotNull(blueprintContainer);
 
         BindingListener listener = (BindingListener) blueprintContainer.getComponentInstance("listBindingListener");
@@ -132,7 +132,7 @@ public class TestReferences extends Abst
     
     @Test
     public void testDefaultReference() throws Exception {
-      BlueprintContainer blueprintContainer = getBlueprintContainerForBundle("org.apache.aries.blueprint.sample");
+      BlueprintContainer blueprintContainer = Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.blueprint.sample");
       assertNotNull(blueprintContainer);
 
       Runnable refRunnable = (Runnable) blueprintContainer.getComponentInstance("refWithDefault");
@@ -162,7 +162,7 @@ public class TestReferences extends Abst
     public void testReferencesCallableInDestroy() throws Exception {
       bundleContext.registerService(Runnable.class.getName(), new Thread(), null);
       
-      BlueprintContainer blueprintContainer = getBlueprintContainerForBundle("org.apache.aries.blueprint.sample");
+      BlueprintContainer blueprintContainer = Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.blueprint.sample");
       assertNotNull(blueprintContainer);
       
       DestroyTest dt = (DestroyTest) blueprintContainer.getComponentInstance("destroyCallingReference");
@@ -189,33 +189,13 @@ public class TestReferences extends Abst
 
     @org.ops4j.pax.exam.junit.Configuration
     public static Option[] configuration() {
-        Option[] options = options(
-            // Log
-            mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
-            mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
-            // Felix Config Admin
-            mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
-            // Felix mvn url handler
-            mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
-
-            // this is how you set the default log level when using pax logging (logProfile)
-            systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
-
-            // Bundles
-            mavenBundle("org.apache.aries", "org.apache.aries.util"),
-            mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
-            mavenBundle("asm", "asm-all"),
-            mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"),
-            mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample"),
-            mavenBundle("org.osgi", "org.osgi.compendium"),
-            mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit"),
-
-//            org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
-
-            equinox().version("3.5.0")
+        return testOptions(
+                paxLogging("INFO"),
+                equinox().version("3.5.0"),
+                Helper.blueprintBundles(),
+                
+                bundles("org.apache.aries.blueprint/org.apache.aries.blueprint.sample")
         );
-        options = updateOptions(options);
-        return options;
     }
 
 }

Modified: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestRegistrationListener.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestRegistrationListener.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestRegistrationListener.java (original)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestRegistrationListener.java Sun Jul 10 20:05:08 2011
@@ -22,30 +22,32 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.ops4j.pax.exam.CoreOptions.equinox;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-
 import java.util.Map;
 
 import org.apache.aries.blueprint.BlueprintConstants;
 import org.apache.aries.blueprint.sample.Foo;
 import org.apache.aries.blueprint.sample.FooRegistrationListener;
+import org.apache.aries.itest.AbstractIntegrationTest;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.JUnit4TestRunner;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 
+import static org.apache.aries.itest.ExtraOptions.*;
+
 @RunWith(JUnit4TestRunner.class)
 public class TestRegistrationListener extends AbstractIntegrationTest {
 
     @Test
     public void testWithAutoExportEnabled() throws Exception {
 
-        BlueprintContainer blueprintContainer = getBlueprintContainerForBundle("org.apache.aries.blueprint.sample");
+        BlueprintContainer blueprintContainer = 
+            Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.blueprint.sample");
+        
         assertNotNull(blueprintContainer);
 
-        Foo foo = getOsgiService(Foo.class, "(" + BlueprintConstants.COMPONENT_NAME_PROPERTY + "=foo)", DEFAULT_TIMEOUT);
+        Foo foo = context().getService(Foo.class, "(" + BlueprintConstants.COMPONENT_NAME_PROPERTY + "=foo)");
         assertEquals(5, foo.getA());
 
         FooRegistrationListener listener = 
@@ -65,35 +67,15 @@ public class TestRegistrationListener ex
         assertEquals("value", props.get("key"));
 
     }
-
+    
     @org.ops4j.pax.exam.junit.Configuration
     public static Option[] configuration() {
-        Option[] options = options(
-                // Log
-                mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
-                mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
-                // Felix Config Admin
-                mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
-                // Felix mvn url handler
-                mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
-
-                // this is how you set the default log level when using pax
-                // logging (logProfile)
-                systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
-
-                // Bundles
-                mavenBundle("org.apache.aries", "org.apache.aries.util"), 
-                mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
-                mavenBundle("asm", "asm-all"),
-                mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"), 
-                mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample"),
-                mavenBundle("org.osgi", "org.osgi.compendium"),
-
-                // org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
-
-                equinox().version("3.5.0"));
-        options = updateOptions(options);
-        return options;
+        return testOptions(
+                equinox().version("3.5.0"),
+                paxLogging("INFO"),
+                Helper.blueprintBundles(),
+                
+                bundles("org.apache.aries.blueprint/org.apache.aries.blueprint.sample"));
     }
 
 }

Modified: aries/trunk/jmx/jmx-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/pom.xml?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/pom.xml (original)
+++ aries/trunk/jmx/jmx-itests/pom.xml Sun Jul 10 20:05:08 2011
@@ -62,6 +62,12 @@
             <version>0.3.1-SNAPSHOT</version>
         </dependency>
         <dependency>
+          <groupId>org.apache.aries.testsupport</groupId>
+          <artifactId>org.apache.aries.testsupport.unit</artifactId>
+          <version>0.3.1-SNAPSHOT</version>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
             <scope>provided</scope>

Modified: aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/AbstractIntegrationTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/AbstractIntegrationTest.java (original)
+++ aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/AbstractIntegrationTest.java Sun Jul 10 20:05:08 2011
@@ -18,16 +18,6 @@ package org.apache.aries.jmx;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
-import static org.ops4j.pax.exam.OptionUtils.combine;
-
-import java.util.Collection;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.LinkedList;
-import java.util.List;
-
 import javax.management.InstanceNotFoundException;
 import javax.management.MBeanServer;
 import javax.management.MBeanServerFactory;
@@ -37,40 +27,20 @@ import javax.management.ObjectName;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.CoreOptions;
-import org.ops4j.pax.exam.Inject;
-import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
-import org.osgi.framework.Version;
-import org.osgi.util.tracker.ServiceTracker;
 
 /**
- * 
- * 
- *
  * @version $Rev$ $Date$
  */
 @RunWith(JUnit4TestRunner.class)
-public class AbstractIntegrationTest {
+public class AbstractIntegrationTest extends org.apache.aries.itest.AbstractIntegrationTest {
     
-    public static final long DEFAULT_TIMEOUT = 60000;
-
     ServiceRegistration registration;
     ServiceReference reference;
     protected MBeanServer mbeanServer;
 
-    @Inject
-    protected BundleContext bundleContext;
-    
     @Before
     public void setUp() throws Exception {
         mbeanServer = MBeanServerFactory.createMBeanServer();
@@ -94,8 +64,7 @@ public class AbstractIntegrationTest {
      * 
      * @throws Exception
      */
-    protected void doSetUp() throws Exception {           
-    }
+    protected void doSetUp() throws Exception {}
     
     @After
     public void tearDown() throws Exception {
@@ -133,122 +102,8 @@ public class AbstractIntegrationTest {
         }
         assertNotNull(mbeanServer);
         assertNotNull(objectName);
-        T mbean = (T) MBeanServerInvocationHandler.newProxyInstance(mbeanServer, objectName,
+        T mbean = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, objectName,
                 type, false);
         return mbean;
-    }
-    
-    protected Bundle getBundle(String symbolicName) {
-        return getBundle(symbolicName, null);
-    }
-    
-    protected Bundle getBundle(String bundleSymbolicName, String version) {
-        Bundle result = null;
-        for (Bundle b : bundleContext.getBundles()) {
-            if ( b.getSymbolicName().equals(bundleSymbolicName) ) {
-                if (version == null || b.getVersion().equals(Version.parseVersion(version))) {
-                    result = b;
-                    break;
-                }
-            }
-        }
-        return result;
-    }
-    
-    protected <T> T getOsgiService(Class<T> type, long timeout) {
-        return getOsgiService(type, null, timeout);
-    }
-
-    protected <T> T getOsgiService(Class<T> type) {
-        return getOsgiService(type, null, DEFAULT_TIMEOUT);
-    }
-
-    protected <T> T getOsgiService(Class<T> type, String filter, long timeout) {
-        ServiceTracker tracker = null;
-        try {
-            String flt;
-            if (filter != null) {
-                if (filter.startsWith("(")) {
-                    flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")" + filter + ")";
-                } else {
-                    flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")(" + filter + "))";
-                }
-            } else {
-                flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")";
-            }
-            Filter osgiFilter = FrameworkUtil.createFilter(flt);
-            tracker = new ServiceTracker(bundleContext, osgiFilter, null);
-            tracker.open(true);
-            // Note that the tracker is not closed to keep the reference
-            // This is buggy, as the service reference may change i think
-            Object svc = type.cast(tracker.waitForService(timeout));
-            if (svc == null) {
-                Dictionary dic = bundleContext.getBundle().getHeaders();
-                System.err.println("Test bundle headers: " + explode(dic));
-
-                for (ServiceReference ref : asCollection(bundleContext.getAllServiceReferences(null, null))) {
-                    System.err.println("ServiceReference: " + ref);
-                }
-
-                for (ServiceReference ref : asCollection(bundleContext.getAllServiceReferences(null, flt))) {
-                    System.err.println("Filtered ServiceReference: " + ref);
-                }
-
-                throw new RuntimeException("Gave up waiting for service " + flt);
-            }
-            return type.cast(svc);
-        } catch (InvalidSyntaxException e) {
-            throw new IllegalArgumentException("Invalid filter", e);
-        } catch (InterruptedException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    public static MavenArtifactProvisionOption mavenBundle(String groupId, String artifactId) {
-        return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).versionAsInProject();
-    }
-
-    protected static Option[] updateOptions(Option[] options) {
-        // We need to add pax-exam-junit here when running with the ibm
-        // jdk to avoid the following exception during the test run:
-        // ClassNotFoundException: org.ops4j.pax.exam.junit.Configuration
-        if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
-            Option[] ibmOptions = options(
-                wrappedBundle(mavenBundle("org.ops4j.pax.exam", "pax-exam-junit"))
-            );
-            options = combine(ibmOptions, options);
-        }
-
-        return options;
-    }
-
-    /*
-     * Explode the dictionary into a ,-delimited list of key=value pairs
-     */
-    private static String explode(Dictionary dictionary) {
-        Enumeration keys = dictionary.keys();
-        StringBuffer result = new StringBuffer();
-        while (keys.hasMoreElements()) {
-            Object key = keys.nextElement();
-            result.append(String.format("%s=%s", key, dictionary.get(key)));
-            if (keys.hasMoreElements()) {
-                result.append(", ");
-            }
-        }
-        return result.toString();
-    }
-
-    /*
-     * Provides an iterable collection of references, even if the original array is null
-     */
-    private static final Collection<ServiceReference> asCollection(ServiceReference[] references) {
-        List<ServiceReference> result = new LinkedList<ServiceReference>();
-        if (references != null) {
-            for (ServiceReference reference : references) {
-                result.add(reference);
-            }
-        }
-        return result;
-    }
-
+    }    
 }
\ No newline at end of file

Modified: aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/cm/ConfigurationAdminMBeanTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/cm/ConfigurationAdminMBeanTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/cm/ConfigurationAdminMBeanTest.java (original)
+++ aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/cm/ConfigurationAdminMBeanTest.java Sun Jul 10 20:05:08 2011
@@ -25,6 +25,8 @@ import static org.ops4j.pax.swissbox.tin
 import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
 import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.withBnd;
 
+import static org.apache.aries.itest.ExtraOptions.*;
+
 import java.io.InputStream;
 import java.util.Dictionary;
 
@@ -58,12 +60,11 @@ public class ConfigurationAdminMBeanTest
 
     @Configuration
     public static Option[] configuration() {
-        Option[] options = CoreOptions
-                .options(
+        return testOptions(
                         CoreOptions.equinox(),
+                        paxLogging("INFO"),
+                        
                         mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
-                        mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
-                        mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
                         mavenBundle("org.osgi", "org.osgi.compendium"),
                         mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx"),
                         mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.whiteboard"),
@@ -102,8 +103,6 @@ public class ConfigurationAdminMBeanTest
                                         org.apache.aries.jmx.test.bundleb.Activator.class.getName())
                                 .build(withBnd()))
                         );
-        options = updateOptions(options);
-        return options;
     }
     
     @Override
@@ -122,10 +121,10 @@ public class ConfigurationAdminMBeanTest
        
         // get bundles
         
-        Bundle a = getBundle("org.apache.aries.jmx.test.bundlea");
+        Bundle a = context().getBundleByName("org.apache.aries.jmx.test.bundlea");
         assertNotNull(a);
         
-        Bundle b = getBundle("org.apache.aries.jmx.test.bundleb");
+        Bundle b = context().getBundleByName("org.apache.aries.jmx.test.bundleb");
         assertNotNull(b);
        
         

Modified: aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/cm/ConfigurationAdminMBeanWhiteboardTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/cm/ConfigurationAdminMBeanWhiteboardTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/cm/ConfigurationAdminMBeanWhiteboardTest.java (original)
+++ aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/cm/ConfigurationAdminMBeanWhiteboardTest.java Sun Jul 10 20:05:08 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.aries.jmx.cm;
 
+import org.apache.aries.itest.ExtraOptions;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.Configuration;
 import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
@@ -34,7 +35,7 @@ public class ConfigurationAdminMBeanWhit
         MavenArtifactProvisionOption po = (MavenArtifactProvisionOption) options[i];
         String url = po.getURL();
         if (url.contains("mvn:org.apache.aries.jmx/org.apache.aries.jmx/")) {
-          options[i] = mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.core.whiteboard");
+          options[i] = ExtraOptions.mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.core.whiteboard");
         }
       }
     }

Modified: aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleStateMBeanTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleStateMBeanTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleStateMBeanTest.java (original)
+++ aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleStateMBeanTest.java Sun Jul 10 20:05:08 2011
@@ -25,6 +25,8 @@ import static org.ops4j.pax.swissbox.tin
 import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.withBnd;
 import static org.osgi.jmx.framework.BundleStateMBean.OBJECTNAME;
 
+import static org.apache.aries.itest.ExtraOptions.*;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -45,21 +47,17 @@ import org.osgi.framework.Constants;
 import org.osgi.jmx.framework.BundleStateMBean;
 
 /**
- * 
- * 
- * 
  * @version $Rev$ $Date$
  */
 public class BundleStateMBeanTest extends AbstractIntegrationTest {
 
     @Configuration
     public static Option[] configuration() {
-        Option[] options = CoreOptions
-                .options(
+        return testOptions(
                         CoreOptions.equinox(),
+                        paxLogging("INFO"),
+                        
                         mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
-                        mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
-                        mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
                         mavenBundle("org.osgi", "org.osgi.compendium"),
                         mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx"),
                         mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.api"),
@@ -103,8 +101,6 @@ public class BundleStateMBeanTest extend
                                 .set(Constants.REQUIRE_BUNDLE, "org.apache.aries.jmx.test.bundlea;bundle-version=2.0.0")
                                 .build(withBnd()))
                         );
-        options = updateOptions(options);
-        return options;
     }
     
     @Override
@@ -120,16 +116,16 @@ public class BundleStateMBeanTest extend
         
         //get bundles
         
-        Bundle a = getBundle("org.apache.aries.jmx.test.bundlea");
+        Bundle a = context().getBundleByName("org.apache.aries.jmx.test.bundlea");
         assertNotNull(a);
         
-        Bundle b = getBundle("org.apache.aries.jmx.test.bundleb");
+        Bundle b = context().getBundleByName("org.apache.aries.jmx.test.bundleb");
         assertNotNull(b);
         
-        Bundle frag = getBundle("org.apache.aries.jmx.test.fragc");
+        Bundle frag = context().getBundleByName("org.apache.aries.jmx.test.fragc");
         assertNotNull(frag);
 
-        Bundle d = getBundle("org.apache.aries.jmx.test.bundled");
+        Bundle d = context().getBundleByName("org.apache.aries.jmx.test.bundled");
         assertNotNull(d);
         
         // exportedPackages

Modified: aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleStateMBeanWhiteboardTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleStateMBeanWhiteboardTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleStateMBeanWhiteboardTest.java (original)
+++ aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleStateMBeanWhiteboardTest.java Sun Jul 10 20:05:08 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.aries.jmx.framework;
 
+import org.apache.aries.itest.ExtraOptions;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.Configuration;
 import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
@@ -34,7 +35,7 @@ public class BundleStateMBeanWhiteboardT
         MavenArtifactProvisionOption po = (MavenArtifactProvisionOption) options[i];
         String url = po.getURL();
         if (url.contains("mvn:org.apache.aries.jmx/org.apache.aries.jmx/")) {
-          options[i] = mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.core.whiteboard");
+          options[i] = ExtraOptions.mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.core.whiteboard");
         }
       }
     }

Modified: aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/FrameworkMBeanTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/FrameworkMBeanTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/FrameworkMBeanTest.java (original)
+++ aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/FrameworkMBeanTest.java Sun Jul 10 20:05:08 2011
@@ -21,6 +21,8 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import static org.apache.aries.itest.ExtraOptions.*;
+
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -39,27 +41,21 @@ import org.ops4j.pax.exam.junit.Configur
 import org.osgi.jmx.framework.FrameworkMBean;
 
 /**
- * 
- * 
  * @version $Rev$ $Date$
  */
 public class FrameworkMBeanTest extends AbstractIntegrationTest {    
 
     @Configuration
     public static Option[] configuration() {
-        
-        Option[] options = CoreOptions.options(
+        return testOptions(
             CoreOptions.equinox(),
-            mavenBundle("org.ops4j.pax.logging", "pax-logging-api"), 
-            mavenBundle("org.ops4j.pax.logging", "pax-logging-service"), 
+            paxLogging("INFO"),
+
             mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx"),
             mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.api"),
             mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.whiteboard"),
             mavenBundle("org.apache.aries", "org.apache.aries.util")
         );
-        
-        options = updateOptions(options);
-        return options;
     }
 
     @Override

Modified: aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/FrameworkMBeanWhiteboardTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/FrameworkMBeanWhiteboardTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/FrameworkMBeanWhiteboardTest.java (original)
+++ aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/FrameworkMBeanWhiteboardTest.java Sun Jul 10 20:05:08 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.aries.jmx.framework;
 
+import org.apache.aries.itest.ExtraOptions;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.Configuration;
 import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
@@ -34,7 +35,7 @@ public class FrameworkMBeanWhiteboardTes
         MavenArtifactProvisionOption po = (MavenArtifactProvisionOption) options[i];
         String url = po.getURL();
         if (url.contains("mvn:org.apache.aries.jmx/org.apache.aries.jmx/")) {
-          options[i] = mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.core.whiteboard");
+          options[i] = ExtraOptions.mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.core.whiteboard");
         }
       }
     }

Modified: aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/PackageStateMBeanTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/PackageStateMBeanTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/PackageStateMBeanTest.java (original)
+++ aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/PackageStateMBeanTest.java Sun Jul 10 20:05:08 2011
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.apache.aries.itest.ExtraOptions.*;
 
 import java.io.IOException;
 import java.util.Collection;
@@ -44,15 +45,13 @@ public class PackageStateMBeanTest exten
 
     @Configuration
     public static Option[] configuration() {
-        Option[] options = CoreOptions.options(CoreOptions.equinox(), 
-            mavenBundle("org.ops4j.pax.logging", "pax-logging-api"), 
-            mavenBundle("org.ops4j.pax.logging", "pax-logging-service"), 
+        return testOptions(
+            CoreOptions.equinox(), 
+            paxLogging("INFO"),
             mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx"),
             mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.api"),
             mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.whiteboard"),
             mavenBundle("org.apache.aries", "org.apache.aries.util"));
-        options = updateOptions(options);
-        return options;
     }
 
     @Override

Modified: aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/PackageStateMBeanWhiteboardTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/PackageStateMBeanWhiteboardTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/PackageStateMBeanWhiteboardTest.java (original)
+++ aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/PackageStateMBeanWhiteboardTest.java Sun Jul 10 20:05:08 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.aries.jmx.framework;
 
+import org.apache.aries.itest.ExtraOptions;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.Configuration;
 import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
@@ -34,7 +35,7 @@ public class PackageStateMBeanWhiteboard
         MavenArtifactProvisionOption po = (MavenArtifactProvisionOption) options[i];
         String url = po.getURL();
         if (url.contains("mvn:org.apache.aries.jmx/org.apache.aries.jmx/")) {
-          options[i] = mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.core.whiteboard");
+          options[i] = ExtraOptions.mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.core.whiteboard");
         }
       }
     }

Modified: aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/ServiceStateMBeanTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/ServiceStateMBeanTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/ServiceStateMBeanTest.java (original)
+++ aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/ServiceStateMBeanTest.java Sun Jul 10 20:05:08 2011
@@ -24,8 +24,7 @@ import static org.ops4j.pax.exam.CoreOpt
 import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.modifyBundle;
 import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
 import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.withBnd;
-import static org.ops4j.pax.exam.CoreOptions.waitForFrameworkStartup; 
-import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
+import static org.apache.aries.itest.ExtraOptions.*;
 
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -63,17 +62,17 @@ public class ServiceStateMBeanTest exten
 
     @Configuration
     public static Option[] configuration() {
-        Option[] options = CoreOptions
-                .options(
+        return testOptions(
                         CoreOptions.equinox(),
+                        paxLogging("INFO"),
+                        
                         mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
-                        mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
-                        mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
                         mavenBundle("org.osgi", "org.osgi.compendium"),
                         mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx"),
                         mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.api"),
                         mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.whiteboard"),
                         mavenBundle("org.apache.aries", "org.apache.aries.util"),
+                        
                         new Customizer() {
                             public InputStream customizeTestProbe(InputStream testProbe) throws Exception {
                                 return modifyBundle(testProbe)
@@ -112,8 +111,6 @@ public class ServiceStateMBeanTest exten
 //                              vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7777"),
 //                              waitForFrameworkStartup()
                         );
-        options = updateOptions(options);
-        return options;
     }
     
     @Override
@@ -129,10 +126,10 @@ public class ServiceStateMBeanTest exten
         
         //get bundles
         
-        Bundle a = getBundle("org.apache.aries.jmx.test.bundlea");
+        Bundle a = context().getBundleByName("org.apache.aries.jmx.test.bundlea");
         assertNotNull(a);
         
-        Bundle b = getBundle("org.apache.aries.jmx.test.bundleb");
+        Bundle b = context().getBundleByName("org.apache.aries.jmx.test.bundleb");
         assertNotNull(b);
         
         // get services

Modified: aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/ServiceStateMBeanWhiteboardTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/ServiceStateMBeanWhiteboardTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/ServiceStateMBeanWhiteboardTest.java (original)
+++ aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/framework/ServiceStateMBeanWhiteboardTest.java Sun Jul 10 20:05:08 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.aries.jmx.framework;
 
+import org.apache.aries.itest.ExtraOptions;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.Configuration;
 import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
@@ -34,7 +35,7 @@ public class ServiceStateMBeanWhiteboard
         MavenArtifactProvisionOption po = (MavenArtifactProvisionOption) options[i];
         String url = po.getURL();
         if (url.contains("mvn:org.apache.aries.jmx/org.apache.aries.jmx/")) {
-          options[i] = mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.core.whiteboard");
+          options[i] = ExtraOptions.mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.core.whiteboard");
         }
       }
     }

Modified: aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/permissionadmin/PermissionAdminMBeanTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/permissionadmin/PermissionAdminMBeanTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/permissionadmin/PermissionAdminMBeanTest.java (original)
+++ aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/permissionadmin/PermissionAdminMBeanTest.java Sun Jul 10 20:05:08 2011
@@ -21,8 +21,7 @@ import static org.junit.Assert.assertNot
 import static org.ops4j.pax.exam.CoreOptions.provision;
 import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
 import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.withBnd;
-import static org.ops4j.pax.exam.CoreOptions.waitForFrameworkStartup; 
-import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
+import static org.apache.aries.itest.ExtraOptions.*;
 
 import java.io.IOException;
 
@@ -49,10 +48,9 @@ public class PermissionAdminMBeanTest ex
     
     @Configuration
     public static Option[] configuration() {
-        Option[] options = CoreOptions.options(
+        return testOptions(
             CoreOptions.equinox(),
-            mavenBundle("org.ops4j.pax.logging", "pax-logging-api"), 
-            mavenBundle("org.ops4j.pax.logging", "pax-logging-service"), 
+            paxLogging("INFO"),
             mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx"),
             mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.api"),
             mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.whiteboard"),
@@ -72,8 +70,6 @@ public class PermissionAdminMBeanTest ex
 //                     vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7778"),
 //                     waitForFrameworkStartup()
         );
-        options = updateOptions(options);
-        return options;
     }
     
     @Override
@@ -100,7 +96,7 @@ public class PermissionAdminMBeanTest ex
         String[] mBeanDefPermissions = mBean.listDefaultPermissions();
         assertArrayEquals(encoded, mBeanDefPermissions);
         
-        Bundle a = getBundle("org.apache.aries.jmx.test.bundlea");
+        Bundle a = context().getBundleByName("org.apache.aries.jmx.test.bundlea");
         assertNotNull(a);
         
         String location = a.getLocation();

Modified: aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/permissionadmin/PermissionAdminMBeanWhiteboardTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/permissionadmin/PermissionAdminMBeanWhiteboardTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/permissionadmin/PermissionAdminMBeanWhiteboardTest.java (original)
+++ aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/permissionadmin/PermissionAdminMBeanWhiteboardTest.java Sun Jul 10 20:05:08 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.aries.jmx.permissionadmin;
 
+import org.apache.aries.itest.ExtraOptions;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.Configuration;
 import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
@@ -34,7 +35,7 @@ public class PermissionAdminMBeanWhitebo
         MavenArtifactProvisionOption po = (MavenArtifactProvisionOption) options[i];
         String url = po.getURL();
         if (url.contains("mvn:org.apache.aries.jmx/org.apache.aries.jmx/")) {
-          options[i] = mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.core.whiteboard");
+          options[i] = ExtraOptions.mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.core.whiteboard");
         }
       }
     }

Modified: aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/provisioning/ProvisioningServiceMBeanTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/provisioning/ProvisioningServiceMBeanTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/provisioning/ProvisioningServiceMBeanTest.java (original)
+++ aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/provisioning/ProvisioningServiceMBeanTest.java Sun Jul 10 20:05:08 2011
@@ -24,6 +24,8 @@ import static org.junit.Assert.assertTru
 import static org.osgi.service.provisioning.ProvisioningService.PROVISIONING_AGENT_CONFIG;
 import static org.osgi.service.provisioning.ProvisioningService.PROVISIONING_REFERENCE;
 
+import static org.apache.aries.itest.ExtraOptions.*;
+
 import java.io.File;
 import java.io.FileOutputStream;
 import java.util.Dictionary;
@@ -56,18 +58,13 @@ public class ProvisioningServiceMBeanTes
 
     @Configuration
     public static Option[] configuration() {
-        Option[] options = CoreOptions
-                .options(
+        return testOptions(
                         CoreOptions.equinox(),
-                        //provision("file:///<local>"),
-                        mavenBundle("org.ops4j.pax.logging", "pax-logging-api"), 
-                        mavenBundle("org.ops4j.pax.logging", "pax-logging-service"), 
+                        paxLogging("INFO"),
                         mavenBundle("org.osgi", "org.osgi.compendium"), 
                         mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.whiteboard"),
                         mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx"),
                         mavenBundle("org.apache.aries", "org.apache.aries.util"));
-        options = updateOptions(options);
-        return options;
     }
 
     @Override

Modified: aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/provisioning/ProvisioningServiceMBeanWhiteboardTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/provisioning/ProvisioningServiceMBeanWhiteboardTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/provisioning/ProvisioningServiceMBeanWhiteboardTest.java (original)
+++ aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/provisioning/ProvisioningServiceMBeanWhiteboardTest.java Sun Jul 10 20:05:08 2011
@@ -18,7 +18,7 @@
  */
 package org.apache.aries.jmx.provisioning;
 
-import org.apache.aries.jmx.permissionadmin.PermissionAdminMBeanTest;
+import org.apache.aries.itest.ExtraOptions;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.Configuration;
 import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
@@ -35,7 +35,7 @@ public class ProvisioningServiceMBeanWhi
         MavenArtifactProvisionOption po = (MavenArtifactProvisionOption) options[i];
         String url = po.getURL();
         if (url.contains("mvn:org.apache.aries.jmx/org.apache.aries.jmx/")) {
-          options[i] = mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.core.whiteboard");
+          options[i] = ExtraOptions.mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.core.whiteboard");
         }
       }
     }

Modified: aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/test/blueprint/BlueprintMBeanTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/test/blueprint/BlueprintMBeanTest.java?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/test/blueprint/BlueprintMBeanTest.java (original)
+++ aries/trunk/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/test/blueprint/BlueprintMBeanTest.java Sun Jul 10 20:05:08 2011
@@ -21,6 +21,8 @@ package org.apache.aries.jmx.test.bluepr
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
+import static org.apache.aries.itest.ExtraOptions.*;
+
 import javax.management.MBeanServerInvocationHandler;
 import javax.management.ObjectName;
 import javax.management.openmbean.TabularData;
@@ -54,11 +56,11 @@ public class BlueprintMBeanTest extends 
     
     @Configuration
     public static Option[] configuration() {    
-        Option[] options = CoreOptions.options(
+        return testOptions(
                 CoreOptions.equinox(), 
+                paxLogging("INFO"),
+                
                 mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
-                mavenBundle("org.ops4j.pax.logging", "pax-logging-api"), 
-                mavenBundle("org.ops4j.pax.logging", "pax-logging-service"), 
                 mavenBundle("org.apache.aries", "org.apache.aries.util"),
                 mavenBundle("asm", "asm-all"),
                 mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
@@ -67,8 +69,6 @@ public class BlueprintMBeanTest extends 
                 mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.blueprint"),
                 mavenBundle("org.osgi", "org.osgi.compendium")
         );
-        options = updateOptions(options);
-        return options;
     }  
 
     @Override
@@ -78,8 +78,8 @@ public class BlueprintMBeanTest extends 
        
        // Wait enough time for osgi framework and blueprint bundles to be set up
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Waiting for bundles to be set up");
-       getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=org.apache.aries.blueprint)", DEFAULT_TIMEOUT);
-       getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=org.apache.aries.blueprint.sample)", DEFAULT_TIMEOUT);
+       context().getService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=org.apache.aries.blueprint)");
+       context().getService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=org.apache.aries.blueprint.sample)");
     }
     
     @Test
@@ -101,7 +101,7 @@ public class BlueprintMBeanTest extends 
         if (-1==extenderBundleId) fail("Blueprint Extender Bundle is not found!");
         
         //retrieve the proxy object
-        BlueprintStateMBean stateProxy = (BlueprintStateMBean) MBeanServerInvocationHandler.newProxyInstance(mbeanServer, new ObjectName(BlueprintStateMBean.OBJECTNAME), BlueprintStateMBean.class, false);
+        BlueprintStateMBean stateProxy = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, new ObjectName(BlueprintStateMBean.OBJECTNAME), BlueprintStateMBean.class, false);
         
         // test getBlueprintBundleIds
         long[] bpBundleIds = stateProxy.getBlueprintBundleIds();
@@ -131,7 +131,7 @@ public class BlueprintMBeanTest extends 
         long sampleBlueprintContainerServiceId = (Long) serviceReferences[0].getProperty(Constants.SERVICE_ID);
         
         //retrieve the proxy object
-        BlueprintMetadataMBean metadataProxy = (BlueprintMetadataMBean) MBeanServerInvocationHandler.newProxyInstance(mbeanServer, new ObjectName(BlueprintMetadataMBean.OBJECTNAME), BlueprintMetadataMBean.class, false);
+        BlueprintMetadataMBean metadataProxy = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, new ObjectName(BlueprintMetadataMBean.OBJECTNAME), BlueprintMetadataMBean.class, false);
         
         // test getBlueprintContainerServiceIds
         long[] bpContainerServiceIds = metadataProxy.getBlueprintContainerServiceIds();

Modified: aries/trunk/jndi/jndi-url-itest/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-url-itest/pom.xml?rev=1144949&r1=1144948&r2=1144949&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-url-itest/pom.xml (original)
+++ aries/trunk/jndi/jndi-url-itest/pom.xml Sun Jul 10 20:05:08 2011
@@ -222,6 +222,13 @@
             <scope>test</scope>
             <version>0.3.1-SNAPSHOT</version>
         </dependency>
+        
+        <dependency>
+          <groupId>org.apache.aries.testsupport</groupId>
+          <artifactId>org.apache.aries.testsupport.unit</artifactId>
+          <version>0.3.1-SNAPSHOT</version>
+          <scope>test</scope>
+        </dependency>
 
     </dependencies>
 



Mime
View raw message