aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1595010 [2/2] - in /aries/trunk/blueprint: ./ blueprint-annotation-impl/ blueprint-annotation-itest/ blueprint-annotation-itest/src/test/java/org/apache/aries/blueprint/itests/ blueprint-bundle/ blueprint-core/ blueprint-itests/ blueprint-...
Date Thu, 15 May 2014 18:29:16 GMT
Added: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/MemoryLeakTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/MemoryLeakTest.java?rev=1595010&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/MemoryLeakTest.java
(added)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/MemoryLeakTest.java
Thu May 15 18:29:16 2014
@@ -0,0 +1,77 @@
+/*
+ * 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 WARRANTIES OR 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 static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.CoreOptions.provision;
+
+import java.io.InputStream;
+
+import org.junit.Test;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+
+public class MemoryLeakTest extends AbstractBlueprintIntegrationTest {
+
+    @Test
+    public void testScheduledExecMemoryLeak() throws Exception {
+        Bundle b = context().getBundleByName("test.bundle");
+        
+        long startFreeMemory = getFreeMemory();
+        
+        // 3000 iterations on a Mac 1.6 JVM leaks 30+ mb, 2000 leaks a bit more than 20,

+        // 10000 iterations would be close to OutOfMemory however by that stage the test
runs very slowly
+        for (int i=0; i<1500; i++) {
+            b.start();
+            // give the container some time to operate, otherwise it probably won't even
get to create a future
+            Thread.sleep(10);
+            b.stop();
+        }
+        
+        long endFreeMemory = getFreeMemory();
+        
+        long lossage = startFreeMemory - endFreeMemory;
+        System.out.println("We lost: " + lossage);
+        assertTrue("We lost: " + lossage, lossage < 25000000);
+    }
+
+    private long getFreeMemory() {
+        for (int i=0; i<16; i++) System.gc();
+        return Runtime.getRuntime().freeMemory();
+    }
+
+    private InputStream memoryLeakTestBundle() {
+        return TinyBundles.bundle()
+        .add("OSGI-INF/blueprint/blueprint.xml", this.getClass().getResource("/bp2.xml"))
+        .set(Constants.BUNDLE_SYMBOLICNAME, "test.bundle")
+        .build();
+    }
+
+    @org.ops4j.pax.exam.Configuration
+    public Option[] configuration() {
+        return new Option[] {
+            baseOptions(),
+            Helper.blueprintBundles(),
+            provision(memoryLeakTestBundle())
+        };
+    }
+
+}

Propchange: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/MemoryLeakTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/MultiInterfacesTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/MultiInterfacesTest.java?rev=1595010&r1=1595009&r2=1595010&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/MultiInterfacesTest.java
(original)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/MultiInterfacesTest.java
Thu May 15 18:29:16 2014
@@ -18,52 +18,35 @@
  */
 package org.apache.aries.blueprint.itests;
 
-import static org.apache.aries.itest.ExtraOptions.mavenBundle;
-import static org.apache.aries.itest.ExtraOptions.paxLogging;
-import static org.apache.aries.itest.ExtraOptions.testOptions;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-
-import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 
 import org.apache.aries.blueprint.testbundlea.multi.InterfaceA;
 import org.apache.aries.blueprint.testbundlea.multi.InterfaceB;
 import org.apache.aries.blueprint.testbundlea.multi.InterfaceC;
 import org.apache.aries.blueprint.testbundlea.multi.InterfaceD;
-import org.apache.aries.itest.AbstractIntegrationTest;
-
 import org.junit.Test;
 import org.junit.runner.RunWith;
