Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Adjust -Dtarget.container=jboss720 test suite for arquillian-osgi-1.0…

….3.Final
  • Loading branch information...
commit 4ef4a298d4225e09d0a5396ebee0b35b7d832ebe 1 parent a14cdd6
Thomas Diesler authored

Showing 13 changed files with 243 additions and 106 deletions. Show diff stats Hide diff stats

  1. 23  testsuite/example/pom.xml
  2. 3  testsuite/example/src/test/java/org/jboss/test/osgi/example/cdi/ManagedBeansTestCase.java
  3. 3  testsuite/example/src/test/java/org/jboss/test/osgi/example/ear/EnterpriseArchiveTestCase.java
  4. 7  testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java
  5. 7  testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/LifecycleInterceptorTestCase.java
  6. 3  testsuite/example/src/test/java/org/jboss/test/osgi/example/jaxrs/RestEndpointTestCase.java
  7. 3  testsuite/example/src/test/java/org/jboss/test/osgi/example/jaxws/WebServiceClientTestCase.java
  8. 3  testsuite/example/src/test/java/org/jboss/test/osgi/example/jaxws/WebServiceEndpointTestCase.java
  9. 195  testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/NamingStandaloneTestCase.java
  10. 91  ...example/src/test/java/org/jboss/test/osgi/example/jndi/{NamingSpecTestCase.java → NamingTestCase.java}
  11. 3  testsuite/example/src/test/java/org/jboss/test/osgi/example/jpa/PersistenceTestCase.java
  12. 3  testsuite/example/src/test/java/org/jboss/test/osgi/example/resource/BundleContextInjectionTestCase.java
  13. 5  testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppTestCase.java
23  testsuite/example/pom.xml
@@ -276,6 +276,29 @@
276 276
                 </plugins>
277 277
             </build>
278 278
         </profile>
  279
+
  280
+        <profile>
  281
+            <id>jboss720-testing</id>
  282
+            <activation>
  283
+                <property>
  284
+                    <name>target.container</name>
  285
+                    <value>jboss720</value>
  286
+                </property>
  287
+            </activation>
  288
+            <build>
  289
+                <plugins>
  290
+                    <plugin>
  291
+                        <artifactId>maven-surefire-plugin</artifactId>
  292
+                        <configuration>
  293
+                            <argLine>${surefire.system.args} ${surefire.security.args}</argLine>
  294
+                            <excludes>
  295
+                                <exclude>**/*StandaloneTestCase.java</exclude>
  296
+                            </excludes>
  297
+                        </configuration>
  298
+                    </plugin>
  299
+                </plugins>
  300
+            </build>
  301
+        </profile>
279 302
     </profiles>
280 303
 
281 304
     <!-- Repositories -->
3  testsuite/example/src/test/java/org/jboss/test/osgi/example/cdi/ManagedBeansTestCase.java
@@ -58,7 +58,7 @@
58 58
 
59 59
 /**
60 60
  * Tests CDI deployments with OSGi metadata
61  
- * 
  61
+ *
62 62
  * @author Thomas.Diesler@jboss.com
63 63
  * @since 09-Jul-2012
64 64
  */
@@ -91,6 +91,7 @@ public InputStream openStream() {
91 91
                 OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
92 92
                 builder.addBundleSymbolicName(jar.getName());
93 93
                 builder.addBundleManifestVersion(2);
  94
+                builder.addImportPackages(PackageAdmin.class, ManagementClient.class);
94 95
                 return builder.openStream();
95 96
             }
96 97
         });
3  testsuite/example/src/test/java/org/jboss/test/osgi/example/ear/EnterpriseArchiveTestCase.java
@@ -49,7 +49,7 @@
49 49
 
50 50
 /**
51 51
  * Test OSGi bundles contained in EARs
52  
- * 
  52
+ *
53 53
  * @author thomas.diesler@jboss.com
54 54
  * @since 07-Jun-2011
55 55
  */
@@ -77,6 +77,7 @@ public InputStream openStream() {
77 77
                 OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
78 78
                 builder.addBundleSymbolicName(jar.getName());
79 79
                 builder.addBundleManifestVersion(2);
  80
+                builder.addImportPackages(ManagementClient.class);
80 81
                 return builder.openStream();
81 82
             }
