[jboss-svn-commits] JBoss Common SVN: r4728 - in arquillian/trunk: build and 22 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Jul 14 18:18:23 EDT 2010
Author: thomas.diesler at jboss.com
Date: 2010-07-14 18:18:21 -0400 (Wed, 14 Jul 2010)
New Revision: 4728
Added:
arquillian/trunk/containers/osgi-embedded-4.2/src/main/java/org/jboss/arquillian/container/osgi/embedded_4_2/OSGiEmbeddedContainer.java
arquillian/trunk/containers/osgi-embedded-4.2/src/main/java/org/jboss/arquillian/packager/
arquillian/trunk/containers/osgi-embedded-4.2/src/main/java/org/jboss/arquillian/packager/osgi/
arquillian/trunk/containers/osgi-embedded-4.2/src/main/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackager.java
arquillian/trunk/containers/osgi-embedded-4.2/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeploymentPackager
arquillian/trunk/containers/osgi-embedded-4.2/src/test/java/org/jboss/arquillian/packager/
arquillian/trunk/containers/osgi-embedded-4.2/src/test/java/org/jboss/arquillian/packager/osgi/
arquillian/trunk/containers/osgi-embedded-4.2/src/test/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackagerTestCase.java
Removed:
arquillian/trunk/containers/osgi-embedded-4.2/src/main/java/org/jboss/arquillian/container/osgi/embedded_4_2/OSGiEmbeddedFrameworkContainer.java
arquillian/trunk/packagers/osgi/pom.xml
arquillian/trunk/packagers/osgi/src/main/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackager.java
arquillian/trunk/packagers/osgi/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeploymentPackager
arquillian/trunk/packagers/osgi/src/test/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackagerTestCase.java
arquillian/trunk/packagers/pom.xml
Modified:
arquillian/trunk/build/pom.xml
arquillian/trunk/bundle/pom.xml
arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/osgi/ArquillianBundleActivator.java
arquillian/trunk/containers/osgi-embedded-4.2/pom.xml
arquillian/trunk/containers/osgi-embedded-4.2/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeployableContainer
arquillian/trunk/containers/osgi-embedded-4.2/src/test/java/org/jboss/arquillian/container/osgi/embedded_4_2/OSGiEmbeddedFrameworkTestCase.java
arquillian/trunk/containers/osgi-embedded-4.2/src/test/java/org/jboss/arquillian/container/osgi/embedded_4_2/SimpleActivator.java
arquillian/trunk/containers/osgi-embedded-4.2/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
arquillian/trunk/containers/pom.xml
arquillian/trunk/pom.xml
arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXMethodExecutor.java
arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXTestRunner.java
arquillian/trunk/protocols/jmx/src/test/java/org/jboss/arquillian/jmx/JMXTestRunnerTestCase.java
arquillian/trunk/testenrichers/osgi/src/main/java/org/jboss/arquillian/testenricher/osgi/OSGiTestEnricher.java
Log:
JMXTestRunner uses TestClassLoader to callback into the BundleActivator.
The TestClassLoader then uses Bundle.loadClass() and does not go through the ClassLoader backdoor.
Add logic to automatically install the compendium and the arquillian bundle
Modified: arquillian/trunk/build/pom.xml
===================================================================
--- arquillian/trunk/build/pom.xml 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/build/pom.xml 2010-07-14 22:18:21 UTC (rev 4728)
@@ -29,7 +29,7 @@
<version.javaee_api>6.0</version.javaee_api>
<version.jboss_embedded>1.0.0-alpha-1</version.jboss_embedded>
<version.jboss_logging>2.1.0.GA</version.jboss_logging>
- <version.jboss_osgi_spi>1.0.7-SNAPSHOT</version.jboss_osgi_spi>
+ <version.jboss_osgi_spi>1.0.10-SNAPSHOT</version.jboss_osgi_spi>
<version.jboss_osgi_vfs>1.0.0</version.jboss_osgi_vfs>
<version.jetty_jetty>6.1.9</version.jetty_jetty>
<version.junit_junit>4.6</version.junit_junit>
Modified: arquillian/trunk/bundle/pom.xml
===================================================================
--- arquillian/trunk/bundle/pom.xml 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/bundle/pom.xml 2010-07-14 22:18:21 UTC (rev 4728)
@@ -66,6 +66,7 @@
javax.inject;version=${version.javax.inject_javax.inject},
org.jboss.arquillian.junit;version=${version},
org.jboss.shrinkwrap.api;version=${version.shrinkwrap_shrinkwrap},
+ org.jboss.shrinkwrap.api.asset;version=${version.shrinkwrap_shrinkwrap},
org.jboss.shrinkwrap.api.spec;version=${version.shrinkwrap_shrinkwrap},
org.junit.runner;version=${version.junit_junit},
org.junit;version=${version.junit_junit},
Modified: arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/osgi/ArquillianBundleActivator.java
===================================================================
--- arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/osgi/ArquillianBundleActivator.java 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/osgi/ArquillianBundleActivator.java 2010-07-14 22:18:21 UTC (rev 4728)
@@ -28,9 +28,11 @@
import javax.management.StandardMBean;
import org.jboss.arquillian.protocol.jmx.JMXTestRunner;
+import org.jboss.arquillian.protocol.jmx.JMXTestRunner.TestClassLoader;
import org.jboss.arquillian.testenricher.osgi.BundleContextHolder;
import org.jboss.arquillian.testenricher.osgi.OSGiTestEnricher;
import org.jboss.logging.Logger;
+import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -48,17 +50,27 @@
// Provide logging
private static Logger log = Logger.getLogger(ArquillianBundleActivator.class);
- @Override
+ private JMXTestRunner testRunner;
+
public void start(final BundleContext context) throws Exception
{
+ TestClassLoader loader = new TestClassLoader()
+ {
+ public Class<?> loadTestClass(String className) throws ClassNotFoundException
+ {
+ Bundle bundle = context.getBundle();
+ return bundle.loadClass(className);
+ }
+ };
+
// Register the JMXTestRunner
MBeanServer mbeanServer = getMBeanServer(context);
- JMXTestRunner.register(mbeanServer);
+ testRunner = new JMXTestRunner(loader);
+ testRunner.registerMBean(mbeanServer);
// Register the BundleContextHolder
BundleContextHolder holder = new BundleContextHolder()
{
- @Override
public BundleContext getBundleContext()
{
return context;
@@ -68,13 +80,12 @@
mbeanServer.registerMBean(holderMBean, new ObjectName(BundleContextHolder.OBJECT_NAME));
}
- @Override
public void stop(BundleContext context) throws Exception
{
// Unregister the JMXTestRunner
MBeanServer mbeanServer = getMBeanServer(context);
- JMXTestRunner.unregister(mbeanServer);
-
+ testRunner.unregisterMBean(mbeanServer);
+
// Unregister the BundleContextHolder
mbeanServer.unregisterMBean(new ObjectName(BundleContextHolder.OBJECT_NAME));
}
@@ -89,7 +100,7 @@
log.debug("Found MBeanServer fom service: " + mbeanServer.getDefaultDomain());
return mbeanServer;
}
-
+
// Find or create the MBeanServer
return OSGiTestEnricher.findOrCreateMBeanServer();
}
Modified: arquillian/trunk/containers/osgi-embedded-4.2/pom.xml
===================================================================
--- arquillian/trunk/containers/osgi-embedded-4.2/pom.xml 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/containers/osgi-embedded-4.2/pom.xml 2010-07-14 22:18:21 UTC (rev 4728)
@@ -21,7 +21,8 @@
<!-- Properties -->
<properties>
- <version.jboss_osgi_framework>1.0.0.Alpha5</version.jboss_osgi_framework>
+ <version.jboss_osgi_framework>1.0.0.Alpha6-SNAPSHOT</version.jboss_osgi_framework>
+ <version.jboss_osgi_resolver_felix>2.1.0-SNAPSHOT</version.jboss_osgi_resolver_felix>
</properties>
<!-- Build -->
@@ -66,12 +67,6 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.jboss.arquillian.protocol</groupId>
- <artifactId>arquillian-protocol-local</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>org.jboss.arquillian.packager</groupId>
<artifactId>arquillian-packager-osgi</artifactId>
<version>${project.version}</version>
@@ -120,6 +115,12 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.jboss.osgi.resolver</groupId>
+ <artifactId>jbosgi-resolver-felix</artifactId>
+ <version>${version.jboss_osgi_resolver_felix}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
Copied: arquillian/trunk/containers/osgi-embedded-4.2/src/main/java/org/jboss/arquillian/container/osgi/embedded_4_2/OSGiEmbeddedContainer.java (from rev 4725, arquillian/trunk/containers/osgi-embedded-4.2/src/main/java/org/jboss/arquillian/container/osgi/embedded_4_2/OSGiEmbeddedFrameworkContainer.java)
===================================================================
--- arquillian/trunk/containers/osgi-embedded-4.2/src/main/java/org/jboss/arquillian/container/osgi/embedded_4_2/OSGiEmbeddedContainer.java (rev 0)
+++ arquillian/trunk/containers/osgi-embedded-4.2/src/main/java/org/jboss/arquillian/container/osgi/embedded_4_2/OSGiEmbeddedContainer.java 2010-07-14 22:18:21 UTC (rev 4728)
@@ -0,0 +1,180 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.arquillian.container.osgi.embedded_4_2;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+
+import org.jboss.arquillian.protocol.jmx.JMXMethodExecutor;
+import org.jboss.arquillian.spi.Configuration;
+import org.jboss.arquillian.spi.ContainerMethodExecutor;
+import org.jboss.arquillian.spi.Context;
+import org.jboss.arquillian.spi.DeployableContainer;
+import org.jboss.arquillian.spi.DeploymentException;
+import org.jboss.arquillian.spi.LifecycleException;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * OSGiEmbeddedContainer
+ *
+ * @author thomas.diesler at jboss.com
+ * @version $Revision: $
+ */
+public class OSGiEmbeddedContainer implements DeployableContainer
+{
+ // Provide logging
+ private static final Logger log = Logger.getLogger(OSGiEmbeddedContainer.class);
+
+ private Framework framework;
+
+ public void setup(Context context, Configuration configuration)
+ {
+ OSGiBootstrapProvider provider = OSGiBootstrap.getBootstrapProvider();
+ framework = provider.getFramework();
+ context.add(Framework.class, framework);
+ }
+
+ public void start(Context context) throws LifecycleException
+ {
+ try
+ {
+ framework.start();
+ context.add(BundleContext.class, framework.getBundleContext());
+
+ Bundle[] bundles = framework.getBundleContext().getBundles();
+ if (getInstalledBundle(bundles, "osgi.cmpn") == null)
+ installBundle("org.osgi.compendium", false);
+
+ if (getInstalledBundle(bundles, "arquillian-bundle") == null)
+ installBundle("arquillian-bundle", true);
+ }
+ catch (BundleException ex)
+ {
+ throw new LifecycleException("Cannot start embedded OSGi Framework", ex);
+ }
+ }
+
+ public void stop(Context context) throws LifecycleException
+ {
+ try
+ {
+ framework.stop();
+ framework.waitForStop(3000);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new LifecycleException("Cannot stop embedded OSGi Framework", ex);
+ }
+ }
+
+ public ContainerMethodExecutor deploy(Context context, final Archive<?> archive) throws DeploymentException
+ {
+ try
+ {
+ // Export the bundle bytes
+ ZipExporter exporter = archive.as(ZipExporter.class);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ exporter.exportZip(baos);
+
+ ByteArrayInputStream inputStream = new ByteArrayInputStream(baos.toByteArray());
+
+ BundleContext sysContext = framework.getBundleContext();
+ Bundle bundle = sysContext.installBundle(archive.getName(), inputStream);
+ context.add(Bundle.class, bundle);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new DeploymentException("Cannot deploy: " + archive, ex);
+ }
+
+ //return new LocalMethodExecutor();
+ return new JMXMethodExecutor();
+ }
+
+ public void undeploy(Context context, Archive<?> archive) throws DeploymentException
+ {
+ try
+ {
+ Bundle bundle = context.get(Bundle.class);
+ if (bundle != null)
+ bundle.uninstall();
+ }
+ catch (BundleException ex)
+ {
+ log.error("Cannot undeploy: " + archive, ex);
+ }
+ }
+
+ private Bundle getInstalledBundle(Bundle[] bundles, String symbolicName)
+ {
+ for (Bundle aux : bundles)
+ {
+ if (symbolicName.equals(aux.getSymbolicName()))
+ return aux;
+ }
+ return null;
+ }
+
+ private Bundle installBundle(String artifactId, boolean startBundle)
+ {
+ String classPath = System.getProperty("java.class.path");
+ if (classPath.contains(artifactId) == false)
+ {
+ log.debug("Class path does not contain '" + artifactId + "'");
+ return null;
+ }
+
+ String[] paths = classPath.split("" + File.pathSeparatorChar);
+ for (String path : paths)
+ {
+ if (path.contains(artifactId))
+ {
+ BundleContext sysContext = framework.getBundleContext();
+ try
+ {
+ Bundle bundle = sysContext.installBundle(new File(path).toURI().toString());
+ if (startBundle == true)
+ bundle.start();
+
+ return bundle;
+ }
+ catch (BundleException ex)
+ {
+ log.error("Cannot install bundle: " + path);
+ }
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file
Deleted: arquillian/trunk/containers/osgi-embedded-4.2/src/main/java/org/jboss/arquillian/container/osgi/embedded_4_2/OSGiEmbeddedFrameworkContainer.java
===================================================================
--- arquillian/trunk/containers/osgi-embedded-4.2/src/main/java/org/jboss/arquillian/container/osgi/embedded_4_2/OSGiEmbeddedFrameworkContainer.java 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/containers/osgi-embedded-4.2/src/main/java/org/jboss/arquillian/container/osgi/embedded_4_2/OSGiEmbeddedFrameworkContainer.java 2010-07-14 22:18:21 UTC (rev 4728)
@@ -1,135 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.arquillian.container.osgi.embedded_4_2;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-
-import org.jboss.arquillian.protocol.jmx.JMXMethodExecutor;
-import org.jboss.arquillian.spi.Configuration;
-import org.jboss.arquillian.spi.ContainerMethodExecutor;
-import org.jboss.arquillian.spi.Context;
-import org.jboss.arquillian.spi.DeployableContainer;
-import org.jboss.arquillian.spi.DeploymentException;
-import org.jboss.arquillian.spi.LifecycleException;
-import org.jboss.logging.Logger;
-import org.jboss.osgi.spi.framework.OSGiBootstrap;
-import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.exporter.ZipExporter;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.launch.Framework;
-
-/**
- * OSGiEmbeddedFrameworkContainer
- *
- * @author thomas.diesler at jboss.com
- * @version $Revision: $
- */
-public class OSGiEmbeddedFrameworkContainer implements DeployableContainer
-{
- // Provide logging
- private static final Logger log = Logger.getLogger(OSGiEmbeddedFrameworkContainer.class);
-
- private Framework framework;
-
- @Override
- public void setup(Context context, Configuration configuration)
- {
- OSGiBootstrapProvider provider = OSGiBootstrap.getBootstrapProvider();
- framework = provider.getFramework();
- context.add(Framework.class, framework);
- }
-
- @Override
- public void start(Context context) throws LifecycleException
- {
- try
- {
- framework.start();
- context.add(BundleContext.class, framework.getBundleContext());
- }
- catch (BundleException ex)
- {
- throw new LifecycleException("Cannot start embedded OSGi Framework", ex);
- }
- }
-
- @Override
- public void stop(Context context) throws LifecycleException
- {
- try
- {
- framework.stop();
- framework.waitForStop(3000);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new LifecycleException("Cannot stop embedded OSGi Framework", ex);
- }
- }
-
- @Override
- public ContainerMethodExecutor deploy(Context context, final Archive<?> archive) throws DeploymentException
- {
- try
- {
- // Export the bundle bytes
- ZipExporter exporter = archive.as(ZipExporter.class);
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- exporter.exportZip(baos);
-
- ByteArrayInputStream inputStream = new ByteArrayInputStream(baos.toByteArray());
-
- BundleContext sysContext = framework.getBundleContext();
- Bundle bundle = sysContext.installBundle(archive.getName(), inputStream);
- context.add(Bundle.class, bundle);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new DeploymentException("Cannot deploy: " + archive, ex);
- }
-
- //return new LocalMethodExecutor();
- return new JMXMethodExecutor();
- }
-
- @Override
- public void undeploy(Context context, Archive<?> archive) throws DeploymentException
- {
- try
- {
- Bundle bundle = context.get(Bundle.class);
- if (bundle != null)
- bundle.uninstall();
- }
- catch (BundleException ex)
- {
- log.error("Cannot undeploy: " + archive, ex);
- }
- }
-}
\ No newline at end of file
Copied: arquillian/trunk/containers/osgi-embedded-4.2/src/main/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackager.java (from rev 4725, arquillian/trunk/packagers/osgi/src/main/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackager.java)
===================================================================
--- arquillian/trunk/containers/osgi-embedded-4.2/src/main/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackager.java (rev 0)
+++ arquillian/trunk/containers/osgi-embedded-4.2/src/main/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackager.java 2010-07-14 22:18:21 UTC (rev 4728)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.arquillian.packager.osgi;
+
+import java.io.File;
+import java.util.Collection;
+
+import org.jboss.arquillian.spi.DeploymentPackager;
+import org.jboss.arquillian.spi.TestDeployment;
+import org.jboss.osgi.spi.util.BundleInfo;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.jboss.osgi.vfs.VirtualFile;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+/**
+ * Packager for running Arquillian against OSGi containers.
+ *
+ * @author thomas.diesler at jboss.com
+ * @version $Revision: $
+ */
+public class OSGiDeploymentPackager implements DeploymentPackager
+{
+ public Archive<?> generateDeployment(TestDeployment testDeployment)
+ {
+ Archive<?> appArchive = testDeployment.getApplicationArchive();
+ Collection<Archive<?>> auxArchives = testDeployment.getAuxiliaryArchives();
+ if(JavaArchive.class.isInstance(appArchive))
+ {
+ return handleArchive(JavaArchive.class.cast(appArchive), auxArchives);
+ }
+
+ throw new IllegalArgumentException(OSGiDeploymentPackager.class.getName() +
+ " can not handle archive of type " + appArchive.getClass().getName());
+ }
+
+ private Archive<?> handleArchive(JavaArchive archive, Collection<Archive<?>> auxiliaryArchives)
+ {
+ try
+ {
+ validateBundleArchive(archive);
+ return archive;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalArgumentException("Not a valid OSGi bundle: " + archive, ex);
+ }
+ }
+
+ private void validateBundleArchive(Archive<?> archive) throws Exception
+ {
+ String archiveName = archive.getName();
+ int dotIndex = archiveName.lastIndexOf(".");
+ if (dotIndex > 0)
+ archiveName = archiveName.substring(0, dotIndex);
+
+ // [TODO] Can this be done in memory?
+ File target = File.createTempFile(archiveName + "-", ".jar");
+ try
+ {
+ ZipExporter exporter = archive.as(ZipExporter.class);
+ exporter.exportZip(target, true);
+ VirtualFile virtualFile = AbstractVFS.getRoot(target.toURI().toURL());
+ BundleInfo.createBundleInfo(virtualFile);
+ }
+ finally
+ {
+ target.delete();
+ }
+ }
+}
\ No newline at end of file
Modified: arquillian/trunk/containers/osgi-embedded-4.2/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeployableContainer
===================================================================
--- arquillian/trunk/containers/osgi-embedded-4.2/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeployableContainer 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/containers/osgi-embedded-4.2/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeployableContainer 2010-07-14 22:18:21 UTC (rev 4728)
@@ -1 +1 @@
-org.jboss.arquillian.container.osgi.embedded_4_2.OSGiEmbeddedFrameworkContainer
\ No newline at end of file
+org.jboss.arquillian.container.osgi.embedded_4_2.OSGiEmbeddedContainer
\ No newline at end of file
Copied: arquillian/trunk/containers/osgi-embedded-4.2/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeploymentPackager (from rev 4725, arquillian/trunk/packagers/osgi/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeploymentPackager)
===================================================================
--- arquillian/trunk/containers/osgi-embedded-4.2/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeploymentPackager (rev 0)
+++ arquillian/trunk/containers/osgi-embedded-4.2/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeploymentPackager 2010-07-14 22:18:21 UTC (rev 4728)
@@ -0,0 +1 @@
+org.jboss.arquillian.packager.osgi.OSGiDeploymentPackager
\ No newline at end of file
Modified: arquillian/trunk/containers/osgi-embedded-4.2/src/test/java/org/jboss/arquillian/container/osgi/embedded_4_2/OSGiEmbeddedFrameworkTestCase.java
===================================================================
--- arquillian/trunk/containers/osgi-embedded-4.2/src/test/java/org/jboss/arquillian/container/osgi/embedded_4_2/OSGiEmbeddedFrameworkTestCase.java 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/containers/osgi-embedded-4.2/src/test/java/org/jboss/arquillian/container/osgi/embedded_4_2/OSGiEmbeddedFrameworkTestCase.java 2010-07-14 22:18:21 UTC (rev 4728)
@@ -17,7 +17,6 @@
package org.jboss.arquillian.container.osgi.embedded_4_2;
import static org.junit.Assert.assertEquals;
-
import static org.junit.Assert.assertNotNull;
import java.io.InputStream;
@@ -45,12 +44,6 @@
@RunWith(Arquillian.class)
public class OSGiEmbeddedFrameworkTestCase
{
-
- public OSGiEmbeddedFrameworkTestCase()
- {
- super();
- }
-
@Deployment
public static JavaArchive createdeployment()
{
@@ -65,7 +58,8 @@
builder.addBundleActivator(SimpleActivator.class.getName());
// [TODO] generate a separate bundle the contains the test case
builder.addExportPackages(OSGiEmbeddedFrameworkTestCase.class);
- builder.addImportPackages("org.jboss.arquillian.junit", "org.jboss.shrinkwrap.api", "org.jboss.shrinkwrap.api.spec");
+ builder.addImportPackages("org.jboss.arquillian.junit");
+ builder.addImportPackages("org.jboss.shrinkwrap.api", "org.jboss.shrinkwrap.api.asset", "org.jboss.shrinkwrap.api.spec");
builder.addImportPackages("javax.inject", "org.junit", "org.junit.runner");
return builder.openStream();
}
Modified: arquillian/trunk/containers/osgi-embedded-4.2/src/test/java/org/jboss/arquillian/container/osgi/embedded_4_2/SimpleActivator.java
===================================================================
--- arquillian/trunk/containers/osgi-embedded-4.2/src/test/java/org/jboss/arquillian/container/osgi/embedded_4_2/SimpleActivator.java 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/containers/osgi-embedded-4.2/src/test/java/org/jboss/arquillian/container/osgi/embedded_4_2/SimpleActivator.java 2010-07-14 22:18:21 UTC (rev 4728)
@@ -27,12 +27,10 @@
*/
public class SimpleActivator implements BundleActivator
{
- @Override
public void start(BundleContext context) throws Exception
{
SimpleService service = new SimpleService()
{
- @Override
public Integer sum(Integer... values)
{
Integer result = 0;
@@ -49,7 +47,6 @@
context.registerService(SimpleService.class.getName(), service, null);
}
- @Override
public void stop(BundleContext context) throws Exception
{
}
Copied: arquillian/trunk/containers/osgi-embedded-4.2/src/test/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackagerTestCase.java (from rev 4725, arquillian/trunk/packagers/osgi/src/test/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackagerTestCase.java)
===================================================================
--- arquillian/trunk/containers/osgi-embedded-4.2/src/test/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackagerTestCase.java (rev 0)
+++ arquillian/trunk/containers/osgi-embedded-4.2/src/test/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackagerTestCase.java 2010-07-14 22:18:21 UTC (rev 4728)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.arquillian.packager.osgi;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.jboss.arquillian.spi.TestDeployment;
+import org.jboss.osgi.testing.OSGiManifestBuilder;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.Asset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+
+/**
+ * OSGiDeploymentPackagerTestCase
+ *
+ * @author thomas.diesler at jboss.com
+ * @version $Revision: $
+ */
+public class OSGiDeploymentPackagerTestCase
+{
+ @Test
+ public void testValidBundle() throws Exception
+ {
+ final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "test-archive.jar");
+ archive.setManifest(new Asset()
+ {
+ public InputStream openStream()
+ {
+ OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
+ builder.addBundleSymbolicName(archive.getName());
+ builder.addBundleManifestVersion(2);
+ return builder.openStream();
+ }
+ });
+
+ Collection<Archive<?>> auxArchives = new ArrayList<Archive<?>>();
+ Archive<?> result = new OSGiDeploymentPackager().generateDeployment(new TestDeployment(archive, auxArchives));
+ assertNotNull("Result archive not null", result);
+ }
+
+ @Test
+ public void testInvalidBundle() throws Exception
+ {
+ final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "test-archive.jar");
+ archive.setManifest(new Asset()
+ {
+ public InputStream openStream()
+ {
+ OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
+ return builder.openStream();
+ }
+ });
+ try
+ {
+ Collection<Archive<?>> auxArchives = new ArrayList<Archive<?>>();
+ new OSGiDeploymentPackager().generateDeployment(new TestDeployment(archive, auxArchives));
+ fail("RuntimeException expected");
+ }
+ catch (RuntimeException ex)
+ {
+ // expected
+ }
+ }
+}
Modified: arquillian/trunk/containers/osgi-embedded-4.2/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- arquillian/trunk/containers/osgi-embedded-4.2/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/containers/osgi-embedded-4.2/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-07-14 22:18:21 UTC (rev 4728)
@@ -19,15 +19,17 @@
org.jboss.beans.metadata.spi.builder;version=2.2,
org.jboss.dependency.spi;version=2.2,
org.jboss.kernel.spi.dependency;version=2.2,
+ -->
- <!- - jboss-osgi - ->
+ <!-- jboss-osgi -->
+ org.jboss.osgi.deployment.deployer;version=1.0,
+ org.jboss.osgi.deployment.interceptor;version=1.0,
org.jboss.osgi.spi;version=1.0,
org.jboss.osgi.spi.capability;version=1.0,
org.jboss.osgi.spi.framework;version=1.0,
org.jboss.osgi.spi.service;version=1.0,
org.jboss.osgi.spi.util;version=1.0,
org.jboss.osgi.testing;version=1.0
- -->
</value></entry>
</map>
</parameter>
Modified: arquillian/trunk/containers/pom.xml
===================================================================
--- arquillian/trunk/containers/pom.xml 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/containers/pom.xml 2010-07-14 22:18:21 UTC (rev 4728)
@@ -24,7 +24,7 @@
<!-- Aggregate Modules -->
<modules>
<module>jsr88-remote-1.2</module>
-<!-- <module>osgi-embedded-4.2</module> -->
+ <module>osgi-embedded-4.2</module>
<!-- <module>jbossas-remote-4_2</module> -->
<module>jbossas-remote-5</module>
<module>jbossas-remote-5.1</module>
Deleted: arquillian/trunk/packagers/osgi/pom.xml
===================================================================
--- arquillian/trunk/packagers/osgi/pom.xml 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/packagers/osgi/pom.xml 2010-07-14 22:18:21 UTC (rev 4728)
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi:ts=2:sw=2:expandtab: -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <!-- Parent -->
- <parent>
- <groupId>org.jboss.arquillian</groupId>
- <artifactId>arquillian-build</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <relativePath>../../build/pom.xml</relativePath>
- </parent>
-
- <!-- Model Version -->
- <modelVersion>4.0.0</modelVersion>
-
- <!-- Artifact Configuration -->
- <groupId>org.jboss.arquillian.packager</groupId>
- <artifactId>arquillian-packager-osgi</artifactId>
- <name>Arquillian Packager OSGi</name>
- <description>OSGi Packager for the Arquillian project</description>
-
-
- <!-- Properties -->
- <properties>
-
-
- </properties>
-
- <!-- Dependencies -->
- <dependencies>
-
- <!-- org.jboss.arquillian -->
- <dependency>
- <groupId>org.jboss.arquillian</groupId>
- <artifactId>arquillian-spi</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- org.jboss.osgi -->
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.shrinkwrap</groupId>
- <artifactId>shrinkwrap-impl-base</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.shrinkwrap</groupId>
- <artifactId>shrinkwrap-spi</artifactId>
- </dependency>
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>org.jboss.osgi.vfs</groupId>
- <artifactId>jboss-osgi-vfs30</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-</project>
-
Deleted: arquillian/trunk/packagers/osgi/src/main/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackager.java
===================================================================
--- arquillian/trunk/packagers/osgi/src/main/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackager.java 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/packagers/osgi/src/main/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackager.java 2010-07-14 22:18:21 UTC (rev 4728)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.arquillian.packager.osgi;
-
-import java.io.File;
-import java.util.Collection;
-
-import org.jboss.arquillian.spi.DeploymentPackager;
-import org.jboss.osgi.spi.util.BundleInfo;
-import org.jboss.osgi.vfs.AbstractVFS;
-import org.jboss.osgi.vfs.VirtualFile;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.exporter.ZipExporter;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-
-/**
- * Packager for running Arquillian against OSGi containers.
- *
- * @author thomas.diesler at jboss.com
- * @version $Revision: $
- */
-public class OSGiDeploymentPackager implements DeploymentPackager
-{
- @Override
- public Archive<?> generateDeployment(Archive<?> bundleArchive, Collection<Archive<?>> auxiliaryArchives)
- {
- if(JavaArchive.class.isInstance(bundleArchive))
- {
- return handleArchive(JavaArchive.class.cast(bundleArchive), auxiliaryArchives);
- }
-
- throw new IllegalArgumentException(OSGiDeploymentPackager.class.getName() +
- " can not handle archive of type " + bundleArchive.getClass().getName());
- }
-
- private Archive<?> handleArchive(JavaArchive archive, Collection<Archive<?>> auxiliaryArchives)
- {
- try
- {
- validateBundleArchive(archive);
- return archive;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new IllegalArgumentException("Not a valid OSGi bundle: " + archive, ex);
- }
- }
-
- private void validateBundleArchive(Archive<?> archive) throws Exception
- {
- String archiveName = archive.getName();
- int dotIndex = archiveName.lastIndexOf(".");
- if (dotIndex > 0)
- archiveName = archiveName.substring(0, dotIndex);
-
- // [TODO] Can this be done in memory?
- File target = File.createTempFile(archiveName + "-", ".jar");
- try
- {
- ZipExporter exporter = archive.as(ZipExporter.class);
- exporter.exportZip(target, true);
- VirtualFile virtualFile = AbstractVFS.getRoot(target.toURI().toURL());
- BundleInfo.createBundleInfo(virtualFile);
- }
- finally
- {
- target.delete();
- }
- }
-}
\ No newline at end of file
Deleted: arquillian/trunk/packagers/osgi/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeploymentPackager
===================================================================
--- arquillian/trunk/packagers/osgi/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeploymentPackager 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/packagers/osgi/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeploymentPackager 2010-07-14 22:18:21 UTC (rev 4728)
@@ -1 +0,0 @@
-org.jboss.arquillian.packager.osgi.OSGiDeploymentPackager
\ No newline at end of file
Deleted: arquillian/trunk/packagers/osgi/src/test/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackagerTestCase.java
===================================================================
--- arquillian/trunk/packagers/osgi/src/test/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackagerTestCase.java 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/packagers/osgi/src/test/java/org/jboss/arquillian/packager/osgi/OSGiDeploymentPackagerTestCase.java 2010-07-14 22:18:21 UTC (rev 4728)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.arquillian.packager.osgi;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import java.io.InputStream;
-
-import org.jboss.osgi.testing.OSGiManifestBuilder;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.asset.Asset;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.junit.Test;
-
-/**
- * OSGiDeploymentPackagerTestCase
- *
- * @author thomas.diesler at jboss.com
- * @version $Revision: $
- */
-public class OSGiDeploymentPackagerTestCase
-{
- @Test
- public void testValidBundle() throws Exception
- {
- final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "test-archive.jar");
- archive.setManifest(new Asset()
- {
- public InputStream openStream()
- {
- OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
- builder.addBundleSymbolicName(archive.getName());
- builder.addBundleManifestVersion(2);
- return builder.openStream();
- }
- });
-
- Archive<?> result = new OSGiDeploymentPackager().generateDeployment(archive, null);
- assertNotNull("Result archive not null", result);
- }
-
- @Test
- public void testInvalidBundle() throws Exception
- {
- final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "test-archive.jar");
- archive.setManifest(new Asset()
- {
- public InputStream openStream()
- {
- OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
- return builder.openStream();
- }
- });
- try
- {
- new OSGiDeploymentPackager().generateDeployment(archive, null);
- fail("RuntimeException expected");
- }
- catch (RuntimeException ex)
- {
- // expected
- }
- }
-}
Deleted: arquillian/trunk/packagers/pom.xml
===================================================================
--- arquillian/trunk/packagers/pom.xml 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/packagers/pom.xml 2010-07-14 22:18:21 UTC (rev 4728)
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- vi:ts=2:sw=2:expandtab:
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <!-- Parent -->
- <parent>
- <groupId>org.jboss.arquillian</groupId>
- <artifactId>arquillian-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <!-- Model Information -->
- <modelVersion>4.0.0</modelVersion>
-
- <!-- Artifact Information -->
- <groupId>org.jboss.arquillian.packager</groupId>
- <artifactId>arquillian-packager-parent</artifactId>
- <packaging>pom</packaging>
- <name>Arquillian Packager Aggregator</name>
- <url>http://www.jboss.org</url>
- <description>Arquillian Packager Aggregator</description>
-
- <!-- Aggregate Modules -->
- <modules>
-
- <module>osgi</module>
-
- </modules>
-
-</project>
Modified: arquillian/trunk/pom.xml
===================================================================
--- arquillian/trunk/pom.xml 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/pom.xml 2010-07-14 22:18:21 UTC (rev 4728)
@@ -59,7 +59,7 @@
<!-- Extensions -->
<module>protocols</module>
<module>testenrichers</module>
-<!-- <module>bundle</module>a -->
+ <module>bundle</module>
<module>containers</module>
<module>frameworks</module>
Modified: arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXMethodExecutor.java
===================================================================
--- arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXMethodExecutor.java 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXMethodExecutor.java 2010-07-14 22:18:21 UTC (rev 4728)
@@ -42,7 +42,6 @@
// Provide logging
private static Logger log = Logger.getLogger(JMXMethodExecutor.class);
- @Override
public TestResult invoke(TestMethodExecutor testMethodExecutor)
{
if(testMethodExecutor == null)
Modified: arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXTestRunner.java
===================================================================
--- arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXTestRunner.java 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXTestRunner.java 2010-07-14 22:18:21 UTC (rev 4728)
@@ -43,15 +43,40 @@
// Provide logging
private static Logger log = Logger.getLogger(JMXTestRunner.class);
- public static ObjectName register(MBeanServer mbeanServer) throws JMException
+ private TestClassLoader testClassLoader;
+
+ public interface TestClassLoader
{
+ Class<?> loadTestClass(String className) throws ClassNotFoundException;
+ }
+
+ public JMXTestRunner(TestClassLoader classLoader)
+ {
+ this.testClassLoader = classLoader;
+
+ // Initialize the default TestClassLoader
+ if (testClassLoader == null)
+ {
+ testClassLoader = new TestClassLoader()
+ {
+ public Class<?> loadTestClass(String className) throws ClassNotFoundException
+ {
+ ClassLoader classLoader = JMXTestRunner.class.getClassLoader();
+ return classLoader.loadClass(className);
+ }
+ };
+ }
+ }
+
+ public ObjectName registerMBean(MBeanServer mbeanServer) throws JMException
+ {
ObjectName oname = new ObjectName(JMXTestRunnerMBean.OBJECT_NAME);
- mbeanServer.registerMBean(new JMXTestRunner(), oname);
+ mbeanServer.registerMBean(this, oname);
log.debug("JMXTestRunner registered: " + oname);
return oname;
}
- public static void unregister(MBeanServer mbeanServer) throws JMException
+ public void unregisterMBean(MBeanServer mbeanServer) throws JMException
{
ObjectName oname = new ObjectName(JMXTestRunnerMBean.OBJECT_NAME);
if (mbeanServer.isRegistered(oname))
@@ -61,13 +86,11 @@
}
}
- @Override
public TestResult runTestMethodLocal(String className, String methodName)
{
return runTestMethodInternal(className, methodName);
}
- @Override
public InputStream runTestMethodRemote(String className, String methodName)
{
TestResult result = runTestMethodInternal(className, methodName);
@@ -92,11 +115,9 @@
{
try
{
- ClassLoader classLoader = getClass().getClassLoader();
- Class<?> testClass = classLoader.loadClass(className);
-
- TestRunner runner = TestRunners.getTestRunner(classLoader);
-
+ TestRunner runner = TestRunners.getTestRunner(JMXTestRunner.class.getClassLoader());
+ Class<?> testClass = testClassLoader.loadTestClass(className);
+
TestResult testResult = runner.execute(testClass, methodName);
return testResult;
}
Modified: arquillian/trunk/protocols/jmx/src/test/java/org/jboss/arquillian/jmx/JMXTestRunnerTestCase.java
===================================================================
--- arquillian/trunk/protocols/jmx/src/test/java/org/jboss/arquillian/jmx/JMXTestRunnerTestCase.java 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/protocols/jmx/src/test/java/org/jboss/arquillian/jmx/JMXTestRunnerTestCase.java 2010-07-14 22:18:21 UTC (rev 4728)
@@ -44,7 +44,8 @@
public void testJMXTestRunner() throws Throwable
{
MBeanServer mbeanServer = getMBeanServer();
- ObjectName oname = JMXTestRunner.register(mbeanServer);
+ JMXTestRunner jmxTestRunner = new JMXTestRunner(null);
+ ObjectName oname = jmxTestRunner.registerMBean(mbeanServer);
try
{
Modified: arquillian/trunk/testenrichers/osgi/src/main/java/org/jboss/arquillian/testenricher/osgi/OSGiTestEnricher.java
===================================================================
--- arquillian/trunk/testenrichers/osgi/src/main/java/org/jboss/arquillian/testenricher/osgi/OSGiTestEnricher.java 2010-07-14 21:19:45 UTC (rev 4727)
+++ arquillian/trunk/testenrichers/osgi/src/main/java/org/jboss/arquillian/testenricher/osgi/OSGiTestEnricher.java 2010-07-14 22:18:21 UTC (rev 4728)
@@ -56,7 +56,6 @@
// Provide logging
private static Logger log = Logger.getLogger(OSGiTestEnricher.class);
- @Override
public void enrich(Context context, Object testCase)
{
Class<? extends Object> testClass = testCase.getClass();
@@ -76,7 +75,6 @@
}
}
- @Override
public Object[] resolve(Context context, Method method)
{
return null;
More information about the jboss-svn-commits
mailing list