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/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
Software Architect / Project Manager / Scrum Master