xstream icon indicating copy to clipboard operation
xstream copied to clipboard

a quick, simple IT using PAX to validate OSGi config

Open wwannemacher opened this issue 5 years ago • 6 comments

After the discussion on https://github.com/x-stream/xstream/pull/156 I thought maybe it would be helpful to add a quick test that loads xstream in an OSGi container. There may be other ways to pull this off, but this is the way that I'm familiar with. It's pretty straightforward - it pretty closely aligns with the tutorial here: https://ops4j1.jira.com/wiki/spaces/PAXEXAM4/pages/54263846/Getting+Started+with+OSGi+Tests

I am not sure about formatting styles, headers, etc. So just let me know if there are some updates to get in-line.

wwannemacher avatar Jul 11 '19 20:07 wwannemacher

Coverage Status

Coverage remained the same at 78.394% when pulling deef9d6f26beea5114aec8ab3f0f99ff277a4190 on wwannemacher:osgi-it into 31e5f9403269a912952d7b5a656e013741098ee8 on x-stream:v-1.4.x.

coveralls avatar Jul 11 '19 20:07 coveralls

Thanks!

joehni avatar Aug 22 '19 22:08 joehni

The it-test fails, if the main artifact of XStream is not yet in the repository. For me it failed now the release, but it fails also if you clean the local repository first of the XStream SNAPSHOTs and run

mvn clean integration-test

joehni avatar Apr 12 '20 17:04 joehni

@joehni - I will have a look at this tonight.

wwannemacher avatar Apr 13 '20 13:04 wwannemacher

Thanks, because I have no idea how this really works. I've included the module again in master. Remember, you have to clean your repo of the XStream SNAPSHOTs and for me the build does not break with "mvn clean integration-test", but the test fails.

joehni avatar Apr 13 '20 21:04 joehni

Well, "tonight" is long gone, but now it fails for Java 16:

[INFO] Running com.thoughtworks.xstream.OSGiIT
20 [main] INFO org.ops4j.pax.exam.spi.DefaultExamSystem - Pax Exam System (Version: 4.13.4) created.
72 [main] INFO org.ops4j.pax.exam.junit.impl.ProbeRunner - creating PaxExam runner for class com.thoughtworks.xstream.OSGiIT
130 [main] INFO org.ops4j.pax.exam.junit.impl.ProbeRunner - running test class com.thoughtworks.xstream.OSGiIT
362 [main] INFO org.ops4j.pax.exam.spi.reactors.ReactorManager - suite finished
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.377 s <<< FAILURE! - in com.thoughtworks.xstream.OSGiIT
[ERROR] smokeTest(com.thoughtworks.xstream.OSGiIT)  Time elapsed: 0.229 s  <<< ERROR!
java.lang.ExceptionInInitializerError
Caused by: java.lang.RuntimeException: Unable to make protected boolean java.net.URLStreamHandler.equals(java.net.URL,java.net.URL) accessible: module java.base does not "opens java.net" to unnamed module @3e6d8c1c
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected boolean java.net.URLStreamHandler.equals(java.net.URL,java.net.URL) accessible: module java.base does not "opens java.net" to unnamed module @3e6d8c1c

Since I have no experience with OSGi nor do I know, how Pax Exam works, all I can do is to disable this test.

joehni avatar Mar 20 '21 16:03 joehni