You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by zo...@apache.org on 2011/02/27 21:20:30 UTC
svn commit: r1075132 [11/18] - in /aries/tags/application-0.3: ./
application-api/ application-api/src/ application-api/src/main/
application-api/src/main/java/ application-api/src/main/java/org/
application-api/src/main/java/org/apache/ application-ap...
Added: aries/tags/application-0.3/application-modeller/src/test/java/org/apache/aries/application/modelling/utils/BundleResourceTest.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-modeller/src/test/java/org/apache/aries/application/modelling/utils/BundleResourceTest.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-modeller/src/test/java/org/apache/aries/application/modelling/utils/BundleResourceTest.java (added)
+++ aries/tags/application-0.3/application-modeller/src/test/java/org/apache/aries/application/modelling/utils/BundleResourceTest.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.application.modelling.utils;
+
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.jar.Manifest;
+
+import org.apache.aries.application.InvalidAttributeException;
+import org.apache.aries.application.management.ResolverException;
+import org.apache.aries.application.modelling.ModelledResource;
+import org.apache.aries.application.modelling.ResourceType;
+import org.apache.aries.application.modelling.impl.ModelledResourceImpl;
+import org.junit.Test;
+import org.osgi.framework.Constants;
+
+public class BundleResourceTest extends AbstractBundleResourceTest
+{
+ /**
+ *
+ */
+ private static final String MANIFEST_MF = "MANIFEST.MF";
+ /**
+ *
+ */
+ private static final String TEST_APP_MANIFEST_PATH = "../src/test/resources/bundles/test.bundle1.jar/META-INF";
+
+ /**
+ * @return
+ * @throws IOException
+ * @throws FileNotFoundException
+ * @throws ResolverException
+ * @throws InvalidAttributeException
+ */
+ protected ModelledResource instantiateBundleResource() throws Exception
+ {
+ File file = new File(TEST_APP_MANIFEST_PATH, MANIFEST_MF);
+ Manifest man = new Manifest(new FileInputStream(file));
+
+ ModelledResource br = new ModelledResourceImpl(null, man.getMainAttributes(), null, null);
+ return br;
+ }
+
+ @Test
+ public void testBundleResourceIsBundle() throws Exception
+ {
+ assertEquals(ResourceType.BUNDLE, bundleResource.getType());
+ }
+
+ @Test
+ public void testFragmentCapability()
+ {
+ assertEquals("The bundle resource is wrong.", Constants.FRAGMENT_ATTACHMENT_ALWAYS,
+ bundleResource.getExportedBundle().getAttributes().get(Constants.FRAGMENT_ATTACHMENT_DIRECTIVE + ":"));
+ }
+}
Added: aries/tags/application-0.3/application-modeller/src/test/java/org/apache/aries/application/modelling/utils/DeployedBundlesTest.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-modeller/src/test/java/org/apache/aries/application/modelling/utils/DeployedBundlesTest.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-modeller/src/test/java/org/apache/aries/application/modelling/utils/DeployedBundlesTest.java (added)
+++ aries/tags/application-0.3/application-modeller/src/test/java/org/apache/aries/application/modelling/utils/DeployedBundlesTest.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,585 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.application.modelling.utils;
+
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.jar.Attributes;
+
+import org.apache.aries.application.InvalidAttributeException;
+import org.apache.aries.application.management.ResolverException;
+import org.apache.aries.application.modelling.DeployedBundles;
+import org.apache.aries.application.modelling.ExportedService;
+import org.apache.aries.application.modelling.ImportedBundle;
+import org.apache.aries.application.modelling.ImportedService;
+import org.apache.aries.application.modelling.ModelledResource;
+import org.apache.aries.application.modelling.impl.ExportedServiceImpl;
+import org.apache.aries.application.modelling.impl.ImportedBundleImpl;
+import org.apache.aries.application.modelling.impl.ImportedServiceImpl;
+import org.apache.aries.application.modelling.impl.ModelledResourceImpl;
+import org.apache.aries.application.modelling.utils.impl.ModellingHelperImpl;
+import org.apache.aries.application.utils.manifest.ManifestHeaderProcessor;
+import org.apache.aries.application.utils.manifest.ManifestHeaderProcessor.NameValueMap;
+import org.apache.aries.application.utils.manifest.ManifestHeaderProcessor.NameValuePair;
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.framework.Constants;
+
+
+public final class DeployedBundlesTest
+{
+
+ private DeployedBundles validDeployedBundles() throws Exception {
+
+ Collection<ImportedBundle> content = new ArrayList<ImportedBundle>();
+ Collection<ImportedBundle> uses = new ArrayList<ImportedBundle>();
+
+ content.add(new ImportedBundleImpl("bundle.a", "1.0.0"));
+ content.add(new ImportedBundleImpl("bundle.b", "1.0.0"));
+
+ uses.add(new ImportedBundleImpl("bundle.c", "1.0.0"));
+ uses.add(new ImportedBundleImpl("bundle.d", "1.0.0"));
+
+ return new ModellingHelperImpl().createDeployedBundles("test",content, uses, null);
+ }
+
+ private void basicResolve(DeployedBundles db, boolean cPersistent) throws InvalidAttributeException {
+ db.addBundle(createModelledResource("bundle.a", "1.0.0",
+ Arrays.asList("package.b", "package.c"), Arrays.asList("package.a;version=1.0.0")));
+ db.addBundle(createModelledResource("bundle.b", "1.0.0",
+ Arrays.asList("package.d;version=1.0.0", "package.e;version=\"[1.0.0,2.0.0)\"", "package.g"),
+ Arrays.asList("package.b;version=1.0.0")));
+
+ db.addBundle(createModelledResource("bundle.c", "1.0.0",
+ (cPersistent) ? Arrays.asList("package.d;version=\"[1.0.0,2.0.0)\"", "javax.persistence;version=1.1.0") :
+ Arrays.asList("package.d;version=\"[1.0.0,2.0.0)\""), Arrays.asList("package.c;version=1.0.0")));
+ db.addBundle(createModelledResource("bundle.d", "1.0.0",
+ Arrays.asList("package.e;version=\"[1.0.0,1.0.0]\""), Arrays.asList("package.d;version=1.0.0")));
+
+ }
+
+ private void packagesResolve(DeployedBundles db) throws InvalidAttributeException {
+ basicResolve(db, false);
+
+ db.addBundle(createModelledResource("bundle.e", "1.0.0",
+ new ArrayList<String>(), Arrays.asList("package.e;version=1.0.0")));
+ }
+
+ public static ModelledResource createModelledResource(String bundleName, String bundleVersion,
+ Collection<String> importedPackages, Collection<String> exportedPackages) throws InvalidAttributeException {
+ Attributes att = new Attributes();
+ att.put(new Attributes.Name(Constants.BUNDLE_SYMBOLICNAME), bundleName);
+ att.put(new Attributes.Name(Constants.BUNDLE_VERSION), bundleVersion);
+ att.put(new Attributes.Name(Constants.BUNDLE_MANIFESTVERSION), "2");
+
+ StringBuilder builder = new StringBuilder();
+ for(String iPackage : importedPackages) {
+ builder.append(iPackage).append(",");
+ }
+ if(builder.length() > 0) {
+ builder.deleteCharAt(builder.length() - 1);
+ att.put(new Attributes.Name(Constants.IMPORT_PACKAGE), builder.toString());
+ }
+
+ builder = new StringBuilder();
+ for(String ePackage : exportedPackages) {
+ builder.append(ePackage).append(",");
+ }
+ if(builder.length() > 0) {
+ builder.deleteCharAt(builder.length() - 1);
+ att.put(new Attributes.Name(Constants.EXPORT_PACKAGE), builder.toString());
+ }
+ return new ModelledResourceImpl(null, att, null, null);
+ }
+
+ public static ModelledResource createModelledServiceBundle(String bundleName, String bundleVersion,
+ Collection<String> importService, Collection<String> exportService) throws InvalidAttributeException
+ {
+ Attributes att = new Attributes();
+ att.put(new Attributes.Name(Constants.BUNDLE_SYMBOLICNAME), bundleName);
+ att.put(new Attributes.Name(Constants.BUNDLE_VERSION), bundleVersion);
+ att.put(new Attributes.Name(Constants.BUNDLE_MANIFESTVERSION), "2");
+
+ List<ImportedService> importedServices = new ArrayList<ImportedService>();
+ for (String s : importService) {
+ importedServices.add(new ImportedServiceImpl(false, s, null, null, null, false));
+ }
+
+ List<ExportedService> exportedServices = new ArrayList<ExportedService>();
+ for (String s : exportService) {
+ exportedServices.add(new ExportedServiceImpl(null, 0, Collections.singleton(s), Collections.<String,Object>emptyMap()));
+ }
+
+ return new ModelledResourceImpl(null, att, importedServices, exportedServices);
+ }
+
+ /**
+ * Check the actual results match the expected values, regardless of order of the parts.
+ * @param entry the actual manifest entry.
+ * @param expected the expected manifest entry.
+ * @return true if they match; false otherwise.
+ */
+ private static boolean isEqual(String actual, String expected)
+ {
+ Map<NameValuePair<String, NameValueMap<String, String>>, Integer> actualEntries = parseEntries(actual);
+ Map<NameValuePair<String, NameValueMap<String, String>>, Integer> expectedEntries = parseEntries(expected);
+ return actualEntries.equals(expectedEntries);
+ }
+
+ /**
+ * Parse manifest entries into a set of values and associated attributes, which can
+ * be directly compared for equality regardless of ordering.
+ * <p>
+ * Example manifest entry format: value1;attrName1=attrValue1;attrName2=attrValue2,value2;attrName1=attrValue1
+ * @param entries a manifest header entry.
+ * @return a set of parsed entries.
+ */
+ private static Map<NameValuePair<String, NameValueMap<String, String>>, Integer> parseEntries(String entries)
+ {
+ Map<NameValuePair<String, NameValueMap<String, String>>, Integer> result = new HashMap<NameValuePair<String, NameValueMap<String, String>>, Integer>();
+ for (NameValuePair<String, NameValueMap<String, String>> entry : ManifestHeaderProcessor.parseExportString(entries))
+ {
+ Integer count = result.get(entry);
+ if (count != null)
+ {
+ // This entry already exists to increment the count.
+ count++;
+ }
+ else
+ {
+ count = 1;
+ }
+ result.put(entry, count);
+ }
+
+ return result;
+ }
+
+ @Test
+ public void testGetContent_Valid() throws Exception
+ {
+ // Get a valid set of deployment information.
+ DeployedBundles deployedBundles = validDeployedBundles();
+ packagesResolve(deployedBundles);
+
+ // Check the deployed content entry is correct.
+ String contentEntry = deployedBundles.getContent();
+ String expectedResult = "bundle.a;deployed-version=1.0.0,bundle.b;deployed-version=1.0.0";
+ Assert.assertTrue("Content=" + contentEntry, isEqual(contentEntry, expectedResult));
+ }
+
+ @Test
+ public void testGetUseBundle_Valid() throws Exception
+ {
+ // Get a valid set of deployment information.
+ DeployedBundles deployedBundles = validDeployedBundles();
+ packagesResolve(deployedBundles);
+
+ // Check the deployed use bundle entry is correct.
+ String useBundleEntry = deployedBundles.getUseBundle();
+ String expectedResult = "bundle.c;deployed-version=1.0.0,bundle.d;deployed-version=1.0.0";
+ Assert.assertTrue("UseBundle=" + useBundleEntry, isEqual(useBundleEntry, expectedResult));
+ }
+
+ @Test
+ public void testGetProvisionBundle_Valid() throws Exception
+ {
+ // Check the provision bundle entry is correct.
+ DeployedBundles deployedBundles = validDeployedBundles();
+ packagesResolve(deployedBundles);
+ String provisionBundleEntry = deployedBundles.getProvisionBundle();
+ String expectedResult = "bundle.e;deployed-version=1.0.0";
+ Assert.assertTrue("ProvisionBundle=" + provisionBundleEntry, isEqual(provisionBundleEntry, expectedResult));
+ }
+
+ @Test
+ public void testGetImportPackage_Valid() throws Exception
+ {
+ // Check the import package entry is correct.
+ String importPackageEntry = null;
+ try
+ {
+ DeployedBundles deployedBundles = validDeployedBundles();
+ packagesResolve(deployedBundles);
+
+ importPackageEntry = deployedBundles.getImportPackage();
+ }
+ catch (ResolverException e)
+ {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+
+ String expectedResult = "package.c;version=\"1.0.0\";bundle-symbolic-name=\"bundle.c\";bundle-version=\"[1.0.0,1.0.0]\","
+ + "package.d;version=\"1.0.0\";bundle-symbolic-name=\"bundle.d\";bundle-version=\"[1.0.0,1.0.0]\","
+ + "package.e;version=\"[1.0.0,2.0.0)\","
+ + "package.g;version=\"0.0.0\"";
+
+
+ /*
+ * String expectedResult = "package.c;bundle-symbolic-name=bundle.c;bundle-version=\"[1.0.0,1.0.0]\""
+
+ + ",package.d;version=\"1.0.0\";bundle-symbolic-name=bundle.d;bundle-version=\"[1.0.0,1.0.0]\""
+ + ",package.e;version=\"[1.0.0,2.0.0)\""
+ + ",package.g";
+ */
+ Assert.assertTrue("ImportPackage=" + importPackageEntry, isEqual(importPackageEntry, expectedResult));
+ }
+
+
+
+
+ private enum ternary { CONTENT,USES,NONE }
+
+ private DeployedBundles getSimpleDeployedBundles(ternary a, ternary b, ternary c) throws InvalidAttributeException
+ {
+ Collection<ImportedBundle> content = new ArrayList<ImportedBundle>();
+ Collection<ImportedBundle> uses = new ArrayList<ImportedBundle>();
+
+ if(a == ternary.CONTENT)
+ content.add(new ImportedBundleImpl("bundle.a", "1.0.0"));
+ else if (a == ternary.USES)
+ uses.add(new ImportedBundleImpl("bundle.a", "1.0.0"));
+ if (b == ternary.CONTENT)
+ content.add(new ImportedBundleImpl("bundle.b", "1.0.0"));
+ else if (b == ternary.USES)
+ uses.add(new ImportedBundleImpl("bundle.b", "1.0.0"));
+ if (c == ternary.CONTENT)
+ content.add(new ImportedBundleImpl("bundle.c", "1.0.0"));
+ else if (c == ternary.USES)
+ uses.add(new ImportedBundleImpl("bundle.c", "1.0.0"));
+
+ // In a unit test we could go straight to the static method; choosing not to in this case.
+ return new ModellingHelperImpl().createDeployedBundles("test",content, uses, null);
+ }
+
+ @Test
+ public void testGetImportPackage_ValidDuplicates() throws Exception
+ {
+ DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.CONTENT, ternary.CONTENT);
+
+ deployedBundles.addBundle(createModelledResource("bundle.a", "1.0.0",
+ Arrays.asList("package.d;version=\"[1.0.0,3.0.0)\""), new ArrayList<String>()));
+ deployedBundles.addBundle(createModelledResource("bundle.b", "1.0.0",
+ Arrays.asList("package.d;version=\"2.0.0\""), new ArrayList<String>()));
+ deployedBundles.addBundle(createModelledResource("bundle.c", "1.0.0",
+ Arrays.asList("package.d;version=\"1.0.0\""), new ArrayList<String>()));
+ deployedBundles.addBundle(createModelledResource("bundle.d", "1.0.0",
+ new ArrayList<String>(), Arrays.asList("package.d;version=2.0.1")));
+
+ // Check that package D is not duplicated in Import-Package, and that the version range
+ // has been narrowed to the intersection of the original requirements.
+ String importPackageEntry = null;
+ try
+ {
+ importPackageEntry = deployedBundles.getImportPackage();
+ }
+ catch (ResolverException e)
+ {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ String expectedResult = "package.d;version=\"[2.0.0,3.0.0)\"";
+ Assert.assertTrue("ImportPackage=" + importPackageEntry, isEqual(importPackageEntry, expectedResult));
+ }
+
+ @Test
+ public void testGetImportPackage_ValidDuplicatesWithAttributes() throws Exception
+ {
+ DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.CONTENT, ternary.NONE);
+
+ deployedBundles.addBundle(createModelledResource("bundle.a", "1.0.0",
+ Arrays.asList("package.c;version=1.0.0;was_internal=true"), new ArrayList<String>()));
+ deployedBundles.addBundle(createModelledResource("bundle.b", "1.0.0",
+ Arrays.asList("package.c;version=2.0.0;was_internal=true"), new ArrayList<String>()));
+ deployedBundles.addBundle(createModelledResource("bundle.c", "1.0.0",
+ new ArrayList<String>(), Arrays.asList("package.c;version=2.0.0;was_internal=true")));
+
+ // Check that package C is not duplicated in Import-Package, and that the version range
+ // has been narrowed to the intersection of the original requirements.
+ String importPackageEntry = null;
+ try
+ {
+ importPackageEntry = deployedBundles.getImportPackage();
+ }
+ catch (ResolverException e)
+ {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ String expectedResult = "package.c;was_internal=\"true\";version=\"2.0.0\"";
+ Assert.assertTrue("ImportPackage=" + importPackageEntry, isEqual(importPackageEntry, expectedResult));
+ }
+
+ @Test
+ public void testGetImportPackage_InvalidDuplicates() throws Exception
+ {
+ DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.CONTENT, ternary.NONE);
+
+ deployedBundles.addBundle(createModelledResource("bundle.a", "1.0.0",
+ Arrays.asList("package.c;version=\"[1.0.0,2.0.0)\""), new ArrayList<String>()));
+ deployedBundles.addBundle(createModelledResource("bundle.b", "1.0.0",
+ Arrays.asList("package.c;version=2.0.0"), new ArrayList<String>()));
+ deployedBundles.addBundle(createModelledResource("bundle.c", "1.0.0",
+ new ArrayList<String>(), Arrays.asList("package.c;version=2.0.0;was_internal=true")));
+
+ // Check that the incompatible version requirements cannot be resolved.
+ String importPackageEntry = null;
+ try
+ {
+ importPackageEntry = deployedBundles.getImportPackage();
+ Assert.fail("Expected exception. ImportPackage=" + importPackageEntry);
+ }
+ catch (ResolverException e)
+ {
+ // We expect to reach this point if the test passes.
+ }
+ }
+
+ @Test
+ public void testGetImportPackage_InvalidDuplicatesWithAttributes() throws Exception
+ {
+ DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.CONTENT, ternary.NONE);
+
+ deployedBundles.addBundle(createModelledResource("bundle.a", "1.0.0",
+ Arrays.asList("package.c;version=1.0.0;was_internal=true"), new ArrayList<String>()));
+ deployedBundles.addBundle(createModelledResource("bundle.b", "1.0.0",
+ Arrays.asList("package.c;version=2.0.0"), new ArrayList<String>()));
+ deployedBundles.addBundle(createModelledResource("bundle.c", "1.0.0",
+ new ArrayList<String>(), Arrays.asList("package.c;version=2.0.0;was_internal=true")));
+
+ // Check that the incompatible package requirement attributes cause an exception.
+ String importPackageEntry = null;
+ try
+ {
+ importPackageEntry = deployedBundles.getImportPackage();
+ Assert.fail("Expected exception. ImportPackage=" + importPackageEntry);
+ }
+ catch (ResolverException e)
+ {
+ // We expect to reach this point if the test passes.
+ }
+ }
+
+
+ @Test
+ public void testGetImportPackage_bundleSymbolicNameOK() throws Exception
+ {
+ DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.CONTENT, ternary.NONE);
+
+ deployedBundles.addBundle(createModelledResource("bundle.a", "1.0.0",
+ Arrays.asList("package.b;version=1.0.0;bundle-symbolic-name=bundle.b;bundle-version=\"[1.0.0,2.0.0)\""), new ArrayList<String>()));
+ deployedBundles.addBundle(createModelledResource("bundle.b", "1.0.0",
+ new ArrayList<String>(), Arrays.asList("package.b;version=2.0.0")));
+
+ // Check that the bundle-symbolic-name attribute for a bundle within deployed-content is ok.
+ String importPackageEntry = null;
+ try
+ {
+ importPackageEntry = deployedBundles.getImportPackage();
+ }
+ catch (ResolverException e)
+ {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ String expectedResult = ""; // All packages are satisfied internally
+ Assert.assertTrue("ImportPackage=" + importPackageEntry, isEqual(importPackageEntry, expectedResult));
+
+ }
+
+ @Test
+ public void testGetImportPackage_rfc138PreventsBundleSymbolicNameWorking() throws Exception
+ {
+ DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.USES, ternary.NONE);
+
+ deployedBundles.addBundle(createModelledResource("bundle.a", "1.0.0",
+ Arrays.asList("package.b;version=1.0.0;bundle-symbolic-name=bundle.b"), new ArrayList<String>()));
+ deployedBundles.addBundle(createModelledResource("bundle.b", "1.0.0",
+ new ArrayList<String>(), Arrays.asList("package.b;version=2.0.0")));
+
+
+ // Check that the bundle-symbolic-name attribute for a bundle outside use-bundle causes an exception.
+ String importPackageEntry = null;
+ try
+ {
+ importPackageEntry = deployedBundles.getImportPackage();
+ Assert.fail("Expected exception. ImportPackage=" + importPackageEntry);
+ }
+ catch (ResolverException e)
+ {
+ // We expect to reach this point if the test passes.
+ }
+ }
+
+ @Test
+ public void testGetImportPackage_rfc138PreventsBundleVersionWorking() throws Exception
+ {
+ DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.NONE, ternary.NONE);
+
+ deployedBundles.addBundle(createModelledResource("bundle.a", "1.0.0",
+ Arrays.asList("package.b;version=1.0.0;bundle-version=1.0.0"), new ArrayList<String>()));
+ deployedBundles.addBundle(createModelledResource("bundle.b", "1.0.0",
+ new ArrayList<String>(), Arrays.asList("package.b;version=2.0.0")));
+
+
+ // Check that the bundle-symbolic-name attribute for a bundle outside use-bundle causes an exception.
+ String importPackageEntry = null;
+ try
+ {
+ importPackageEntry = deployedBundles.getImportPackage();
+ Assert.fail("Expected exception. ImportPackage=" + importPackageEntry);
+ }
+ catch (ResolverException e)
+ {
+ // We expect to reach this point if the test passes.
+ }
+ }
+
+ @Test
+ public void testGetImportPackage_ValidResolutionAttribute() throws Exception
+ {
+ DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.CONTENT, ternary.NONE);
+
+ deployedBundles.addBundle(createModelledResource("bundle.a", "1.0.0",
+ Arrays.asList("package.c;version=1.0.0;resolution:=optional"), new ArrayList<String>()));
+ deployedBundles.addBundle(createModelledResource("bundle.b", "1.0.0",
+ Arrays.asList("package.c;version=1.0.0"), new ArrayList<String>()));
+ deployedBundles.addBundle(createModelledResource("bundle.c", "1.0.0",
+ new ArrayList<String>(), Arrays.asList("package.c;version=1.0.0")));
+
+ // Check that the resulting resolution directive is not optional.
+ String importPackageEntry = null;
+ try
+ {
+ importPackageEntry = deployedBundles.getImportPackage();
+ }
+ catch (ResolverException e)
+ {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ String expectedResult = "package.c;version=1.0.0";
+ Assert.assertTrue("ImportPackage=" + importPackageEntry, isEqual(importPackageEntry, expectedResult));
+ }
+
+ @Test
+ public void testGetRequiredUseBundle_RedundantEntry() throws Exception
+ {
+ // Bundle A requires package B from bundle B with no version requirement.
+ // Bundle B requires package C from bundle C with no version requirement.
+ // Bundle C requires package B from bundle B with explicit version requirement.
+
+ DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.USES, ternary.USES);
+
+ deployedBundles.addBundle(createModelledResource("bundle.a", "1.0.0",
+ Arrays.asList("package.b"), new ArrayList<String>()));
+ deployedBundles.addBundle(createModelledResource("bundle.b", "1.0.0",
+ Arrays.asList("package.c"), Arrays.asList("package.b;version=1.0.0")));
+ deployedBundles.addBundle(createModelledResource("bundle.c", "1.0.0",
+ Arrays.asList("package.b;version=1.0.0"), Arrays.asList("package.c;version=1.0.0")));
+
+ // Check the redundant use-bundle entry is identified.
+ // Bundle C is not required by app content, although it is specified in use-bundle.
+ Collection<ModelledResource> requiredUseBundle = null;
+ try
+ {
+ requiredUseBundle = deployedBundles.getRequiredUseBundle();
+ }
+ catch (ResolverException e)
+ {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ Assert.assertTrue("RequiredUseBundle=" + requiredUseBundle, requiredUseBundle.size() == 1);
+ }
+
+ @Test
+ public void testGetRequiredUseBundle_Valid() throws Exception
+ {
+ // Get a valid set of deployment information.
+ DeployedBundles deployedBundles = validDeployedBundles();
+ packagesResolve(deployedBundles);
+
+ // Check all the use-bundle entries are required.
+ Collection<ModelledResource> requiredUseBundle = null;
+ try
+ {
+ requiredUseBundle = deployedBundles.getRequiredUseBundle();
+ }
+ catch (ResolverException e)
+ {
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
+ Assert.assertTrue("RequiredUseBundle=" + requiredUseBundle, requiredUseBundle.size() == 2);
+ }
+
+ //Inside cannot bundle-symbolic-name an outside bundle until the new RFC 138!
+ @Test
+ public void testGetImportPackage_InvalidBundleVersion() throws Exception
+ {
+ DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.USES, ternary.NONE);
+
+ deployedBundles.addBundle(createModelledResource("bundle.a", "1.0.0",
+ Arrays.asList("package.b;version=\"[1.0.0,1.0.0]\";bundle-symbolic-name=bundle.b;bundle-version=\"[0.0.0,1.0.0)\"")
+ , new ArrayList<String>()));
+ deployedBundles.addBundle(createModelledResource("bundle.b", "1.0.0",
+ new ArrayList<String>(), Arrays.asList("package.b;version=1.0.0")));
+
+ // Check that the bundle version requirement generates an error because it doesn't match the a bundle in use-bundle.
+ String importPackageEntry = null;
+ try
+ {
+ importPackageEntry = deployedBundles.getImportPackage();
+ Assert.fail("Expected exception. ImportPackage=" + importPackageEntry);
+ }
+ catch (ResolverException e)
+ {
+ // We expect to reach this point if the test passes.
+ }
+ }
+
+
+ @Test
+ public void testImportedService() throws Exception
+ {
+ DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.NONE, ternary.NONE);
+
+ deployedBundles.addBundle(createModelledServiceBundle("bundle.a", "1.0.0",
+ Collections.singleton("java.util.List"), Collections.<String>emptyList()));
+
+ deployedBundles.addBundle(createModelledServiceBundle("bundle.b", "1.0.0",
+ Collections.singleton("java.util.Set"), Collections.singleton("java.util.List")));
+
+ deployedBundles.addBundle(createModelledServiceBundle("bundle.c", "1.0.0",
+ Collections.<String>emptyList(), Collections.singleton("java.util.Set")));
+
+ assertEquals("(objectClass=java.util.List)", deployedBundles.getDeployedImportService());
+ }
+
+}
Added: aries/tags/application-0.3/application-modeller/src/test/java/org/apache/aries/application/modelling/utils/ExportedServiceTest.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-modeller/src/test/java/org/apache/aries/application/modelling/utils/ExportedServiceTest.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-modeller/src/test/java/org/apache/aries/application/modelling/utils/ExportedServiceTest.java (added)
+++ aries/tags/application-0.3/application-modeller/src/test/java/org/apache/aries/application/modelling/utils/ExportedServiceTest.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.application.modelling.utils;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.aries.application.modelling.WrappedServiceMetadata;
+import org.apache.aries.application.modelling.impl.ExportedServiceImpl;
+import org.junit.Test;
+public class ExportedServiceTest
+{
+
+
+ @Test
+ public void checkEquality() {
+
+ // public ExportedService (String name, int ranking, Collection<String> ifaces,
+ // Map<String, String> serviceProperties ) {
+ Map<String, Object> props = new HashMap<String, Object>();
+ props.put ("away", "www.away.com");
+ props.put ("home", "www.home.net");
+ WrappedServiceMetadata wsm1 = new ExportedServiceImpl (null, 0, Arrays.asList("a.b.c", "d.e.f"), props);
+ WrappedServiceMetadata wsm2 = new ExportedServiceImpl (null, 0, Arrays.asList("d.e.f", "a.b.c"), props);
+
+ assertTrue ("Basic equality test", wsm1.equals(wsm2));
+ assertTrue ("Basic equality test", wsm2.equals(wsm1));
+ assertTrue ("Hashcodes equal", wsm1.hashCode() == wsm2.hashCode());
+
+
+
+ wsm2 = new ExportedServiceImpl (null, 0, Arrays.asList("d.e.f", "a.b.c", "g.e.f"), props);
+ assertFalse ("Adding an interface makes them different", wsm1.equals(wsm2));
+ assertFalse ("Adding an interface makes them different", wsm2.equals(wsm1));
+ assertFalse ("Hashcodes should differ", wsm1.hashCode() == wsm2.hashCode());
+
+ props = new HashMap<String, Object>(props);
+ props.put("interim", "w3.interim.org");
+
+ wsm1 = new ExportedServiceImpl (null, 0, Arrays.asList("a.b.c","d.e.f", "g.e.f"), props);
+
+ assertFalse ("Adding a service property makes them different", wsm1.equals(wsm2));
+ assertFalse ("Adding a service property makes them different", wsm2.equals(wsm1));
+ assertFalse ("Hashcodes still different", wsm1.hashCode() == wsm2.hashCode());
+ }
+}
Added: aries/tags/application-0.3/application-modeller/src/test/java/org/apache/aries/application/modelling/utils/PackageRequirementMergerTest.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-modeller/src/test/java/org/apache/aries/application/modelling/utils/PackageRequirementMergerTest.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-modeller/src/test/java/org/apache/aries/application/modelling/utils/PackageRequirementMergerTest.java (added)
+++ aries/tags/application-0.3/application-modeller/src/test/java/org/apache/aries/application/modelling/utils/PackageRequirementMergerTest.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,247 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.application.modelling.utils;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.aries.application.InvalidAttributeException;
+import org.apache.aries.application.VersionRange;
+import org.apache.aries.application.modelling.ImportedPackage;
+import org.apache.aries.application.modelling.impl.ImportedPackageImpl;
+import org.apache.aries.application.modelling.internal.PackageRequirementMerger;
+import org.apache.aries.application.utils.manifest.ManifestHeaderProcessor;
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.framework.Constants;
+
+
+public final class PackageRequirementMergerTest
+{
+ private static boolean isEqual(Collection<ImportedPackage> reqs1, Collection<ImportedPackage> reqs2)
+ {
+ boolean result = true;
+
+ if (reqs1.size() != reqs2.size())
+ {
+ result = false;
+ }
+ else
+ {
+ for (ImportedPackage r1 : reqs1)
+ {
+ boolean foundMatch = false;
+ for (ImportedPackage r2 : reqs2)
+ {
+ if (!r1.getPackageName().equals(r2.getPackageName()))
+ {
+ continue;
+ }
+
+ if (r1.isOptional() != r2.isOptional())
+ {
+ continue;
+ }
+
+ Map<String, String> attribs1 = new HashMap<String, String>(r1.getAttributes());
+ Map<String, String> attribs2 = new HashMap<String, String>(r2.getAttributes());
+
+ VersionRange v1 = ManifestHeaderProcessor.parseVersionRange(attribs1.remove(Constants.VERSION_ATTRIBUTE));
+ VersionRange v2 = ManifestHeaderProcessor.parseVersionRange(attribs2.remove(Constants.VERSION_ATTRIBUTE));
+ if (!v1.equals(v2))
+ {
+ continue;
+ }
+
+ if (!attribs1.equals(attribs2))
+ {
+ continue;
+ }
+
+ foundMatch = true;
+ break;
+ }
+
+ if (!foundMatch)
+ {
+ result = false;
+ break;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ static ImportedPackage newImportedPackage (String name, String version) throws InvalidAttributeException {
+ Map<String, String> attrs = new HashMap<String, String>();
+ attrs.put(Constants.VERSION_ATTRIBUTE, version);
+ return new ImportedPackageImpl (name, attrs);
+ }
+
+ static ImportedPackage newImportedPackage (String name, String version, boolean optional) throws InvalidAttributeException {
+ Map<String, String> attrs = new HashMap<String, String>();
+ attrs.put(Constants.VERSION_ATTRIBUTE, version);
+ attrs.put(Constants.RESOLUTION_DIRECTIVE + ":", (optional)?Constants.RESOLUTION_OPTIONAL:Constants.RESOLUTION_MANDATORY);
+ return new ImportedPackageImpl (name, attrs);
+ }
+
+ static ImportedPackage newImportedPackage (String name, String version, String attribute) throws InvalidAttributeException {
+ Map<String, String> attrs = new HashMap<String, String>();
+ attrs.put(Constants.VERSION_ATTRIBUTE, version);
+ attrs.put(attribute.split("=")[0], attribute.split("=")[1]);
+ return new ImportedPackageImpl (name, attrs);
+ }
+
+ @Test
+ public void testMergeValid() throws Exception
+ {
+ Collection<ImportedPackage> reqs = new ArrayList<ImportedPackage>();
+ reqs.add(newImportedPackage("a", "1.0.0"));
+ reqs.add(newImportedPackage("a", "2.0.0"));
+ reqs.add(newImportedPackage("a", "3.0.0"));
+ reqs.add(newImportedPackage("b", "1.0.0"));
+ reqs.add(newImportedPackage("b", "2.0.0"));
+ reqs.add(newImportedPackage("c", "1.0.0"));
+ PackageRequirementMerger merger = new PackageRequirementMerger(reqs);
+
+ Assert.assertTrue(merger.isMergeSuccessful());
+
+ Assert.assertTrue(merger.getInvalidRequirements().isEmpty());
+
+ Collection<ImportedPackage> result = merger.getMergedRequirements();
+ Collection<ImportedPackage> expected = new ArrayList<ImportedPackage>();
+ expected.add(newImportedPackage("a", "3.0.0"));
+ expected.add(newImportedPackage("b", "2.0.0"));
+ expected.add(newImportedPackage("c", "1.0.0"));
+ Assert.assertTrue(result.toString(), isEqual(result, expected));
+ }
+
+ @Test
+ public void testMergeInvalid() throws Exception
+ {
+ Collection<ImportedPackage> reqs = new ArrayList<ImportedPackage>();
+ reqs.add(newImportedPackage("a", "[1.0.0,2.0.0]"));
+ reqs.add(newImportedPackage("a", "[3.0.0,3.0.0]"));
+ reqs.add(newImportedPackage("b", "1.0.0"));
+ reqs.add(newImportedPackage("b", "2.0.0"));
+ reqs.add(newImportedPackage("c", "[1.0.0,2.0.0)"));
+ reqs.add(newImportedPackage("c", "2.0.0"));
+ PackageRequirementMerger merger = new PackageRequirementMerger(reqs);
+
+ Assert.assertFalse(merger.isMergeSuccessful());
+
+ try
+ {
+ merger.getMergedRequirements();
+ Assert.fail("getMergedRequirements should throw IllegalStateException.");
+ }
+ catch (IllegalStateException e) { }
+
+ Set<String> result = merger.getInvalidRequirements();
+ Set<String> expected = new HashSet<String>();
+ expected.add("a");
+ expected.add("c");
+ Assert.assertEquals(expected, result);
+ }
+
+ @Test
+ public void testMergeOptionalResolution() throws Exception
+ {
+ Collection<ImportedPackage> reqs = new ArrayList<ImportedPackage>();
+ reqs.add(newImportedPackage("a", "1.0.0", true));
+ reqs.add(newImportedPackage("a", "2.0.0", true));
+ PackageRequirementMerger merger = new PackageRequirementMerger(reqs);
+
+ Assert.assertTrue(merger.isMergeSuccessful());
+
+ Assert.assertTrue(merger.getInvalidRequirements().isEmpty());
+
+ Collection<ImportedPackage> result = merger.getMergedRequirements();
+ Collection<ImportedPackage> expected = new ArrayList<ImportedPackage>();
+ expected.add(newImportedPackage("a", "2.0.0", true));
+ Assert.assertTrue(result.toString(), isEqual(result, expected));
+ }
+
+ @Test
+ public void testMergeMandatoryResolution() throws Exception
+ {
+ Collection<ImportedPackage> reqs = new ArrayList<ImportedPackage>();
+ reqs.add(newImportedPackage("a", "1.0.0", true));
+ reqs.add(newImportedPackage("a", "2.0.0", false));
+ PackageRequirementMerger merger = new PackageRequirementMerger(reqs);
+
+ Assert.assertTrue(merger.isMergeSuccessful());
+
+ Assert.assertTrue(merger.getInvalidRequirements().isEmpty());
+
+ Collection<ImportedPackage> result = merger.getMergedRequirements();
+ Collection<ImportedPackage> expected = new ArrayList<ImportedPackage>();
+ expected.add(newImportedPackage("a", "2.0.0"));
+ Assert.assertTrue(result.toString(), isEqual(result, expected));
+ }
+
+ @Test
+ public void testMergeValidAdditionalAttributes() throws Exception
+ {
+ Collection<ImportedPackage> reqs = new ArrayList<ImportedPackage>();
+ reqs.add(newImportedPackage("a", "1.0.0", "foo=bar"));
+ reqs.add(newImportedPackage("a", "2.0.0", "foo=bar"));
+ PackageRequirementMerger merger = new PackageRequirementMerger(reqs);
+
+ Assert.assertTrue(merger.isMergeSuccessful());
+
+ Assert.assertTrue(merger.getInvalidRequirements().isEmpty());
+
+ Collection<ImportedPackage> result = merger.getMergedRequirements();
+ Collection<ImportedPackage> expected = new ArrayList<ImportedPackage>();
+ expected.add(newImportedPackage("a", "2.0.0", "foo=bar"));
+ Assert.assertTrue(result.toString(), isEqual(result, expected));
+ }
+
+ @Test
+ public void testMergeInvalidAdditionalAttributes() throws Exception
+ {
+ Collection<ImportedPackage> reqs = new ArrayList<ImportedPackage>();
+ reqs.add(newImportedPackage("a", "1.0.0", "foo=bar"));
+ reqs.add(newImportedPackage("a", "2.0.0", "foo=blah"));
+ reqs.add(newImportedPackage("b", "1.0.0"));
+ PackageRequirementMerger merger = new PackageRequirementMerger(reqs);
+
+ Assert.assertFalse(merger.isMergeSuccessful());
+
+ try
+ {
+ merger.getMergedRequirements();
+ Assert.fail("getMergedRequirements should throw IllegalStateException.");
+ }
+ catch (IllegalStateException e) { }
+
+ Set<String> result = merger.getInvalidRequirements();
+ Set<String> expected = new HashSet<String>();
+ expected.add("a");
+ Assert.assertEquals(expected, result);
+ }
+
+}
Added: aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/META-INF/APPLICATION.MF
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/META-INF/APPLICATION.MF?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/META-INF/APPLICATION.MF (added)
+++ aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/META-INF/APPLICATION.MF Sun Feb 27 20:20:13 2011
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Application-ManifestVersion: 1.0
+Application-Name: test1.eba
+Application-SymbolicName: com.ibm.ws.eba.admin.application.modeller.test1.eba
+Application-Version: 1.0
+Application-Content: com.ibm.ws.eba.admin.application.modeller.bundle1;version=1.0.0
+Application-ImportService: foo.bar.MyInjectedService;filter="(security.authority=intranet)",
+ com.ibm.infrastructure.Manager;filter="(hands.off=true)"
+Application-ExportService: foo.bar.MyService;filter="(volume=11)",
+ com.acme.Delivery;filter="(&(customer=pig)(target=rabbit))"
Added: aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/META-INF/DEPLOYMENT.MF
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/META-INF/DEPLOYMENT.MF?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/META-INF/DEPLOYMENT.MF (added)
+++ aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/META-INF/DEPLOYMENT.MF Sun Feb 27 20:20:13 2011
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Application-ManifestVersion: 2
+Application-SymbolicName: com.ibm.ws.eba.admin.application.modeller.test1.eba
+Application-Version: 1.0
+Deployed-Content: com.ibm.ws.eba.admin.application.modeller.bundle1;deployed-version=1.0.0
Added: aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/bundle1.jar/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/bundle1.jar/META-INF/MANIFEST.MF?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/bundle1.jar/META-INF/MANIFEST.MF (added)
+++ aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/bundle1.jar/META-INF/MANIFEST.MF Sun Feb 27 20:20:13 2011
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-Version: 1.0.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: com.ibm.ws.eba.admin.application.modeller.bundle1
+Bundle-Name: bundle1
+
+
Added: aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bp.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bp.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bp.xml (added)
+++ aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bp.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <bean id="myBean" class="foo.bar.MyBean" activation="lazy">
+ <property name="myInjectedService" ref="fromOutside"/>
+ </bean>
+
+ <service id="myService" ref="myBean" interface="foo.bar.MyService">
+ <service-properties>
+ <entry key="priority" value="9"/>
+ <entry key="volume" value="11"/>
+ </service-properties>
+ </service>
+
+ <!-- Services for which we can generate no name should not be exposed -->
+ <service interface="foo.bar.AnonService">
+ <bean class="an.anonymous.Bean"/>
+ </service>
+
+ <!-- All inlined classes will be given null IDs as per 121.4.8 of the OSGi 4.2 spec -->
+ <service interface="foo.bar.NamedInnerBeanService">
+ <bean id="namedInnerBean" class="an.anonymous.Bean"/>
+ </service>
+
+
+ <reference id="fromOutside" interface="foo.bar.MyInjectedService"/>
+
+ <reference id="anotherOptionalReference" interface="foo.bar.MyInjectedService" availability="optional"/>
+</blueprint>
\ No newline at end of file
Added: aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bp2.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bp2.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bp2.xml (added)
+++ aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bp2.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <bean id="bean1" class="com.ibm.useful.Bean"/>
+
+ <bean id="bean2" class="com.ibm.useful.Bean"/>
+
+ <bean id="bean3" class="com.ibm.useful.Bean"/>
+
+ <service id="service1.should.be.exported" ref="bean1" interface="foo.bar.MyService">
+ <service-properties>
+ <entry key="volume" value="11"/>
+ <entry key="priority" value="7"/>
+ </service-properties>
+ </service>
+
+ <service id="service2.should.not.be.exported" ref="bean2" interface="com.acme.Delivery">
+ <service-properties>
+ <entry key="customer" value="pig"/>
+ </service-properties>
+ </service>
+
+ <!-- Let's put no id on this service - it should come from the bean -->
+ <service ref="bean3" interface="com.acme.Delivery">
+ <service-properties>
+ <entry key="customer" value="pig"/>
+ <entry key="target" value="rabbit"/>
+ <entry key="payload" value="excessive"/>
+ </service-properties>
+ </service>
+
+ <reference-list id="refList1" interface="my.logging.service" filter="(&(trace=on)(debug=true))"/>
+
+</blueprint>
\ No newline at end of file
Added: aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bpMultiValues.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bpMultiValues.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bpMultiValues.xml (added)
+++ aries/tags/application-0.3/application-modeller/src/test/resources/appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bpMultiValues.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <bean id="myBean" class="foo.bar.MyBean" activation="lazy">
+ </bean>
+
+ <service id="greeting" ref="myBean" interface="greeting.Greeting">
+ <service-properties>
+ <entry key="service.exported.interfaces" value="greeting.Greeting"/>
+ <entry key="service.intents">
+ <array>
+ <value>propagatesTransaction</value>
+ <value>confidentiality</value>
+ </array>
+ </entry>
+ </service-properties>
+ </service>
+
+</blueprint>
\ No newline at end of file
Added: aries/tags/application-0.3/application-modeller/src/test/resources/bundles/test.bundle1.jar/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-modeller/src/test/resources/bundles/test.bundle1.jar/META-INF/MANIFEST.MF?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-modeller/src/test/resources/bundles/test.bundle1.jar/META-INF/MANIFEST.MF (added)
+++ aries/tags/application-0.3/application-modeller/src/test/resources/bundles/test.bundle1.jar/META-INF/MANIFEST.MF Sun Feb 27 20:20:13 2011
@@ -0,0 +1,27 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test Bundle
+Bundle-SymbolicName: test.bundle1;fragment-attachment:=always;singleton:=true
+Bundle-Version: 2.0.0.build-121
+Bundle-Vendor: Aries
+Import-Package: aries.ejs.ras,
+ aries.ws.app.framework.plugin;version="[1,2)",
+ aries.ws.event;version="1.0.0",
+ aries.ws.ffdc;resolution:=optional,
+ aries.ws.kernel.file;resolution:=mandatory,
+ aries.wsspi.app.container.aries;bundle-symbolic-name=B;bundle-version="[1.2.0,2.2.0)",
+ aries.wsspi.application.aries;company=yang;security:=haha,
+ org.osgi.framework;version="1.3.0",
+ aries.ws.eba.bundle4;aries.ws.eba.bundle5;version=3,
+ aries.ws.eba.bundle6;aries.ws.eba.bundle7
+DynamicImport-Package: *;vendor=acmen, *,aries.ws.eba.bla,aries.ws.eba.launcher;
+ version="[1,2]"
+Export-Package: aries.ws.eba.bundle1; version=2.2.0,
+ aries.ws.eba.bundle2;aries.ws.eba.bundle3;version=3
+Require-Bundle: com.acme.facade;bundle-version=3;visibility:=reexport,
+ com.acme.bar; visibility:=reexport;resolution:=optional,
+ com.ab.de; visibility:=private,
+ com.de.ba; resolution:=mandatory,
+Import-Service: aries.ws.eba.import
+Export-Service: aries.ws.eba.export
+Fragment-Host: eba.framework;bundle-version="[3.0,4.0]"
Added: aries/tags/application-0.3/application-noop-platform-repository/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-noop-platform-repository/pom.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-noop-platform-repository/pom.xml (added)
+++ aries/tags/application-0.3/application-noop-platform-repository/pom.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version
+ 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>application</artifactId>
+ <groupId>org.apache.aries.application</groupId>
+ <version>0.3</version>
+ </parent>
+ <artifactId>org.apache.aries.application.noop.platform.repo</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Aries Application Platform Repository</name>
+ <description>
+ Implementation of the no-op Platform Repository
+ </description>
+ <properties>
+ <aries.osgi.export.pkg>
+ </aries.osgi.export.pkg>
+ <aries.osgi.private.pkg>
+ org.apache.aries.application.noop.platform.repo.impl
+ </aries.osgi.private.pkg>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Added: aries/tags/application-0.3/application-noop-platform-repository/src/main/java/org/apache/aries/application/noop/platform/repo/impl/DefaultPlatformRepository.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-noop-platform-repository/src/main/java/org/apache/aries/application/noop/platform/repo/impl/DefaultPlatformRepository.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-noop-platform-repository/src/main/java/org/apache/aries/application/noop/platform/repo/impl/DefaultPlatformRepository.java (added)
+++ aries/tags/application-0.3/application-noop-platform-repository/src/main/java/org/apache/aries/application/noop/platform/repo/impl/DefaultPlatformRepository.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,35 @@
+
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.application.noop.platform.repo.impl;
+import java.net.URI;
+import java.util.Collection;
+
+import org.apache.aries.application.management.spi.repository.PlatformRepository;
+
+public class DefaultPlatformRepository implements PlatformRepository
+{
+ public Collection<URI> getPlatformRepositoryURLs()
+ {
+ return null;
+ }
+
+}
Added: aries/tags/application-0.3/application-noop-platform-repository/src/main/resources/OSGI-INF/blueprint/noop-platform-repo.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-noop-platform-repository/src/main/resources/OSGI-INF/blueprint/noop-platform-repo.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-noop-platform-repository/src/main/resources/OSGI-INF/blueprint/noop-platform-repo.xml (added)
+++ aries/tags/application-0.3/application-noop-platform-repository/src/main/resources/OSGI-INF/blueprint/noop-platform-repo.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <bean id="default-platform-repository" class="org.apache.aries.application.noop.platform.repo.impl.DefaultPlatformRepository"/>
+ <service interface="org.apache.aries.application.management.spi.repository.PlatformRepository" ref="default-platform-repository" ranking="-1"/>
+
+</blueprint>
Added: aries/tags/application-0.3/application-noop-postresolve-process/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-noop-postresolve-process/pom.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-noop-postresolve-process/pom.xml (added)
+++ aries/tags/application-0.3/application-noop-postresolve-process/pom.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version
+ 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>application</artifactId>
+ <groupId>org.apache.aries.application</groupId>
+ <version>0.3</version>
+ </parent>
+ <artifactId>org.apache.aries.application.noop.postresolve.process</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Aries Application postresolve process</name>
+ <description>
+ Implementation of the no-op Postresolve process
+ </description>
+ <properties>
+ <aries.osgi.export.pkg>
+ </aries.osgi.export.pkg>
+ <aries.osgi.private.pkg>
+ org.apache.aries.application.noop.postresolve.process.impl
+ </aries.osgi.private.pkg>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Added: aries/tags/application-0.3/application-noop-postresolve-process/src/main/java/org/apache/aries/application/noop/postresolve/process/impl/DefaultPostResolveTransformer.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-noop-postresolve-process/src/main/java/org/apache/aries/application/noop/postresolve/process/impl/DefaultPostResolveTransformer.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-noop-postresolve-process/src/main/java/org/apache/aries/application/noop/postresolve/process/impl/DefaultPostResolveTransformer.java (added)
+++ aries/tags/application-0.3/application-noop-postresolve-process/src/main/java/org/apache/aries/application/noop/postresolve/process/impl/DefaultPostResolveTransformer.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.application.noop.postresolve.process.impl;
+
+import org.apache.aries.application.ApplicationMetadata;
+import org.apache.aries.application.management.ResolverException;
+import org.apache.aries.application.management.spi.resolve.PostResolveTransformer;
+import org.apache.aries.application.modelling.DeployedBundles;
+
+
+
+public class DefaultPostResolveTransformer implements PostResolveTransformer
+{
+
+ @Override
+ public DeployedBundles postResolveProcess(ApplicationMetadata appMetadata, DeployedBundles deployedBundles)
+ throws ResolverException
+ {
+
+ return deployedBundles;
+ }
+
+
+}
Added: aries/tags/application-0.3/application-noop-postresolve-process/src/main/resources/OSGI-INF/blueprint/noop-postresolve-process.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-noop-postresolve-process/src/main/resources/OSGI-INF/blueprint/noop-postresolve-process.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-noop-postresolve-process/src/main/resources/OSGI-INF/blueprint/noop-postresolve-process.xml (added)
+++ aries/tags/application-0.3/application-noop-postresolve-process/src/main/resources/OSGI-INF/blueprint/noop-postresolve-process.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <bean id="default-postresolve-transformer" class="org.apache.aries.application.noop.postresolve.process.impl.DefaultPostResolveTransformer"/>
+ <service interface="org.apache.aries.application.management.spi.resolve.PostResolveTransformer" ref="default-postresolve-transformer" ranking="-1"/>
+
+</blueprint>
Added: aries/tags/application-0.3/application-noop-resolver/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-noop-resolver/pom.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-noop-resolver/pom.xml (added)
+++ aries/tags/application-0.3/application-noop-resolver/pom.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version
+ 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>application</artifactId>
+ <groupId>org.apache.aries.application</groupId>
+ <version>0.3</version>
+ </parent>
+ <artifactId>org.apache.aries.application.resolver.noop</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Aries Application OBR Resolver</name>
+ <description>
+ Implementation of the AriesApplicationResolver using OBR
+ </description>
+ <properties>
+ <aries.osgi.export.pkg>
+ </aries.osgi.export.pkg>
+ <aries.osgi.private.pkg>
+ org.apache.aries.application.resolver.noop.impl
+ </aries.osgi.private.pkg>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Added: aries/tags/application-0.3/application-noop-resolver/src/main/java/org/apache/aries/application/resolver/noop/impl/NoOpResolver.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-noop-resolver/src/main/java/org/apache/aries/application/resolver/noop/impl/NoOpResolver.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-noop-resolver/src/main/java/org/apache/aries/application/resolver/noop/impl/NoOpResolver.java (added)
+++ aries/tags/application-0.3/application-noop-resolver/src/main/java/org/apache/aries/application/resolver/noop/impl/NoOpResolver.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.application.resolver.noop.impl;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.aries.application.Content;
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.BundleInfo;
+import org.apache.aries.application.management.ResolveConstraint;
+import org.apache.aries.application.management.ResolverException;
+import org.apache.aries.application.management.spi.repository.PlatformRepository;
+import org.apache.aries.application.management.spi.resolve.AriesApplicationResolver;
+import org.apache.aries.application.modelling.ModelledResource;
+import org.osgi.framework.Version;
+/**
+ * AriesApplicationManager requires that there be at least one
+ * AriesApplicationResolver service present. This class provides a null
+ * implementation: it simply returns the bundles that it was provided with -
+ * enough to permit the testing of Aries applications that have no external
+ * dependencies.
+ * It is not intended to be used in a production environment, as the implementation
+ * of the AriesApplicationResolver just returns the bundles included in the application irrespective of
+ * what is specified in application.mf.
+ */
+
+public class NoOpResolver implements AriesApplicationResolver {
+
+ Set<BundleInfo> resolvedBundles = new HashSet<BundleInfo>();
+
+ public Set<BundleInfo> resolve(AriesApplication app, ResolveConstraint... constraints) {
+ resolvedBundles.addAll(app.getBundleInfo());
+ return app.getBundleInfo();
+ }
+
+ public BundleInfo getBundleInfo(String bundleSymbolicName, Version bundleVersion)
+ {
+ BundleInfo result = null;
+ for (BundleInfo info : resolvedBundles)
+ {
+ if (info.getSymbolicName().equals(bundleSymbolicName) &&
+ info.getVersion().equals(bundleVersion))
+ {
+ result = info;
+ }
+ }
+ return result;
+ }
+
+ public Collection<ModelledResource> resolve(String appName, String appVersion,
+ Collection<ModelledResource> byValueBundles, Collection<Content> inputs)
+ throws ResolverException
+ {
+
+ return byValueBundles;
+ }
+
+ public Collection<ModelledResource> resolve(String appName, String appVersion,
+ Collection<ModelledResource> byValueBundles, Collection<Content> inputs, PlatformRepository platformRepository)
+ throws ResolverException
+ {
+
+ return byValueBundles;
+ }
+
+}
+
+
Added: aries/tags/application-0.3/application-noop-resolver/src/main/resources/OSGI-INF/blueprint/noop-resolver.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-noop-resolver/src/main/resources/OSGI-INF/blueprint/noop-resolver.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-noop-resolver/src/main/resources/OSGI-INF/blueprint/noop-resolver.xml (added)
+++ aries/tags/application-0.3/application-noop-resolver/src/main/resources/OSGI-INF/blueprint/noop-resolver.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+ <bean id="no-op-resolver" class="org.apache.aries.application.resolver.noop.impl.NoOpResolver" />
+ <service interface="org.apache.aries.application.management.spi.resolve.AriesApplicationResolver"
+ ref="no-op-resolver"
+ ranking="-1" />
+</blueprint>
Added: aries/tags/application-0.3/application-obr-resolver/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-obr-resolver/pom.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-obr-resolver/pom.xml (added)
+++ aries/tags/application-0.3/application-obr-resolver/pom.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version
+ 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>application</artifactId>
+ <groupId>org.apache.aries.application</groupId>
+ <version>0.3</version>
+ </parent>
+ <artifactId>org.apache.aries.application.resolver.obr</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Aries Application OBR Resolver</name>
+ <description>
+ Implementation of the AriesApplicationResolver using OBR
+ </description>
+ <properties>
+ <aries.osgi.export.pkg>
+ org.apache.aries.application.resolver.obr.ext;
+ </aries.osgi.export.pkg>
+ <aries.osgi.private.pkg>
+ org.apache.aries.application.resolver.obr;
+ org.apache.aries.application.resolver.obr.impl;
+ org.apache.aries.application.resolver.internal
+ </aries.osgi.private.pkg>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.management</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.utils</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.deployment.management</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.modeller</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.bundlerepository</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.testsupport</groupId>
+ <artifactId>org.apache.aries.testsupport.unit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Added: aries/tags/application-0.3/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/internal/MessageUtil.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/internal/MessageUtil.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/internal/MessageUtil.java (added)
+++ aries/tags/application-0.3/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/internal/MessageUtil.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.application.resolver.internal;
+
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+
+public class MessageUtil
+{
+ /** The resource bundle for blueprint messages */
+ private final static ResourceBundle messages = ResourceBundle.getBundle("org.apache.aries.application.resolver.messages.ResolverMessages");
+
+ /**
+ * Resolve a message from the bundle, including any necessary formatting.
+ *
+ * @param key the message key.
+ * @param inserts any required message inserts.
+ * @return the message translated into the server local.
+ */
+ public static final String getMessage(String key, Object ... inserts)
+ {
+ String msg = messages.getString(key);
+
+ if (inserts.length > 0)
+ msg = MessageFormat.format(msg, inserts);
+
+ return msg;
+ }
+}