Author: [email protected]
Date: Thu Oct 27 19:13:19 2011
New Revision: 1680

Log:
AMDATU-383 Added test to validate Pax Exam frameworkpackage option

Modified:
   
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/IntegrationFrameworkTest.java

Modified: 
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/IntegrationFrameworkTest.java
==============================================================================
--- 
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/IntegrationFrameworkTest.java
       (original)
+++ 
trunk/amdatu-core/itest/tests/src/test/java/org/amdatu/core/itest/tests/IntegrationFrameworkTest.java
       Thu Oct 27 19:13:19 2011
@@ -3,18 +3,19 @@
 import static org.hamcrest.core.Is.is;
 import static org.hamcrest.core.IsNull.notNullValue;
 import static org.junit.Assert.assertThat;
-import static org.ops4j.pax.exam.CoreOptions.junitBundles;
 import static org.ops4j.pax.exam.CoreOptions.options;
 
 import javax.inject.Inject;
 
 import org.amdatu.core.itest.base.CoreFixture;
 import org.junit.After;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TestName;
 import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.Configuration;
 import org.ops4j.pax.exam.junit.ExamReactorStrategy;
@@ -23,7 +24,8 @@
 import org.ops4j.pax.exam.util.Filter;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.log.LogService;
-import org.osgi.service.startlevel.StartLevel;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.service.packageadmin.PackageAdmin;
 
 /**
  * Sample testcase to demo and validate the Pax Exam 2.3 base integration test
@@ -68,8 +70,10 @@
      * PaxExam \@Configuration methods are used to configure provisioning.
      */
     @Configuration
-    public Option[] junitConfig() {
-        return options(junitBundles(), CoreFixture.provision());
+    public Option[] configureOptions() {
+        return options(CoreOptions.systemPackages("sun.misc", 
"com.sun.management"),
+            CoreOptions.junitBundles(),
+            CoreFixture.provision());
     }
 
     /**
@@ -100,11 +104,23 @@
      * Optional \@Filter specifies additional constraints on \@Inject.
      */
     @Inject
-    @Filter("(service.id=1)")
-    private StartLevel m_sl;
+    @Filter("(service.id=2)")
+    private PackageAdmin m_pa;
 
     @Test
     public void doTestStartLevel() throws Exception {
-        assertThat("StartLevel was supposed to be set!", m_sl, 
is(notNullValue()));
+        assertThat("PackageAdmin was supposed to be set!", m_pa, 
is(notNullValue()));
+    }
+
+    /**
+     * Extra framework packages added in the configureOptions method
+     * should be available AMDATU-383
+     */
+    @Test
+    public void testSystemPackagesOption() throws Exception {
+        ExportedPackage epa1 = m_pa.getExportedPackage("sun.misc");
+        Assert.assertNotNull("Expected sun.misc package from system bundle", 
epa1);
+        ExportedPackage epa2 = m_pa.getExportedPackage("com.sun.management");
+        Assert.assertNotNull("Expected com.sun.management package from system 
bundle", epa2);
     }
 }
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits

Reply via email to