aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwr...@apache.org
Subject svn commit: r1738984 - in /aries/trunk/subsystem: subsystem-itests/ subsystem-itests/src/test/bundles/aries1523fragment/ subsystem-itests/src/test/bundles/aries1523fragment/META-INF/ subsystem-itests/src/test/bundles/aries1523host/ subsystem-itests/src...
Date Wed, 13 Apr 2016 18:51:03 GMT
Author: jwross
Date: Wed Apr 13 18:51:02 2016
New Revision: 1738984

URL: http://svn.apache.org/viewvc?rev=1738984&view=rev
Log:
[ARIES-1523] Application with fragment in archive and host in OBR will fail to resolve.

Test installing and starting a subsystem with fragment and host bundles as content where the
fragment is included in the archive and the host in OBR. Test both
apache-aries-provision-dependencies:=install and apache-aries-provision-dependencies:=resolve.

Modify existing unit test to expect the osgi.wiring.host capability from the Felix OBR resource
adapter.

Add org.apache.aries.subsystem.obr and org.apache.felix.bundlerepository to the test configuration.

Added:
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523fragment/
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523fragment/META-INF/
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523fragment/META-INF/MANIFEST.MF
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523host/
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523host/META-INF/
    aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523host/META-INF/MANIFEST.MF
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1523Test.java
Modified:
    aries/trunk/subsystem/subsystem-itests/pom.xml
    aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java
    aries/trunk/subsystem/subsystem-obr/src/test/java/org/apache/aries/subsystem/obr/internal/FelixResourceAdapterTest.java

Modified: aries/trunk/subsystem/subsystem-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/pom.xml?rev=1738984&r1=1738983&r2=1738984&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/pom.xml (original)
+++ aries/trunk/subsystem/subsystem-itests/pom.xml Wed Apr 13 18:51:02 2016
@@ -177,7 +177,7 @@
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.bundlerepository</artifactId>
             <scope>test</scope>
-            <version>1.6.4</version>
+            <version>1.6.6</version>
             <exclusions>
                 <exclusion>
                     <groupId>org.osgi</groupId>
@@ -580,6 +580,44 @@
                     </execution>
 
                     <!-- End of new pom for hello tests, part 1 -->
