Christoph Thodte created SLING-6069:
---------------------------------------
Summary: Error: Multiple matches found for unary reference
'factory'
Key: SLING-6069
URL: https://issues.apache.org/jira/browse/SLING-6069
Project: Sling
Issue Type: Bug
Components: Testing
Affects Versions: Testing Sling Mock Oak 2.0.2, Testing Sling Mock 2.1.0
Reporter: Christoph Thodte
When starting with a simple test using a the special rs type
ResourceResolverType.JCR_OAK
{code:java}
public class FormularServiceTest {
@Rule
public final SlingContext slingContext = new
SlingContext(ResourceResolverType.JCR_OAK);
@Test
public void testFormService() {
FormularService formularService =
slingContext.registerInjectActivateService(new FormularService());
FormModel form = formularService.findFormByFormId("331");
Assert.assertNotNull(form);
}
...
{code}
I get the error
org.apache.sling.testing.mock.osgi.ReferenceViolationException: Multiple
matches found for unary reference 'factory' for class
de.htsolutions.formver.service.FormularService
at
org.apache.sling.testing.mock.osgi.OsgiServiceUtil.injectServiceReference(OsgiServiceUtil.java:416)
at
org.apache.sling.testing.mock.osgi.OsgiServiceUtil.injectServices(OsgiServiceUtil.java:389)
at
org.apache.sling.testing.mock.osgi.MockOsgi.injectServices(MockOsgi.java:146)
I debug the code and I find that the reason is that there are two
resourceresolver in context not only one.
What's the problem here? Is it a bug? Problem in setup?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)