82 83
         });
7  testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java
@@ -36,7 +36,6 @@
36 36
 import org.jboss.arquillian.junit.Arquillian;
37 37
 import org.jboss.arquillian.test.api.ArquillianResource;
38 38
 import org.jboss.as.arquillian.container.ManagementClient;
39  
-import org.jboss.logging.Logger;
40 39
 import org.jboss.osgi.metadata.OSGiManifestBuilder;
41 40
 import org.jboss.osgi.resolver.XBundle;
42 41
 import org.jboss.shrinkwrap.api.Archive;
@@ -55,7 +54,7 @@
55 54
 
56 55
 /**
57 56
  * Test the {@link HttpService} on JBossWeb
58  
- * 
  57
+ *
59 58
  * @author thomas.diesler@jboss.com
60 59
  * @since 19-Jul-2011
61 60
  */
@@ -83,6 +82,7 @@ public InputStream openStream() {
83 82
                 builder.addBundleManifestVersion(2);
84 83
                 builder.addImportPackages(HttpService.class);
85 84
                 builder.addImportPackages(Servlet.class, HttpServlet.class);
  85
+                builder.addImportPackages(XBundle.class, ManagementClient.class);
86 86
                 return builder.openStream();
87 87
             }
88 88
         });
@@ -201,8 +201,6 @@ private String performCall(String path) throws Exception {
201 201
     @SuppressWarnings("serial")
202 202
     static final class HttpServiceServlet extends HttpServlet {
203 203
 
204  
-        static Logger log = Logger.getLogger(HttpServiceServlet.class);
205  
-
206 204
         private final XBundle bundle;
207 205
 
208 206
         // This hides the default ctor and verifies that this instance is used
@@ -210,6 +208,7 @@ private String performCall(String path) throws Exception {
210 208
             this.bundle = (XBundle) bundle;
211 209
         }
212 210
 
  211
+        @Override
213 212
         protected void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
214 213
             PrintWriter out = res.getWriter();
215 214
             String type = req.getParameter("test");
7  testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/LifecycleInterceptorTestCase.java
@@ -57,10 +57,10 @@
57 57
 /**
58 58
  * A test that deployes a bundle that contains some metadata and an interceptor bundle that processes the metadata and
59 59
  * registeres an http endpoint from it.
60  
- * 
  60
+ *
61 61
  * The idea is that the bundle does not process its own metadata. Instead this work is delegated to some specialized metadata
62 62
  * processor (i.e. the interceptor)
63  
- * 
  63
+ *
64 64
  * @author thomas.diesler@jboss.com
65 65
  * @since 23-Oct-2009
66 66
  */
@@ -84,11 +84,12 @@ public static JavaArchive createdeployment() {
84 84
         final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "example-interceptor");
85 85
         archive.addClasses(HttpRequest.class);
86 86
         archive.setManifest(new Asset() {
  87
+            @Override
87 88
             public InputStream openStream() {
88 89
                 OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
89 90
                 builder.addBundleSymbolicName(archive.getName());
90 91
                 builder.addBundleManifestVersion(2);
91  
-                builder.addImportPackages(HttpService.class);
  92
+                builder.addImportPackages(HttpService.class, ManagementClient.class);
92 93
                 return builder.openStream();
93 94
             }
94 95
         });
3  testsuite/example/src/test/java/org/jboss/test/osgi/example/jaxrs/RestEndpointTestCase.java
@@ -55,7 +55,7 @@
55 55
 
56 56
 /**
57 57
  * Test simple OSGi REST deployment
58  
- * 
  58
+ *
59 59
  * @author thomas.diesler@jboss.com
60 60
  * @since 30-Aug-2012
61 61
  */
@@ -87,6 +87,7 @@ public InputStream openStream() {
87 87
                 OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
88 88
                 builder.addBundleSymbolicName(jar.getName());
89 89
                 builder.addBundleManifestVersion(2);
  90
+                builder.addImportPackages(ManagementClient.class);
90 91
                 return builder.openStream();
91 92
             }
92 93
         });
