Actually, it makes sense now. I'm looking at the "Java Build Path" of the project (as generated by "mvn eclipse:eclipse") and there is nothing that would result in the folder "target/test-classes" being in the launch configuration's classpath (it is not exported). I edited the launch configuration that was created for the JUnit test, adding the "target/test-classes" folder and the problem was resolved. Thanks for helping out.

On 18/8/2010 20:45, Alexandros Karypidis wrote:
Actually, I just found it at:

C:\aries\trunk\blueprint\blueprint-itests>dir target\test-classes\META-INF\maven
 Volume in drive C has no label.
 Volume Serial Number is DEDC-167F

Directory of C:\aries\trunk\blueprint\blueprint-itests\target\test-classes\META-INF\maven

18/08/2010  20:31 <DIR>          .
18/08/2010  20:31 <DIR>          ..
18/08/2010  20:31             6.882 dependencies.properties
               1 File(s)          6.882 bytes

I still can't run the test from within Eclipse though:

java.lang.reflect.InvocationTargetException
    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.ops4j.pax.exam.junit.internal.DefaultConfigMethod.getOptions(DefaultConfigMethod.java:133) at org.ops4j.pax.exam.junit.JUnit4TestRunner.getOptions(JUnit4TestRunner.java:347) at org.ops4j.pax.exam.junit.JUnit4TestRunner.getTestMethods(JUnit4TestRunner.java:97) at org.ops4j.pax.exam.junit.JUnit4TestRunner.<init>(JUnit4TestRunner.java:80) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:29) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:40) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:30) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: java.lang.RuntimeException: Could not resolve version. Did you configured the plugin in your maven project?Or maybe you did not run the maven build and you are using an IDE? at org.ops4j.pax.exam.MavenUtils.getArtifactVersion(MavenUtils.java:79)
    at org.ops4j.pax.exam.MavenUtils$1.getVersion(MavenUtils.java:102)
at org.ops4j.pax.exam.options.MavenArtifactUrlReference.version(MavenArtifactUrlReference.java:110) at org.ops4j.pax.exam.options.MavenArtifactUrlReference.versionAsInProject(MavenArtifactUrlReference.java:118) at org.ops4j.pax.exam.options.MavenArtifactUrlReference.versionAsInProject(MavenArtifactUrlReference.java:29) at org.ops4j.pax.exam.options.MavenArtifactProvisionOption.versionAsInProject(MavenArtifactProvisionOption.java:121) at org.apache.aries.blueprint.itests.AbstractIntegrationTest.mavenBundle(AbstractIntegrationTest.java:152) at org.apache.aries.blueprint.itests.BlueprintContainer2BTCustomizerTest.configuration(BlueprintContainer2BTCustomizerTest.java:116)
    ... 26 more



On 18/8/2010 20:41, Alexandros Karypidis wrote:
Thanks for taking the time to explain this. However, I am getting the error even though I have successfully completed an "mvn install" (which surely should have generated that file). For example, I just ran an "mvn test" in blueprint-itests:

C:\aries\trunk\blueprint\blueprint-itests>mvn test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Apache Aries Blueprint iTests
[INFO]    task-segment: [test]
[INFO] ------------------------------------------------------------------------
[INFO] [enforcer:enforce {execution: default}]
[INFO] [antrun:run {execution: create-prop}]
[INFO] Executing tasks
     [echo] Maven version: 0.3-incubating-SNAPSHOT
     [echo] OSGi version: 0.3.0.incubating-SNAPSHOT
