use of org.apache.aries.subsystem.util.felix.FelixCapabilityAdapter in project aries by apache.
the class FelixCapabilityAdapterTest method testOsgiWiringBundleNamespace.
@Test
public void testOsgiWiringBundleNamespace() {
Capability cap = EasyMock.createNiceMock(Capability.class);
EasyMock.expect(cap.getName()).andReturn(Capability.BUNDLE);
EasyMock.replay(cap);
FelixCapabilityAdapter adapter = new FelixCapabilityAdapter(cap, EasyMock.createNiceMock(org.osgi.resource.Resource.class));
assertEquals("Wrong namespace", BundleNamespace.BUNDLE_NAMESPACE, adapter.getNamespace());
}
use of org.apache.aries.subsystem.util.felix.FelixCapabilityAdapter in project aries by apache.
the class FelixCapabilityAdapterTest method testObjectClassAttribute.
@Test
public void testObjectClassAttribute() {
String objectClass = "com.foo.Bar";
Capability cap = EasyMock.createNiceMock(Capability.class);
EasyMock.expect(cap.getName()).andReturn(Capability.SERVICE);
Map<String, Object> props = new HashMap<String, Object>();
props.put(ServiceNamespace.CAPABILITY_OBJECTCLASS_ATTRIBUTE.toLowerCase(), objectClass);
EasyMock.expect(cap.getPropertiesAsMap()).andReturn(props);
EasyMock.replay(cap);
FelixCapabilityAdapter adapter = new FelixCapabilityAdapter(cap, EasyMock.createNiceMock(org.osgi.resource.Resource.class));
assertEquals("Wrong value for attribute " + ServiceNamespace.CAPABILITY_OBJECTCLASS_ATTRIBUTE, objectClass, adapter.getAttributes().get(ServiceNamespace.CAPABILITY_OBJECTCLASS_ATTRIBUTE));
}
use of org.apache.aries.subsystem.util.felix.FelixCapabilityAdapter in project aries by apache.
the class FelixCapabilityAdapterTest method testOsgiWiringPackageAttribute.
@Test
public void testOsgiWiringPackageAttribute() {
String pkg = "com.foo.Bar";
Capability cap = EasyMock.createNiceMock(Capability.class);
EasyMock.expect(cap.getName()).andReturn(Capability.PACKAGE).anyTimes();
Map<String, Object> props = new HashMap<String, Object>();
props.put(Capability.PACKAGE, pkg);
EasyMock.expect(cap.getPropertiesAsMap()).andReturn(props);
EasyMock.replay(cap);
FelixCapabilityAdapter adapter = new FelixCapabilityAdapter(cap, EasyMock.createNiceMock(org.osgi.resource.Resource.class));
assertEquals("Wrong value for attribute " + PackageNamespace.PACKAGE_NAMESPACE, pkg, adapter.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE));
}
use of org.apache.aries.subsystem.util.felix.FelixCapabilityAdapter in project aries by apache.
the class FelixCapabilityAdapterTest method testOsgiWiringPackageNamespace.
@Test
public void testOsgiWiringPackageNamespace() {
Capability cap = EasyMock.createNiceMock(Capability.class);
EasyMock.expect(cap.getName()).andReturn(Capability.PACKAGE);
EasyMock.replay(cap);
FelixCapabilityAdapter adapter = new FelixCapabilityAdapter(cap, EasyMock.createNiceMock(org.osgi.resource.Resource.class));
assertEquals("Wrong namespace", PackageNamespace.PACKAGE_NAMESPACE, adapter.getNamespace());
}
use of org.apache.aries.subsystem.util.felix.FelixCapabilityAdapter in project aries by apache.
the class FelixCapabilityAdapterTest method testOsgiWiringBundleAttribute.
@Test
public void testOsgiWiringBundleAttribute() {
String symbolicName = "derbyclient";
Capability cap = EasyMock.createNiceMock(Capability.class);
EasyMock.expect(cap.getName()).andReturn(Capability.BUNDLE).anyTimes();
Map<String, Object> props = new HashMap<String, Object>();
props.put(Resource.SYMBOLIC_NAME, symbolicName);
EasyMock.expect(cap.getPropertiesAsMap()).andReturn(props);
EasyMock.replay(cap);
FelixCapabilityAdapter adapter = new FelixCapabilityAdapter(cap, EasyMock.createNiceMock(org.osgi.resource.Resource.class));
assertEquals("Wrong value for attribute " + BundleNamespace.BUNDLE_NAMESPACE, symbolicName, adapter.getAttributes().get(BundleNamespace.BUNDLE_NAMESPACE));
}
Aggregations