3  testsuite/example/src/test/java/org/jboss/test/osgi/example/jaxws/WebServiceClientTestCase.java
@@ -49,7 +49,7 @@
49 49
 
50 50
 /**
51 51
  * Test web service client functionality
52  
- * 
  52
+ *
53 53
  * @author thomas.diesler@jboss.com
54 54
  * @since 28-Aug-2011
55 55
  */
@@ -80,6 +80,7 @@ public InputStream openStream() {
80 80
                 builder.addBundleSymbolicName(archive.getName());
81 81
                 builder.addBundleManifestVersion(2);
82 82
                 builder.addImportPackages(WebService.class, SOAPBinding.class, QName.class, Service.class);
  83
+                builder.addImportPackages(ManagementClient.class);
83 84
                 return builder.openStream();
84 85
             }
85 86
         });
3  testsuite/example/src/test/java/org/jboss/test/osgi/example/jaxws/WebServiceEndpointTestCase.java
@@ -57,7 +57,7 @@
57 57
 
58 58
 /**
59 59
  * Test web service endpoint functionality
60  
- * 
  60
+ *
61 61
  * @author thomas.diesler@jboss.com
62 62
  * @since 28-Aug-2011
63 63
  */
@@ -93,6 +93,7 @@ public InputStream openStream() {
93 93
                 builder.addBundleSymbolicName(archive.getName());
94 94
                 builder.addBundleManifestVersion(2);
95 95
                 builder.addImportPackages(WebService.class, SOAPBinding.class, QName.class, Service.class);
  96
+                builder.addImportPackages(PackageAdmin.class, ManagementClient.class);
96 97
                 return builder.openStream();
97 98
             }
98 99
         });
195  testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/NamingStandaloneTestCase.java
... ...
@@ -0,0 +1,195 @@
  1
+/*
  2
+ * JBoss, Home of Professional Open Source
  3
+ * Copyright 2012, JBoss Inc., and individual contributors as indicated
  4
+ * by the @authors tag. See the copyright.txt in the distribution for a
  5
+ * full listing of individual contributors.
  6
+ *
  7
+ * This is free software; you can redistribute it and/or modify it
  8
+ * under the terms of the GNU Lesser General Public License as
  9
+ * published by the Free Software Foundation; either version 2.1 of
  10
+ * the License, or (at your option) any later version.
  11
+ *
  12
+ * This software is distributed in the hope that it will be useful,
  13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15
+ * Lesser General Public License for more details.
  16
+ *
  17
+ * You should have received a copy of the GNU Lesser General Public
  18
+ * License along with this software; if not, write to the Free
  19
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21
+ */
  22
+package org.jboss.test.osgi.example.jndi;
  23
+
  24
+import java.io.InputStream;
  25
+import java.util.Hashtable;
  26
+
  27
+import javax.naming.Context;
  28
+import javax.naming.InitialContext;
  29
+import javax.naming.Reference;
  30
+import javax.naming.spi.InitialContextFactory;
  31
+
  32
+import org.jboss.arquillian.container.test.api.Deployer;
  33
+import org.jboss.arquillian.container.test.api.Deployment;
  34
+import org.jboss.arquillian.junit.Arquillian;
  35
+import org.jboss.arquillian.junit.InSequence;
  36
+import org.jboss.arquillian.test.api.ArquillianResource;
  37
+import org.jboss.osgi.metadata.OSGiManifestBuilder;
  38
+import org.jboss.osgi.repository.XRequirementBuilder;
  39
+import org.jboss.osgi.resolver.MavenCoordinates;
  40
+import org.jboss.shrinkwrap.api.ShrinkWrap;
  41
+import org.jboss.shrinkwrap.api.asset.Asset;
  42
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
  43
+import org.jboss.test.osgi.AriesSupport;
  44
+import org.jboss.test.osgi.BlueprintSupport;
  45
+import org.jboss.test.osgi.ConfigurationAdminSupport;
  46
+import org.jboss.test.osgi.NamingSupport;
  47
+import org.jboss.test.osgi.RepositorySupport;
  48
