Thank you and thank you for your patience and time today Achim.
On 2015-07-28 16:05, Achim Nierbeck wrote: > Hi, > > if you need the wrap feature, make sure you define this dependency in your > own feature file and > make sure it is marked as a prerequisite feature. > > <feature prerequisite=true>wrap</feature> > > With this the feature resolve will know it first needs to install this > feature before actually installing your own feature descriptor. > This is especially needed in the case with testing, because all features > defined in the configuration of the test are automatically > used as bootfeatures, and therefore the wrap and your own features are > started at the same time. > > regards, Achim > > 2015-07-28 21:58 GMT+02:00 <[email protected]>: > > Hello all, > > I am trying to add a custom feature to my test instance (Karaf 4.0.0 Pax Exam > 4.5). It seems to be trying to add my custom feature before it adds the wrap > feature even though I have wrap as a dependency to my custom feature. I have > tried it as is and with dependency=true. > > <feature name="file-ingestion-server" description="file-ingestion-server" > install="auto" version="1.0.0.SNAPSHOT"> > <feature>wrap</feature> > > KarafDistributionOption.features(karafStandardRepo, "wrap"), > KarafDistributionOption.features(karafStandardRepo, "aries-blueprint"), > KarafDistributionOption.features(karafStandardRepo, "shell"), > KarafDistributionOption.features(karafStandardRepo, "shell-compat"), > KarafDistributionOption.features(karafStandardRepo, "feature"), > KarafDistributionOption.features(karafStandardRepo, "jaas"), > KarafDistributionOption.features(karafStandardRepo, "ssh"), > KarafDistributionOption.features(karafStandardRepo, "management"), > KarafDistributionOption.features(karafStandardRepo, "bundle"), > KarafDistributionOption.features(karafStandardRepo, "config"), > KarafDistributionOption.features(karafStandardRepo, "deployer"), > KarafDistributionOption.features(karafStandardRepo, "diagnostic"), > KarafDistributionOption.features(karafStandardRepo, "feature"), > KarafDistributionOption.features(karafStandardRepo, "instance"), > KarafDistributionOption.features(karafStandardRepo, "kar"), > KarafDistributionOption.features(karafStandardRepo, "log"), > KarafDistributionOption.features(karafStandardRepo, "package"), > KarafDistributionOption.features(karafStandardRepo, "service"), > KarafDistributionOption.features(karafStandardRepo, "system"), > KarafDistributionOption.features(karafStandardRepo, "war"), > KarafDistributionOption.features(karafStandardRepo, "webconsole"), > KarafDistributionOption.features(karafStandardRepo, "scr"), > KarafDistributionOption.features(karafStandardRepo, "transaction"), > KarafDistributionOption.features(karafCxfRepo, "cxf-jaxrs"), > KarafDistributionOption.features(karafFitRepo, "file-ingestion-server") > > Some excerpts from the log are below > > Caused by: java.net.MalformedURLException: unknown protocol: wrap > at java.net.URL.<init>(URL.java:592)[:1.7.0_71] > at java.net.URL.<init>(URL.java:482)[:1.7.0_71] > at java.net.URL.<init>(URL.java:431)[:1.7.0_71] > at > org.apache.karaf.features.internal.download.impl.SimpleDownloadTask.download(SimpleDownloadTask.java:62)[8:org.apache.karaf.features.core:4.0.0] > > > 2015-07-28 15:49:24,888 | INFO | pool-1-thread-1 | FeaturesServiceImpl | 8 - > org.apache.karaf.features.core - 4.0.0 | Adding features: > shell/[4.0.0,4.0.0], scr/[4.0.0,4.0.0], transaction/[1.1.1,1.1.1], > package/[4.0.0,4.0.0], ssh/[4.0.0,4.0.0], war/[4.0.0,4.0.0], > config/[4.0.0,4.0.0], bundle/[4.0.0,4.0.0], feature/[4.0.0,4.0.0], > deployer/[4.0.0,4.0.0], instance/[4.0.0,4.0.0], diagnostic/[4.0.0,4.0.0], > aries-blueprint/[4.0.0,4.0.0], wrap/[0,0.0.0], kar/[4.0.0,4.0.0], > test-dependencies/[0,0.0.0], cxf-jaxrs/[3.1.1,3.1.1], > shell-compat/[4.0.0,4.0.0], > file-ingestion-server/[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT], > webconsole/[4.0.0,4.0.0], log/[4.0.0,4.0.0], jaas/[4.0.0,4.0.0], > system/[4.0.0,4.0.0], service/[4.0.0,4.0.0], exam/[4.5.0,4.5.0], > management/[4.0.0,4.0.0] > 2015-07-28 15:51:19,324 | ERROR | pool-1-thread-1 | BootFeaturesInstaller | 8 > - org.apache.karaf.features.core - 4.0.0 | Error installing boot features > org.apache.karaf.features.internal.util.MultiException: Error > at > org.apache.karaf.features.internal.download.impl.MavenDownloadManager$MavenDownloader.<init>(MavenDownloadManager.java:84)[8:org.apache.karaf.features.core:4.0.0] > > > On 2015-07-28 13:48, Achim Nierbeck wrote: > Ahh, > with those options the test will wait for the debugger to attach. > But actually there is a much simpler way of attaching a debugger to it. > Just add the following to your test-configuration: > KarafDistributionOption.debugConfiguration("5005", true) > > regards, Achim > > 2015-07-28 19:30 GMT+02:00 <[email protected]>: > > When I removed the debug part and the systemtimeout the test ran. Would be > nice to debug but I can always do that in a different manner. > > On 2015-07-28 07:56, [email protected] wrote: > > I believe I have switched it but still recieve the same error. When I run > netstat I can see 21000 is opened and listening while the test runs. The new > log is as follows. > > Running com.orbis.ingestion.models.FileTest > [org.ops4j.pax.exam.junit.impl.ProbeRunner] : creating PaxExam runner for > class com.orbis.ingestion.models.FileTest > [org.ops4j.pax.exam.spi.PaxExamRuntime] : Found TestContainerFactory: > org.ops4j.pax.exam.karaf.container.internal.KarafTestContainerFactory > [org.ops4j.pax.exam.spi.reactors.ReactorManager] : No User defined probe hook > found > [org.ops4j.pax.exam.spi.intern.DefaultTestAddress] : NEW ADDRESS= > PaxExam-e3f5d499-1bf8-4f12-b813-93d8c14e18fb parent=null > root=[TestAddress:PaxExam-e3f5d499-1bf8-4f12-b813-93d8c14e18fb > root:PaxExam-e3f5d499-1bf8-4f12-b813-93d8c14e18fb] > args=[Ljava.lang.Object;@5e48a0e1 > [org.ops4j.pax.exam.spi.DefaultExamReactor] : Staging reactor with probes: 1 > using strategy: org.ops4j.pax.exam.spi.reactors.PerMethod@723a4422 > [org.ops4j.store.intern.TemporaryStore] : Storage Area is /tmp/1438084276075-0 > [org.ops4j.pax.exam.spi.intern.DefaultTestAddress] : NEW ADDRESS= > PaxExam-a9b61633-92c4-44dc-8588-5dd21bd13293 > parent=[TestAddress:PaxExam-843362dd-4547-489c-ad3f-ebed4aa2c482 > root:PaxExam-843362dd-4547-489c-ad3f-ebed4aa2c482] > root=[TestAddress:PaxExam-843362dd-4547-489c-ad3f-ebed4aa2c482 > root:PaxExam-843362dd-4547-489c-ad3f-ebed4aa2c482] > args=[Ljava.lang.Object;@4f4f4ec4 > [org.ops4j.pax.exam.junit.impl.ProbeRunner] : running test class > com.orbis.ingestion.models.FileTest > [org.ops4j.pax.exam.junit.impl.ProbeRunner] : Invoke simpleTest @ > [TestAddress:PaxExam-a9b61633-92c4-44dc-8588-5dd21bd13293 > root:PaxExam-843362dd-4547-489c-ad3f-ebed4aa2c482] Arguments: > [Ljava.lang.Object;@28adcd81 > [org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer] : using RMI > registry at port 21000 > [org.ops4j.store.intern.TemporaryStore] : Storage Area is /tmp/1438084276075-0 > [org.ops4j.pax.url.mvn.internal.Connection] : Resolving > [mvn:org.apache.karaf/apache-karaf/4.0.0/tar.gz] > [shaded.org.eclipse.aether.internal.impl.DefaultLocalRepositoryProvider] : > Using manager SimpleLocalRepositoryManager with priority 0.0 for > /home/david/.m2/repository Ignored FQCN: > shaded.org.eclipse.aether.internal.impl.slf4j.Slf4jLoggerFactory$Slf4jLoggerEx > [org.ops4j.pax.url.mvn.internal.AetherBasedResolver] : Resolved > (org.apache.karaf:apache-karaf:tar.gz:4.0.0) as > /home/david/.m2/repository/org/apache/karaf/apache-karaf/4.0.0/apache-karaf-4.0.0.tar.gz > [shaded.org.apache.http.impl.conn.PoolingHttpClientConnectionManager] : > Connection manager is shutting down Ignored FQCN: > shaded.org.apache.commons.logging.impl.SLF4JLocationAwareLog > [shaded.org.apache.http.impl.conn.PoolingHttpClientConnectionManager] : > Connection manager shut down Ignored FQCN: > shaded.org.apache.commons.logging.impl.SLF4JLocationAwareLog > [org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer] : Test > Container started in 3 millis > [org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer] : Wait for > test container to finish its initialization [ RelativeTimeout value = 0 ] > [org.ops4j.pax.exam.rbc.client.RemoteBundleContextClient] : Waiting for > remote bundle context.. on 21000 name: 1269041e-ec7f-41d2-8c45-5147836cc4bb > timout: [ RelativeTimeout value = 0 ] > Listening for transport dt_socket at address: 5005 > [org.ops4j.pax.exam.spi.reactors.ReactorManager] : suite finished > Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 36.892 sec > <<< FAILURE! - in com.orbis.ingestion.models.FileTest > simpleTest(com.orbis.ingestion.models.FileTest) Time elapsed: 36.886 sec <<< > ERROR! > java.rmi.NotBoundException: 1269041e-ec7f-41d2-8c45-5147836cc4bb > at sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:136) > at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source) > at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:409) > at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267) > at sun.rmi.transport.Transport$1.run(Transport.java:177) > at sun.rmi.transport.Transport$1.run(Transport.java:174) > at java.security.AccessController.doPrivileged(Native Method) > at sun.rmi.transport.Transport.serviceCall(Transport.java:173) > at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556) > at > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811) > at > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > at java.lang.Thread.run(Thread.java:745) > at > sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275) > at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252) > at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:378) > at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) > at > org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl.getRemoteBundleContext(RemoteBundleContextClientImpl.java:242) > at > org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl.waitForState(RemoteBundleContextClientImpl.java:211) > at > org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.waitForState(KarafTestContainer.java:578) > at > org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.startKaraf(KarafTestContainer.java:230) > at > org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.start(KarafTestContainer.java:180) > at > org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactor.invoke(AllConfinedStagedReactor.java:79) > at org.ops4j.pax.exam.junit.impl.ProbeRunner$2.evaluate(ProbeRunner.java:267) > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) > at org.junit.runners.ParentRunner.run(ParentRunner.java:363) > at org.ops4j.pax.exam.junit.impl.ProbeRunner.run(ProbeRunner.java:98) > at org.ops4j.pax.exam.junit.PaxExam.run(PaxExam.java:93) > at > org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283) > at > org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173) > at > org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) > at > org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128) > at > org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203) > at > org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155) > at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) > > Results : > > Tests in error: > FileTest.simpleTest » NotBound 1269041e-ec7f-41d2-8c45-5147836cc4bb > > Here is my test code > > @SuppressWarnings("deprecation") > @RunWith(PaxExam.class) > @ExamReactorStrategy(PerMethod.class) > public class FileTest { > private static final Logger LOGGER = LoggerFactory.getLogger(FileTest.class); > > @Inject > protected BundleContext bundleContext; > > @Configuration > public Option[] config() { > > MavenArtifactUrlReference karafUrl = > CoreOptions.maven().groupId("org.apache.karaf").artifactId("apache-karaf").version("4.0.0").type("tar.gz"); > > return new Option[]{ > KarafDistributionOption.karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache > Karaf"). > unpackDirectory(new File("target/paxexam/unpack")).useDeployFolder(false), > KarafDistributionOption.keepRuntimeFolder(), > > CoreOptions.keepCaches(), > CoreOptions.systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"), > > // TODO define settings.xml if behind a proxy > > CoreOptions.systemTimeout(0), > CoreOptions.vmOptions("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"), > KarafDistributionOption.editConfigurationFilePut(CustomProperties.KARAF_FRAMEWORK, > "equinox"), > // disable JMX RBAC security, thanks to the KarafMBeanServerBuilder > KarafDistributionOption.configureSecurity().disableKarafMBeanServerBuilder(), > KarafDistributionOption.logLevel(LogLevel.INFO) > }; > } > > @Test > public void simpleTest() { > try { > Thread.sleep(5000); > } catch (InterruptedException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > LOGGER.info("++++ Executing the test!!!!"); > Assert.assertNotNull(bundleContext); > } > } > > On 2015-07-28 07:31, Achim Nierbeck wrote: > Hi David, > > taken from your stacktrace I can see you seem to use TestNG, > could you try convert the test to JUnit. I'm not so sure about how good > TestNG always runs with Pax-Exam. > > regards, Achim -- Apache Member Apache Karaf <http://karaf.apache.org/ [1]> Committer & PMC OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/ [2]> Committer & Project Lead blog <http://notizblog.nierbeck.de/ [3]> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS [4]> Software Architect / Project Manager / Scrum Master -- Apache Member Apache Karaf <http://karaf.apache.org/ [1]> Committer & PMC OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/ [2]> Committer & Project Lead blog <http://notizblog.nierbeck.de/ [3]> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS [4]> Software Architect / Project Manager / Scrum Master Links: ------ [1] http://karaf.apache.org/ [2] http://wiki.ops4j.org/display/paxweb/Pax+Web/ [3] http://notizblog.nierbeck.de/ [4] http://bit.ly/1ps9rkS