-
+import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.osgi.framework.Bundle;
+import org.ops4j.pax.exam.junit.PaxExam;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 
-@RunWith(JUnit4TestRunner.class)
-public class MultiInterfacesTest extends AbstractIntegrationTest {
+@RunWith(PaxExam.class)
+public class MultiInterfacesTest extends AbstractBlueprintIntegrationTest {
 
     @Test
     public void testMultiInterfaceReferences() throws Exception {
         //bundlea provides the ns handlers, bean processors, interceptors etc for this test.
-        Bundle bundlea = context().getBundleByName("org.apache.aries.blueprint.testbundlea");
-        assertNotNull(bundlea);
-        bundlea.start();
+        startBundleBlueprint("org.apache.aries.blueprint.testbundlea");
         
         //bundleb makes use of the extensions provided by bundlea
-        Bundle bundleb = context().getBundleByName("org.apache.aries.blueprint.testbundleb");
-        assertNotNull(bundleb);
-        bundleb.start();
-        
         //bundleb's container will hold the beans we need to query to check the function
         //provided by bundlea functioned as expected
-        BlueprintContainer beanContainer = 
-            Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.blueprint.testbundleb");
-        assertNotNull(beanContainer);
+        BlueprintContainer beanContainer = startBundleBlueprint("org.apache.aries.blueprint.testbundleb");
 
         Object obj1 = beanContainer.getComponentInstance("OnlyA");
         Object obj2 = beanContainer.getComponentInstance("AandB");
@@ -89,14 +72,13 @@ public class MultiInterfacesTest extends
         }        
     }
     
-    @org.ops4j.pax.exam.junit.Configuration
-    public static Option[] configuration() {
-        return testOptions(
-            paxLogging("DEBUG"),
+    @Configuration
+    public Option[] configuration() {
+        return new Option[] {
+            baseOptions(),
             Helper.blueprintBundles(),
-            mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testbundlea").noStart(),
-            mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testbundleb").noStart(),
-            equinox().version("3.5.0")
-        );
+            mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testbundlea"),
+            mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testbundleb")
+        };
     } 
 }

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=1595010&r1=1595009&r2=1595010&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
Thu May 15 18:29:16 2014
@@ -16,7 +16,8 @@
 package org.apache.aries.blueprint.itests;
 
 import static org.junit.Assert.assertNotNull;
-import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.bootDelegationPackages;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -25,24 +26,26 @@ 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.Configuration;
 import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.options.BootDelegationOption;
 import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.Version;
-import static org.apache.aries.itest.ExtraOptions.*;
 
-@RunWith(JUnit4TestRunner.class)
-public class QuiesceBlueprintTest extends AbstractIntegrationTest {
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
+public class QuiesceBlueprintTest extends AbstractBlueprintIntegrationTest {
 
   private static class TestQuiesceCallback implements QuiesceCallback
   {
@@ -58,7 +61,8 @@ public class QuiesceBlueprintTest extend
   	}
   }
   
-  private QuiesceParticipant getParticipant(String bundleName) throws InvalidSyntaxException
{
+  @SuppressWarnings({ "rawtypes", "unchecked" })
+private QuiesceParticipant getParticipant(String bundleName) throws InvalidSyntaxException
{
     ServiceReference[] refs = bundleContext.getServiceReferences(QuiesceParticipant.class.getName(),
null);
     
     if(refs != null) {
@@ -73,19 +77,19 @@ public class QuiesceBlueprintTest extend
     return null;
   }
 
-  @org.ops4j.pax.exam.junit.Configuration
-  public static Option[] configuration() {
-    return testOptions(
-            paxLogging("DEBUG"),
-            transactionBootDelegation(),
+  @Configuration
+  public Option[] configuration() {
+    return new Option[] {
+            baseOptions(),
+            bootDelegationPackages("javax.transaction", "javax.transaction.*"),
+            CoreOptions.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.c
 allback,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.Portable
 Server.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"),
             Helper.blueprintBundles(),
         
             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"),
-
-            equinox().version("3.5.0"));
+            mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testquiescebundle")
+    };
   }
   
   

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=1595010&r1=1595009&r2=1595010&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
Thu May 15 18:29:16 2014
@@ -22,26 +22,26 @@ 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;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
 
-import static org.apache.aries.itest.ExtraOptions.mavenBundle;
-import static org.apache.aries.itest.ExtraOptions.paxLogging;
-import static org.apache.aries.itest.ExtraOptions.testOptions;
 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.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 
-@RunWith(JUnit4TestRunner.class)
-public class TestConfigAdmin extends AbstractIntegrationTest {
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
+public class TestConfigAdmin extends AbstractBlueprintIntegrationTest {
 
     @Test
     public void testStrategyNone() throws Exception {
@@ -118,6 +118,8 @@ public class TestConfigAdmin extends Abs
         props.put("a", "5");
         props.put("currency", "PLN");
         cf.update(props);
+        
+        Thread.sleep(2000);
 
         Bundle bundle = context().getBundleByName("org.apache.aries.blueprint.sample");
         assertNotNull(bundle);
@@ -146,6 +148,7 @@ public class TestConfigAdmin extends Abs
         assertEquals("USD", foo.getProps().get("currency"));
     }
 
+    @SuppressWarnings("rawtypes")
     @Test
     public void testManagedServiceFactory() throws Exception {
 
@@ -176,15 +179,13 @@ public class TestConfigAdmin extends Abs
 
     }
 
-    @org.ops4j.pax.exam.junit.Configuration
+    @org.ops4j.pax.exam.Configuration
     public static Option[] configuration() {
-        return testOptions(
+        return new Option[] {
+            junitBundles(),
             Helper.blueprintBundles(),
-            paxLogging("DEBUG"),
-            mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample").noStart(),
-
-            equinox().version("3.5.0")
-        );
+            mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample").noStart()
+        };
     }
 
 }

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=1595010&r1=1595009&r2=1595010&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
Thu May 15 18:29:16 2014
@@ -23,32 +23,33 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.equinox;
+
 import java.util.Hashtable;
 import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import junit.framework.Assert;
 
 import org.apache.aries.blueprint.sample.BindingListener;
 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;
 import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceRegistration;
 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 {
+@RunWith(PaxExam.class)
+public class TestReferences extends AbstractBlueprintIntegrationTest {
 
+    @SuppressWarnings("rawtypes")
     @Test
     public void testUnaryReference() throws Exception {
         BlueprintContainer blueprintContainer = Helper.getBlueprintContainerForBundle(context(),
"org.apache.aries.blueprint.sample");
@@ -77,7 +78,7 @@ public class TestReferences extends Abst
         assertNotNull(listener.getReference());
         assertEquals("Hello world!", a.hello("world"));
 
-        Hashtable props = new Hashtable();
+        Hashtable<String, Object> props = new Hashtable<String, Object>();
         props.put(Constants.SERVICE_RANKING, Integer.valueOf(1));
         ServiceRegistration reg2 = bundleContext.registerService(InterfaceA.class.getName(),
new InterfaceA() {
             public String hello(String msg) {
@@ -119,15 +120,16 @@ public class TestReferences extends Abst
         assertNull(listener.getA());
         assertNull(listener.getReference());
 
-        List refs = (List) blueprintContainer.getComponentInstance("ref-list");
+        List<?> refs = (List<?>) blueprintContainer.getComponentInstance("ref-list");
         assertNotNull(refs);
         assertTrue(refs.isEmpty());
 
-        ServiceRegistration reg1 = bundleContext.registerService(InterfaceA.class.getName(),
new InterfaceA() {
+        InterfaceA testService = new InterfaceA() {
             public String hello(String msg) {
                 return "Hello " + msg + "!";
             }
-        }, null);
+        };
+        bundleContext.registerService(InterfaceA.class.getName(), testService, null);
     
         waitForAsynchronousHandling();
         assertNotNull(listener.getA());
@@ -139,6 +141,7 @@ public class TestReferences extends Abst
 
     }
     
+    @SuppressWarnings("rawtypes")
     @Test
     public void testDefaultReference() throws Exception {
       BlueprintContainer blueprintContainer = Helper.getBlueprintContainerForBundle(context(),
"org.apache.aries.blueprint.sample");
@@ -152,7 +155,12 @@ public class TestReferences extends Abst
       
       assertEquals("The default runnable was not called", 1, defaultRunnable.getCount());
       
-      Runnable mockService = Skeleton.newMock(Runnable.class);
+      final AtomicBoolean called = new AtomicBoolean(false);
+      Runnable mockService = new Runnable() {
+        public void run() {
+            called.set(true);
+        }
+      };
       
       ServiceRegistration reg = bundleContext.registerService(Runnable.class.getName(), mockService,
null);
       waitForAsynchronousHandling();
@@ -162,7 +170,7 @@ public class TestReferences extends Abst
       
       assertEquals("The default runnable was called when a service was bound", 1, defaultRunnable.getCount());
       
-      Skeleton.getSkeleton(mockService).assertCalled(new MethodCall(Runnable.class, "run"));
+      Assert.assertTrue("Service should have been called", called.get());
       
       reg.unregister();
       waitForAsynchronousHandling();
@@ -208,15 +216,13 @@ public class TestReferences extends Abst
       
    }
 
-   @org.ops4j.pax.exam.junit.Configuration
+   @Configuration
     public static Option[] configuration() {
-        return testOptions(
-                paxLogging("INFO"),
-                equinox().version("3.5.0"),
+        return new Option[] {
+                CoreOptions.junitBundles(),
                 Helper.blueprintBundles(),
-                
-                bundles("org.apache.aries.blueprint/org.apache.aries.blueprint.sample")
-        );
+                CoreOptions.mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample")
+        };
     }
 
 }

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=1595010&r1=1595009&r2=1595010&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
Thu May 15 18:29:16 2014
@@ -21,23 +21,22 @@ package org.apache.aries.blueprint.itest
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import static org.ops4j.pax.exam.CoreOptions.equinox;
+
 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.Configuration;
+import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 
-import static org.apache.aries.itest.ExtraOptions.*;
-
-@RunWith(JUnit4TestRunner.class)
-public class TestRegistrationListener extends AbstractIntegrationTest {
+@RunWith(PaxExam.class)
+public class TestRegistrationListener extends AbstractBlueprintIntegrationTest {
 
     @Test
     public void testWithAutoExportEnabled() throws Exception {
@@ -57,7 +56,7 @@ public class TestRegistrationListener ex
         // have already been called and properties that were passed to this
         // method should have been not null
 
-        Map props = listener.getProperties();
+        Map<?, ?> props = listener.getProperties();
         assertNotNull(props);
 
         assertTrue(props.containsKey(BlueprintConstants.COMPONENT_NAME_PROPERTY));
@@ -68,14 +67,13 @@ public class TestRegistrationListener ex
 
     }
     
-    @org.ops4j.pax.exam.junit.Configuration
-    public static Option[] configuration() {
-        return testOptions(
-                equinox().version("3.5.0"),
-                paxLogging("INFO"),
+    @Configuration
+    public Option[] configuration() {
+        return new Option[] {
+                baseOptions(),
                 Helper.blueprintBundles(),
-                
-                bundles("org.apache.aries.blueprint/org.apache.aries.blueprint.sample"));
+                CoreOptions.mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample")
+        };
     }
 
 }

Added: aries/trunk/blueprint/blueprint-itests/src/test/resources/bp2.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/resources/bp2.xml?rev=1595010&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/resources/bp2.xml (added)
+++ aries/trunk/blueprint/blueprint-itests/src/test/resources/bp2.xml Thu May 15 18:29:16
2014
@@ -0,0 +1,3 @@
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+	<reference interface="java.util.List" />
+</blueprint>

Propchange: aries/trunk/blueprint/blueprint-itests/src/test/resources/bp2.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: aries/trunk/blueprint/blueprint-itests/src/test/resources/bp2.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: aries/trunk/blueprint/blueprint-itests/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/resources/log4j.properties?rev=1595010&r1=1595009&r2=1595010&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/resources/log4j.properties (original)
+++ aries/trunk/blueprint/blueprint-itests/src/test/resources/log4j.properties Thu May 15
18:29:16 2014
@@ -18,7 +18,7 @@
 ################################################################################
 
 # Root logger
-log4j.rootLogger=DEBUG, stdout
+log4j.rootLogger=INFO, stdout
 
 # CONSOLE appender not used by default
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
@@ -29,5 +29,5 @@ log4j.appender.stdout.layout.ConversionP
 log4j.appender.out=org.apache.log4j.FileAppender
 log4j.appender.out.layout=org.apache.log4j.PatternLayout
 log4j.appender.out.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32c{1}
| %-32.32C %4L | %m%n
-log4j.appender.out.file=${karaf.base}/data/log/karaf.log
+log4j.appender.out.file=target/log/karaf.log
 log4j.appender.out.append=true

Added: aries/trunk/blueprint/blueprint-itests/src/test/resources/logback.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/resources/logback.xml?rev=1595010&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/resources/logback.xml (added)
+++ aries/trunk/blueprint/blueprint-itests/src/test/resources/logback.xml Thu May 15 18:29:16
2014
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright 2010 Harald Wellmann
+ 
+Licensed 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
+ 
+-->
+<configuration>
+ 
+  <!-- log to System.out on console -->
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+    </encoder>
+  </appender>
+   
+  <!-- log to file test.log -->
+  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+    <file>target/test.log</file>
+    <encoder>
+      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+    </encoder>
+  </appender>
+   
+  <root level="WARN">
+    <appender-ref ref="STDOUT"/>
+    <appender-ref ref="FILE"/>
+  </root>
+  <logger name="org.ops4j.pax.exam" level="INFO"/>
+   
+</configuration>

Propchange: aries/trunk/blueprint/blueprint-itests/src/test/resources/logback.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: aries/trunk/blueprint/blueprint-itests/src/test/resources/logback.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Foo.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Foo.java?rev=1595010&r1=1595009&r2=1595010&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Foo.java
(original)
+++ aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Foo.java
Thu May 15 18:29:16 2014
@@ -23,6 +23,11 @@ import java.util.Map;
 
 public class Foo implements Serializable {
     
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 5557730221435945564L;
+
     private int a;
     private int b;
     private Bar bar;

Modified: aries/trunk/blueprint/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/pom.xml?rev=1595010&r1=1595009&r2=1595010&view=diff
==============================================================================
--- aries/trunk/blueprint/pom.xml (original)
+++ aries/trunk/blueprint/pom.xml Thu May 15 18:29:16 2014
@@ -59,7 +59,6 @@
         <module>blueprint-testbundleb</module>
         <module>blueprint-testquiescebundle</module>
         <module>blueprint-itests</module>
-        <module>blueprint-annotation-itest</module>
     </modules>
 
 </project>



Mime
View raw message