+import org.jboss.test.osgi.example.jndi.bundle.JNDITestActivator;
  49
+import org.jboss.test.osgi.example.jndi.bundle.JNDITestActivator.SimpleInitalContextFactory;
  50
+import org.jboss.test.osgi.example.jndi.bundle.JNDITestActivator.StringReference;
  51
+import org.jboss.test.osgi.example.jndi.bundle.JNDITestService;
  52
+import org.junit.Assert;
  53
+import org.junit.Ignore;
  54
+import org.junit.Test;
  55
+import org.junit.runner.RunWith;
  56
+import org.osgi.framework.Bundle;
  57
+import org.osgi.framework.BundleContext;
  58
+import org.osgi.resource.Resource;
  59
+import org.osgi.service.jndi.JNDIContextManager;
  60
+import org.osgi.service.packageadmin.PackageAdmin;
  61
+import org.osgi.service.repository.Repository;
  62
+
  63
+/**
  64
+ * This test exercises the OSGi-JNDI integration
  65
+ *
  66
+ * @author David Bosschaert
  67
+ * @author Thomas.Diesler@jboss.com
  68
+ */
  69
+@RunWith(Arquillian.class)
  70
+public class NamingStandaloneTestCase {
  71
+
  72
+    private static final String JNDI_PROVIDER = "jndi-provider";
  73
+
  74
+    @ArquillianResource
  75
+    BundleContext context;
  76
+
  77
+    @ArquillianResource
  78
+    Deployer deployer;
  79
+
  80
+    @Deployment(name = JNDI_PROVIDER)
  81
+    public static JavaArchive jndiProvider() {
  82
+        final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, JNDI_PROVIDER);
  83
+        archive.addClasses(RepositorySupport.class, NamingSupport.class, AriesSupport.class, BlueprintSupport.class, ConfigurationAdminSupport.class);
  84
+        archive.addClasses(JNDITestService.class, JNDITestActivator.class);
  85
+        archive.addAsManifestResource(RepositorySupport.BUNDLE_VERSIONS_FILE);
  86
+        archive.setManifest(new Asset() {
  87
+            @Override
  88
+            public InputStream openStream() {
  89
+                OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
  90
+                builder.addBundleSymbolicName(archive.getName());
  91
+                builder.addBundleManifestVersion(2);
  92
+                builder.addBundleActivator(JNDITestActivator.class);
  93
+                builder.addImportPackages(XRequirementBuilder.class, MavenCoordinates.class, Repository.class, Resource.class);
  94
+                builder.addImportPackages(PackageAdmin.class, Context.class, InitialContextFactory.class);
  95
+                builder.addDynamicImportPackages(JNDIContextManager.class.getPackage().getName());
  96
+                builder.addExportPackages(JNDITestService.class);
  97
+                return builder.openStream();
  98
+            }
  99
+        });
  100
+        return archive;
  101
+    }
  102
+
  103
+    @Test
  104
+    @InSequence(0)
  105
+    public void addNamingSupport(@ArquillianResource Bundle bundle) throws Exception {
  106
+        NamingSupport.provideJNDIIntegration(context, bundle);
  107
+        bundle.start();
  108
+    }
  109
+
  110
+    @Test
  111
+    @InSequence(1)
  112
+    public void testContextManagerOwnerContext(@ArquillianResource Bundle bundle) throws Exception {
  113
+
  114
+        // Get the InitialContext via {@link JNDIContextManager}
  115
+        JNDIContextManager contextManager = NamingSupport.getContextManager(bundle);
  116
+        Context initialContext = contextManager.newInitialContext();
  117
+
  118
+        // Get the context of the owner bundle
  119
+        BundleContext context = (BundleContext) initialContext.lookup("osgi:framework/bundleContext");
  120
+        Assert.assertEquals(bundle.getBundleContext(), context);
  121
+    }
  122
+
  123
+    @Test
  124
+    @InSequence(1)
  125
