Hi,
I try to use the following unit test class but get a PAX error
@RunWith(JUnit4TestRunner.class)
public class JpaSapDocumentServiceTest extends AbstractIntegrationTest {
private static final Log LOG =
LogFactory.getLog(JpaSapDocumentServiceTest.class);
private Persistence persistenceService = null;
@Configuration
public static Option[] configuration() throws Exception{
return combine(
// Default karaf environment
Helper.getDefaultOptions(
// this is how you set the default log level when
using pax logging (logProfile)
systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG")
),
// add two features
scanFeatures(
maven().groupId("org.apache.felix.karaf").artifactId("apache-felix-karaf").type("xml").classifier("features").version("1.4.0"),
"spring", "spring-dm"
),
workingDirectory("target/paxrunner/features/"),
waitForFrameworkStartup(),
// Test on felix
felix()
);
}
Error :
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at
org.junit.internal.requests.ClassRequest.buildRunner(ClassRequest.java:33)
at
org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:28)
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.felix.karaf.testing.Helper.mavenBundle(Helper.java:75)
at
org.apache.felix.karaf.testing.Helper.getDefaultProvisioningOptions(Helper.java:203)
at
org.apache.felix.karaf.testing.Helper.getDefaultProvisioningOptions(Helper.java:182)
at
org.apache.felix.karaf.testing.Helper.getDefaultOptions(Helper.java:242)
at
com.goodyear.emea.gicl.esb.persistence.JpaSapDocumentServiceTest.configuration(JpaSapDocumentServiceTest.java:55)
... 22 more
It seems that PAX prefers to receive the groupId, artifactId and
version which is not the case now in the following method of the
helper :
/**
* Create an provisioning option for the specified maven artifact
* (groupId and artifactId), using the version found in the list
* of dependencies of this maven project.
public static MavenArtifactProvisionOption mavenBundle(String
groupId, String artifactId) {
return CoreOptions.mavenBundle(groupId,
artifactId).versionAsInProject();
}
Kind regards,
Charles Moulliard
Senior Enterprise Architect (J2EE, .NET, SOA)
Apache Camel Committer
*******************************************************************
- Blog : http://cmoulliard.blogspot.com
- Twitter : http://twitter.com/cmoulliard
- Linkedlin : http://www.linkedin.com/in/charlesmoulliard
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]