+                    
+                    <execution>
+                        <id>aries1523host</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                        <configuration>
+                            <archive>
+                                <manifestFile>src/test/bundles/aries1523host/META-INF/MANIFEST.MF</manifestFile>
+                            </archive>
+                            <classesDirectory>${project.build.directory}/test-classes</classesDirectory>
+                            <includes>
+                                <include>org/apache/aries/subsystem/itests/aries1523host/**</include>
+                            </includes>
+                            <outputDirectory>${project.build.directory}/test-classes/aries1523</outputDirectory>
+                            <finalName>aries1523host</finalName>
+                        </configuration>
+                        <phase>process-test-classes</phase>
+                    </execution>
+                    
+                    <execution>
+                        <id>aries1523fragment</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                        <configuration>
+                            <archive>
+                                <manifestFile>src/test/bundles/aries1523fragment/META-INF/MANIFEST.MF</manifestFile>
+                            </archive>
+                            <classesDirectory>${project.build.directory}/test-classes</classesDirectory>
+                            <includes>
+                                <include>org/apache/aries/subsystem/itests/aries1523fragment/**</include>
+                            </includes>
+                            <outputDirectory>${project.build.directory}/test-classes/aries1523</outputDirectory>
+                            <finalName>aries1523fragment</finalName>
+                        </configuration>
+                        <phase>process-test-classes</phase>
+                    </execution>
 
                 </executions>
             </plugin>
@@ -679,6 +717,32 @@
                     </execution>
 
                     <!-- End of new pom for hello tests, part 2 -->
+                    
+                    <execution>
+                        <id>add-source-aries1523host</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-test-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>src/test/bundles/aries1523host</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                    
+                    <execution>
+                        <id>add-source-aries1523fragment</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-test-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>src/test/bundles/aries1523fragment</source>
+                            </sources>
+                        </configuration>
+                    </execution>
 
                     <execution>
                         <id>add-source-classes</id>

Added: aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523fragment/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523fragment/META-INF/MANIFEST.MF?rev=1738984&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523fragment/META-INF/MANIFEST.MF
(added)
+++ aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523fragment/META-INF/MANIFEST.MF
Wed Apr 13 18:51:02 2016
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Aries 1523 Fragment
+Bundle-SymbolicName: org.apache.aries.subsystem.itests.aries1523fragment
+Bundle-Version: 1.0.0
+Fragment-Host: org.apache.aries.subsystem.itests.aries1523host;bundle-version=1
\ No newline at end of file

Added: aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523host/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523host/META-INF/MANIFEST.MF?rev=1738984&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523host/META-INF/MANIFEST.MF
(added)
+++ aries/trunk/subsystem/subsystem-itests/src/test/bundles/aries1523host/META-INF/MANIFEST.MF
Wed Apr 13 18:51:02 2016
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Aries 1523 Host
+Bundle-SymbolicName: org.apache.aries.subsystem.itests.aries1523host
+Bundle-Version: 1.0.0

Modified: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java?rev=1738984&r1=1738983&r2=1738984&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java
(original)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/SubsystemTest.java
Wed Apr 13 18:51:02 2016
@@ -155,6 +155,8 @@ public abstract class SubsystemTest exte
                 mavenBundle("org.ops4j.pax.logging",        "pax-logging-service").versionAsInProject(),
                 mavenBundle("org.ops4j.pax.tinybundles",    "tinybundles").versionAsInProject(),
                 mavenBundle("biz.aQute.bnd",                "bndlib").versionAsInProject(),
+                mavenBundle("org.apache.aries.subsystem",	"org.apache.aries.subsystem.obr").versionAsInProject(),
+                mavenBundle("org.apache.felix",				"org.apache.felix.bundlerepository").versionAsInProject(),

 //				org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7777"),
 		};
 	}

Added: aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1523Test.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1523Test.java?rev=1738984&view=auto
==============================================================================
--- aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1523Test.java
(added)
+++ aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/defect/Aries1523Test.java
Wed Apr 13 18:51:02 2016
@@ -0,0 +1,140 @@
+/*
+ * 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.
+ */
+package org.apache.aries.subsystem.itests.defect;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.net.URL;
+
+import org.apache.aries.subsystem.core.archive.AriesProvisionDependenciesDirective;
+import org.apache.aries.subsystem.itests.SubsystemTest;
+import org.apache.aries.subsystem.itests.util.SubsystemArchiveBuilder;
+import org.apache.felix.bundlerepository.DataModelHelper;
+import org.apache.felix.bundlerepository.Repository;
+import org.apache.felix.bundlerepository.RepositoryAdmin;
+import org.apache.felix.bundlerepository.Resource;
+import org.junit.Test;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.subsystem.Subsystem;
+import org.osgi.service.subsystem.SubsystemConstants;
+import org.osgi.service.subsystem.SubsystemException;
+
+public class Aries1523Test extends SubsystemTest {
+	private RepositoryAdmin repositoryAdmin;
+	private URL url;
+	
+	@Override
+    public void setUp() throws Exception {
+        super.setUp();
+        BundleContext context = context();
+        ServiceReference<RepositoryAdmin> ref = context.getServiceReference(RepositoryAdmin.class);
+        assertNotNull("The RepositoryAdmin service does not exist", ref);
+        try {
+        	repositoryAdmin = (RepositoryAdmin)context.getService(ref);
+        	DataModelHelper helper = repositoryAdmin.getHelper();
+        	url = createRepositoryXml(helper);
+        	Repository repository = repositoryAdmin.addRepository(url);
+        	Resource resource = repository.getResources()[0];
+        	System.out.println(resource.getURI());
+        }
+        finally {
+        	context.ungetService(ref);
+        }
+    }
+	
+	@Override
+	public void tearDown() throws Exception {
+		repositoryAdmin.removeRepository(url.toString());
+		super.tearDown();
+	}
+	
+	@Test
+	public void testApacheAriesProvisionDepenenciesInstall() throws Exception {
+		test(AriesProvisionDependenciesDirective.INSTALL);
+	}
+	
+	@Test
+	public void testApacheAriesProvisionDepenenciesResolve() throws Exception {
+		test(AriesProvisionDependenciesDirective.RESOLVE);
+	}
+	
+	private void test(AriesProvisionDependenciesDirective provisionDependencies) throws Exception
{
+		boolean flag = AriesProvisionDependenciesDirective.INSTALL.equals(provisionDependencies);
+		Subsystem root = getRootSubsystem();
+		try {
+			Subsystem subsystem = installSubsystem(
+					root,
+					"subsystem", 
+					new SubsystemArchiveBuilder()
+							.symbolicName("subsystem")
+							.type(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION + ';' 
+										+ provisionDependencies.toString())
+							.content("org.apache.aries.subsystem.itests.aries1523host,org.apache.aries.subsystem.itests.aries1523fragment")
+							.bundle(
+									"aries1523fragment", 
+									getClass().getClassLoader().getResourceAsStream("aries1523/aries1523fragment.jar"))
+							.build(),
+					flag
+			);
+			try {
+				startSubsystem(subsystem, flag);
+				stopSubsystem(subsystem);
+			}
+			catch (SubsystemException e) {
+				e.printStackTrace();
+				fail("Subsystem should have started");
+			}
+			finally {
+				uninstallSubsystemSilently(subsystem);
+			}
+		}
+		catch (SubsystemException e) {
+			e.printStackTrace();
+			fail("Subsystem should have installed");
+		}
+	}
+	
+	private URL createRepositoryXml(DataModelHelper helper) throws Exception {
+		File dir;
+		if (new File("").getAbsolutePath().endsWith("/target")) {
+			dir = new File("test-classes/aries1523");
+		}
+		else {
+			dir = new File("target/test-classes/aries1523");
+		}
+		File jar = new File(dir, "aries1523host.jar");
+		assertTrue("The host jar does not exist", jar.exists());
+		Resource resource = helper.createResource(jar.toURI().toURL());
+		Repository repository = helper.repository(new Resource[] {resource});
+		File file = new File(dir, "repository.xml");
+		FileWriter fw = new FileWriter(file);
+		try {
+			helper.writeRepository(repository, fw);
+			return file.toURI().toURL();
+		}
+		finally {
+			fw.close();
+		}
+	}
+}

Modified: aries/trunk/subsystem/subsystem-obr/src/test/java/org/apache/aries/subsystem/obr/internal/FelixResourceAdapterTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-obr/src/test/java/org/apache/aries/subsystem/obr/internal/FelixResourceAdapterTest.java?rev=1738984&r1=1738983&r2=1738984&view=diff
==============================================================================
--- aries/trunk/subsystem/subsystem-obr/src/test/java/org/apache/aries/subsystem/obr/internal/FelixResourceAdapterTest.java
(original)
+++ aries/trunk/subsystem/subsystem-obr/src/test/java/org/apache/aries/subsystem/obr/internal/FelixResourceAdapterTest.java
Wed Apr 13 18:51:02 2016
@@ -41,6 +41,7 @@ public class FelixResourceAdapterTest {
 		EasyMock.replay(resource);
 		FelixResourceAdapter adapter = new FelixResourceAdapter(resource);
 		List<org.osgi.resource.Capability> caps = adapter.getCapabilities(null);
-		assertEquals("Null namespace should return all capabilities", 3, caps.size());
+		// osgi.identity, osgi.content. osgi.wiring.host, and osgi.wiring.package
+		assertEquals("Null namespace should return all capabilities", 4, caps.size());
 	}
 }



Mime
View raw message