+    public void testContextManagerReferenceBinding(@ArquillianResource Bundle bundle) throws Exception {
  126
+
  127
+        // Get the InitialContext via {@link JNDIContextManager}
  128
+        JNDIContextManager contextManager = NamingSupport.getContextManager(bundle);
  129
+        Hashtable<String, String> env = new Hashtable<String, String>();
  130
+        env.put(Context.INITIAL_CONTEXT_FACTORY, SimpleInitalContextFactory.class.getName());
  131
+        Context initialContext = contextManager.newInitialContext(env);
  132
+
  133
+        // Bind a some value reference under some key
  134
+        Reference ref = new StringReference("bar");
  135
+        initialContext.bind("test/foo", ref);
  136
+        try {
  137
+            // Lookup the value
  138
+            Assert.assertEquals("bar", initialContext.lookup("test/foo"));
  139
+        } finally {
  140
+            initialContext.unbind("test/foo");
  141
+        }
  142
+    }
  143
+
  144
+    @Test
  145
+    @Ignore
  146
+    @InSequence(1)
  147
+    public void testTraditionalAPIOwnerContext(@ArquillianResource Bundle bundle) throws Exception {
  148
+
  149
+        // Get the InitialContext via API
  150
+        Context initialContext = new InitialContext();
  151
+
  152
+        // Get the context of the owner bundle
  153
+        BundleContext context = (BundleContext) initialContext.lookup("osgi:framework/bundleContext");
  154
+        Assert.assertEquals(bundle.getBundleContext(), context);
  155
+    }
  156
+
  157
+    @Test
  158
+    @InSequence(1)
  159
+    public void testTraditionalAPIValueBinding(@ArquillianResource Bundle bundle) throws Exception {
  160
+
  161
+        // Get the InitialContext via API
  162
+        Hashtable<String, String> env = new Hashtable<String, String>();
  163
+        env.put(Context.INITIAL_CONTEXT_FACTORY, SimpleInitalContextFactory.class.getName());
  164
+        Context initialContext = new InitialContext(env);
  165
+
  166
+        // Bind a some value under some key
  167
+        initialContext.bind("test/foo", "bar");
  168
+        try {
  169
+            // Lookup the value
  170
+            Assert.assertEquals("bar", initialContext.lookup("test/foo"));
  171
+        } finally {
  172
+            initialContext.unbind("test/foo");
  173
+        }
  174
+    }
  175
+
  176
+    @Test
  177
+    @InSequence(1)
  178
+    public void testTraditionalAPIReferenceBinding(@ArquillianResource Bundle bundle) throws Exception {
  179
+
  180
+        // Get the InitialContext via API
  181
+        Hashtable<String, String> env = new Hashtable<String, String>();
  182
+        env.put(Context.INITIAL_CONTEXT_FACTORY, SimpleInitalContextFactory.class.getName());
  183
+        Context initialContext = new InitialContext(env);
  184
+
  185
+        // Bind a some value reference under some key
  186
+        Reference ref = new StringReference("bar");
  187
+        initialContext.bind("test/foo", ref);
  188
+        try {
  189
+            // Lookup the value
  190
+            Assert.assertEquals("bar", initialContext.lookup("test/foo"));
  191
+        } finally {
  192
+            initialContext.unbind("test/foo");
  193
+        }
  194
+    }
  195
+}
91  ...ss/test/osgi/example/jndi/NamingSpecTestCase.java → .../jboss/test/osgi/example/jndi/NamingTestCase.java
@@ -27,7 +27,6 @@
27 27
 import javax.naming.Context;
28 28
 import javax.naming.InitialContext;
29 29
 import javax.naming.NameNotFoundException;
30  
-import javax.naming.Reference;
31 30
 import javax.naming.spi.InitialContextFactory;
32 31
 
33 32
 import org.jboss.arquillian.container.test.api.Deployer;
@@ -48,10 +47,8 @@
48 47
 import org.jboss.test.osgi.RepositorySupport;
49 48
 import org.jboss.test.osgi.example.jndi.bundle.JNDITestActivator;
50 49
 import org.jboss.test.osgi.example.jndi.bundle.JNDITestActivator.SimpleInitalContextFactory;
51  
-import org.jboss.test.osgi.example.jndi.bundle.JNDITestActivator.StringReference;
52 50
 import org.jboss.test.osgi.example.jndi.bundle.JNDITestService;
