Hi people, I'm having problems with an integration test. I've followed the instructions in https://github.com/openengsb/labs-paxexam-karaf/wiki, but when I run the test I got the exception:
------------------------------------------------------- T E S T S ------------------------------------------------------- Running cl.toeska.cc.person.virtuoso.PersonServiceSaveITest SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/home/totex/.m2/repository/org/apache/karaf/org.apache.karaf.client/2.2.4/org.apache.karaf.client-2.2.4.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/home/totex/.m2/repository/org/slf4j/slf4j-simple/1.6.1/slf4j-simple-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/home/totex/.m2/repository/org/ops4j/pax/logging/pax-logging-api/1.6.3/pax-logging-api-1.6.3.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. [org.ops4j.pax.url.mvn.internal.AetherBridgeConnection] : Ather URL Handler not available. Using mvn fallback to resolve mvn:org.apache.karaf/apache-karaf/2.2.4/tar.gz [org.ops4j.pax.url.mvn.internal.Connection] : Resolving [mvn:org.apache.karaf/apache-karaf/2.2.4/tar.gz] [org.ops4j.pax.url.mvn.internal.Connection] : Collecting versions from repository [file:/home/totex/.m2/repository/,releases=true,snapshots=true] [org.ops4j.pax.url.mvn.internal.Connection] : Resolving exact version [org.ops4j.pax.url.mvn.internal.Connection] : Collecting versions from repository [http://osgi.sonatype.org/content/groups/pax-runner/,releases=true,snapshots=false] [org.ops4j.pax.url.mvn.internal.Connection] : Resolving exact version [org.ops4j.pax.url.mvn.internal.Connection] : Collecting versions from repository [http://repo1.maven.org/maven2/,releases=true,snapshots=false] [org.ops4j.pax.url.mvn.internal.Connection] : Resolving exact version [org.ops4j.pax.url.mvn.internal.Connection] : Collecting versions from repository [http://repository.ops4j.org/maven2/,releases=true,snapshots=false] [org.ops4j.pax.url.mvn.internal.Connection] : Resolving exact version [org.ops4j.pax.url.mvn.internal.Connection] : Collecting versions from repository [http://repository.springsource.com/maven/bundles/release/,releases=true,snapshots=false] [org.ops4j.pax.url.mvn.internal.Connection] : Resolving exact version [org.ops4j.pax.url.mvn.internal.Connection] : Collecting versions from repository [http://repository.springsource.com/maven/bundles/external/,releases=true,snapshots=false] [org.ops4j.pax.url.mvn.internal.Connection] : Resolving exact version 855 [main] ERROR org.ops4j.pax.exam.junit.JUnit4TestRunner - Exception java.lang.IllegalStateException: Either distribution.info or the property itself has to define a karaf version. at org.openengsb.labs.paxexam.karaf.container.internal.InternalKarafDistributionConfigurationOption.getKarafVersion(InternalKarafDistributionConfigurationOption.java:34) at org.openengsb.labs.paxexam.karaf.container.internal.KarafTestContainer.start(KarafTestContainer.java:156) at org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactor.invoke(AllConfinedStagedReactor.java:67) at org.ops4j.pax.exam.junit.JUnit4TestRunner$3.evaluate(JUnit4TestRunner.java:289) 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:87) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:120) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:103) at org.apache.maven.surefire.Surefire.run(Surefire.java:169) 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.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021) Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.965 sec <<< FAILURE! I checked the file target/classes/META-INF/maven/dependencies.properties and it contains the distribution version: org.apache.karaf/apache-karaf/version = 2.2.4 org.apache.karaf/apache-karaf/type = tar.gz org.apache.karaf/apache-karaf/scope = compile The test is pretty simple: @RunWith(JUnit4TestRunner.class) @ExamReactorStrategy(AllConfinedStagedReactorFactory.class) // @ExamReactorStrategy(EagerSingleStagedReactorFactory.class) public class PersonServiceSaveITest { @Inject private PersonService personService; @Configuration public static Option[] configuration() throws Exception { return new Option[] { KarafDistributionOption .karafDistributionConfiguration().frameworkUrl( CoreOptions.maven().groupId("org.apache.karaf") .artifactId("apache-karaf").type("tar.gz") .versionAsInProject()) }; } @Test(expected = BeanValidationException.class) public void failInvalidEmailFormat1() { final Person person = new Person(); person.setName("asdf"); person.setLastName("lolo"); person.setEmail(""); //invalid email personService.save(person); } } Thanks in advance -- Jorge Riquelme Santana
