Somethings wrong with my test,
@Rule
public final OsgiContext context = new OsgiContextBuilder().build();
@Test
public void test() throws CiscoAPIException, FailedSecurityException {
context.registerInjectActivateService(BusinessServiceImpl.class);
BusinessService service = context.getService(BusinessService.class);
Assert.assertEquals("got more campaigns than
expected",0,service.getAllCampaigns().size());
}
Above are failing at
"context.registerInjectActivateService(BusinessServiceImpl.class);"
With this message:
org.apache.sling.testing.mock.osgi.NoScrMetadataException: No OSGi SCR
metadata found for class java.lang.Class
at
org.apache.sling.testing.mock.osgi.OsgiServiceUtil.injectServices(OsgiServiceUtil.java:381)
at
org.apache.sling.testing.mock.osgi.MockOsgi.injectServices(MockOsgi.java:148)
at
org.apache.sling.testing.mock.osgi.context.OsgiContextImpl.registerInjectActivateService(OsgiContextImpl.java:153)
at
org.apache.sling.testing.mock.osgi.context.OsgiContextImpl.registerInjectActivateService(OsgiContextImpl.java:141)
at
dk.netdesign.dialer.backend.SlingMockTestBusinessService.test(SlingMockTestBusinessService.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
When debugging the test the actual fail are :
class org.apache.sling.testing.mock.osgi.MockConfigurationAdmin
Which comes from OsgiContextImpl.setUp().. Seems I am missing something,
what am I doing wrong?
--
Best regards / Med venlig hilsen
Nino Martinez