Search in sources :

Example 1 with FelixRequirementAdapter

use of org.apache.aries.subsystem.util.felix.FelixRequirementAdapter in project aries by apache.

the class FelixRequirementAdapterTest method testResolutionDirectiveMandatory.

@Test
public void testResolutionDirectiveMandatory() {
    Requirement req = EasyMock.createNiceMock(Requirement.class);
    EasyMock.expect(req.getFilter()).andReturn("");
    EasyMock.expect(req.isOptional()).andReturn(false);
    EasyMock.replay(req);
    FelixRequirementAdapter adapter = new FelixRequirementAdapter(req, EasyMock.createNiceMock(Resource.class));
    assertEquals("Wrong value for directive " + Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE, Namespace.RESOLUTION_MANDATORY, adapter.getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE));
}
Also used : FelixRequirementAdapter(org.apache.aries.subsystem.util.felix.FelixRequirementAdapter) Requirement(org.apache.felix.bundlerepository.Requirement) Resource(org.osgi.resource.Resource) Test(org.junit.Test)

Example 2 with FelixRequirementAdapter

use of org.apache.aries.subsystem.util.felix.FelixRequirementAdapter in project aries by apache.

the class FelixRequirementAdapterTest method testCardinalityDirectiveMultiple.

@Test
public void testCardinalityDirectiveMultiple() {
    Requirement req = EasyMock.createNiceMock(Requirement.class);
    EasyMock.expect(req.getFilter()).andReturn("");
    EasyMock.expect(req.isMultiple()).andReturn(true);
    EasyMock.replay(req);
    FelixRequirementAdapter adapter = new FelixRequirementAdapter(req, EasyMock.createNiceMock(Resource.class));
    assertEquals("Wrong value for directive " + Namespace.REQUIREMENT_CARDINALITY_DIRECTIVE, Namespace.CARDINALITY_MULTIPLE, adapter.getDirectives().get(Namespace.REQUIREMENT_CARDINALITY_DIRECTIVE));
}
Also used : FelixRequirementAdapter(org.apache.aries.subsystem.util.felix.FelixRequirementAdapter) Requirement(org.apache.felix.bundlerepository.Requirement) Resource(org.osgi.resource.Resource) Test(org.junit.Test)

Example 3 with FelixRequirementAdapter

use of org.apache.aries.subsystem.util.felix.FelixRequirementAdapter in project aries by apache.

the class FelixRequirementAdapterTest method testResolutionDirectiveOptional.

@Test
public void testResolutionDirectiveOptional() {
    Requirement req = EasyMock.createNiceMock(Requirement.class);
    EasyMock.expect(req.getFilter()).andReturn("");
    EasyMock.expect(req.isOptional()).andReturn(true);
    EasyMock.replay(req);
    FelixRequirementAdapter adapter = new FelixRequirementAdapter(req, EasyMock.createNiceMock(Resource.class));
    assertEquals("Wrong value for directive " + Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE, Namespace.RESOLUTION_OPTIONAL, adapter.getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE));
}
Also used : FelixRequirementAdapter(org.apache.aries.subsystem.util.felix.FelixRequirementAdapter) Requirement(org.apache.felix.bundlerepository.Requirement) Resource(org.osgi.resource.Resource) Test(org.junit.Test)

Example 4 with FelixRequirementAdapter

use of org.apache.aries.subsystem.util.felix.FelixRequirementAdapter in project aries by apache.

the class FelixRequirementAdapterTest method testCardinalityDirectiveSingle.

@Test
public void testCardinalityDirectiveSingle() {
    Requirement req = EasyMock.createNiceMock(Requirement.class);
    EasyMock.expect(req.getFilter()).andReturn("");
    EasyMock.expect(req.isMultiple()).andReturn(false);
    EasyMock.replay(req);
    FelixRequirementAdapter adapter = new FelixRequirementAdapter(req, EasyMock.createNiceMock(Resource.class));
    assertEquals("Wrong value for directive " + Namespace.REQUIREMENT_CARDINALITY_DIRECTIVE, Namespace.CARDINALITY_SINGLE, adapter.getDirectives().get(Namespace.REQUIREMENT_CARDINALITY_DIRECTIVE));
}
Also used : FelixRequirementAdapter(org.apache.aries.subsystem.util.felix.FelixRequirementAdapter) Requirement(org.apache.felix.bundlerepository.Requirement) Resource(org.osgi.resource.Resource) Test(org.junit.Test)

Aggregations

FelixRequirementAdapter (org.apache.aries.subsystem.util.felix.FelixRequirementAdapter)4 Requirement (org.apache.felix.bundlerepository.Requirement)4 Test (org.junit.Test)4 Resource (org.osgi.resource.Resource)4