[jboss-cvs] JBossAS SVN: r87182 - in projects/jboss-osgi/trunk: runtime/felix/src/main/resources and 14 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Apr 13 09:47:53 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-04-13 09:47:53 -0400 (Mon, 13 Apr 2009)
New Revision: 87182
Added:
projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/service/log/RemoteLogReaderService.java
projects/jboss-osgi/trunk/service/remote-log/
projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/RemoteLogListener.java
projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/internal/
projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/internal/RemoteLogReaderServiceImpl.java
projects/jboss-osgi/trunk/testsuite/scripts/assembly-bundles.xml
Removed:
projects/jboss-osgi/trunk/service/remlog/
projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/RemoteLogActivator.java
projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/RemoteLogReceiverService.java
projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/RemoteLogSenderService.java
projects/jboss-osgi/trunk/testsuite/scripts/assembly-thirdparty-bundles.xml
Modified:
projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml
projects/jboss-osgi/trunk/runtime/felix/src/main/resources/jboss-osgi-beans.xml
projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml
projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTest.java
projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java
projects/jboss-osgi/trunk/service/pom.xml
projects/jboss-osgi/trunk/service/remote-log/pom.xml
projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/internal/RemoteLogEntry.java
projects/jboss-osgi/trunk/testsuite/pom.xml
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/example/log/LogServiceRemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38RemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39RemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41RemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelRemoteTestCase.java
Log:
First pass of remote logging service
Modified: projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml 2009-04-13 11:08:55 UTC (rev 87181)
+++ projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml 2009-04-13 13:47:53 UTC (rev 87182)
@@ -40,7 +40,7 @@
</bean>
<!-- A Service that gives access to the Microcontainer Kernel -->
- <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.service.MicrocontainerService">
+ <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.service.mc.MicrocontainerService">
<property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext"/></property>
<property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
<property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/resources/jboss-osgi-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/resources/jboss-osgi-beans.xml 2009-04-13 11:08:55 UTC (rev 87181)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/resources/jboss-osgi-beans.xml 2009-04-13 13:47:53 UTC (rev 87182)
@@ -29,6 +29,12 @@
org.jboss.util.propertyeditor,
</value>
</entry>
+ <!--
+ Setup remote logging
+ -->
+ <entry><key>org.jboss.osgi.service.remote.log.reader</key><value>true</value></entry>
+ <entry><key>org.jboss.osgi.service.remote.log.host</key><value>localhost</value></entry>
+ <entry><key>org.jboss.osgi.service.remote.log.port</key><value>5400</value></entry>
</map>
</property>
</bean>
Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml 2009-04-13 11:08:55 UTC (rev 87181)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml 2009-04-13 13:47:53 UTC (rev 87182)
@@ -16,12 +16,23 @@
javax.management,
javax.xml.parsers,
org.jboss.logging,
- org.jboss.osgi.service,
+ org.jboss.osgi.service.log,
+ org.jboss.osgi.service.mc,
org.jboss.osgi.spi.management,
org.osgi.framework; version=1.4,
org.osgi.service.packageadmin; version=1.2,
org.osgi.service.startlevel; version=1.1,
- org.xml.sax
+ org.xml.sax,
+
+ <!-- needed by jboss-remoting -->
+ javax.naming,
+ javax.net,
+ javax.net.ssl,
+ org.apache.log4j,
+ org.jboss.util,
+ org.jboss.util.id,
+ org.jboss.util.threadpool,
+ org.jboss.util.propertyeditor,
</value>
</entry>
<!--
@@ -29,6 +40,12 @@
If set to 'false' bundles must be deployed in the order that is required to start them.
-->
<entry><key>org.jboss.osgi.deferred.start</key><value>true</value></entry>
+ <!--
+ Setup remote logging
+ -->
+ <entry><key>org.jboss.osgi.service.remote.log.sender</key><value>true</value></entry>
+ <entry><key>org.jboss.osgi.service.remote.log.host</key><value>localhost</value></entry>
+ <entry><key>org.jboss.osgi.service.remote.log.port</key><value>5400</value></entry>
</map>
</property>
<property name="autoStart">
@@ -45,7 +62,7 @@
</bean>
<!-- A Service that gives access to the Microcontainer Kernel -->
- <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.service.MicrocontainerService">
+ <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.service.mc.MicrocontainerService">
<property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext"/></property>
<property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
<property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml 2009-04-13 11:08:55 UTC (rev 87181)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml 2009-04-13 13:47:53 UTC (rev 87182)
@@ -39,7 +39,7 @@
</bean>
<!-- A Service that gives access to the Microcontainer Kernel -->
- <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.service.MicrocontainerService">
+ <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.service.mc.MicrocontainerService">
<property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext"/></property>
<property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
<property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
Added: projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/service/log/RemoteLogReaderService.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/service/log/RemoteLogReaderService.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/service/log/RemoteLogReaderService.java 2009-04-13 13:47:53 UTC (rev 87182)
@@ -0,0 +1,36 @@
+/*
+ * 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.service.log;
+
+//$Id$
+
+import org.osgi.service.log.LogReaderService;
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 12-Apr-2009
+ */
+public interface RemoteLogReaderService extends LogReaderService
+{
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/service/log/RemoteLogReaderService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTest.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTest.java 2009-04-13 11:08:55 UTC (rev 87181)
+++ projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTest.java 2009-04-13 13:47:53 UTC (rev 87182)
@@ -59,6 +59,16 @@
return getDelegate().isTargetJBoss50();
}
+ protected RemoteBundle deployBundle(String archive) throws Exception
+ {
+ return getDelegate().deployBundle(archive);
+ }
+
+ protected void undeployBundle(String archive) throws Exception
+ {
+ getDelegate().undeployBundle(archive);
+ }
+
protected void deploy(String archive) throws Exception
{
getDelegate().deploy(archive);
@@ -69,11 +79,6 @@
getDelegate().deploy(archive);
}
- protected RemoteBundle deployBundle(String bundleName) throws Exception
- {
- return getDelegate().deployBundle(bundleName);
- }
-
protected void undeploy(String archive) throws Exception
{
getDelegate().undeploy(archive);
@@ -84,11 +89,6 @@
getDelegate().undeploy(archive);
}
- protected void undeployBundle(String bundleName) throws Exception
- {
- getDelegate().undeployBundle(bundleName);
- }
-
protected RemoteFramework getRemoteFramework() throws Exception
{
return getDelegate().getRemoteFramework();
Modified: projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java 2009-04-13 11:08:55 UTC (rev 87181)
+++ projects/jboss-osgi/trunk/runtime/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java 2009-04-13 13:47:53 UTC (rev 87182)
@@ -21,10 +21,14 @@
*/
package org.jboss.osgi.spi.junit;
+import java.io.File;
+import java.io.FileInputStream;
import java.net.URL;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Set;
+import java.util.jar.Attributes;
+import java.util.jar.JarInputStream;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
@@ -40,6 +44,7 @@
import org.jboss.osgi.spi.management.MBeanProxyException;
import org.jboss.osgi.spi.management.ManagedBundleMBean;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
+import org.osgi.framework.Constants;
/**
* An integration test helper that deals with test deployment/undeployment, etc.
@@ -143,15 +148,25 @@
}
}
- public RemoteBundle deployBundle(String bundleName) throws Exception
+ public RemoteBundle deployBundle(String archive) throws Exception
{
- deploy(bundleName + ".jar");
- return getRemoteFramework().getBundle(bundleName);
+ File archiveFile = getTestArchiveFile(archive);
+ JarInputStream jarInputStream = new JarInputStream(new FileInputStream(archiveFile));
+ Attributes attribs = jarInputStream.getManifest().getMainAttributes();
+ String symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
+ jarInputStream.close();
+
+ if (symbolicName == null)
+ throw new IllegalArgumentException("Cannot obtain Bundle-SymbolicName for: " + archive);
+
+ deploy(archive);
+
+ return getRemoteFramework().getBundle(symbolicName);
}
- public void undeployBundle(String bundleName) throws Exception
+ public void undeployBundle(String archive) throws Exception
{
- undeploy(bundleName + ".jar");
+ undeploy(archive);
}
public RemoteFramework getRemoteFramework() throws Exception
Modified: projects/jboss-osgi/trunk/service/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/service/pom.xml 2009-04-13 11:08:55 UTC (rev 87181)
+++ projects/jboss-osgi/trunk/service/pom.xml 2009-04-13 13:47:53 UTC (rev 87182)
@@ -13,7 +13,7 @@
<modules>
<module>logging</module>
- <module>remlog</module>
+ <module>remote-log</module>
<module>webconsole</module>
</modules>
Copied: projects/jboss-osgi/trunk/service/remote-log (from rev 87178, projects/jboss-osgi/trunk/service/remlog)
Modified: projects/jboss-osgi/trunk/service/remote-log/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/service/remlog/pom.xml 2009-04-12 22:17:09 UTC (rev 87178)
+++ projects/jboss-osgi/trunk/service/remote-log/pom.xml 2009-04-13 13:47:53 UTC (rev 87182)
@@ -5,7 +5,7 @@
<name>JBossOSGi - Service Remote Logging</name>
<groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-service-remlog</artifactId>
+ <artifactId>jboss-osgi-service-remote-log</artifactId>
<packaging>bundle</packaging>
<!-- Parent -->
@@ -25,6 +25,11 @@
<!-- Dependencies -->
<dependencies>
<dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-runtime-spi</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
@@ -72,14 +77,15 @@
<extensions>true</extensions>
<configuration>
<instructions>
- <Bundle-SymbolicName>org.jboss.osgi.service.remlog</Bundle-SymbolicName>
+ <Bundle-SymbolicName>org.jboss.osgi.service.remote.log</Bundle-SymbolicName>
<Bundle-Activator>org.jboss.osgi.service.remlog.RemoteLogActivator</Bundle-Activator>
<Export-Package>org.jboss.osgi.service.remlog;version=${version}</Export-Package>
<Import-Package>
+ org.jboss.osgi.service.log,
org.osgi.framework,
org.osgi.service.log,
org.osgi.util.tracker,
-
+
javax.crypto;resolution:=optional,
javax.crypto.spec;resolution:=optional,
javax.management,
Deleted: projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/RemoteLogActivator.java
===================================================================
--- projects/jboss-osgi/trunk/service/remlog/src/main/java/org/jboss/osgi/service/remlog/RemoteLogActivator.java 2009-04-12 22:17:09 UTC (rev 87178)
+++ projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/RemoteLogActivator.java 2009-04-13 13:47:53 UTC (rev 87182)
@@ -1,90 +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.service.remlog;
-
-//$Id$
-
-import java.util.Properties;
-
-import org.jboss.remoting.transport.ServerFactory;
-import org.jboss.remoting.transport.local.TransportServerFactory;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * [TODO]
- *
- * @author thomas.diesler at jboss.com
- * @since 23-Jan-2009
- */
-public class RemoteLogActivator implements BundleActivator
-{
- public static final String REMOTE_LOG_HOST = "org.jboss.osgi.service.remlog.host";
- public static final String REMOTE_LOG_PORT = "org.jboss.osgi.service.remlog.port";
-
- private RemoteLogReceiverService receiverService;
- private ServiceRegistration receiverRegistration;
-
- private RemoteLogSenderService senderService;
- private ServiceRegistration senderRegistration;
-
- public void start(BundleContext context)
- {
- Properties props = new Properties();
- props.put(REMOTE_LOG_HOST, "localhost");
- props.put(REMOTE_LOG_PORT, "5400");
-
- ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-
- receiverService = new RemoteLogReceiverService(context, props);
- receiverRegistration = context.registerService(RemoteLogReceiverService.class.getName(), receiverService, props);
- receiverService.start();
-
- senderService = new RemoteLogSenderService(context, props);
- senderRegistration = context.registerService(RemoteLogSenderService.class.getName(), senderService, props);
- senderService.start();
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(ctxLoader);
- }
- }
-
- public void stop(BundleContext context) throws Exception
- {
- receiverRegistration.unregister();
- receiverRegistration = null;
-
- receiverService.stop();
- receiverService = null;
-
- senderRegistration.unregister();
- senderRegistration = null;
-
- senderService.stop();
- senderService = null;
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/RemoteLogListener.java (from rev 87178, projects/jboss-osgi/trunk/service/remlog/src/main/java/org/jboss/osgi/service/remlog/RemoteLogSenderService.java)
===================================================================
--- projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/RemoteLogListener.java (rev 0)
+++ projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/RemoteLogListener.java 2009-04-13 13:47:53 UTC (rev 87182)
@@ -0,0 +1,98 @@
+/*
+ * 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.service.remlog;
+
+//$Id$
+
+import java.util.Properties;
+
+import org.jboss.osgi.service.remlog.internal.RemoteLogEntry;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogEntry;
+import org.osgi.service.log.LogListener;
+import org.osgi.service.log.LogReaderService;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 12-Apr-2009
+ */
+public class RemoteLogListener implements LogListener
+{
+ private BundleContext context;
+ private ServiceTracker tracker;
+ private String host;
+ private Integer port;
+
+ public RemoteLogListener(BundleContext context, Properties props)
+ {
+ this.context = context;
+ this.host = props.getProperty(RemoteLogActivator.REMOTE_LOG_HOST);
+ this.port = new Integer(props.getProperty(RemoteLogActivator.REMOTE_LOG_PORT));
+ }
+
+ public void start()
+ {
+ final LogListener logListener = this;
+ tracker = new ServiceTracker(context, LogReaderService.class.getName(), null)
+ {
+ @Override
+ public Object addingService(ServiceReference reference)
+ {
+ LogReaderService logReader = (LogReaderService)super.addingService(reference);
+ logReader.addLogListener(logListener);
+ return logReader;
+ }
+ };
+ tracker.open();
+ }
+
+ public void stop()
+ {
+ LogReaderService logReader = (LogReaderService)tracker.getService();
+ if (logReader != null)
+ logReader.removeLogListener(this);
+ }
+
+ public void logged(LogEntry entry)
+ {
+ RemoteLogEntry remoteEntry = new RemoteLogEntry(entry);
+ try
+ {
+ String locatorURI = "socket://" + host + ":" + port;
+ InvokerLocator locator = new InvokerLocator(locatorURI);
+ Client remotingClient = new Client(locator);
+ remotingClient.connect();
+ remotingClient.invoke(remoteEntry);
+ remotingClient.disconnect();
+ }
+ catch (Throwable ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/RemoteLogReceiverService.java
===================================================================
--- projects/jboss-osgi/trunk/service/remlog/src/main/java/org/jboss/osgi/service/remlog/RemoteLogReceiverService.java 2009-04-12 22:17:09 UTC (rev 87178)
+++ projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/RemoteLogReceiverService.java 2009-04-13 13:47:53 UTC (rev 87182)
@@ -1,179 +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.service.remlog;
-
-//$Id$
-
-import java.util.Enumeration;
-import java.util.Properties;
-
-import javax.management.MBeanServer;
-
-import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.remoting.ServerInvoker;
-import org.jboss.remoting.callback.InvokerCallbackHandler;
-import org.jboss.remoting.transport.Connector;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.log.LogEntry;
-import org.osgi.service.log.LogListener;
-import org.osgi.service.log.LogReaderService;
-
-/**
- * [TODO]
- *
- * @author thomas.diesler at jboss.com
- * @since 12-Apr-2009
- */
-public class RemoteLogReceiverService implements LogReaderService
-{
- private String host;
- private Integer port;
- private Connector connector;
-
- // String to be returned from invocation handler upon client invocation calls.
- private static final String RESPONSE_VALUE = "This is the return to SampleInvocationHandler invocation";
-
- public RemoteLogReceiverService(BundleContext context, Properties props)
- {
- this.host = props.getProperty(RemoteLogActivator.REMOTE_LOG_HOST);
- this.port = new Integer(props.getProperty(RemoteLogActivator.REMOTE_LOG_PORT));
- }
-
- public void addLogListener(LogListener listener)
- {
- }
-
- public void removeLogListener(LogListener listener)
- {
- }
-
- public Enumeration<LogEntry> getLog()
- {
- throw new NotImplementedException();
- }
-
- public void start()
- {
- String locatorURI = "socket://" + host + ":" + port;
- try
- {
- // create the InvokerLocator based on url string format
- // to indicate the transport, host, and port to use for the
- // server invoker.
- InvokerLocator locator = new InvokerLocator(locatorURI);
- System.out.println("Starting remoting server with locator uri of: " + locatorURI);
- connector = new Connector(locator);
- // creates all the connector's needed resources, such as the server invoker
- connector.create();
-
- // create the handler to receive the invocation request from the client for processing
- SampleInvocationHandler invocationHandler = new SampleInvocationHandler();
- // first parameter is sub-system name. can be any String value.
- connector.addInvocationHandler("sample", invocationHandler);
-
- // start with a new non daemon thread so
- // server will wait for request and not exit
- connector.start();
- }
- catch (Throwable ex)
- {
- ex.printStackTrace();
- }
- }
-
- public void stop()
- {
- try
- {
- if (connector != null)
- connector.stop();
- }
- catch (Throwable ex)
- {
- ex.printStackTrace();
- }
- }
-
- /**
- * Simple invocation handler implementation. This is the code that will be called with the invocation payload from the client.
- */
- public static class SampleInvocationHandler implements ServerInvocationHandler
- {
- /**
- * called to handle a specific invocation
- *
- * @param invocation
- * @return
- * @throws Throwable
- */
- public Object invoke(InvocationRequest invocation) throws Throwable
- {
- // Print out the invocation request
- System.out.println("Invocation request is: " + invocation.getParameter());
- System.out.println("Returning response of: " + RESPONSE_VALUE);
- // Just going to return static string as this is just simple example code.
- return RESPONSE_VALUE;
- }
-
- /**
- * Adds a callback handler that will listen for callbacks from the server invoker handler.
- *
- * @param callbackHandler
- */
- public void addListener(InvokerCallbackHandler callbackHandler)
- {
- // NO OP as do not handling callback listeners in this example
- }
-
- /**
- * Removes the callback handler that was listening for callbacks from the server invoker handler.
- *
- * @param callbackHandler
- */
- public void removeListener(InvokerCallbackHandler callbackHandler)
- {
- // NO OP as do not handling callback listeners in this example
- }
-
- /**
- * set the mbean server that the handler can reference
- *
- * @param server
- */
- public void setMBeanServer(MBeanServer server)
- {
- // NO OP as do not need reference to MBeanServer for this handler
- }
-
- /**
- * set the invoker that owns this handler
- *
- * @param invoker
- */
- public void setInvoker(ServerInvoker invoker)
- {
- // NO OP as do not need reference back to the server invoker
- }
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/RemoteLogSenderService.java
===================================================================
--- projects/jboss-osgi/trunk/service/remlog/src/main/java/org/jboss/osgi/service/remlog/RemoteLogSenderService.java 2009-04-12 22:17:09 UTC (rev 87178)
+++ projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/RemoteLogSenderService.java 2009-04-13 13:47:53 UTC (rev 87182)
@@ -1,108 +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.service.remlog;
-
-//$Id$
-
-import java.util.Properties;
-
-import org.jboss.remoting.Client;
-import org.jboss.remoting.InvokerLocator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.log.LogEntry;
-import org.osgi.service.log.LogListener;
-import org.osgi.service.log.LogReaderService;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * [TODO]
- *
- * @author thomas.diesler at jboss.com
- * @since 12-Apr-2009
- */
-public class RemoteLogSenderService implements LogListener
-{
- private BundleContext context;
- private ServiceTracker tracker;
- private String host;
- private Integer port;
-
- public RemoteLogSenderService(BundleContext context, Properties props)
- {
- this.context = context;
- this.host = props.getProperty(RemoteLogActivator.REMOTE_LOG_HOST);
- this.port = new Integer(props.getProperty(RemoteLogActivator.REMOTE_LOG_PORT));
- }
-
- public void start()
- {
- final LogListener logListener = this;
- tracker = new ServiceTracker(context, LogReaderService.class.getName(), null)
- {
- @Override
- public Object addingService(ServiceReference reference)
- {
- LogReaderService logReader = (LogReaderService)super.addingService(reference);
- logReader.addLogListener(logListener);
- return logReader;
- }
- };
- tracker.open();
- }
-
- public void stop()
- {
- LogReaderService logReader = (LogReaderService)tracker.getService();
- if (logReader != null)
- logReader.removeLogListener(this);
- }
-
- public void logged(LogEntry entry)
- {
- String locatorURI = "socket://" + host + ":" + port;
- try
- {
- makeInvocation(locatorURI);
- }
- catch (Throwable ex)
- {
- ex.printStackTrace();
- }
- }
-
- public void makeInvocation(String locatorURI) throws Throwable
- {
- // create InvokerLocator with the url type string
- // indicating the target remoting server to call upon.
- InvokerLocator locator = new InvokerLocator(locatorURI);
- System.out.println("Calling remoting server with locator uri of: " + locatorURI);
-
- Client remotingClient = new Client(locator);
- remotingClient.connect();
- String request = "Do something";
- System.out.println("Invoking server with request of '" + request + "'");
- Object response = remotingClient.invoke(request);
- remotingClient.disconnect();
- System.out.println("Invocation response: " + response);
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/internal (from rev 87181, projects/jboss-osgi/trunk/service/remlog/src/main/java/org/jboss/osgi/service/remlog/internal)
Modified: projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/internal/RemoteLogEntry.java
===================================================================
--- projects/jboss-osgi/trunk/service/remlog/src/main/java/org/jboss/osgi/service/remlog/internal/RemoteLogEntry.java 2009-04-13 11:08:55 UTC (rev 87181)
+++ projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/internal/RemoteLogEntry.java 2009-04-13 13:47:53 UTC (rev 87182)
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.Serializable;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -45,8 +46,10 @@
* @author thomas.diesler at jboss.com
* @since 09-Apr-2009
*/
-public class RemoteLogEntry implements LogEntry
+public class RemoteLogEntry implements LogEntry, Serializable
{
+ private static final long serialVersionUID = 4078248244119704523L;
+
private long time;
private Bundle bundle;
private ServiceReference sref;
@@ -136,8 +139,10 @@
/**
* A dummy Bundle for remote logging
*/
- class DummyBundle implements Bundle
+ class DummyBundle implements Bundle, Serializable
{
+ private static final long serialVersionUID = 7582641115925353657L;
+
private String symbolicName;
public DummyBundle(Bundle bundle)
@@ -275,8 +280,10 @@
/**
* A dummy ServiceReference for remote logging
*/
- class DummyServiceReference implements ServiceReference
+ class DummyServiceReference implements ServiceReference, Serializable
{
+ private static final long serialVersionUID = -4043921452530056434L;
+
private Bundle bundle;
public DummyServiceReference(ServiceReference sref)
Copied: projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/internal/RemoteLogReaderServiceImpl.java (from rev 87178, projects/jboss-osgi/trunk/service/remlog/src/main/java/org/jboss/osgi/service/remlog/RemoteLogReceiverService.java)
===================================================================
--- projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/internal/RemoteLogReaderServiceImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/service/remote-log/src/main/java/org/jboss/osgi/service/remlog/internal/RemoteLogReaderServiceImpl.java 2009-04-13 13:47:53 UTC (rev 87182)
@@ -0,0 +1,156 @@
+/*
+ * 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.service.remlog.internal;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Properties;
+
+import javax.management.MBeanServer;
+
+import org.jboss.osgi.service.log.RemoteLogReaderService;
+import org.jboss.osgi.service.remlog.NotImplementedException;
+import org.jboss.osgi.service.remlog.RemoteLogActivator;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogEntry;
+import org.osgi.service.log.LogListener;
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 12-Apr-2009
+ */
+public class RemoteLogReaderServiceImpl implements RemoteLogReaderService
+{
+ private String host;
+ private Integer port;
+ private Connector connector;
+
+ private List<LogListener> listeners = new ArrayList<LogListener>();
+
+ public RemoteLogReaderServiceImpl(BundleContext context, Properties props)
+ {
+ this.host = props.getProperty(RemoteLogActivator.REMOTE_LOG_HOST);
+ this.port = new Integer(props.getProperty(RemoteLogActivator.REMOTE_LOG_PORT));
+ }
+
+ public void addLogListener(LogListener listener)
+ {
+ listeners.add(listener);
+ }
+
+ public void removeLogListener(LogListener listener)
+ {
+ listeners.remove(listener);
+ }
+
+ public Enumeration<LogEntry> getLog()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void start()
+ {
+ try
+ {
+ String locatorURI = "socket://" + host + ":" + port;
+ InvokerLocator locator = new InvokerLocator(locatorURI);
+ connector = new Connector(locator);
+ connector.create();
+
+ LogEntryInvocationHandler invocationHandler = new LogEntryInvocationHandler();
+ connector.addInvocationHandler("remote-log", invocationHandler);
+ connector.start(true);
+ }
+ catch (Throwable ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ public void stop()
+ {
+ try
+ {
+ if (connector != null)
+ connector.stop();
+ }
+ catch (Throwable ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Simple invocation handler implementation.
+ * This is the code that will be called with the invocation payload from the client.
+ */
+ class LogEntryInvocationHandler implements ServerInvocationHandler
+ {
+ public Object invoke(InvocationRequest invocation) throws Throwable
+ {
+ RemoteLogEntry remoteEntry = (RemoteLogEntry)invocation.getParameter();
+ for (LogListener listener : listeners)
+ {
+ try
+ {
+ listener.logged(remoteEntry);
+ }
+ catch (RuntimeException rte)
+ {
+ System.out.println(rte.toString());
+ }
+ }
+ return null;
+ }
+
+ public void addListener(InvokerCallbackHandler callbackHandler)
+ {
+ // NOOP as do not handling callback listeners
+ }
+
+ public void removeListener(InvokerCallbackHandler callbackHandler)
+ {
+ // NOOP as do not handling callback listeners
+ }
+
+ public void setMBeanServer(MBeanServer server)
+ {
+ // NOOP as do not need reference to MBeanServer for this handler
+ }
+
+ public void setInvoker(ServerInvoker invoker)
+ {
+ // NOOP as do not need reference back to the server invoker
+ }
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-04-13 11:08:55 UTC (rev 87181)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-04-13 13:47:53 UTC (rev 87182)
@@ -54,7 +54,7 @@
</dependency>
<dependency>
<groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-service-remlog</artifactId>
+ <artifactId>jboss-osgi-service-remote-log</artifactId>
<version>${version}</version>
<scope>provided</scope>
</dependency>
@@ -90,7 +90,7 @@
<ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
- <descriptor>scripts/assembly-thirdparty-bundles.xml</descriptor>
+ <descriptor>scripts/assembly-bundles.xml</descriptor>
</descriptors>
</configuration>
</execution>
@@ -271,7 +271,7 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <argLine>${surefire.security.args}</argLine>
+ <!-- argLine>${surefire.security.args}</argLine -->
<excludes>
</excludes>
</configuration>
Copied: projects/jboss-osgi/trunk/testsuite/scripts/assembly-bundles.xml (from rev 87178, projects/jboss-osgi/trunk/testsuite/scripts/assembly-thirdparty-bundles.xml)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/scripts/assembly-bundles.xml (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/scripts/assembly-bundles.xml 2009-04-13 13:47:53 UTC (rev 87182)
@@ -0,0 +1,28 @@
+<assembly 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/xsd/assembly-1.1.0-SNAPSHOT.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>*:org.apache.felix.log:jar</include>
+ <include>*:org.osgi.compendium:jar</include>
+ <include>*:jboss-osgi-service-remote-log:jar</include>
+ </includes>
+ <useStrictFiltering>true</useStrictFiltering>
+ <scope>provided</scope>
+ <unpack>false</unpack>
+ </dependencySet>
+
+ </dependencySets>
+</assembly>
Deleted: projects/jboss-osgi/trunk/testsuite/scripts/assembly-thirdparty-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/scripts/assembly-thirdparty-bundles.xml 2009-04-13 11:08:55 UTC (rev 87181)
+++ projects/jboss-osgi/trunk/testsuite/scripts/assembly-thirdparty-bundles.xml 2009-04-13 13:47:53 UTC (rev 87182)
@@ -1,28 +0,0 @@
-<assembly 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/xsd/assembly-1.1.0-SNAPSHOT.xsd">
-
- <id>deploy-artifacts</id>
- <formats>
- <format>dir</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
-
- <!-- Dependency Sets -->
- <dependencySets>
-
- <!-- bundle -->
- <dependencySet>
- <outputDirectory>thirdparty</outputDirectory>
- <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
- <includes>
- <include>*:org.apache.felix.log:jar</include>
- <include>*:org.osgi.compendium:jar</include>
- <include>*:jboss-osgi-service-remlog:jar</include>
- </includes>
- <useStrictFiltering>true</useStrictFiltering>
- <scope>provided</scope>
- <unpack>false</unpack>
- </dependencySet>
-
- </dependencySets>
-</assembly>
Modified: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/example/log/LogServiceRemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/example/log/LogServiceRemoteTestCase.java 2009-04-13 11:08:55 UTC (rev 87181)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/example/log/LogServiceRemoteTestCase.java 2009-04-13 13:47:53 UTC (rev 87182)
@@ -23,22 +23,27 @@
//$Id$
-import java.net.URL;
+import java.util.List;
+import org.jboss.osgi.service.log.LogEntryCache;
+import org.jboss.osgi.service.log.LogEntryFilter;
+import org.jboss.osgi.service.log.RemoteLogReaderService;
import org.jboss.osgi.spi.framework.OSGiBootstrap;
import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.OSGiTest;
-import org.osgi.framework.Bundle;
+import org.jboss.osgi.spi.junit.IntegrationTest;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogEntry;
import org.osgi.service.log.LogService;
+import org.osgi.util.tracker.ServiceTracker;
/**
- * This example demonstrates the usage of the {@link LogService}
+ * This example demonstrates the usage of the {@link RemoteLogReaderService}
*
* @author thomas.diesler at jboss.com
* @since 09-Apr-2009
*/
-public class LogServiceRemoteTestCase extends OSGiTest
+public class LogServiceRemoteTestCase extends IntegrationTest
{
public void testServiceA() throws Exception
{
@@ -46,13 +51,49 @@
OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
BundleContext sysContext = framework.getSystemBundleContext();
- // Install and start the 3rd party LogService.
- URL testURL = getTestArchiveURL("thirdparty/org.apache.felix.log.jar");
- Bundle logServiceBundle = sysContext.installBundle(testURL.toExternalForm());
- logServiceBundle.start();
+ // Setup the LogEntryCache
+ final LogEntryCache logEntryCache = new LogEntryCache();
+ logEntryCache.addFilter(new LogEntryFilter("example-log(.*)", LogService.LOG_INFO, "BundleEvent(.*)"));
+ logEntryCache.addFilter(new LogEntryFilter(null, -1, "\\[ServiceA\\](.*)"));
- installBundle(sysContext, "thirdparty/jboss-osgi-service-remlog.jar", true);
+ // Track the RemoteLogReaderService to add the LogEntryCache as LogListener
+ ServiceTracker tracker = new ServiceTracker(sysContext, RemoteLogReaderService.class.getName(), null)
+ {
+ @Override
+ public Object addingService(ServiceReference sref)
+ {
+ RemoteLogReaderService service = (RemoteLogReaderService)super.addingService(sref);
+ service.addLogListener(logEntryCache);
+ return service;
+ }
+ };
+ tracker.open();
+
+ // Install the RemoteLogReaderService in the local OSGiFramework.
+ installBundle(sysContext, "bundles/jboss-osgi-service-remote-log.jar", true);
- installBundle(sysContext, "example/example-log-bundleA.jar", true);
+ // Deploy the RemoteLogListener to the remote OSGiFramework.
+ deployBundle("bundles/jboss-osgi-service-remote-log.jar");
+
+ // Deploy the test bundle
+ deployBundle("example/example-log-bundleA.jar");
+
+ // Undeploy the test bundle
+ undeployBundle("example/example-log-bundleA.jar");
+
+ // Uneploy the RemoteLogListener from the remote OSGiFramework.
+ undeployBundle("bundles/jboss-osgi-service-remote-log.jar");
+
+// System.out.println(logEntryCache.getLog());
+
+ // Verify the received log entries
+ List<LogEntry> entries = logEntryCache.getLog();
+ assertEquals("Number of entries", 6, entries.size());
+// assertEquals("BundleEvent RESOLVED", entries.get(1).getMessage());
+// assertEquals("BundleEvent INSTALLED", entries.get(0).getMessage());
+// assertEquals("[ServiceA] addingService: org.apache.felix.log.LogServiceImpl", entries.get(2).getMessage());
+// assertEquals("BundleEvent STARTED", entries.get(3).getMessage());
+// assertEquals("BundleEvent STOPPED", entries.get(4).getMessage());
+// assertEquals("BundleEvent UNINSTALLED", entries.get(5).getMessage());
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java 2009-04-13 11:08:55 UTC (rev 87181)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java 2009-04-13 13:47:53 UTC (rev 87182)
@@ -73,7 +73,7 @@
// Install and start the 3rd party LogService.
// This will register the LogReaderService that we track above.
- URL testURL = getTestArchiveURL("thirdparty/org.apache.felix.log.jar");
+ URL testURL = getTestArchiveURL("bundles/org.apache.felix.log.jar");
Bundle logServiceBundle = sysContext.installBundle(testURL.toExternalForm());
logServiceBundle.start();
Modified: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38RemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38RemoteTestCase.java 2009-04-13 11:08:55 UTC (rev 87181)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38RemoteTestCase.java 2009-04-13 13:47:53 UTC (rev 87182)
@@ -47,11 +47,11 @@
*/
public void testInstallStartX() throws Exception
{
- RemoteBundle bundleX = deployBundle("jbosgi38-bundleX");
+ RemoteBundle bundleX = deployBundle("jbosgi38-bundleX.jar");
assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
- undeployBundle("jbosgi38-bundleX");
+ undeployBundle("jbosgi38-bundleX.jar");
}
/*
@@ -59,14 +59,14 @@
*/
public void testInstallXBeforeB() throws Exception
{
- RemoteBundle bundleX = deployBundle("jbosgi38-bundleX");
- RemoteBundle bundleB = deployBundle("jbosgi38-bundleB");
+ RemoteBundle bundleX = deployBundle("jbosgi38-bundleX.jar");
+ RemoteBundle bundleB = deployBundle("jbosgi38-bundleB.jar");
assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
- undeployBundle("jbosgi38-bundleB");
- undeployBundle("jbosgi38-bundleX");
+ undeployBundle("jbosgi38-bundleB.jar");
+ undeployBundle("jbosgi38-bundleX.jar");
}
/*
@@ -74,17 +74,17 @@
*/
public void testInstallBBeforeA() throws Exception
{
- RemoteBundle bundleX = deployBundle("jbosgi38-bundleX");
- RemoteBundle bundleB = deployBundle("jbosgi38-bundleB");
- RemoteBundle bundleA = deployBundle("jbosgi38-bundleA");
+ RemoteBundle bundleX = deployBundle("jbosgi38-bundleX.jar");
+ RemoteBundle bundleB = deployBundle("jbosgi38-bundleB.jar");
+ RemoteBundle bundleA = deployBundle("jbosgi38-bundleA.jar");
assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
- undeployBundle("jbosgi38-bundleA");
- undeployBundle("jbosgi38-bundleB");
- undeployBundle("jbosgi38-bundleX");
+ undeployBundle("jbosgi38-bundleA.jar");
+ undeployBundle("jbosgi38-bundleB.jar");
+ undeployBundle("jbosgi38-bundleX.jar");
}
/*
@@ -92,17 +92,17 @@
*/
public void testInstallBBeforeX() throws Exception
{
- RemoteBundle bundleB = deployBundle("jbosgi38-bundleB");
+ RemoteBundle bundleB = deployBundle("jbosgi38-bundleB.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
- RemoteBundle bundleX = deployBundle("jbosgi38-bundleX");
+ RemoteBundle bundleX = deployBundle("jbosgi38-bundleX.jar");
assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
- undeployBundle("jbosgi38-bundleB");
- undeployBundle("jbosgi38-bundleX");
+ undeployBundle("jbosgi38-bundleB.jar");
+ undeployBundle("jbosgi38-bundleX.jar");
}
/*
@@ -110,22 +110,22 @@
*/
public void testInstallABeforeB() throws Exception
{
- RemoteBundle bundleA = deployBundle("jbosgi38-bundleA");
+ RemoteBundle bundleA = deployBundle("jbosgi38-bundleA.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
- RemoteBundle bundleB = deployBundle("jbosgi38-bundleB");
+ RemoteBundle bundleB = deployBundle("jbosgi38-bundleB.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
- RemoteBundle bundleX = deployBundle("jbosgi38-bundleX");
+ RemoteBundle bundleX = deployBundle("jbosgi38-bundleX.jar");
assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
- undeployBundle("jbosgi38-bundleA");
- undeployBundle("jbosgi38-bundleB");
- undeployBundle("jbosgi38-bundleX");
+ undeployBundle("jbosgi38-bundleA.jar");
+ undeployBundle("jbosgi38-bundleB.jar");
+ undeployBundle("jbosgi38-bundleX.jar");
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39RemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39RemoteTestCase.java 2009-04-13 11:08:55 UTC (rev 87181)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39RemoteTestCase.java 2009-04-13 13:47:53 UTC (rev 87182)
@@ -44,7 +44,7 @@
{
public void testVerifyUnresolved() throws Exception
{
- RemoteBundle bundleB = deployBundle("jbosgi39-bundleB");
+ RemoteBundle bundleB = deployBundle("jbosgi39-bundleB.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
@@ -58,13 +58,13 @@
// expected
}
- RemoteBundle bundleX = deployBundle("jbosgi39-bundleX");
+ RemoteBundle bundleX = deployBundle("jbosgi39-bundleX.jar");
assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
- undeployBundle("jbosgi39-bundleB");
- undeployBundle("jbosgi39-bundleX");
+ undeployBundle("jbosgi39-bundleB.jar");
+ undeployBundle("jbosgi39-bundleX.jar");
}
/*
@@ -80,8 +80,8 @@
*/
public void testWiringToUninstalled() throws Exception
{
- RemoteBundle bundleX = deployBundle("jbosgi39-bundleX");
- RemoteBundle bundleB = deployBundle("jbosgi39-bundleB");
+ RemoteBundle bundleX = deployBundle("jbosgi39-bundleX.jar");
+ RemoteBundle bundleB = deployBundle("jbosgi39-bundleB.jar");
bundleB.start();
@@ -89,16 +89,16 @@
assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
// Undeploy X before B
- undeployBundle("jbosgi39-bundleX");
- undeployBundle("jbosgi39-bundleB");
+ undeployBundle("jbosgi39-bundleX.jar");
+ undeployBundle("jbosgi39-bundleB.jar");
// Install B without X
- bundleB = deployBundle("jbosgi39-bundleB");
+ bundleB = deployBundle("jbosgi39-bundleB.jar");
bundleB.start();
assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
- undeployBundle("jbosgi39-bundleB");
+ undeployBundle("jbosgi39-bundleB.jar");
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41RemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41RemoteTestCase.java 2009-04-13 11:08:55 UTC (rev 87181)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41RemoteTestCase.java 2009-04-13 13:47:53 UTC (rev 87182)
@@ -43,7 +43,7 @@
{
public void testFirstRun() throws Exception
{
- RemoteBundle bundleA = deployBundle("jbosgi41-bundleA");
+ RemoteBundle bundleA = deployBundle("jbosgi41-bundleA.jar");
assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
File dataFile = getBundleDataFile(bundleA, "config/jbosgi41.txt");
@@ -53,7 +53,7 @@
String symbolicName = br.readLine();
assertEquals("jbosgi41-bundleA", symbolicName);
- undeployBundle("jbosgi41-bundleA");
+ undeployBundle("jbosgi41-bundleA.jar");
}
private File getBundleDataFile(RemoteBundle bundleA, String filename)
Modified: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelRemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelRemoteTestCase.java 2009-04-13 11:08:55 UTC (rev 87181)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelRemoteTestCase.java 2009-04-13 13:47:53 UTC (rev 87182)
@@ -37,10 +37,10 @@
{
public void testStartLevel() throws Exception
{
- RemoteBundle bundle = deployBundle("startlevel-service");
+ RemoteBundle bundle = deployBundle("startlevel-service.jar");
assertEquals("Bundle active", Bundle.ACTIVE, bundle.getState());
- undeployBundle("startlevel-service");
+ undeployBundle("startlevel-service.jar");
}
}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list