After I switched pax exam 2.x(2.5.0), the same errors("Invalid
BundleContext") happened. However, I can confirm that "Test Hanging"
did not appear one time on my local env, and pax exam can exit testing
normally.

Tang Yong wrote:
> After confirming pax exam 3.0.x changes many times according to [1], the
> following error does not happen, and
> org.apache.cxf.dosgi.systests2.single.TestDiscoveryRountrip has passed
> BTW: the attachment is my modified pom file and TestDiscoveryRountrip
> source file.
> [1]: http://team.ops4j.org/wiki/display/PAXEXAM3/Maven+Dependencies
> 
> However, org.apache.cxf.dosgi.systests2.single.TestExportService and
> org.apache.cxf.dosgi.systests2.single.TestImportService failed as
> following, and needing to investigate them deeply.
> 
> SEVERE: Failed to determine BusFactory implementation class name.
> java.lang.ClassCastException: class
> org.apache.cxf.bus.spring.SpringBusFactory
>         at java.lang.Class.asSubclass(Class.java:3037)
>         at org.apache.cxf.BusFactory.getBusFactoryClass(BusFactory.java:368)
>         at org.apache.cxf.BusFactory.newInstance(BusFactory.java:289)
>         at org.apache.cxf.BusFactory.newInstance(BusFactory.java:276)
>         at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:106)
>         at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:95)
>         at org.apache.cxf.dosgi.dsw.Activator.stop(Activator.java:107)
>         at
> org.apache.cxf.dosgi.singlebundle.AggregatedActivator.stopEmbeddedActivators(AggregatedActivator.java:139)
>         at
> org.apache.cxf.dosgi.singlebundle.AggregatedActivator.stop(AggregatedActivator.java:55)
>         at
> org.apache.felix.framework.util.SecureAction.stopActivator(SecureAction.java:663)
>         at org.apache.felix.framework.Felix.stopBundle(Felix.java:2361)
>         at
> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1214)
>         at
> org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
> ERROR: Bundle cxf-dosgi-ri-singlebundle-distribution [12]
> EventDispatcher: Error during dispatch.
> (java.lang.IllegalStateException: Invalid BundleContext.)
>         at java.lang.Thread.run(Thread.java:722)
> 
> 1 08, 2013 7:50:28 午後 org.apache.cxf.BusFactory newInstance
> SEVERE: Failed to instantiate bus factory.
> java.lang.ClassCastException: class
> org.apache.cxf.bus.spring.SpringBusFactory
>         at java.lang.Class.asSubclass(Class.java:3037)
>         at org.apache.cxf.BusFactory.newInstance(BusFactory.java:300)
>         at org.apache.cxf.BusFactory.newInstance(BusFactory.java:276)
>         at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:106)
>         at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:95)
>         at org.apache.cxf.dosgi.dsw.Activator.stop(Activator.java:107)
>         at
> org.apache.cxf.dosgi.singlebundle.AggregatedActivator.stopEmbeddedActivators(AggregatedActivator.java:139)
>         at
> org.apache.cxf.dosgi.singlebundle.AggregatedActivator.stop(AggregatedActivator.java:55)
>         at
> org.apache.felix.framework.util.SecureAction.stopActivator(SecureAction.java:663)
>         at org.apache.felix.framework.Felix.stopBundle(Felix.java:2361)
> ERROR: Bundle cxf-dosgi-ri-singlebundle-distribution [12]
> EventDispatcher: Error during dispatch.
> (java.lang.IllegalStateException: Invalid BundleContext.)
>         at
> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1214)
>         at
> org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
>         at java.lang.Thread.run(Thread.java:722)
> 
> java.lang.IllegalStateException: Invalid BundleContext.
>         at
> org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)
>         at
> org.apache.felix.framework.BundleContextImpl.ungetService(BundleContextImpl.java:473)
>         at
> org.osgi.util.tracker.ServiceTracker.removedService(ServiceTracker.java:495)
>         at
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1006)
>         at
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:906)
>         at
> org.osgi.util.tracker.AbstractTracked.untrack(AbstractTracked.java:352)
>         at
> org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:949)
>         at
> org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
>         at
> org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
>         at
> org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
>         at
> org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
>         at org.apache.felix.framework.Felix.access$000(Felix.java:74)
>         at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:390)
>         at
> org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:148)
>         at
> org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:127)
>         at
> org.ops4j.pax.web.service.internal.Activator$DynamicsServiceTrackerCustomizer.removedService(Activator.java:362)
>         at
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1006)
>         at
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:906)
>         at
> org.osgi.util.tracker.AbstractTracked.untrack(AbstractTracked.java:352)
>         at
> org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:949)
>         at
> org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
>         at
> org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
>         at
> org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
>         at
> org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
>         at org.apache.felix.framework.Felix.access$000(Felix.java:74)
>         at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:390)
>         at
> org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:148)
>         at
> org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:127)
>         at
> org.apache.felix.framework.ServiceRegistry.unregisterServices(ServiceRegistry.java:191)
>         at org.apache.felix.framework.Felix.stopBundle(Felix.java:2386)
>         at
> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1214)
>         at
> org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
>         at java.lang.Thread.run(Thread.java:722)
> java.lang.IllegalStateException: Invalid BundleContext.
>         at
> org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)
>         at
> org.apache.felix.framework.BundleContextImpl.ungetService(BundleContextImpl.java:473)
>         at
> org.ops4j.pax.web.service.internal.Activator$DynamicsServiceTrackerCustomizer.removedService(Activator.java:364)
>         at
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1006)
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.swissbox.extender.BundleWatcher]
> : Releasing bundle [cxf-dosgi-ri-singlebundle-distribution]
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.swissbox.extender.BundleWatcher]
> : Releasing bundle [org.apache.geronimo.specs.geronimo-atinject_1.0_spec]
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.swissbox.extender.BundleWatcher]
> : Releasing bundle [org.ops4j.pax.swissbox.lifecycle]
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.swissbox.extender.BundleWatcher]
> : Releasing bundle [org.ops4j.pax.swissbox.framework]
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.swissbox.extender.BundleWatcher]
> : Releasing bundle [org.ops4j.pax.swissbox.extender]
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.swissbox.extender.BundleWatcher]
> : Releasing bundle [org.ops4j.pax.swissbox.core]
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.swissbox.extender.BundleWatcher]
> : Releasing bundle [org.ops4j.base]
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
> : Disabling SLF4J API support.
>         at
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:906)
>         at
> org.osgi.util.tracker.AbstractTracked.untrack(AbstractTracked.java:352)
>         at
> org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:949)
>         at
> org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
> : Disabling Jakarta Commons Logging API support.
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
> : Disabling Log4J API support.
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
> : Disabling Avalon Logger API support.
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
> : Disabling JULI Logger API support.
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.swissbox.extender.BundleWatcher]
> : Releasing bundle [org.ops4j.pax.logging.pax-logging-api]
>         at
> org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
>         at
> org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
>         at
> org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
>         at org.apache.felix.framework.Felix.access$000(Felix.java:74)
>         at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:390)
>         at
> org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:148)
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.swissbox.extender.BundleWatcher]
> : Releasing bundle [osgi.cmpn]
>         at
> org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:127)
>         at
> org.apache.felix.framework.ServiceRegistry.unregisterServices(ServiceRegistry.java:191)
>         at org.apache.felix.framework.Felix.stopBundle(Felix.java:2386)
>         at
> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1214)
>         at
> org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
>         at java.lang.Thread.run(Thread.java:722)
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.swissbox.extender.BundleWatcher]
> : Releasing bundle [org.ops4j.pax.exam]
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.swissbox.extender.BundleWatcher]
> : Releasing bundle [org.apache.felix.framework]
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.swissbox.extender.BundleWatcher]
> : Releasing bundle [org.ops4j.pax.exam.extender.service]
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.swissbox.extender.BundleWatcher]
> : Releasing bundle [org.ops4j.pax.exam.inject]
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 14.938 sec
> Running org.apache.cxf.dosgi.systests2.single.TestExportService
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec
> <<< FAILURE!
> Running org.apache.cxf.dosgi.systests2.single.TestImportService
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.031
> sec <<< FAILURE!
> 
> Results :
> 
> Tests in error:
>   org.apache.cxf.dosgi.systests2.single.TestExportService
>   org.apache.cxf.dosgi.systests2.single.TestImportService
> 
> Tang Yong wrote:
>> Hi Sergey
>> CC:Christian
>>
>> I am re-opening a thread about DOSGI-152.
>>
>> Now, I have applied the patch of DOSGI-152 and DOSGI-106, and built new
>> local snapshot. After executing mvn clean install from dcxf root, the
>> following error happened on
>> org.apache.cxf.dosgi.systests2.single.TestDiscoveryRountrip, and am
>> investigating it.
>>
>> Test set: org.apache.cxf.dosgi.systests2.single.TestDiscoveryRountrip
>> -------------------------------------------------------------------------------
>> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 6.328
>> sec <<< FAILURE!
>> testDiscoveryRoundtrip(org.apache.cxf.dosgi.systests2.single.TestDiscoveryRountrip)
>>  Time elapsed: 2.875 sec  <<< ERROR!
>> java.lang.IllegalStateException: Stream handler unavailable due to: null
>>      at
>> org.apache.felix.framework.URLHandlersStreamHandlerProxy.openConnection(URLHandlersStreamHandlerProxy.java:311)
>>      at java.net.URL.openConnection(URL.java:945)
>>      at
>> org.apache.felix.framework.cache.JarRevision.initialize(JarRevision.java:155)
>>      at 
>> org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:82)
>>      at 
>> org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:60)
>>      at
>> org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:868)
>>      at
>> org.apache.felix.framework.cache.BundleArchive.reviseInternal(BundleArchive.java:549)
>>      at
>> org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:148)
>>      at
>> org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:251)
>>      at org.apache.felix.framework.Felix.installBundle(Felix.java:2476)
>>      at org.apache.felix.framework.Felix.installBundle(Felix.java:2436)
>>      at
>> org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:129)
>>      at
>> org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:107)
>>      at
>> org.ops4j.pax.exam.nat.internal.NativeTestContainer.installAndStartBundles(NativeTestContainer.java:320)
>>      at
>> org.ops4j.pax.exam.nat.internal.NativeTestContainer.start(NativeTestContainer.java:164)
>>      at
>> org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactor.invoke(AllConfinedStagedReactor.java:86)
>>      at
>> org.ops4j.pax.exam.junit.JUnit4TestRunner$2.evaluate(JUnit4TestRunner.java:323)
>>      at
>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
>>      at
>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
>>      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
>>      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
>>      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
>>      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
>>      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
>>      at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
>>      at 
>> org.ops4j.pax.exam.junit.JUnit4TestRunner.run(JUnit4TestRunner.java:120)
>>      at
>> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
>>      at
>> org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:119)
>>      at
>> org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:101)
>>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>      at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>      at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>      at java.lang.reflect.Method.invoke(Method.java:597)
>>      at
>> org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
>>      at $Proxy0.invoke(Unknown Source)
>>      at
>> org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
>>      at
>> org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
>>      at 
>> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
>>
>> Thanks
>> --Tang
>>
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version='1.0' encoding='UTF-8' ?>
> <!--
>   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.
> -->
> <project xmlns="http://maven.apache.org/POM/4.0.0"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
> http://maven.apache.org/maven-v4_0_0.xsd";>
> 
>     <modelVersion>4.0.0</modelVersion>
> 
>     <parent>
>         <groupId>org.apache.cxf.dosgi</groupId>
>         <artifactId>cxf-dosgi-ri-parent</artifactId>
>         <version>1.4-SNAPSHOT</version>
>         <relativePath>../../parent/pom.xml</relativePath>
>     </parent>
> 
>     <groupId>org.apache.cxf.dosgi.systests</groupId>
>     <artifactId>cxf-dosgi-ri-systests2-singlebundle</artifactId>
>     <packaging>jar</packaging>
> 
>     <name>Distributed OSGi System Tests Single-Bundle</name>
> 
>     <dependencies>
>         <dependency>
>             <groupId>org.ops4j.pax.exam</groupId>
>             <artifactId>pax-exam-junit4</artifactId>
>             <version>3.0.0.RC1</version>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.geronimo.specs</groupId>
>             <artifactId>geronimo-atinject_1.0_spec</artifactId>
>             <version>1.0</version>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.ops4j.pax.exam</groupId>
>             <artifactId>pax-exam-container-native</artifactId>
>             <version>3.0.0.RC1</version>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.ops4j.pax.exam</groupId>
>             <artifactId>pax-exam-link-mvn</artifactId>
>             <version>3.0.0.RC1</version>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.ops4j.pax.url</groupId>
>             <artifactId>pax-url-aether</artifactId>
>             <version>1.4.0</version>
>             <scope>test</scope>
>         </dependency>
>          <dependency>
>             <groupId>org.ops4j.pax.url</groupId>
>             <artifactId>pax-url-wrap</artifactId>
>             <version>1.4.0</version>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>            <groupId>org.apache.felix</groupId>
>            <artifactId>org.apache.felix.framework</artifactId>
>            <version>4.0.2</version>
>            <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.ops4j.pax.swissbox</groupId>
>             <artifactId>pax-swissbox-tinybundles</artifactId>
>             <version>1.3.1</version>
>         </dependency>
>         <dependency>
>             <groupId>org.osgi</groupId>
>             <artifactId>org.osgi.core</artifactId>
>         </dependency>
> 
>         <dependency>
>             <groupId>org.osgi</groupId>
>             <artifactId>org.osgi.enterprise</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.cxf.dosgi.systests</groupId>
>             <artifactId>cxf-dosgi-ri-systests2-common</artifactId>
>             <version>${project.version}</version>
>             <scope>test</scope>
>         </dependency>
> 
>         <dependency>
>             <groupId>org.apache.cxf.dosgi</groupId>
>             <artifactId>cxf-dosgi-ri-singlebundle-distribution</artifactId>
>             <version>${project.version}</version>
>             <scope>test</scope>           
>             <exclusions>
>                 <exclusion>
>                     <groupId>org.apache.felix</groupId>
>                     <artifactId>org.osgi.foundation</artifactId>
>                 </exclusion>
>             </exclusions>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.zookeeper</groupId>
>             <artifactId>zookeeper</artifactId>
>             <version>${zookeeper.version}</version>
>             <exclusions>
>                 <exclusion>
>                    <groupId>com.sun.jdmk</groupId>
>                    <artifactId>jmxtools</artifactId> 
>                 </exclusion>
>                 <exclusion>
>                    <groupId>com.sun.jmx</groupId>
>                    <artifactId>jmxri</artifactId> 
>                 </exclusion>
>                 <exclusion>
>                    <groupId>log4j</groupId>
>                    <artifactId>log4j</artifactId> 
>                 </exclusion>
>             </exclusions>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.cxf.dosgi</groupId>
>             
> <artifactId>cxf-dosgi-ri-discovery-distributed-zookeeper-server</artifactId>
>             <version>${project.version}</version>
>             <scope>test</scope>           
>         </dependency>
>         <dependency>
>             <groupId>org.apache.cxf.dosgi.samples</groupId>
>             <artifactId>cxf-dosgi-ri-samples-greeter-impl</artifactId>
>             <version>${project.version}</version>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.cxf.dosgi.samples</groupId>
>             <artifactId>cxf-dosgi-ri-samples-greeter-interface</artifactId>
>             <version>${project.version}</version>
>             <scope>test</scope>
>         </dependency>
> 
>         <dependency>
>             <groupId>junit</groupId>
>             <artifactId>junit</artifactId>
>             <scope>test</scope>
>         </dependency>
> 
>     </dependencies>
> 
>     <build>
>         <plugins>
>             <!-- use pax exam maven plugin -->
> 
>             <!--
>             Note: settings and dependencies for the final osgi runtime 
> (TESTS) are just used in TestCases
>             that annotated with this:
>             @RunWith( MavenConfiguredJUnit4TestRunner.class )
> 
>             All other testcases will use their own settings/provisioning 
> inside @Configure Methods.
>             -->
>             <plugin>
>                 <groupId>org.ops4j.pax.exam</groupId>
>                 <artifactId>maven-paxexam-plugin</artifactId>
>                 <executions>
>                     <execution>
>                         <id>generate-config</id>
>                         <goals>
>                             <goal>generate-config</goal>
>                             <goal>generate-depends-file</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>                 <configuration>
>                     <options>
>                         <platform>equinox</platform>
>                         <profiles>log</profiles>
>                     </options>
>                 </configuration>
>             </plugin>
>         </plugins>
>     </build>
> </project>
> 
> 
> ------------------------------------------------------------------------
> 
> /**
>  * 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.cxf.dosgi.systests2.single;
> 
> import javax.inject.Inject;
> 
> import org.apache.cxf.dosgi.systests2.common.AbstractTestDiscoveryRoundtrip;
> import org.junit.Test;
> import org.junit.runner.RunWith;
> import org.ops4j.pax.exam.CoreOptions;
> import org.ops4j.pax.exam.Option;
> import org.ops4j.pax.exam.options.FrameworkStartLevelOption;
> import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
> import org.osgi.framework.BundleContext;
> 
> import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
> import static org.ops4j.pax.exam.CoreOptions.provision;
> import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
> 
> import org.ops4j.pax.exam.options.extra.VMOption;
> import org.ops4j.pax.exam.options.TimeoutOption;
> import org.ops4j.pax.exam.junit.PaxExam;
> import org.ops4j.pax.exam.Configuration;
> 
> 
> @RunWith(PaxExam.class)
> public class TestDiscoveryRountrip extends AbstractTestDiscoveryRoundtrip {
>     @Inject
>     BundleContext bundleContext;
> 
>     @Configuration
>     public  Option[] configure() {
>         return CoreOptions.options(
> //                // this just adds all what you write here to java vm 
> argumenents of the (new) osgi process.
>                // new VMOption( 
> "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006" ),
>                 //new TimeoutOption( 0 ),
> //                // this is necessary to let junit runner not timout the 
> remote process before attaching debugger
> //                // setting timeout to 0 means wait as long as the remote 
> service comes available.
> //                waitForFrameworkStartup(),
>                 
>                 mavenBundle().groupId("org.apache.cxf.dosgi")
>                     
> .artifactId("cxf-dosgi-ri-singlebundle-distribution").versionAsInProject(),
>                 wrappedBundle(new MavenArtifactUrlReference()
>                     
> .groupId("log4j").artifactId("log4j").versionAsInProject()),
>                 
> mavenBundle().groupId("org.apache.zookeeper").artifactId("zookeeper").versionAsInProject(),
>                 mavenBundle().groupId("org.apache.cxf.dosgi")
>                     
> .artifactId("cxf-dosgi-ri-discovery-distributed-zookeeper-server").versionAsInProject(),
>                 
>                 // This bundle contains the common system testing code
>                 mavenBundle().groupId("org.apache.cxf.dosgi.systests")
>                     
> .artifactId("cxf-dosgi-ri-systests2-common").versionAsInProject(),
> 
>                 provision(getClientBundle()),
>                 provision(getServerBundle())
>         );
>     }
>     
>     protected BundleContext getBundleContext() {
>         return bundleContext;
>     }
> 
>     @Test
>     public void testDiscoveryRoundtrip() throws Exception {
>          // Disabled temporarily
>          // baseTestDiscoveryRoundtrip();
>     }
> }

Reply via email to