53 51
 import org.junit.Assert;
54  
-import org.junit.Ignore;
55 52
 import org.junit.Test;
56 53
 import org.junit.runner.RunWith;
57 54
 import org.osgi.framework.Bundle;
@@ -71,7 +68,7 @@
71 68
  * @author Thomas.Diesler@jboss.com
72 69
  */
73 70
 @RunWith(Arquillian.class)
74  
-public class NamingSpecTestCase {
  71
+public class NamingTestCase {
75 72
 
76 73
     private static final String JNDI_PROVIDER = "jndi-provider";
77 74
 
@@ -137,19 +134,6 @@ public void testContextManager(@ArquillianResource Bundle bundle) throws Excepti
137 134
 
138 135
     @Test
139 136
     @InSequence(1)
140  
-    public void testContextManagerOwnerContext(@ArquillianResource Bundle bundle) throws Exception {
141  
-
142  
-        // Get the InitialContext via {@link JNDIContextManager}
143  
-        JNDIContextManager contextManager = NamingSupport.getContextManager(bundle);
144  
-        Context initialContext = contextManager.newInitialContext();
145  
-
146  
-        // Get the context of the owner bundle
147  
-        BundleContext context = (BundleContext) initialContext.lookup("osgi:framework/bundleContext");
148  
-        Assert.assertEquals(bundle.getBundleContext(), context);
149  
-    }
150  
-
151  
-    @Test
152  
-    @InSequence(1)
153 137
     public void testContextManagerValueBinding(@ArquillianResource Bundle bundle) throws Exception {
154 138
 
155 139
         // Get the InitialContext via {@link JNDIContextManager}
@@ -170,27 +154,6 @@ public void testContextManagerValueBinding(@ArquillianResource Bundle bundle) th
170 154
 
171 155
     @Test
172 156
     @InSequence(1)
173  
-    public void testContextManagerReferenceBinding(@ArquillianResource Bundle bundle) throws Exception {
174  
-
175  
-        // Get the InitialContext via {@link JNDIContextManager}
176  
-        JNDIContextManager contextManager = NamingSupport.getContextManager(bundle);
177  
-        Hashtable<String, String> env = new Hashtable<String, String>();
178  
-        env.put(Context.INITIAL_CONTEXT_FACTORY, SimpleInitalContextFactory.class.getName());
179  
-        Context initialContext = contextManager.newInitialContext(env);
180  
-
181  
-        // Bind a some value reference under some key
182  
-        Reference ref = new StringReference("bar");
183  
-        initialContext.bind("test/foo", ref);
184  
-        try {
185  
-            // Lookup the value
186  
-            Assert.assertEquals("bar", initialContext.lookup("test/foo"));
187  
-        } finally {
188  
-            initialContext.unbind("test/foo");
189  
-        }
190  
-    }
191  
-
192  
-    @Test
193  
-    @InSequence(1)
194 157
     public void testContextManagerValueLookup(@ArquillianResource Bundle bundle) throws Exception {
195 158
 
196 159
         InputStream inputB = deployer.getDeployment("bundleB");
@@ -285,58 +248,6 @@ public void testTraditionalAPI(@ArquillianResource Bundle bundle) throws Excepti
285 248
     }
286 249
 
287 250
     @Test
288  
-    @Ignore
289  
-    @InSequence(1)
290  
-    public void testTraditionalAPIOwnerContext(@ArquillianResource Bundle bundle) throws Exception {
291  
-
292  
-        // Get the InitialContext via API
293  
-        Context initialContext = new InitialContext();
294  
-
295  
-        // Get the context of the owner bundle
296  
-        BundleContext context = (BundleContext) initialContext.lookup("osgi:framework/bundleContext");
297  
-        Assert.assertEquals(bundle.getBundleContext(), context);
298  
-    }
299  
-
300  
-    @Test
301  
-    @InSequence(1)
302  
-    public void testTraditionalAPIValueBinding(@ArquillianResource Bundle bundle) throws Exception {
303  
-
304  
-        // Get the InitialContext via API
305  
-        Hashtable<String, String> env = new Hashtable<String, String>();
306  
-        env.put(Context.INITIAL_CONTEXT_FACTORY, SimpleInitalContextFactory.class.getName());
307  
-        Context initialContext = new InitialContext(env);
308  
-
309  
-        // Bind a some value under some key
310  
-        initialContext.bind("test/foo", "bar");
311  
-        try {
312  
-            // Lookup the value
313  
-            Assert.assertEquals("bar", initialContext.lookup("test/foo"));
314  
-        } finally {
315  
-            initialContext.unbind("test/foo");
316  
-        }
317  
-    }
318  
-
319  
-    @Test
320  
-    @InSequence(1)
321  
-    public void testTraditionalAPIReferenceBinding(@ArquillianResource Bundle bundle) throws Exception {
322  
-
323  
-        // Get the InitialContext via API
324  
-        Hashtable<String, String> env = new Hashtable<String, String>();
325  
-        env.put(Context.INITIAL_CONTEXT_FACTORY, SimpleInitalContextFactory.class.getName());
326  
-        Context initialContext = new InitialContext(env);
327  
-
328  
-        // Bind a some value reference under some key
329  
-        Reference ref = new StringReference("bar");
330  
-        initialContext.bind("test/foo", ref);
331  
-        try {
332  
-            // Lookup the value
333  
-            Assert.assertEquals("bar", initialContext.lookup("test/foo"));
334  
-        } finally {
335  
-            initialContext.unbind("test/foo");
336  
-        }
337  
-    }
338  
-
339  
-    @Test
340 251
     @InSequence(1)
341 252
     public void testTraditionalAPIValueLookup(@ArquillianResource Bundle bundle) throws Exception {
342 253
 
3  testsuite/example/src/test/java/org/jboss/test/osgi/example/jpa/PersistenceTestCase.java
@@ -54,7 +54,7 @@
54 54
 
55 55
 /**
56 56
  * Test simple OSGi Persistence deployment
57  
- * 
  57
+ *
58 58
  * @author thomas.diesler@jboss.com
59 59
  * @since 31-Aug-2012
60 60
  */
@@ -83,6 +83,7 @@ public InputStream openStream() {
83 83
                 builder.addBundleSymbolicName(archive.getName());
84 84
                 builder.addBundleManifestVersion(2);
85 85
                 builder.addImportPackages(Bundle.class, ServiceTracker.class, EntityManager.class);
  86
+                builder.addImportPackages(PackageAdmin.class);
86 87
                 return builder.openStream();
87 88
             }
88 89
         });
3  testsuite/example/src/test/java/org/jboss/test/osgi/example/resource/BundleContextInjectionTestCase.java
@@ -46,7 +46,7 @@
46 46
 
47 47
 /**
48 48
  * An example of OSGi resource injection.
49  
- * 
  49
+ *
50 50
  * @author thomas.diesler@jboss.com
51 51
  * @since 10-Jul-2012
52 52
  */
@@ -73,6 +73,7 @@ public InputStream openStream() {
73 73
                 OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
74 74
                 builder.addBundleSymbolicName(jar.getName());
75 75
                 builder.addBundleManifestVersion(2);
  76
+                builder.addImportPackages(ManagementClient.class);
76 77
                 return builder.openStream();
77 78
             }
78 79
         });
5  testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppTestCase.java
@@ -58,9 +58,9 @@
58 58
 
59 59
 /**
60 60
  * Test webapp deployemnts as OSGi bundles
61  
- * 
  61
+ *
62 62
  * @author thomas.diesler@jboss.com
63  
- * 
  63
+ *
64 64
  * @since 07-Jun-2011
65 65
  */
66 66
 @RunWith(Arquillian.class)
@@ -98,6 +98,7 @@ public InputStream openStream() {
98 98
                 OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
99 99
                 builder.addBundleSymbolicName(jar.getName());
100 100
                 builder.addBundleManifestVersion(2);
  101
+                builder.addImportPackages(PackageAdmin.class, ManagementClient.class);
101 102
                 return builder.openStream();
102 103
             }
103 104
         });

0 notes on commit 4ef4a29

Please sign in to comment.
Something went wrong with that request. Please try again.