[INFO] Executed tasks
[INFO] [properties:read-project-properties {execution: default}]
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] [remote-resources:process {execution: default}]
[INFO] [paxexam:generate-depends-file {execution: generate-config}]
[INFO] Created: C:\aries\trunk\blueprint\blueprint-itests\target\test-classes\META-INF\maven\dependencies.properties
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\aries\trunk\blueprint\blueprint-itests\src\main\resources [INFO] skip non existing resourceDirectory C:\aries\trunk\blueprint\blueprint-itests\src\main\filtered-resources
[INFO] Copying 4 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] No sources to compile
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] skip non existing resourceDirectory C:\aries\trunk\blueprint\blueprint-itests\src\test\filtered-resources
[INFO] Copying 4 resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: C:\aries\trunk\blueprint\blueprint-itests\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.apache.aries.blueprint.itests.TestRegistrationListener
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.258 sec
Running org.apache.aries.blueprint.itests.MultiBundleWithAsmTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.556 sec
Running org.apache.aries.blueprint.itests.BlueprintContainerTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.834 sec
Running org.apache.aries.blueprint.itests.TestConfigAdmin
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 17.511 sec Running org.apache.aries.blueprint.itests.BlueprintContainerBTCustomizerTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.502 sec
Running org.apache.aries.blueprint.itests.BlueprintContainer2Test
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.122 sec Running org.apache.aries.blueprint.itests.BlueprintContainer2BTCustomizerTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.934 sec
Running org.apache.aries.blueprint.itests.MultiBundleWithCgLibTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.47 sec
Running org.apache.aries.blueprint.itests.TestReferences
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.333 sec

Results :

Tests run: 13, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 9 seconds
[INFO] Finished at: Wed Aug 18 20:32:59 EEST 2010
[INFO] Final Memory: 28M/67M
[INFO] ------------------------------------------------------------------------

Immediately afterwards (and without even launching Eclipse), I checked for the file, but it was not generated:

C:\aries\trunk\blueprint\blueprint-itests>dir target\classes\META-INF
 Volume in drive C has no label.
 Volume Serial Number is DEDC-167F

Directory of C:\aries\trunk\blueprint\blueprint-itests\target\classes\META-INF

18/08/2010  20:32 <DIR>          .
18/08/2010  20:32 <DIR>          ..
18/08/2010  20:31               572 DEPENDENCIES
18/08/2010  20:31               562 DISCLAIMER
18/08/2010  20:31            11.358 LICENSE
18/08/2010  20:31               186 NOTICE
               4 File(s)         12.678 bytes

On 18/8/2010 19:42, Bartosz Kowalewski wrote:
Hi,

As Lin said, Pax Exam tests are just ordinary JUnit tests and can be
run from Eclipse w/o any additional tweaking. Unfortunately, there's
one little catch that is introduced by Pax Exam configuration used in
Aries itests projects. That is why you're observing this weird error.

These tests need to download Maven artifacts. Versions of these
artifacts are not specified inside the Pax Exam tests. It is so,
because it's cleaner to keep those versions in a single location - in
pom.xml (and not in both pom.xml and JUnit test). The issue is that
Pax Exam tests do not have access to pom.xml. That is why, during a
build of an itests project, a properties file with all details on
artifacts that are dependencies of the itests project is being
generated. This is done using ServiceMix's Mojo - depends-maven-plugin
- or a similar Mojo from OPS4J Pax (I don't remember its name). The
file is being added to target\classes\META-INF\maven\ and is named
dependencies.properties.

Conclusion: You need to run a Maven build to have this file generated.
If it's present, you'll be able to run tests from Eclipse until this
file is deleted (when running 'mvn clean' or by Eclipse itself). Oh,
one more thing - this plugin should attached to the
'generate-resources' phase of a Maven lifecycle, so it should be
enough to just run this Maven phase and then invoke tests from
Eclipse.

Thanks,
   Bartek

2010/8/18 Lin Sun<[email protected]>:
Hi,

Are you trying to run the itests from Eclipse or just the junit tests
from Eclipse?

I personally have never run the itests from Eclipse, but running junit
tests from Eclipse should be doable.

Lin

On Wed, Aug 18, 2010 at 11:38 AM, Alexandros Karypidis
<[email protected]>  wrote:
Hi,

I'm trying to run the integration tests from within Eclipse. I've never used pax-exam before. As far as I can understand I need to configure pax-exam to create an OSGi container in order to deply the test bundle. What kind of launch configuration should I use in Eclispe to have the test run within an Equinox instance? My workspace has all Aries modules in it, imported from an
"mvn eclipse:eclipse" after a successful build.

Thanks,
Alexander




Reply via email to