cancel
Showing results for 
Search instead for 
Did you mean: 

Providing external bundle as a Maven dependency when unit testing

Antoine_Cordier
Star Contributor
Star Contributor

Hello,

I want to execute tests in a bundle A and those tests need bundle B to be deployed.

Bundle B is provided as a dependency by an in-house Nexus server, and declared as a dependency with the scope "test" in bundle A pom.

Then I want to deploy bundle A using RuntimeFeature:

@RunWith(FeaturesRunner.class)
@Features({ CoreFeature.class, RuntimeFeature.class  })
@Deploy({ "org.nuxeo.ecm.automation.core", "org.nuxeo.ecm.core.schema", "com.company.my.types"})
public class MakeLinkBeanTest {
	
	@Inject
	CoreSession session;

	private DocumentModel doc;
	
	@Test
	public void testDoGet() throws Exception {
	  doc = session.createDocumentModel("/", "test", "Thesis"); // <- defined in bundle B
	}
}

But this does not work. What I get is:

[NXRuntimeTestCase] No bundle with symbolic name 'com.company.my.types'; Falling back to deprecated url lookup scheme
[RuntimeFeature] Unable to deploy artifact: com.company.my.types

One solution is to bundle everything together, but this has led me to ask myself: what's wrong with this ?

Thanks

1 ACCEPTED ANSWER

Damien_Metzler
Star Contributor
Star Contributor

If the bundle B (which I suppose is com.company.my.types) is not found, that means that it's not in your classpath.

To put it in the classpath, you should add the maven module containing it to your dependencies in your pom.xml and run a

mvn eclipse:eclipse

in your module. Then refresh you project in eclipse, check that the bundle is in the "Referenced Libraries", then it should work.

View answer in original post

2 REPLIES 2

Damien_Metzler
Star Contributor
Star Contributor

If the bundle B (which I suppose is com.company.my.types) is not found, that means that it's not in your classpath.

To put it in the classpath, you should add the maven module containing it to your dependencies in your pom.xml and run a

mvn eclipse:eclipse

in your module. Then refresh you project in eclipse, check that the bundle is in the "Referenced Libraries", then it should work.

That's right, I forgot the mvn eclipse part of the process, thank you !

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.