Author: jwross
Date: Tue Jun 11 15:42:38 2013
New Revision: 1491843

URL: http://svn.apache.org/r1491843
Log:
[aries-1072] Test subsystem with satisfied BREE requirement installs.

Modified:
    
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ResolutionTest.java

Modified: 
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ResolutionTest.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ResolutionTest.java?rev=1491843&r1=1491842&r2=1491843&view=diff
==============================================================================
--- 
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ResolutionTest.java
 (original)
+++ 
aries/trunk/subsystem/subsystem-itests/src/test/java/org/apache/aries/subsystem/itests/ResolutionTest.java
 Tue Jun 11 15:42:38 2013
@@ -55,6 +55,11 @@ public class ResolutionTest extends Subs
         */
        private static final String APPLICATION_B = "application.b.esa";
        /*
+        * Subsystem-SymbolicName: application.c.esa
+        * Subsystem-Content: bundle.e.jar
+        */
+       private static final String APPLICATION_C = "application.c.esa";
+       /*
         * Bundle-SymbolicName: bundle.a.jar
         * Require-Capability: a
         */
@@ -75,6 +80,11 @@ public class ResolutionTest extends Subs
         * Bundle-RequiredExecutionEnvironment: JavaSE-100.100
         */
        private static final String BUNDLE_D = "bundle.d.jar";
+       /*
+        * Bundle-SymbolicName: bundle.e.jar
+        * Bundle-RequiredExecutionEnvironment: J2SE-1.4, J2SE-1.5,             
J2SE-1.6,JavaSE-1.7
+        */
+       private static final String BUNDLE_E = "bundle.e.jar";
        
        @Before
        public static void createApplications() throws Exception {
@@ -85,8 +95,10 @@ public class ResolutionTest extends Subs
                createBundleB();
                createBundleC();
                createBundleD();
+               createBundleE();
                createApplicationA();
                createApplicationB();
+               createApplicationC();
                createdApplications = true;
        }
        
@@ -112,6 +124,17 @@ public class ResolutionTest extends Subs
                createManifest(APPLICATION_B + ".mf", attributes);
        }
        
+       private static void createApplicationC() throws IOException {
+               createApplicationCManifest();
+               createSubsystem(APPLICATION_C, BUNDLE_E);
+       }
+       
+       private static void createApplicationCManifest() throws IOException {
+               Map<String, String> attributes = new HashMap<String, String>();
+               attributes.put(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME, 
APPLICATION_C);
+               createManifest(APPLICATION_C + ".mf", attributes);
+       }
+       
        private static void createBundleA() throws IOException {
                Map<String, String> headers = new HashMap<String, String>();
                headers.put(Constants.REQUIRE_CAPABILITY, "a");
@@ -138,6 +161,13 @@ public class ResolutionTest extends Subs
                createBundle(BUNDLE_D, headers);
        }
        
+       @SuppressWarnings("deprecation")
+       private static void createBundleE() throws IOException {
+               Map<String, String> headers = new HashMap<String, String>();
+               headers.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, 
"J2SE-1.4, J2SE-1.5,         J2SE-1.6,JavaSE-1.7");
+               createBundle(BUNDLE_E, headers);
+       }
+       
        /*
         * Test that the right regions are used when validating capabilities.
         * 
@@ -211,4 +241,25 @@ public class ResolutionTest extends Subs
                        uninstallSubsystemSilently(applicationB);
                }
        }
+       
+       /*
+        * BREE headers must be converted into osgi.ee requirements.
+        * 
+        * The subsystem should resolve and install if at least one of the 
specified
+        * execution environments is present.
+        */
+       @Test
+       public void testMultipleBundleRequiredExecutionEnvironments() throws 
Exception {
+               Subsystem applicationC = null;
+               try {
+                       applicationC = installSubsystemFromFile(APPLICATION_C);
+               }
+               catch (Exception e) {
+                       e.printStackTrace();
+                       fail("Installation should succeed when at least one 
BREE is present");
+               }
+               finally {
+                       uninstallSubsystemSilently(applicationC);
+               }
+       }
 }


Reply via email to