OpenLiberty / sample-getting-started

Getting started sample
https://openliberty.io/start/
Other
13 stars 118 forks source link

Fix unit tests #41

Closed Auskennfuchs closed 3 years ago

Auskennfuchs commented 4 years ago

The unit tests are failing when using this project without any modification and using mvn clean install

Error:

Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.474 sec <<< FAILURE! - in it.io.openliberty.sample.health.HealthTest   
testIfServicesAreUp(it.io.openliberty.sample.health.HealthTest)  Time elapsed: 0.869 sec  <<< ERROR!                                     
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException                                                                             
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)                                       
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)                                    
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)                                                               
        at org.apache.cxf.service.model.EndpointInfo.setAddress(EndpointInfo.java:97)                                                    
        at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.createEndpointInfo(AbstractJAXRSFactoryBean.java:150)                           
        at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.createEndpoint(AbstractJAXRSFactoryBean.java:219)                               
        at org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean.createWebClient(JAXRSClientFactoryBean.java:220)                           
        at org.apache.cxf.jaxrs.client.spec.ClientImpl$WebTargetImpl.initTargetClientIfNeeded(ClientImpl.java:357)                       
        at org.apache.cxf.jaxrs.client.spec.ClientImpl$WebTargetImpl.request(ClientImpl.java:260)                                        
        at it.io.openliberty.sample.health.HealthTestUtil.connectToHealthEnpoint(HealthTestUtil.java:46)                                 
        at it.io.openliberty.sample.health.HealthTest.testIfServicesAreUp(HealthTest.java:40)                                            

testIfServicesAreDown(it.io.openliberty.sample.health.HealthTest)  Time elapsed: 0.604 sec  <<< ERROR!                                   
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException                                                                             
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)                                       
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)                                    
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)                                                               
        at org.apache.cxf.service.model.EndpointInfo.setAddress(EndpointInfo.java:97)                                                    
        at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.createEndpointInfo(AbstractJAXRSFactoryBean.java:150)                           
        at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.createEndpoint(AbstractJAXRSFactoryBean.java:219)                               
        at org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean.createWebClient(JAXRSClientFactoryBean.java:220)                           
        at org.apache.cxf.jaxrs.client.spec.ClientImpl$WebTargetImpl.initTargetClientIfNeeded(ClientImpl.java:357)                       
        at org.apache.cxf.jaxrs.client.spec.ClientImpl$WebTargetImpl.request(ClientImpl.java:260)                                        
        at it.io.openliberty.sample.health.HealthTestUtil.connectToHealthEnpoint(HealthTestUtil.java:46)                                 
        at it.io.openliberty.sample.health.HealthTest.testIfServicesAreDown(HealthTest.java:46)                                          

To fix this, this pull request adds the JAX-B dependency for tests. Also it removes an unused import and moves the port variable to local, because it's just used at one statement.

mbroz2 commented 3 years ago

Thank you for taking the time to open this PR, and apologies for missing it. This has been fixed by https://github.com/OpenLiberty/sample-getting-started/commit/d638518d8800b96df0e1cc9c92fb1acfec88b3af

As such, I'm going to close this; if you disagree, please reopen with a comment.