You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Jorge Riquelme <to...@totex.cl> on 2011/11/07 21:30:27 UTC

[PaxExam Karaf Testframework 0.4.0] Either distribution.info or the property itself has to define a karaf version

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

Re: [PaxExam Karaf Testframework 0.4.0] Either distribution.info or the property itself has to define a karaf version

Posted by akuhtz <an...@gmail.com>.
Hi Jorge,

I've the same problem, but no solution yet.

Kind regards
Andi

--
View this message in context: http://karaf.922171.n3.nabble.com/PaxExam-Karaf-Testframework-0-4-0-Either-distribution-info-or-the-property-itself-has-to-define-a-kan-tp3488143p3488157.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: [PaxExam Karaf Testframework 0.4.0] Either distribution.info or the property itself has to define a karaf version

Posted by Andreas Pieber <an...@gmail.com>.
Hey Andreas, hey Jorge,

Sorry for didn't making this more visible. I've updated the changelog and
the samples. Since different Karaf versions behave a little bit differently
I need a way to get the version from the distribution. Either add the
karafVersion and name to the framework definition or add a etc/
distribution.info (with karafVersion=X.X.X and name=NAME). I think future
Karaf versions will include this file out of the box removing this problem
entirely.

Thanks and kind regards,
Andreas

On Mon, Nov 7, 2011 at 21:52, Jorge Riquelme <to...@totex.cl> wrote:

> problem solved, thank you
>
> 2011/11/7 akuhtz <an...@gmail.com>:
> > Hi Jorge,
> >
> > Found the solution: You have to add ".karafVersion("2.2.4").name("Apache
> > Karaf")." to the options.
> > See
> >
> https://github.com/openengsb/labs-paxexam-karaf/blob/master/regression/src/test/java/org/openengsb/labs/paxexam/karaf/regression/BaseKarafDefaultFrameworkReplaceConfigFileTest.java
> >
> >
> >
> > King regards
> > Andi
> >
> > --
> > View this message in context:
> http://karaf.922171.n3.nabble.com/PaxExam-Karaf-Testframework-0-4-0-Either-distribution-info-or-the-property-itself-has-to-define-a-kan-tp3488143p3488169.html
> > Sent from the Karaf - User mailing list archive at Nabble.com.
> >
>
>
>
> --
> Jorge Riquelme Santana
>

Re: [PaxExam Karaf Testframework 0.4.0] Either distribution.info or the property itself has to define a karaf version

Posted by Jorge Riquelme <to...@totex.cl>.
problem solved, thank you

2011/11/7 akuhtz <an...@gmail.com>:
> Hi Jorge,
>
> Found the solution: You have to add ".karafVersion("2.2.4").name("Apache
> Karaf")." to the options.
> See
> https://github.com/openengsb/labs-paxexam-karaf/blob/master/regression/src/test/java/org/openengsb/labs/paxexam/karaf/regression/BaseKarafDefaultFrameworkReplaceConfigFileTest.java
>
>
>
> King regards
> Andi
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/PaxExam-Karaf-Testframework-0-4-0-Either-distribution-info-or-the-property-itself-has-to-define-a-kan-tp3488143p3488169.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 
Jorge Riquelme Santana

Re: [PaxExam Karaf Testframework 0.4.0] Either distribution.info or the property itself has to define a karaf version

Posted by akuhtz <an...@gmail.com>.
Hi Jorge,

Found the solution: You have to add ".karafVersion("2.2.4").name("Apache
Karaf")." to the options.
See
https://github.com/openengsb/labs-paxexam-karaf/blob/master/regression/src/test/java/org/openengsb/labs/paxexam/karaf/regression/BaseKarafDefaultFrameworkReplaceConfigFileTest.java



King regards
Andi

--
View this message in context: http://karaf.922171.n3.nabble.com/PaxExam-Karaf-Testframework-0-4-0-Either-distribution-info-or-the-property-itself-has-to-define-a-kan-tp3488143p3488169.html
Sent from the Karaf - User mailing list archive at Nabble.com.