[jboss-cvs] JBossAS SVN: r89261 - in projects/jboss-osgi/projects: bundles/blueprint/trunk and 32 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu May 21 17:58:42 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-05-21 17:58:42 -0400 (Thu, 21 May 2009)
New Revision: 89261
Added:
projects/jboss-osgi/projects/husky/trunk/harness/
projects/jboss-osgi/projects/husky/trunk/harness/.classpath
projects/jboss-osgi/projects/husky/trunk/harness/.project
projects/jboss-osgi/projects/husky/trunk/harness/.settings/
projects/jboss-osgi/projects/husky/trunk/harness/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/husky/trunk/harness/.settings/org.maven.ide.eclipse.prefs
projects/jboss-osgi/projects/husky/trunk/harness/pom.xml
projects/jboss-osgi/projects/husky/trunk/harness/src/
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXInvocation.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvocation.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/OSGiInvoker.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/SocketInvocation.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/SocketConnector.java
projects/jboss-osgi/projects/husky/trunk/testsuite/
projects/jboss-osgi/projects/husky/trunk/testsuite/.classpath
projects/jboss-osgi/projects/husky/trunk/testsuite/.project
projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/
projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/org.maven.ide.eclipse.prefs
projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml
projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/
projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/antrun-test-jars.xml
projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/assembly-bundles.xml
projects/jboss-osgi/projects/husky/trunk/testsuite/src/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/context/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/context/context-basic.bnd
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/jboss-osgi-framework.properties
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/log4j.xml
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
projects/jboss-osgi/projects/integration/
projects/jboss-osgi/projects/integration/jbossas/trunk/
projects/jboss-osgi/projects/integration/pom.xml
Removed:
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java
projects/jboss-osgi/projects/husky/trunk/src/
projects/jboss-osgi/projects/integration/jbossas/.classpath
projects/jboss-osgi/projects/integration/jbossas/.project
projects/jboss-osgi/projects/integration/jbossas/.settings/
projects/jboss-osgi/projects/integration/jbossas/pom.xml
projects/jboss-osgi/projects/integration/jbossas/src/
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/service/
Modified:
projects/jboss-osgi/projects/bundles/blueprint/trunk/pom.xml
projects/jboss-osgi/projects/bundles/blueprint/trunk/scripts/assembly-bundles.xml
projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/java/org/jboss/test/osgi/blueprint/context/BlueprintContextTestCase.java
projects/jboss-osgi/projects/bundles/common/trunk/pom.xml
projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml
projects/jboss-osgi/projects/bundles/jndi/trunk/pom.xml
projects/jboss-osgi/projects/bundles/logging/trunk/pom.xml
projects/jboss-osgi/projects/husky/trunk/.classpath
projects/jboss-osgi/projects/husky/trunk/.project
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/Activator.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/Extender.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnector.java
projects/jboss-osgi/projects/husky/trunk/pom.xml
projects/jboss-osgi/projects/integration/jbossas/trunk/pom.xml
projects/jboss-osgi/projects/parent/trunk/pom.xml
projects/jboss-osgi/projects/pom.xml
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/HuskyCapability.java
Log:
Add Husky SocketConnector
Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/pom.xml 2009-05-21 20:43:31 UTC (rev 89260)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/pom.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -72,7 +72,7 @@
</dependency>
<dependency>
<groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-husky</artifactId>
+ <artifactId>jboss-osgi-husky-harness</artifactId>
<version>${version.jboss.osgi.husky}</version>
<scope>provided</scope>
</dependency>
Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/scripts/assembly-bundles.xml 2009-05-21 20:43:31 UTC (rev 89260)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/scripts/assembly-bundles.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -17,7 +17,7 @@
<includes>
<include>*:jboss-osgi-common:jar</include>
<include>*:jboss-osgi-jmx:jar</include>
- <include>*:jboss-osgi-husky:jar</include>
+ <include>*:jboss-osgi-husky-harness:jar</include>
<include>*:jboss-osgi-logging:jar</include>
<include>*:jbossxb-bundle:jar</include>
<include>*:org.apache.felix.log:jar</include>
Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/java/org/jboss/test/osgi/blueprint/context/BlueprintContextTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/java/org/jboss/test/osgi/blueprint/context/BlueprintContextTestCase.java 2009-05-21 20:43:31 UTC (rev 89260)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/java/org/jboss/test/osgi/blueprint/context/BlueprintContextTestCase.java 2009-05-21 21:58:42 UTC (rev 89261)
@@ -58,7 +58,7 @@
if (context == null)
{
helper = new OSGiTestHelper();
- runtime = helper.getEmbeddedRuntime();
+ runtime = helper.getDefaultRuntime();
runtime.addCapability(new JMXCapability());
runtime.addCapability(new HuskyCapability());
Modified: projects/jboss-osgi/projects/bundles/common/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/common/trunk/pom.xml 2009-05-21 20:43:31 UTC (rev 89260)
+++ projects/jboss-osgi/projects/bundles/common/trunk/pom.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -1,7 +1,7 @@
<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">
<modelVersion>4.0.0</modelVersion>
- <name>JBossOSGi Bundles - JBossOSGi Common</name>
+ <name>JBossOSGi Bundles - Common</name>
<groupId>org.jboss.osgi.bundles</groupId>
<artifactId>jboss-osgi-common</artifactId>
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml 2009-05-21 20:43:31 UTC (rev 89260)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -1,7 +1,7 @@
<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">
<modelVersion>4.0.0</modelVersion>
- <name>JBossOSGi Bundles - JBossOSGi JMX</name>
+ <name>JBossOSGi Bundles - JMX</name>
<groupId>org.jboss.osgi.bundles</groupId>
<artifactId>jboss-osgi-jmx</artifactId>
Modified: projects/jboss-osgi/projects/bundles/jndi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jndi/trunk/pom.xml 2009-05-21 20:43:31 UTC (rev 89260)
+++ projects/jboss-osgi/projects/bundles/jndi/trunk/pom.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -1,7 +1,7 @@
<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">
<modelVersion>4.0.0</modelVersion>
- <name>JBossOSGi Bundles - JBossOSGi JNDI</name>
+ <name>JBossOSGi Bundles - JNDI</name>
<groupId>org.jboss.osgi.bundles</groupId>
<artifactId>jboss-osgi-jndi</artifactId>
Modified: projects/jboss-osgi/projects/bundles/logging/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/logging/trunk/pom.xml 2009-05-21 20:43:31 UTC (rev 89260)
+++ projects/jboss-osgi/projects/bundles/logging/trunk/pom.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -2,7 +2,7 @@
<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">
<modelVersion>4.0.0</modelVersion>
- <name>JBossOSGi Bundles - JBossOSGi Logging</name>
+ <name>JBossOSGi Bundles - Logging</name>
<groupId>org.jboss.osgi.bundles</groupId>
<artifactId>jboss-osgi-logging</artifactId>
Modified: projects/jboss-osgi/projects/husky/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/.classpath 2009-05-21 20:43:31 UTC (rev 89260)
+++ projects/jboss-osgi/projects/husky/trunk/.classpath 2009-05-21 21:58:42 UTC (rev 89261)
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Modified: projects/jboss-osgi/projects/husky/trunk/.project
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/.project 2009-05-21 20:43:31 UTC (rev 89260)
+++ projects/jboss-osgi/projects/husky/trunk/.project 2009-05-21 21:58:42 UTC (rev 89261)
@@ -6,8 +6,13 @@
</projects>
<buildSpec>
<buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+ <triggers>full,incremental,</triggers>
<arguments>
+ <dictionary>
+ <key>LaunchConfigHandle</key>
+ <value><project>/.externalToolBuilders/org.eclipse.jdt.core.javabuilder.launch</value>
+ </dictionary>
</arguments>
</buildCommand>
<buildCommand>
Added: projects/jboss-osgi/projects/husky/trunk/harness/.classpath
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/.classpath (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/.classpath 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: projects/jboss-osgi/projects/husky/trunk/harness/.project
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/.project (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/.project 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jboss-osgi-husky-harness</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: projects/jboss-osgi/projects/husky/trunk/harness/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/.settings/org.eclipse.jdt.core.prefs 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,5 @@
+#Wed May 20 18:39:24 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.source=1.5
Added: projects/jboss-osgi/projects/husky/trunk/harness/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/.settings/org.maven.ide.eclipse.prefs 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,9 @@
+#Wed May 20 18:39:21 CEST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
Copied: projects/jboss-osgi/projects/husky/trunk/harness/pom.xml (from rev 89184, projects/jboss-osgi/projects/husky/trunk/pom.xml)
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/pom.xml (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/pom.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!-- ====================================================================== -->
+ <!-- -->
+ <!-- JBoss, JUnit testing for OSGi bundles -->
+ <!-- -->
+ <!-- Distributable under LGPL license. -->
+ <!-- See terms of license at http://www.gnu.org. -->
+ <!-- -->
+ <!-- ====================================================================== -->
+
+ <!-- $Id$ -->
+
+<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">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>JBossOSGi Project - Husky Harness</name>
+
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-husky-harness</artifactId>
+ <packaging>bundle</packaging>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-husky</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <!-- Bundles -->
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Provided Dependencies -->
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
+ <Bundle-Activator>org.jboss.osgi.husky.runtime.osgi.Activator</Bundle-Activator>
+ <Private-Package>
+ org.jboss.osgi.husky.internal,
+ org.jboss.osgi.husky.runtime*,
+ </Private-Package>
+ <Export-Package>
+ org.jboss.osgi.husky;version=${version},
+ org.jboss.osgi.husky.annotation;version=${version}
+ </Export-Package>
+ <Embed-Transitive>true</Embed-Transitive>
+ <Embed-Dependency>
+ junit;inline=false,
+ </Embed-Dependency>
+ <_exportcontents>org.junit;version=${version.junit}</_exportcontents>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <quiet>true</quiet>
+ <excludePackageNames>*.internal</excludePackageNames>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src (from rev 89184, projects/jboss-osgi/projects/husky/trunk/src)
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java 2009-05-20 13:28:27 UTC (rev 89184)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java 2009-05-21 21:58:42 UTC (rev 89261)
@@ -23,6 +23,11 @@
// $Id$
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.List;
@@ -63,4 +68,35 @@
}
throw new IllegalStateException("Cannot find listener to handle: " + testClass + ", we have " + listeners);
}
+
+ public InputStream process(InputStream reqStream)
+ {
+ try
+ {
+ // Unmarshall the Request
+ ObjectInputStream ois = new ObjectInputStream(reqStream);
+ Request request = (Request)ois.readObject();
+
+ // Field the request through the abstract connector
+ Response response = process(request);
+ if (response == null)
+ throw new IllegalStateException("response cannot be null");
+
+ // Marshall the Response
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(response);
+ oos.close();
+
+ return new ByteArrayInputStream(baos.toByteArray());
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot process request", ex);
+ }
+ }
}
\ No newline at end of file
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXInvocation.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXInvocation.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXInvocation.java 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,73 @@
+/*
+ * 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.osgi.husky.internal;
+
+// $Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.RuntimeMBeanException;
+
+import org.jboss.osgi.husky.Request;
+import org.jboss.osgi.husky.Response;
+import org.jboss.osgi.husky.runtime.osgi.JMXConnector;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public class JMXInvocation
+{
+ public Response invoke(MBeanServerConnection server, Request req) throws Exception
+ {
+ try
+ {
+ // Marshall the Request
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(req);
+ oos.close();
+
+ InputStream reqBytes = new ByteArrayInputStream(baos.toByteArray());
+
+ ObjectName objectName = JMXConnector.getObjectName();
+ InputStream resBytes = (InputStream)server.invoke(objectName, "process", new Object[] { reqBytes }, new String[] { InputStream.class.getName() });
+
+ // Unmarshall the Response
+ ObjectInputStream ois = new ObjectInputStream(resBytes);
+ Response response = (Response)ois.readObject();
+ return response;
+ }
+ catch (RuntimeMBeanException rte)
+ {
+ throw rte.getTargetException();
+ }
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXInvocation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvocation.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvocation.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvocation.java 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,76 @@
+/*
+ * 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.osgi.husky.internal;
+
+// $Id$
+
+import org.jboss.osgi.husky.Context;
+import org.jboss.osgi.husky.Request;
+import org.jboss.osgi.husky.Response;
+import org.jboss.osgi.husky.runtime.Connector;
+import org.jboss.osgi.husky.runtime.Runner;
+import org.jboss.osgi.husky.runtime.junit.JUnitRunner;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public class LocalInvocation
+{
+ public Response invoke(Request req) throws Exception
+ {
+ Connector connector = new LocalConnector();
+ connector.addPackageListener(new MatchAllJUnitPackageListener());
+ return connector.process(req);
+ }
+
+ class LocalConnector extends AbstractConnector
+ {
+ }
+
+ class MatchAllJUnitPackageListener extends AbstractPackageListener
+ {
+ public MatchAllJUnitPackageListener()
+ {
+ super(new String[] { "org.jboss.test" });
+ }
+
+ public Context getContext()
+ {
+ return new BasicContext();
+ }
+
+ @Override
+ public Runner getRunner()
+ {
+ return new JUnitRunner();
+ }
+
+ @Override
+ public Class<?> loadTestClass(String className)
+ {
+ return Util.loadClass(className);
+ }
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvocation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java 2009-05-20 13:28:27 UTC (rev 89184)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java 2009-05-21 21:58:42 UTC (rev 89261)
@@ -1,143 +0,0 @@
-/*
- * 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.osgi.husky.internal;
-
-// $Id$
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.ArrayList;
-
-import javax.management.MBeanServer;
-import javax.management.MBeanServerConnection;
-import javax.management.MBeanServerFactory;
-import javax.management.RuntimeMBeanException;
-
-import org.jboss.osgi.husky.Context;
-import org.jboss.osgi.husky.Invoker;
-import org.jboss.osgi.husky.Request;
-import org.jboss.osgi.husky.Response;
-import org.jboss.osgi.husky.runtime.Connector;
-import org.jboss.osgi.husky.runtime.Runner;
-import org.jboss.osgi.husky.runtime.junit.JUnitRunner;
-import org.jboss.osgi.husky.runtime.osgi.JMXConnector;
-
-/**
- * [TODO]
- *
- * @author Thomas.Diesler at jboss.com
- * @since 16-May-2009
- */
-public class LocalInvoker implements Invoker
-{
- public Response invoke(Request req)
- {
- MBeanServerConnection server = getMBeanServer();
- try
- {
- if (server.isRegistered(JMXConnector.OBJECT_NAME))
- {
- // Marshall the Request
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(req);
- oos.close();
-
- InputStream reqBytes = new ByteArrayInputStream(baos.toByteArray());
-
- InputStream resBytes = (InputStream)server.invoke(JMXConnector.OBJECT_NAME, "process", new Object[] { reqBytes }, new String[] { InputStream.class.getName() });
-
- // Unmarshall the Response
- ObjectInputStream ois = new ObjectInputStream(resBytes);
- Response response = (Response)ois.readObject();
- return response;
- }
- else
- {
- Connector connector = new LocalConnector();
- connector.addPackageListener(new MatchAllJUnitPackageListener());
- return connector.process(req);
- }
- }
- catch (RuntimeMBeanException rte)
- {
- throw rte.getTargetException();
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new IllegalStateException("Cannot invoke connector", ex);
- }
- }
-
- @SuppressWarnings("unchecked")
- private MBeanServerConnection getMBeanServer()
- {
- ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
- if (serverArr.size() > 1)
- throw new IllegalStateException("Multiple MBeanServer instances not supported");
-
- MBeanServer server = null;
- if (serverArr.size() == 1)
- server = serverArr.get(0);
-
- if (server == null)
- server = MBeanServerFactory.createMBeanServer();
-
- return server;
- }
-
- class LocalConnector extends AbstractConnector
- {
- }
-
- class MatchAllJUnitPackageListener extends AbstractPackageListener
- {
- public MatchAllJUnitPackageListener()
- {
- super(new String[] { "org.jboss.test" });
- }
-
- public Context getContext()
- {
- return new BasicContext();
- }
-
- @Override
- public Runner getRunner()
- {
- return new JUnitRunner();
- }
-
- @Override
- public Class<?> loadTestClass(String className)
- {
- return Util.loadClass(className);
- }
- }
-}
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/OSGiInvoker.java (from rev 89184, projects/jboss-osgi/projects/husky/trunk/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java)
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/OSGiInvoker.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/OSGiInvoker.java 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,90 @@
+/*
+ * 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.osgi.husky.internal;
+
+// $Id$
+
+import java.util.ArrayList;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerFactory;
+
+import org.jboss.osgi.husky.Invoker;
+import org.jboss.osgi.husky.Request;
+import org.jboss.osgi.husky.Response;
+import org.jboss.osgi.husky.runtime.osgi.JMXConnector;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public class OSGiInvoker implements Invoker
+{
+ public Response invoke(Request req)
+ {
+ try
+ {
+ MBeanServerConnection server = getMBeanServer();
+ if (SocketInvocation.isRemoteConnection())
+ {
+ return new SocketInvocation().invoke(req);
+ }
+ else if (server.isRegistered(JMXConnector.getObjectName()))
+ {
+ return new JMXInvocation().invoke(server, req);
+ }
+ else
+ {
+ return new LocalInvocation().invoke(req);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot invoke connector", ex);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private MBeanServerConnection getMBeanServer()
+ {
+ ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
+ if (serverArr.size() > 1)
+ throw new IllegalStateException("Multiple MBeanServer instances not supported");
+
+ MBeanServer server = null;
+ if (serverArr.size() == 1)
+ server = serverArr.get(0);
+
+ if (server == null)
+ server = MBeanServerFactory.createMBeanServer();
+
+ return server;
+ }
+
+}
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/SocketInvocation.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/SocketInvocation.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/SocketInvocation.java 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,83 @@
+/*
+ * 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.osgi.husky.internal;
+
+// $Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.InetAddress;
+import java.net.Socket;
+
+import org.jboss.osgi.husky.Request;
+import org.jboss.osgi.husky.Response;
+import org.jboss.osgi.husky.runtime.Connector;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public class SocketInvocation
+{
+ public static boolean isRemoteConnection()
+ {
+ return getHost() != null && getPort() != null;
+ }
+
+ private static String getPort()
+ {
+ String propNamePort = Connector.class.getName().toLowerCase() + ".port";
+ String port = System.getProperty(propNamePort);
+ return port;
+ }
+
+ private static String getHost()
+ {
+ String propNameHost = Connector.class.getName().toLowerCase() + ".host";
+ String host = System.getProperty(propNameHost);
+ return host;
+ }
+
+ public Response invoke(Request req) throws Exception
+ {
+ Socket socket = new Socket(InetAddress.getByName(getHost()), new Integer(getPort()));
+
+ // Marshall the Request
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(req);
+ oos.close();
+
+ InputStream reqBytes = new ByteArrayInputStream(baos.toByteArray());
+ Util.copyStream(reqBytes, socket.getOutputStream());
+
+ // Unmarshall the Response
+ ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
+ Response response = (Response)ois.readObject();
+ return response;
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/SocketInvocation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/src/main/java/org/jboss/osgi/husky/internal/Util.java 2009-05-20 13:28:27 UTC (rev 89184)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java 2009-05-21 21:58:42 UTC (rev 89261)
@@ -23,9 +23,14 @@
// $Id$
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.lang.reflect.Constructor;
import java.util.Properties;
+import org.jboss.osgi.husky.Bridge;
+
/**
* Loads the configured test {@link Bridge} instance.
*
@@ -89,4 +94,15 @@
return instanceClass;
}
+
+ public static void copyStream(InputStream in, OutputStream out) throws IOException
+ {
+ byte[] bytes = new byte[1024];
+ int read = in.read(bytes);
+ while (read > 0)
+ {
+ out.write(bytes, 0, read);
+ read = in.read(bytes);
+ }
+ }
}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/Activator.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/src/main/java/org/jboss/osgi/husky/runtime/osgi/Activator.java 2009-05-20 13:28:27 UTC (rev 89184)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/Activator.java 2009-05-21 21:58:42 UTC (rev 89261)
@@ -34,22 +34,35 @@
*/
public class Activator implements BundleActivator
{
- private JMXConnector connector;
+ private SocketConnector socketConnector;
+ private JMXConnector jmxConnector;
public void start(BundleContext context) throws Exception
{
- connector = new JMXConnector(context);
- connector.start();
+ jmxConnector = new JMXConnector(context);
+ jmxConnector.start();
+ if (SocketConnector.isRemoteConnection(context))
+ {
+ socketConnector = new SocketConnector(context);
+ socketConnector.start();
+ }
+
context.addBundleListener(new Extender(context));
}
public void stop(BundleContext context) throws Exception
{
- if (connector != null)
+ if (socketConnector != null)
{
- connector.stop();
- connector = null;
+ socketConnector.stop();
+ socketConnector = null;
}
+
+ if (jmxConnector != null)
+ {
+ jmxConnector.stop();
+ jmxConnector = null;
+ }
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/Extender.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/src/main/java/org/jboss/osgi/husky/runtime/osgi/Extender.java 2009-05-20 13:28:27 UTC (rev 89184)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/Extender.java 2009-05-21 21:58:42 UTC (rev 89261)
@@ -23,15 +23,14 @@
// $Id$
-import javax.management.MBeanServer;
-
import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.osgi.husky.runtime.PackageListener;
+import org.jboss.osgi.husky.runtime.Connector;
import org.jboss.osgi.husky.runtime.junit.JUnitPackageListener;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleListener;
+import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
import org.osgi.service.log.LogService;
@@ -68,28 +67,21 @@
private void registerPackageListener(Bundle bundle, String[] testPackages)
{
- ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
- if (sref == null)
+ ServiceReference[] srefs = null;
+ try
{
- log.log(LogService.LOG_WARNING, "Cannot obtain MBeanServer service");
- return;
+ srefs = context.getServiceReferences(Connector.class.getName(), null);
}
-
- JUnitPackageListener listener = new OSGiJUnitPackageListener(bundle, testPackages);
- MBeanServer server = (MBeanServer)context.getService(sref);
- if (server.isRegistered(JMXConnector.OBJECT_NAME) == false)
+ catch (InvalidSyntaxException ex)
{
- log.log(LogService.LOG_WARNING, "Cannot obtain connector: " + JMXConnector.OBJECT_NAME);
- return;
+ // cannot get here
}
-
- try
+
+ for (ServiceReference sref : srefs)
{
- server.invoke(JMXConnector.OBJECT_NAME, "addPackageListener", new Object[] { listener }, new String[] { PackageListener.class.getName() });
+ Connector connector = (Connector)context.getService(sref);
+ JUnitPackageListener listener = new OSGiJUnitPackageListener(bundle, testPackages);
+ connector.addPackageListener(listener);
}
- catch (Exception ex)
- {
- throw new IllegalStateException("Cannot register package listener", ex);
- }
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnector.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnector.java 2009-05-20 13:28:27 UTC (rev 89184)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnector.java 2009-05-21 21:58:42 UTC (rev 89261)
@@ -23,22 +23,18 @@
// $Id$
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
+import java.util.Properties;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.osgi.husky.Request;
-import org.jboss.osgi.husky.Response;
import org.jboss.osgi.husky.internal.AbstractConnector;
+import org.jboss.osgi.husky.runtime.Connector;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
import org.osgi.service.log.LogService;
/**
@@ -49,21 +45,9 @@
*/
public class JMXConnector extends AbstractConnector implements JMXConnectorMBean
{
- public static ObjectName OBJECT_NAME;
- static
- {
- try
- {
- OBJECT_NAME = ObjectName.getInstance("jboss.osgi.husky:service=jmx-connector");
- }
- catch (MalformedObjectNameException e)
- {
- // should never get here
- }
- }
-
private LogService log;
private BundleContext context;
+ private ServiceRegistration sreg;
public JMXConnector(BundleContext context)
{
@@ -77,50 +61,39 @@
if (sref == null)
throw new IllegalStateException("Cannot obtain MBeanServer service");
+ Properties props = new Properties();
+ props.setProperty("transport", "jmx");
+ sreg = context.registerService(Connector.class.getName(), this, props);
+
MBeanServer server = (MBeanServer)context.getService(sref);
- server.registerMBean(this, OBJECT_NAME);
- log.log(LogService.LOG_INFO, "JMXConnector registered: " + OBJECT_NAME);
+ server.registerMBean(this, getObjectName());
+ log.log(LogService.LOG_INFO, "JMXConnector registered: " + getObjectName());
}
public void stop() throws Exception
{
+ if (sreg != null)
+ sreg.unregister();
+
ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
if (sref != null)
{
MBeanServer server = (MBeanServer)context.getService(sref);
- if (server.isRegistered(OBJECT_NAME));
- server.unregisterMBean(OBJECT_NAME);
+ if (server.isRegistered(getObjectName()));
+ server.unregisterMBean(getObjectName());
}
}
- public InputStream process(InputStream reqStream)
+ public static ObjectName getObjectName()
{
try
{
- // Unmarshall the Request
- ObjectInputStream ois = new ObjectInputStream(reqStream);
- Request request = (Request)ois.readObject();
-
- // Field the request through the abstract connector
- Response response = process(request);
- if (response == null)
- throw new IllegalStateException("response cannot be null");
-
- // Marshall the Response
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(response);
- oos.close();
-
- return new ByteArrayInputStream(baos.toByteArray());
+ return ObjectName.getInstance("jboss.osgi.husky:service=jmx-connector");
}
- catch (RuntimeException rte)
+ catch (MalformedObjectNameException ex)
{
- throw rte;
+ // should never get here
+ return null;
}
- catch (Exception ex)
- {
- throw new IllegalStateException("Cannot process request", ex);
- }
}
}
\ No newline at end of file
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/SocketConnector.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/SocketConnector.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/SocketConnector.java 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,170 @@
+/*
+ * 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.osgi.husky.runtime.osgi;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.Properties;
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.osgi.husky.internal.AbstractConnector;
+import org.jboss.osgi.husky.internal.Util;
+import org.jboss.osgi.husky.runtime.Connector;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.log.LogService;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 17-May-2009
+ */
+public class SocketConnector extends AbstractConnector
+{
+ private LogService log;
+ private BundleContext context;
+ private ServiceRegistration sreg;
+ private ListenerThread listenerThread;
+
+ public SocketConnector(BundleContext context)
+ {
+ this.log = new LogServiceTracker(context);
+ this.context = context;
+ }
+
+ public static boolean isRemoteConnection(BundleContext context)
+ {
+ return getHost(context) != null && getPort(context) != null;
+ }
+
+ private static String getPort(BundleContext context)
+ {
+ String propNamePort = Connector.class.getName().toLowerCase() + ".port";
+ String port = context.getProperty(propNamePort);
+ return port;
+ }
+
+ private static String getHost(BundleContext context)
+ {
+ String propNameHost = Connector.class.getName().toLowerCase() + ".host";
+ String host = context.getProperty(propNameHost);
+ return host;
+ }
+
+ public void start() throws Exception
+ {
+ String host = getHost(context);
+ String port = getPort(context);
+
+ Properties props = new Properties();
+ props.setProperty("transport", "socket");
+ props.setProperty("host", host);
+ props.setProperty("port", port);
+
+ listenerThread = new ListenerThread(host, new Integer(port));
+ listenerThread.start();
+
+ sreg = context.registerService(Connector.class.getName(), this, props);
+ log.log(LogService.LOG_INFO, "SocketConnector registered: " + props);
+ }
+
+ public void stop() throws Exception
+ {
+ if (sreg != null)
+ sreg.unregister();
+
+ if (listenerThread != null)
+ listenerThread.stopListener();
+ }
+
+ private class ListenerThread extends Thread
+ {
+ private ServerSocket serverSocket;
+
+ public ListenerThread(String host, int port)
+ {
+ super("ConnectorThread");
+ try
+ {
+ serverSocket = new ServerSocket();
+ serverSocket.bind(new InetSocketAddress(host, port));
+ }
+ catch (IOException ex)
+ {
+ throw new IllegalStateException("Cannot create server socket", ex);
+ }
+ }
+
+ public void stopListener()
+ {
+ try
+ {
+ log.log(LogService.LOG_DEBUG, "Stop SocketConnector");
+ serverSocket.close();
+ }
+ catch (IOException ex)
+ {
+ // ignore
+ }
+ }
+
+ @Override
+ public void run()
+ {
+ while (serverSocket.isClosed() == false)
+ {
+ Socket socket = null;
+ try
+ {
+ log.log(LogService.LOG_DEBUG, "Waiting for connection ...");
+ socket = serverSocket.accept();
+ log.log(LogService.LOG_DEBUG, "Connection accepted");
+ }
+ catch (IOException ex)
+ {
+ if (serverSocket.isClosed())
+ break;
+ }
+
+ if (socket != null)
+ {
+ try
+ {
+ InputStream resStream = process(socket.getInputStream());
+ Util.copyStream(resStream, socket.getOutputStream());
+ socket.close();
+ }
+ catch (IOException ex)
+ {
+ throw new IllegalStateException("Cannot process request", ex);
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/SocketConnector.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/husky/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/pom.xml 2009-05-21 20:43:31 UTC (rev 89260)
+++ projects/jboss-osgi/projects/husky/trunk/pom.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -15,12 +15,12 @@
<modelVersion>4.0.0</modelVersion>
- <name>JBossOSGi Project - Test Harness</name>
+ <name>JBossOSGi Project - Husky</name>
<description>JBoss OSGi Bundle Testsuite</description>
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-husky</artifactId>
- <packaging>bundle</packaging>
+ <packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
@@ -31,82 +31,61 @@
<version>1.0.0-SNAPSHOT</version>
</parent>
+ <!-- Modules -->
+ <modules>
+ <module>harness</module>
+ <module>testsuite</module>
+ </modules>
+
<!-- Properties -->
<properties>
<version.jboss.osgi.common>1.0.0-SNAPSHOT</version.jboss.osgi.common>
+ <version.jboss.osgi.jmx>1.0.0-SNAPSHOT</version.jboss.osgi.jmx>
+ <version.jboss.osgi.logging>1.0.0-SNAPSHOT</version.jboss.osgi.logging>
+ <version.jboss.osgi.runtime.felix>1.0.0-SNAPSHOT</version.jboss.osgi.runtime.felix>
+ <version.junit>4.6</version.junit>
<version.osgi>r4v41</version.osgi>
</properties>
<!-- Dependencies -->
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
-
- <!-- Bundles -->
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common</artifactId>
- <version>${version.jboss.osgi.common}</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- Provided Dependencies -->
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>${version.osgi}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>${version.osgi}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Bundle-Activator>org.jboss.osgi.husky.runtime.osgi.Activator</Bundle-Activator>
- <Private-Package>
- org.jboss.osgi.husky.internal,
- org.jboss.osgi.husky.runtime*,
- </Private-Package>
- <Export-Package>
- org.jboss.osgi.husky;version=${version},
- org.jboss.osgi.husky.annotation;version=${version}
- </Export-Package>
- <Embed-Transitive>true</Embed-Transitive>
- <Embed-Dependency>
- junit;inline=false,
- </Embed-Dependency>
- <_exportcontents>org.junit;version=${version.junit}</_exportcontents>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <quiet>true</quiet>
- <excludePackageNames>*.internal</excludePackageNames>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
+ <version>${version.jboss.osgi.common}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <version>${version.jboss.osgi.jmx}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-logging</artifactId>
+ <version>${version.jboss.osgi.logging}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-runtime-felix</artifactId>
+ <version>${version.jboss.osgi.runtime.felix}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${version.osgi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>${version.osgi}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
</project>
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/.classpath
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/.classpath (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/.classpath 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/.project
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/.project (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/.project 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jboss-osgi-husky-testsuite</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/org.eclipse.jdt.core.prefs 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,5 @@
+#Wed May 20 18:39:24 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.source=1.5
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/org.maven.ide.eclipse.prefs 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,9 @@
+#Wed May 20 18:39:21 CEST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!-- ====================================================================== -->
+ <!-- -->
+ <!-- JBoss, JUnit testing for OSGi bundles -->
+ <!-- -->
+ <!-- Distributable under LGPL license. -->
+ <!-- See terms of license at http://www.gnu.org. -->
+ <!-- -->
+ <!-- ====================================================================== -->
+
+ <!-- $Id$ -->
+
+<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">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>JBossOSGi Project - Husky Testsuite</name>
+
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-husky-testsuite</artifactId>
+ <packaging>jar</packaging>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-husky</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>biz.aQute</groupId>
+ <artifactId>bnd</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-runtime-felix</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </dependency>
+
+ <!-- Bundle Dependencies -->
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
+ <version>${version.jboss.osgi.common}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-husky-harness</artifactId>
+ <version>${version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <version>${version.jboss.osgi.jmx}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-logging</artifactId>
+ <version>${version.jboss.osgi.logging}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>bundles</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>directory-single</goal>
+ </goals>
+ <configuration>
+ <finalName>test-libs</finalName>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>scripts/assembly-bundles.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-test-jars</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+ <property name="tests.output.dir" value="${project.build.directory}" />
+ <ant antfile="scripts/antrun-test-jars.xml" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>org.jboss.osgi.husky.Invoker</name>
+ <value>org.jboss.osgi.husky.internal.OSGiInvoker</value>
+ </property>
+ <property>
+ <name>test.archive.directory</name>
+ <value>${project.build.directory}/test-libs</value>
+ </property>
+ <property>
+ <name>log4j.output.dir</name>
+ <value>/home/tdiesler/svn/jboss-osgi/projects/husky/trunk/testsuite/target</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+
+ <!--
+ Name: remote-tesing
+ Descr: Setup for remote testing
+ -->
+ <profile>
+ <id>remote-tesing</id>
+ <activation>
+ <property>
+ <name>target.container</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>org.jboss.osgi.husky.Invoker</name>
+ <value>org.jboss.osgi.husky.internal.OSGiInvoker</value>
+ </property>
+ <property>
+ <name>org.jboss.osgi.husky.runtime.connector.host</name>
+ <value>localhost</value>
+ </property>
+ <property>
+ <name>org.jboss.osgi.husky.runtime.connector.port</name>
+ <value>5401</value>
+ </property>
+ <property>
+ <name>test.archive.directory</name>
+ <value>${project.build.directory}/test-libs</value>
+ </property>
+ <property>
+ <name>log4j.output.dir</name>
+ <value>/home/tdiesler/svn/jboss-osgi/projects/husky/trunk/testsuite/target</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+
+
+</project>
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/antrun-test-jars.xml (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/antrun-test-jars.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ============================================================ -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- ============================================================ -->
+
+<!-- $Id$ -->
+
+<project default="build-test-jars">
+
+ <description>OSGi test archive builder</description>
+
+ <!-- ================================================================== -->
+ <!-- Init -->
+ <!-- ================================================================== -->
+
+ <target name="init">
+
+ <!-- Property override when not called from maven -->
+ <property name="maven.runtime.classpath" value="/usr/java/bnd.jar" />
+ <property name="tests.output.dir" value="${basedir}/../target" />
+
+ <mkdir dir="${tests.output.dir}/test-libs" />
+ <property name="tests.classes.dir" value="${tests.output.dir}/test-classes" />
+ <property name="tests.resources.dir" value="${tests.output.dir}/test-classes" />
+
+ <taskdef resource="aQute/bnd/ant/taskdef.properties">
+ <classpath>
+ <pathelement path="${maven.runtime.classpath}" />
+ </classpath>
+ </taskdef>
+
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Building -->
+ <!-- ================================================================== -->
+
+ <target name="build-test-jars" depends="init" description="Build the test deployments">
+
+ <!-- Please add alphabetically -->
+
+ <!-- context -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/context-basic.jar" files="${tests.resources.dir}/context/context-basic.bnd" />
+
+ <!-- Please add alphabetically -->
+
+ </target>
+
+</project>
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/antrun-test-jars.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/assembly-bundles.xml (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/assembly-bundles.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,31 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+
+ <id>deploy-artifacts</id>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <!-- Dependency Sets -->
+ <dependencySets>
+
+ <!-- bundle -->
+ <dependencySet>
+ <outputDirectory>bundles</outputDirectory>
+ <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+ <includes>
+ <include>*:jboss-osgi-common:jar</include>
+ <include>*:jboss-osgi-jmx:jar</include>
+ <include>*:jboss-osgi-husky-harness:jar</include>
+ <include>*:jboss-osgi-logging:jar</include>
+ <include>*:org.apache.felix.log:jar</include>
+ <include>*:org.osgi.compendium:jar</include>
+ </includes>
+ <useStrictFiltering>true</useStrictFiltering>
+ <scope>provided</scope>
+ <unpack>false</unpack>
+ </dependencySet>
+
+ </dependencySets>
+</assembly>
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/assembly-bundles.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,90 @@
+/*
+ * 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.husky.context;
+
+//$Id$
+
+import static org.junit.Assert.assertEquals;
+
+import org.jboss.osgi.husky.BridgeFactory;
+import org.jboss.osgi.husky.annotation.ProvideContext;
+import org.jboss.osgi.spi.testing.HuskyCapability;
+import org.jboss.osgi.spi.testing.JMXCapability;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * Test BundleContext injection
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class ContextTestCase
+{
+ @ProvideContext
+ public BundleContext context;
+
+ private OSGiTestHelper helper;
+ private OSGiRuntime runtime;
+
+ @Before
+ public void setUp() throws BundleException
+ {
+ if (context == null)
+ {
+ helper = new OSGiTestHelper();
+ runtime = helper.getDefaultRuntime();
+ runtime.addCapability(new JMXCapability());
+ runtime.addCapability(new HuskyCapability());
+
+ runtime.installBundle("context-basic.jar").start();
+ }
+ }
+
+ @After
+ public void tearDown()
+ {
+ if (context == null)
+ {
+ runtime.shutdown();
+ }
+ }
+
+ @Test
+ public void testBundleContext() throws Exception
+ {
+ if (context == null)
+ {
+ BridgeFactory.getBridge().run();
+ return;
+ }
+
+ Bundle bundle = context.getBundle();
+ assertEquals("context-basic", bundle.getSymbolicName());
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/context/context-basic.bnd
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/context/context-basic.bnd (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/context/context-basic.bnd 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,7 @@
+# bnd build -classpath target/test-classes -output target/test-libs/context-basic.jar src/test/resources/context/context-basic.bnd
+
+Bundle-SymbolicName: context-basic
+Export-Package: org.jboss.test.osgi.husky.context
+Import-Package: org.jboss.osgi.husky, org.jboss.osgi.husky.annotation, org.jboss.osgi.spi.testing, org.junit, org.osgi.framework
+
+Test-Package: org.jboss.test.osgi.husky.context
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/jboss-osgi-framework.properties (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/jboss-osgi-framework.properties 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,36 @@
+#
+# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
+#
+# $Id$
+#
+
+# The OSGiFramework implementation
+org.jboss.osgi.spi.framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
+
+# Properties to configure the Framework
+org.osgi.framework.storage=${basedir}/target/osgi-store
+org.osgi.framework.storage.clean=onFirstInit
+
+# Husky socket connector properties
+org.jboss.osgi.husky.runtime.connector.host=localhost
+org.jboss.osgi.husky.runtime.connector.port=5401
+
+# Framework bootdelegation
+# org.osgi.framework.bootdelegation=org.osgi.service.log
+
+# Extra System Packages
+org.osgi.framework.system.packages.extra=\
+ org.jboss.logging, \
+ org.jboss.osgi.spi, \
+ org.jboss.osgi.spi.testing, \
+ org.osgi.framework; version\=1.4
+
+# Bundles that need to be installed with the Framework automatically
+org.jboss.osgi.spi.framework.autoInstall=\
+ file://${test.archive.directory}/bundles/org.osgi.compendium.jar
+
+# Bundles that need to be started automatically
+org.jboss.osgi.spi.framework.autoStart=\
+ file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-common.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-logging.jar
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/jboss-osgi-framework.properties
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/log4j.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/log4j.xml (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/log4j.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <appender name="FILE" class="org.apache.log4j.FileAppender">
+ <param name="File" value="${log4j.output.dir}/test.log"/>
+ <param name="Append" value="false"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <param name="Threshold" value="INFO" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n" />
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <!-- Show jboss deployer traces
+ <category name="org.jboss.deployers">
+ <priority value="TRACE" />
+ </category>
+ -->
+
+ <!-- Show jboss deployer traces
+ <category name="org.jboss.xb">
+ <priority value="TRACE" />
+ </category>
+ -->
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <!--appender-ref ref="CONSOLE"/-->
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/log4j.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1 @@
+org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
\ No newline at end of file
Copied: projects/jboss-osgi/projects/integration (from rev 89184, projects/jboss-osgi/trunk/integration)
Property changes on: projects/jboss-osgi/projects/integration
___________________________________________________________________
Name: svn:ignore
+ target
Name: svn:mergeinfo
+
Deleted: projects/jboss-osgi/projects/integration/jbossas/.classpath
===================================================================
--- projects/jboss-osgi/trunk/integration/jbossas/.classpath 2009-05-20 13:28:27 UTC (rev 89184)
+++ projects/jboss-osgi/projects/integration/jbossas/.classpath 2009-05-21 21:58:42 UTC (rev 89261)
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
Deleted: projects/jboss-osgi/projects/integration/jbossas/.project
===================================================================
--- projects/jboss-osgi/trunk/integration/jbossas/.project 2009-05-20 13:28:27 UTC (rev 89184)
+++ projects/jboss-osgi/projects/integration/jbossas/.project 2009-05-21 21:58:42 UTC (rev 89261)
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>jboss-osgi-runtime-deployer</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.maven.ide.eclipse.maven2Nature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
Deleted: projects/jboss-osgi/projects/integration/jbossas/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/integration/jbossas/pom.xml 2009-05-20 13:28:27 UTC (rev 89184)
+++ projects/jboss-osgi/projects/integration/jbossas/pom.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<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">
- <modelVersion>4.0.0</modelVersion>
-
- <name>JBossOSGi Integration - JBossAS</name>
-
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-integration-jbossas</artifactId>
- <packaging>jar</packaging>
-
- <parent>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi</artifactId>
- <version>1.0.0.Beta2</version>
- </parent>
-
- <!-- Properties -->
- <properties>
- </properties>
-
- <!-- Dependencies -->
- <dependencies>
- <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.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <!-- Build -->
- <build>
- <plugins>
- </plugins>
- </build>
-
-</project>
Copied: projects/jboss-osgi/projects/integration/jbossas/trunk (from rev 89184, projects/jboss-osgi/trunk/integration/jbossas)
Modified: projects/jboss-osgi/projects/integration/jbossas/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/integration/jbossas/pom.xml 2009-05-20 13:28:27 UTC (rev 89184)
+++ projects/jboss-osgi/projects/integration/jbossas/trunk/pom.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -8,14 +8,18 @@
<artifactId>jboss-osgi-integration-jbossas</artifactId>
<packaging>jar</packaging>
+ <version>1.0.0-SNAPSHOT</version>
+
<parent>
<groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi</artifactId>
- <version>1.0.0.Beta2</version>
+ <artifactId>jboss-osgi-integration</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
</parent>
<!-- Properties -->
<properties>
+ <version.jboss.osgi.spi>1.0.0-SNAPSHOT</version.jboss.osgi.spi>
+ <version.osgi>r4v41</version.osgi>
</properties>
<!-- Dependencies -->
@@ -23,15 +27,18 @@
<dependency>
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-spi</artifactId>
+ <version>${version.jboss.osgi.spi}</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
+ <version>${version.osgi}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
+ <version>${version.osgi}</version>
<scope>provided</scope>
</dependency>
</dependencies>
Added: projects/jboss-osgi/projects/integration/pom.xml
===================================================================
--- projects/jboss-osgi/projects/integration/pom.xml (rev 0)
+++ projects/jboss-osgi/projects/integration/pom.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>JBossOSGi Integration</name>
+
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-integration</artifactId>
+ <packaging>pom</packaging>
+
+ <version>1.0.0-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-projects</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <!-- Modules -->
+ <modules>
+ <module>jbossas/trunk</module>
+ </modules>
+
+</project>
Property changes on: projects/jboss-osgi/projects/integration/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/parent/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/parent/trunk/pom.xml 2009-05-21 20:43:31 UTC (rev 89260)
+++ projects/jboss-osgi/projects/parent/trunk/pom.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -173,7 +173,7 @@
</property>
<property>
<name>org.jboss.osgi.husky.Invoker</name>
- <value>org.jboss.osgi.husky.internal.LocalInvoker</value>
+ <value>org.jboss.osgi.husky.internal.OSGiInvoker</value>
</property>
<!--
Implement URLStreamHandlerService
@@ -189,7 +189,7 @@
</property>
<property>
<name>log4j.output.dir</name>
- <value>${basedir}/target</value>
+ <value>${project.build.directory}</value>
</property>
</systemProperties>
</configuration>
Modified: projects/jboss-osgi/projects/pom.xml
===================================================================
--- projects/jboss-osgi/projects/pom.xml 2009-05-21 20:43:31 UTC (rev 89260)
+++ projects/jboss-osgi/projects/pom.xml 2009-05-21 21:58:42 UTC (rev 89261)
@@ -26,6 +26,7 @@
<module>repository/trunk</module>
<module>bundles</module>
<module>runtime</module>
+ <module>integration</module>
</modules>
<!-- Repositories -->
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/HuskyCapability.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/HuskyCapability.java 2009-05-21 20:43:31 UTC (rev 89260)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/HuskyCapability.java 2009-05-21 21:58:42 UTC (rev 89261)
@@ -40,6 +40,6 @@
//props.setProperty("org.jboss.osgi.jmx.host", System.getProperty("jboss.bind.address", "localhost"));
//props.setProperty("org.jboss.osgi.jmx.rmi.port", "1198");
- addBundle("bundles/jboss-osgi-husky.jar");
+ addBundle("bundles/jboss-osgi-husky-harness.jar");
}
}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list