Author: thomas.diesler(a)jboss.com
Date: 2009-11-25 18:25:11 -0500 (Wed, 25 Nov 2009)
New Revision: 96996
Added:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/bundle/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/bundle/OSGI212Activator.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/bundle/SomeBean.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/bundle/SomeService.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi212/
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi212/META-INF/
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi212/META-INF/jbosgi212-jboss-beans.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi212/jbosgi212-bundle.bnd
Modified:
projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/OSGI212TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/bundleA/ServiceB.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java
Log:
[JBOSGI-212] Cannot refresh Microcontainer service
Modified: projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml 2009-11-25
20:20:02 UTC (rev 96995)
+++ projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml 2009-11-25
23:25:11 UTC (rev 96996)
@@ -130,6 +130,9 @@
<!-- jbosgi161 -->
<bnd classpath="${tests.classes.dir}"
output="${tests.output.dir}/test-libs/jbosgi161-bundle.jar"
files="${tests.resources.dir}/jbosgi161/jbosgi161-bundle.bnd" />
+ <!-- jbosgi212 -->
+ <bnd classpath="${tests.classes.dir}"
output="${tests.output.dir}/test-libs/jbosgi212-bundle.jar"
files="${tests.resources.dir}/jbosgi212/jbosgi212-bundle.bnd" />
+
<!-- performance -->
<bnd classpath="${tests.classes.dir}"
output="${tests.output.dir}/test-libs/performance-blueprint.jar"
files="${tests.resources.dir}/performance/blueprint/performance-blueprint.bnd"
/>
Modified:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/OSGI212TestCase.java
===================================================================
---
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/OSGI212TestCase.java 2009-11-25
20:20:02 UTC (rev 96995)
+++
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/OSGI212TestCase.java 2009-11-25
23:25:11 UTC (rev 96996)
@@ -23,15 +23,17 @@
//$Id:$
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.jboss.osgi.microcontainer.MicrocontainerCapability;
import org.jboss.osgi.spi.service.MicrocontainerService;
-import org.jboss.osgi.testing.OSGiPackageAdmin;
+import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiServiceReference;
import org.jboss.osgi.testing.OSGiTest;
import org.junit.Test;
+import org.osgi.framework.Bundle;
/**
* [JBOSGI-212] Cannot refresh Microcontainer service
@@ -46,18 +48,19 @@
@Test
public void testLogging() throws Exception
{
- OSGiRuntime runtime = getDefaultRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
runtime.addCapability(new MicrocontainerCapability());
+ OSGiBundle bundle = runtime.getBundle("jboss-osgi-microcontainer",
null);
+ assertNotNull("MicrocontainerService available", bundle);
+ assertEquals("Bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
+
+ // Update the MC bundle
+ // bundle.update();
+
OSGiServiceReference sref =
runtime.getServiceReference(MicrocontainerService.class.getName());
- assertNotNull("MicrocontainerService available", sref);
-
- OSGiPackageAdmin packageAdmin = runtime.getPackageAdmin();
- packageAdmin.refreshPackages(null);
-
- sref = runtime.getServiceReference(MicrocontainerService.class.getName());
assertNotNull("MicrocontainerService still available", sref);
}
finally
Added:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/bundle/OSGI212Activator.java
===================================================================
---
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/bundle/OSGI212Activator.java
(rev 0)
+++
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/bundle/OSGI212Activator.java 2009-11-25
23:25:11 UTC (rev 96996)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.osgi.jbosgi212.bundle;
+
+//$Id: SomeServiceActivator.java 89664 2009-06-02 12:55:10Z thomas.diesler(a)jboss.com $
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * A Service Activator
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 24-Apr-2009
+ */
+public class OSGI212Activator implements BundleActivator
+{
+ public void start(BundleContext context)
+ {
+ context.registerService(SomeService.class.getName(), new SomeService(context),
null);
+ }
+
+ public void stop(BundleContext context)
+ {
+ }
+}
\ No newline at end of file
Added:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/bundle/SomeBean.java
===================================================================
---
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/bundle/SomeBean.java
(rev 0)
+++
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/bundle/SomeBean.java 2009-11-25
23:25:11 UTC (rev 96996)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.osgi.jbosgi212.bundle;
+
+//$Id: SomeBean.java 93025 2009-08-31 13:10:16Z thomas.diesler(a)jboss.com $
+
+public class SomeBean
+{
+}
Added:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/bundle/SomeService.java
===================================================================
---
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/bundle/SomeService.java
(rev 0)
+++
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi212/bundle/SomeService.java 2009-11-25
23:25:11 UTC (rev 96996)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.osgi.jbosgi212.bundle;
+
+//$Id: SomeService.java 93025 2009-08-31 13:10:16Z thomas.diesler(a)jboss.com $
+
+import org.jboss.osgi.spi.service.MicrocontainerService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A service that accesses the MicrocontainerService
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 24-Apr-2009
+ */
+public class SomeService
+{
+ // Provide logging
+ private static Logger log = LoggerFactory.getLogger(SomeService.class);
+
+ public SomeService(BundleContext context)
+ {
+ ServiceReference sref =
context.getServiceReference(MicrocontainerService.class.getName());
+ MicrocontainerService service = (MicrocontainerService)context.getService(sref);
+
+ SomeBean bean = (SomeBean)service.getRegisteredBean("SomeBean");
+ if (bean == null)
+ throw new IllegalStateException("No MC bean");
+
+ log.info("MC bean available");
+ }
+}
Modified:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/bundleA/ServiceB.java
===================================================================
---
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/bundleA/ServiceB.java 2009-11-25
20:20:02 UTC (rev 96995)
+++
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/bundleA/ServiceB.java 2009-11-25
23:25:11 UTC (rev 96996)
@@ -58,7 +58,7 @@
tracker.open();
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public void updateConfig(String key, String value)
{
if (configAdmin != null)
@@ -84,7 +84,7 @@
}
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public void updated(Dictionary props) throws ConfigurationException
{
}
Modified:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java
===================================================================
---
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java 2009-11-25
20:20:02 UTC (rev 96995)
+++
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java 2009-11-25
23:25:11 UTC (rev 96996)
@@ -29,6 +29,7 @@
import org.jboss.osgi.spi.util.ConstantsHelper;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
import org.jboss.osgi.testing.OSGiTestHelper;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -46,7 +47,7 @@
* @author thomas.diesler(a)jboss.com
* @since 08-Jul-2009
*/
-public class OSGI99TestCase
+public class OSGI99TestCase extends OSGiTest
{
// Provide logging
private static Logger log = LoggerFactory.getLogger(OSGI99TestCase.class);
Added:
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi212/META-INF/jbosgi212-jboss-beans.xml
===================================================================
---
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi212/META-INF/jbosgi212-jboss-beans.xml
(rev 0)
+++
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi212/META-INF/jbosgi212-jboss-beans.xml 2009-11-25
23:25:11 UTC (rev 96996)
@@ -0,0 +1,6 @@
+<deployment
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="SomeBean"
class="org.jboss.test.osgi.jbosgi212.bundle.SomeBean"/>
+
+</deployment>
+
Added:
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi212/jbosgi212-bundle.bnd
===================================================================
---
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi212/jbosgi212-bundle.bnd
(rev 0)
+++
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi212/jbosgi212-bundle.bnd 2009-11-25
23:25:11 UTC (rev 96996)
@@ -0,0 +1,8 @@
+# bnd build -classpath target/test-classes -output target/test-libs/jbosgi212-bundle.jar
src/test/resources/jbosgi212/jbosgi212-bundle.bnd
+
+Bundle-SymbolicName: jbosgi212-bundle
+Bundle-Activator: org.jboss.test.osgi.jbosgi212.bundle.OSGI212Activator
+Export-Package: org.jboss.test.osgi.jbosgi212.bundle
+Import-Package: org.jboss.osgi.spi.service, org.osgi.framework, org.slf4j
+Include-Resource: META-INF/jbosgi212-jboss-beans.xml=META-INF/jbosgi212-jboss-beans.xml
+-removeheaders: Include-Resource