Permalink
Browse files

Add support for translating multiple cardinality information for requ…

…irements from the Application Modeller API to

OSGi.

git-svn-id: https://svn.apache.org/repos/asf/aries/trunk@1419804 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent f59e428 commit 6740c720aa5d7eb49646e6332b1cd6c1d2f1b9f8 John Ross committed Dec 10, 2012
@@ -189,6 +189,9 @@ private void computeOsgiServiceRequirements(ModelledResource resource) {
.directive(
Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE,
service.isOptional() ? Namespace.RESOLUTION_OPTIONAL : Namespace.RESOLUTION_MANDATORY)
+ .directive(
+ Namespace.REQUIREMENT_CARDINALITY_DIRECTIVE,
+ service.isMultiple() ? Namespace.CARDINALITY_MULTIPLE : Namespace.CARDINALITY_SINGLE)
.resource(this)
.build());
}
@@ -151,7 +151,7 @@ private void computeScopedCapabilities(List<Capability> capabilities) throws Inv
computeOsgiServiceCapabilities(capabilities);
}
- public void computeOsgiServiceCapabilities(List<Capability> capabilities) throws InvalidSyntaxException {
+ private void computeOsgiServiceCapabilities(List<Capability> capabilities) throws InvalidSyntaxException {
SubsystemExportServiceHeader header = getSubsystemManifest().getSubsystemExportServiceHeader();
if (header == null)
return;
@@ -277,7 +277,7 @@ public void testImportServiceDependencySatisfiedByParent() throws Exception {
try {
Subsystem child = installSubsystemFromFile(parent, APPLICATION_A);
try {
- assertSubsystemImportServiceHeader(child, "osgi.service;filter:=\"(&(objectClass=bundle.b))\";resolution:=mandatory");
+ assertSubsystemImportServiceHeader(child, "osgi.service;filter:=\"(&(objectClass=bundle.b))\";resolution:=mandatory;cardinality:=single");
}
finally {
uninstallSubsystemSilently(child);
@@ -314,7 +314,7 @@ public void testMissingImportServiceDependencyOptional() throws Exception {
try {
Subsystem subsystem = installSubsystemFromFile(APPLICATION_B);
try {
- assertSubsystemImportServiceHeader(subsystem, "osgi.service;filter:=\"(&(objectClass=bundle.a))\";resolution:=optional");
+ assertSubsystemImportServiceHeader(subsystem, "osgi.service;filter:=\"(&(objectClass=bundle.a))\";resolution:=optional;cardinality:=single");
}
finally {
uninstallSubsystemSilently(subsystem);

0 comments on commit 6740c72

Please sign in to comment.