01-30-2013 11:14 AM
Hi,
I've seen some examples from the Nuxeo source , where the deployment is done within the test methods through deployContrib (...) (old testing framework?). I would like to do the same using annotations on per method base. Or is it by design to deploy contributions on per class base?
Thanks.
[example]
@RunWith(FeaturesRunner.class)
@Features({CoreFeature.class})
[..]
public class TestClass {
@Test
@Deploy({"org.my.service:OSGI-INF/my-test-contrib.xml"}) /*nice to have*/
public void myTest() throws Exception {
...;
}
02-05-2013 07:20 AM
Hi Edgar,
Using Deploy annotations on method does not do anything. In fact you should not be able to do this. We need to fix the target of the Deploy and LocalDeploy annotation. But what you can do is inject the test harness like this:
@RunWith(FeaturesRunner.class)
@Features({CoreFeature.class})
public class TestClass {
@Inject
protected RuntimeHarness harness.
@Test
public void myTest() throws Exception {
// deploy the complete bundle
harness.deployBundle("org.my.service");
// deploy a specific contribution
harness.deployContrib("org.my.service","OSGI-INF/my-test-contrib.xml");
}
}
02-05-2013 07:20 AM
Hi Edgar,
Using Deploy annotations on method does not do anything. In fact you should not be able to do this. We need to fix the target of the Deploy and LocalDeploy annotation. But what you can do is inject the test harness like this:
@RunWith(FeaturesRunner.class)
@Features({CoreFeature.class})
public class TestClass {
@Inject
protected RuntimeHarness harness.
@Test
public void myTest() throws Exception {
// deploy the complete bundle
harness.deployBundle("org.my.service");
// deploy a specific contribution
harness.deployContrib("org.my.service","OSGI-INF/my-test-contrib.xml");
}
}
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.