JBoss-OSGI SVN: r99942 - in projects/jboss-osgi/projects/bundles: serviceloader and 6 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-26 10:25:35 -0500 (Tue, 26 Jan 2010)
New Revision: 99942
Added:
projects/jboss-osgi/projects/bundles/serviceloader/
projects/jboss-osgi/projects/bundles/serviceloader/trunk/
projects/jboss-osgi/projects/bundles/serviceloader/trunk/pom.xml
projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/
projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/ServiceLoaderCapability.java
projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/ServiceLoaderService.java
projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/
projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderActivator.java
projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderInterceptor.java
Removed:
projects/jboss-osgi/projects/bundles/serviceloader/trunk/pom.xml
projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/common/internal/
projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/common/log/
Modified:
projects/jboss-osgi/projects/bundles/serviceloader/trunk/.settings/org.eclipse.jdt.core.prefs
Log:
Add the jboss-osgi-serviceloader bundle
Copied: projects/jboss-osgi/projects/bundles/serviceloader/trunk (from rev 97207, projects/jboss-osgi/projects/bundles/common/trunk)
Modified: projects/jboss-osgi/projects/bundles/serviceloader/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/bundles/common/trunk/.settings/org.eclipse.jdt.core.prefs 2009-12-01 08:46:33 UTC (rev 97207)
+++ projects/jboss-osgi/projects/bundles/serviceloader/trunk/.settings/org.eclipse.jdt.core.prefs 2010-01-26 15:25:35 UTC (rev 99942)
@@ -1,5 +1,6 @@
-#Tue Apr 14 17:48:49 CEST 2009
+#Tue Jan 26 15:12:03 CET 2010
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.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5
Deleted: projects/jboss-osgi/projects/bundles/serviceloader/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/common/trunk/pom.xml 2009-12-01 08:46:33 UTC (rev 97207)
+++ projects/jboss-osgi/projects/bundles/serviceloader/trunk/pom.xml 2010-01-26 15:25:35 UTC (rev 99942)
@@ -1,141 +0,0 @@
-<?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 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 - Common</name>
- <description>The JBossOSGi common services</description>
-
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common</artifactId>
- <packaging>bundle</packaging>
-
- <version>1.0.4-SNAPSHOT</version>
-
- <!-- Parent -->
- <parent>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-parent</artifactId>
- <version>1.0.4</version>
- </parent>
-
- <!-- SCM -->
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projec...</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/...</developerConnection>
- <url>http://fisheye.jboss.com/qsearch/JBossOSGi</url>
- </scm>
-
- <!-- Properties -->
- <properties>
- <version.jboss.osgi.spi>1.0.3</version.jboss.osgi.spi>
- <version.osgi>4.2.0</version.osgi>
- </properties>
-
- <!-- Dependencies -->
- <dependencies>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-spi</artifactId>
- <version>${version.jboss.osgi.spi}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <version>${version.slf4j}</version>
- </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>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Bundle-Activator>org.jboss.osgi.common.internal.CommonServicesActivator</Bundle-Activator>
- <Export-Package>
- org.jboss.osgi.common.log;version=${version}
- </Export-Package>
- <Import-Package>
- javax.management,
- org.apache.log4j;version=1.2;resolution:=optional,
- org.jboss.osgi.spi.capability;version=1.0,
- org.jboss.osgi.spi.util;version=1.0,
- org.osgi.framework;version=1.4,
- org.osgi.service.log;version=1.3,
- org.osgi.util.tracker
- </Import-Package>
- <Embed-Dependency>
- jcl-over-slf4j;inline=false,
- slf4j-api;inline=false,
- slf4j-log4j12;inline=false,
- </Embed-Dependency>
- <_exportcontents>
- org.apache.commons.logging;version=1.1.1,
- org.slf4j;version=1.5.8,
- </_exportcontents>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-artifacts</id>
- <phase>package</phase>
- <goals>
- <goal>attach-artifact</goal>
- </goals>
- <configuration>
- <artifacts>
- <artifact>
- <!-- For some reason the distribution javadoc module needs this -->
- <file>target/${artifactId}-${version}-sources.jar</file>
- <classifier>sources</classifier>
- <type>jar</type>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
Copied: projects/jboss-osgi/projects/bundles/serviceloader/trunk/pom.xml (from rev 97292, projects/jboss-osgi/projects/bundles/common/trunk/pom.xml)
===================================================================
--- projects/jboss-osgi/projects/bundles/serviceloader/trunk/pom.xml (rev 0)
+++ projects/jboss-osgi/projects/bundles/serviceloader/trunk/pom.xml 2010-01-26 15:25:35 UTC (rev 99942)
@@ -0,0 +1,86 @@
+<?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 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 - Service Loader</name>
+ <description>The JBossOSGi META-INF/services Loader</description>
+
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-serviceloader</artifactId>
+ <packaging>bundle</packaging>
+
+ <version>1.0.0-SNAPSHOT</version>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-parent</artifactId>
+ <version>1.0.4</version>
+ </parent>
+
+ <!-- Properties -->
+ <properties>
+ <version.jboss.osgi.deployment>1.0.1-SNAPSHOT</version.jboss.osgi.deployment>
+ <version.jboss.osgi.spi>1.0.4-SNAPSHOT</version.jboss.osgi.spi>
+ <version.osgi>4.2.0</version.osgi>
+ </properties>
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.osgi.runtime</groupId>
+ <artifactId>jboss-osgi-deployment</artifactId>
+ <version>${version.jboss.osgi.deployment}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-spi</artifactId>
+ <version>${version.jboss.osgi.spi}</version>
+ </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>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
+ <Bundle-Activator>org.jboss.osgi.serviceloader.internal.ServiceLoaderActivator</Bundle-Activator>
+ <Export-Package>
+ org.jboss.osgi.serviceloader;version=${version}
+ </Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/ServiceLoaderCapability.java
===================================================================
--- projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/ServiceLoaderCapability.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/ServiceLoaderCapability.java 2010-01-26 15:25:35 UTC (rev 99942)
@@ -0,0 +1,46 @@
+/*
+ * 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.serviceloader;
+
+//$Id$
+
+import org.jboss.osgi.spi.capability.Capability;
+
+/**
+ * Adds the Blueprint capability to the {@link OSGiRuntime}
+ * under test.
+ *
+ * It is ignored if the {@link ServiceLoaderService} is already registered.
+ *
+ * Installed bundles: jboss-osgi-serviceloader
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 26-Jan-2010
+ */
+public class ServiceLoaderCapability extends Capability
+{
+ public ServiceLoaderCapability()
+ {
+ super(ServiceLoaderService.class.getName());
+ addBundle("bundles/jboss-osgi-serviceloader.jar");
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/ServiceLoaderCapability.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/ServiceLoaderService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/ServiceLoaderService.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/ServiceLoaderService.java 2010-01-26 15:25:35 UTC (rev 99942)
@@ -0,0 +1,34 @@
+/*
+ * 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.serviceloader;
+
+//$Id$
+
+/**
+ * A marker service that is registered by jboss-osgi-serviceloader
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 26-Jan-2010
+ */
+public interface ServiceLoaderService
+{
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/ServiceLoaderService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderActivator.java
===================================================================
--- projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderActivator.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderActivator.java 2010-01-26 15:25:35 UTC (rev 99942)
@@ -0,0 +1,52 @@
+/*
+ * 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.serviceloader.internal;
+
+//$Id$
+
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
+import org.jboss.osgi.serviceloader.ServiceLoaderService;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * A bundle activator that registers the {@link ServiceLoaderInterceptor}.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 26-Jan-2010
+ */
+public class ServiceLoaderActivator implements BundleActivator
+{
+ public void start(BundleContext context)
+ {
+ // Register marker service
+ context.registerService(ServiceLoaderService.class.getName(), new ServiceLoaderService(){}, null);
+
+ // Register lifecycle interceptor
+ ServiceLoaderInterceptor interceptor = new ServiceLoaderInterceptor();
+ context.registerService(LifecycleInterceptor.class.getName(), interceptor, null);
+ }
+
+ public void stop(BundleContext context)
+ {
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderActivator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderInterceptor.java
===================================================================
--- projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderInterceptor.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderInterceptor.java 2010-01-26 15:25:35 UTC (rev 99942)
@@ -0,0 +1,121 @@
+/*
+ * 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.serviceloader.internal;
+
+//$Id$
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Enumeration;
+
+import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.InvocationContext;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An interceptor that registeres service defained in META-INF/services.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 26-Jan-2010
+ */
+public class ServiceLoaderInterceptor extends AbstractLifecycleInterceptor
+{
+ // Provide logging
+ private Logger log = LoggerFactory.getLogger(ServiceLoaderInterceptor.class);
+
+ @SuppressWarnings("unchecked")
+ public void invoke(int state, InvocationContext context)
+ {
+ // Parse and create metadta on STARTING
+ if (state == Bundle.STARTING)
+ {
+ Bundle bundle = context.getBundle();
+ if (bundle.getEntry("META-INF/services") == null)
+ return;
+
+ Enumeration<String> entryPaths = bundle.getEntryPaths("META-INF/services");
+ while (entryPaths.hasMoreElements())
+ {
+ String entryPath = entryPaths.nextElement();
+ processServicesEntryPath(context, entryPath);
+ }
+ }
+ }
+
+ private void processServicesEntryPath(InvocationContext context, String entryPath)
+ {
+ Bundle bundle = context.getBundle();
+ VirtualFile root = context.getRoot();
+
+ try
+ {
+ String serviceName = entryPath.substring("META-INF/services/".length());
+ Class<?> serviceClass = bundle.loadClass(serviceName);
+
+ VirtualFile child = root.getChild(entryPath);
+ InputStream inStream = child.openStream();
+
+ BufferedReader br = new BufferedReader(new InputStreamReader(inStream, "UTF-8"));
+ String implClassName = br.readLine();
+ while (implClassName != null)
+ {
+ int hashIndex = implClassName.indexOf("#");
+ if (hashIndex > 0)
+ implClassName = implClassName.substring(0, hashIndex);
+
+ implClassName = implClassName.trim();
+
+ if (implClassName.length() > 0)
+ {
+ // Load the service class
+ Class<?> implClass = (Class<?>)bundle.loadClass(implClassName);
+ if (serviceClass.isAssignableFrom(implClass) == false)
+ {
+ log.warn("Not assignable: " + implClassName);
+ continue;
+ }
+
+ // Register the service instance
+ Object serviceInstance = implClass.newInstance();
+ BundleContext bundleContext = bundle.getBundleContext();
+ bundleContext.registerService(serviceName, serviceInstance, null);
+ }
+
+ implClassName = br.readLine();
+ }
+ br.close();
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot process: " + entryPath, ex);
+ }
+ }
+}
Property changes on: projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderInterceptor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 11 months
JBoss-OSGI SVN: r99937 - projects/jboss-osgi/projects/runtime/framework/trunk.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-26 07:39:59 -0500 (Tue, 26 Jan 2010)
New Revision: 99937
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
Log:
Use jboss-cl-2.0.9-SNAPSHOT
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-01-26 12:39:30 UTC (rev 99936)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-01-26 12:39:59 UTC (rev 99937)
@@ -47,7 +47,7 @@
<version.apache.felix.log>1.0.0</version.apache.felix.log>
<version.apache.felix.metatype>1.0.2</version.apache.felix.metatype>
<version.drools>5.0.1</version.drools>
- <version.jboss.classloading>2.2.0-SNAPSHOT</version.jboss.classloading>
+ <version.jboss.classloading>2.0.9-SNAPSHOT</version.jboss.classloading>
<version.jboss.deployers>2.2.0.Alpha1</version.jboss.deployers>
<version.jboss.kernel>2.2.0.Alpha2</version.jboss.kernel>
<version.jboss.osgi.apache.xerces>2.9.1.SP3</version.jboss.osgi.apache.xerces>
15 years, 11 months
JBoss-OSGI SVN: r99903 - in projects/jboss-osgi/projects: bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-25 09:31:52 -0500 (Mon, 25 Jan 2010)
New Revision: 99903
Modified:
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiBundle.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundleMBean.java
Log:
[JBOSGI-272] Implement bundle header localization
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiBundle.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiBundle.java 2010-01-25 14:31:10 UTC (rev 99902)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiBundle.java 2010-01-25 14:31:52 UTC (rev 99903)
@@ -68,6 +68,11 @@
public abstract Dictionary<String, String> getHeaders();
/**
+ * Returns this bundle's Manifest headers and values localized to the specified locale.
+ */
+ public abstract Dictionary<String, String> getHeaders(String locale);
+
+ /**
* Returns this bundle's current state.
*/
public abstract int getState();
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java 2010-01-25 14:31:10 UTC (rev 99902)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java 2010-01-25 14:31:52 UTC (rev 99903)
@@ -93,6 +93,13 @@
}
@Override
+ @SuppressWarnings("unchecked")
+ public Dictionary<String, String> getHeaders(String locale)
+ {
+ return bundle.getHeaders(locale);
+ }
+
+ @Override
public long getBundleId()
{
return bundle.getBundleId();
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java 2010-01-25 14:31:10 UTC (rev 99902)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java 2010-01-25 14:31:52 UTC (rev 99903)
@@ -63,7 +63,8 @@
private long bundleId;
private String symbolicName;
private ObjectName objectName;
- private Dictionary<String, String> headers;
+ private Dictionary<String, String> defaultHeaders;
+ private Dictionary<String, String> rawHeaders;
private Version version;
boolean uninstalled;
@@ -85,9 +86,11 @@
symbolicName = bundle.getSymbolicName();
objectName = bundle.getObjectName();
location = bundle.getLocation();
- headers = bundle.getHeaders();
+
+ defaultHeaders = bundle.getHeaders(null);
+ rawHeaders = bundle.getHeaders("");
- String versionStr = headers.get(Constants.BUNDLE_VERSION);
+ String versionStr = defaultHeaders.get(Constants.BUNDLE_VERSION);
version = Version.parseVersion(versionStr);
}
@@ -138,10 +141,22 @@
@SuppressWarnings("unchecked")
public Dictionary<String, String> getHeaders()
{
- return new UnmodifiableDictionary(headers);
+ return new UnmodifiableDictionary(defaultHeaders);
}
@Override
+ @SuppressWarnings("unchecked")
+ public Dictionary<String, String> getHeaders(String locale)
+ {
+ if (locale == null)
+ return new UnmodifiableDictionary(defaultHeaders);
+ else if (locale.length() == 0)
+ return new UnmodifiableDictionary(rawHeaders);
+ else
+ return bundle.getHeaders(locale);
+ }
+
+ @Override
public String getProperty(String key)
{
assertNotUninstalled();
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java 2010-01-25 14:31:10 UTC (rev 99902)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java 2010-01-25 14:31:52 UTC (rev 99903)
@@ -105,11 +105,16 @@
return bundle.getLocation();
}
- @SuppressWarnings("rawtypes")
public Dictionary<String, String> getHeaders()
{
+ return getHeaders(null);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Dictionary<String, String> getHeaders(String locale)
+ {
Hashtable<String, String> retHeaders = new Hashtable<String, String>();
- Dictionary bundleHeaders = bundle.getHeaders();
+ Dictionary bundleHeaders = bundle.getHeaders(locale);
Enumeration keys = bundleHeaders.keys();
while (keys.hasMoreElements())
{
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundleMBean.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundleMBean.java 2010-01-25 14:31:10 UTC (rev 99902)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundleMBean.java 2010-01-25 14:31:52 UTC (rev 99903)
@@ -75,6 +75,11 @@
Dictionary<String, String> getHeaders();
/**
+ * Returns this bundle's Manifest headers and values localized to the specified locale.
+ */
+ Dictionary<String, String> getHeaders(String locale);
+
+ /**
* Returns the value of the specified property from the BundleContext.
*/
String getProperty(String key);
15 years, 11 months
JBoss-OSGI SVN: r99902 - in projects/jboss-osgi: trunk/testsuite/functional/scripts and 7 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-25 09:31:10 -0500 (Mon, 25 Jan 2010)
New Revision: 99902
Added:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/localization/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/localization/LocalizationTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/OSGI-INF/
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/OSGI-INF/l10n/
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/OSGI-INF/l10n/bundle_de.properties
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/OSGI-INF/l10n/bundle_en.properties
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/localization-simple-frag.bnd
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/localization-simple-host.bnd
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiFragmentState.java
projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGi99TestCase.java
Log:
[JBOSGI-272] Implement bundle header localization
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-01-25 12:16:28 UTC (rev 99901)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-01-25 14:31:10 UTC (rev 99902)
@@ -267,13 +267,13 @@
baseName = Constants.BUNDLE_LOCALIZATION_DEFAULT_BASENAME;
// Get the resource bundle URL for the given base and locale
- URL entryURL = getLocalizationEntryPath(baseName, locale);
+ URL entryURL = getLocalizationEntry(baseName, locale);
// If the specified locale entry could not be found fall back to the default locale entry
if (entryURL == null)
{
String defaultLocale = Locale.getDefault().toString();
- entryURL = getLocalizationEntryPath(baseName, defaultLocale);
+ entryURL = getLocalizationEntry(baseName, defaultLocale);
}
// Read the resource bundle
@@ -317,16 +317,17 @@
return new CaseInsensitiveDictionary(locHeaders);
}
- private URL getLocalizationEntryPath(String baseName, String locale)
+ URL getLocalizationEntry(String baseName, String locale)
{
// The Framework searches for localization entries by appending suffixes to
// the localization base name according to a specified locale and finally
// appending the .properties suffix. If a translation is not found, the locale
// must be made more generic by first removing the variant, then the country
// and finally the language until an entry is found that contains a valid translation.
-
+
String entryPath = baseName + "_" + locale + ".properties";
- URL entryURL = getEntryInternal(entryPath);
+
+ URL entryURL = getLocalizationEntry(entryPath);
while (entryURL == null)
{
if (entryPath.equals(baseName + ".properties"))
@@ -345,11 +346,29 @@
// The bundle's class loader is not used to search for localization entries. Only
// the contents of the bundle and its attached fragments are searched.
- entryURL = getEntryInternal(entryPath);
+ entryURL = getLocalizationEntry(entryPath);
}
return entryURL;
}
+ /**
+ * The framework must search for localization entries using the follow-
+ * ing search rules based on the bundle type:
+ *
+ * fragment bundle - If the bundle is a resolved fragment, then the search
+ * for localization data must delegate to the attached host bundle with the
+ * highest version. If the fragment is not resolved, then the framework
+ * must search the fragment's JAR for the localization entry.
+ *
+ * other bundle - The framework must first search in the bundle’s JAR for
+ * the localization entry. If the entry is not found and the bundle has fragments,
+ * then the attached fragment JARs must be searched for the localization entry.
+ */
+ URL getLocalizationEntry(String entryPath)
+ {
+ return null;
+ }
+
// Get the entry without checking permissions and bundle state.
URL getEntryInternal(String path)
{
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2010-01-25 12:16:28 UTC (rev 99901)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2010-01-25 14:31:10 UTC (rev 99902)
@@ -185,6 +185,25 @@
return classLoader.getResources(name);
}
+ @Override
+ URL getLocalizationEntry(String entryPath)
+ {
+ // The framework must first search in the bundle’s JAR for
+ // the localization entry. If the entry is not found and the bundle has fragments,
+ // then the attached fragment JARs must be searched for the localization entry.
+ URL entryURL = getEntryInternal(entryPath);
+ if (entryURL == null)
+ {
+ for (OSGiFragmentState frag : getAttachedFragments())
+ {
+ entryURL = frag.getEntryInternal(entryPath);
+ if (entryURL != null)
+ break;
+ }
+ }
+ return entryURL;
+ }
+
// [TODO] options
public void start(int options) throws BundleException
{
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiFragmentState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiFragmentState.java 2010-01-25 12:16:28 UTC (rev 99901)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiFragmentState.java 2010-01-25 14:31:10 UTC (rev 99902)
@@ -75,6 +75,25 @@
return null;
}
+ @Override
+ URL getLocalizationEntry(String entryPath)
+ {
+ // If the bundle is a resolved fragment, then the search
+ // for localization data must delegate to the attached host bundle with the
+ // highest version. If the fragment is not resolved, then the framework
+ // must search the fragment's JAR for the localization entry.
+ if (getState() == Bundle.RESOLVED)
+ {
+ OSGiBundleState host = getFragmentHost();
+ return host.getLocalizationEntry(entryPath);
+ }
+ else
+ {
+ URL entryURL = getEntryInternal(entryPath);
+ return entryURL;
+ }
+ }
+
@SuppressWarnings("rawtypes")
public Class loadClass(String name) throws ClassNotFoundException
{
Modified: projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml 2010-01-25 12:16:28 UTC (rev 99901)
+++ projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml 2010-01-25 14:31:10 UTC (rev 99902)
@@ -150,6 +150,10 @@
<!-- jbosgi214 -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi214-bundle.jar" files="${tests.resources.dir}/jbosgi214/jbosgi214-bundle.bnd" />
+ <!-- localization -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/localization-simple-host.jar" files="${tests.resources.dir}/localization/localization-simple-host.bnd" />
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/localization-simple-frag.jar" files="${tests.resources.dir}/localization/localization-simple-frag.bnd" />
+
<!-- performance -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/performance-blueprint.jar" files="${tests.resources.dir}/performance/blueprint/performance-blueprint.bnd" />
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGi99TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGi99TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGi99TestCase.java 2010-01-25 14:31:10 UTC (rev 99902)
@@ -85,9 +85,7 @@
assertBundleState(Bundle.ACTIVE, bundle.getState());
bundle.uninstall();
-
- if (runtime.isRemoteRuntime() == false)
- assertBundleState(Bundle.UNINSTALLED, bundle.getState());
+ assertBundleState(Bundle.UNINSTALLED, bundle.getState());
}
@Test
@@ -108,9 +106,7 @@
}
bundle.uninstall();
-
- if (runtime.isRemoteRuntime() == false)
- assertBundleState(Bundle.UNINSTALLED, bundle.getState());
+ assertBundleState(Bundle.UNINSTALLED, bundle.getState());
}
@Test
@@ -131,9 +127,7 @@
}
bundle.uninstall();
-
- if (runtime.isRemoteRuntime() == false)
- assertBundleState(Bundle.UNINSTALLED, bundle.getState());
+ assertBundleState(Bundle.UNINSTALLED, bundle.getState());
}
@Test
@@ -157,14 +151,14 @@
bundle = runtime.getBundle("jbosgi99-allgood", null);
if (bundle != null && bundle.getState() == Bundle.ACTIVE)
break;
-
+
Thread.sleep(200);
timeout -= 200;
}
-
+
assertNotNull("Bundle not null", bundle);
assertBundleState(Bundle.ACTIVE, bundle.getState());
-
+
// Delete the bundle from the deploy directory
outFile.delete();
@@ -173,11 +167,11 @@
{
if (bundle.getState() == Bundle.UNINSTALLED)
break;
-
+
Thread.sleep(200);
timeout -= 200;
}
-
+
assertBundleState(Bundle.UNINSTALLED, bundle.getState());
}
Added: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/localization/LocalizationTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/localization/LocalizationTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/localization/LocalizationTestCase.java 2010-01-25 14:31:10 UTC (rev 99902)
@@ -0,0 +1,123 @@
+/*
+ * 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.localization;
+
+//$Id$
+
+import static org.junit.Assert.*;
+
+import java.util.Dictionary;
+import java.util.Locale;
+
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.jboss.osgi.testing.OSGiTestHelper;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+
+/**
+ * Test the Localization
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 25-Jan-2010
+ */
+public class LocalizationTestCase extends OSGiTest
+{
+ private static OSGiRuntime runtime;
+
+ @BeforeClass
+ public static void beforeClass()
+ {
+ runtime = new OSGiTestHelper().getDefaultRuntime();
+ }
+
+ @AfterClass
+ public static void afterClass()
+ {
+ if (runtime != null)
+ {
+ runtime.shutdown();
+ runtime = null;
+ }
+ }
+
+ @Test
+ public void testHostLocalization() throws Exception
+ {
+ OSGiBundle host = runtime.installBundle("localization-simple-host.jar");
+ assertBundleState(Bundle.INSTALLED, host.getState());
+
+ // Test default locale
+ Dictionary<String, String> headers = host.getHeaders();
+ String bundleName = headers.get(Constants.BUNDLE_NAME);
+ assertEquals("English Bundle Name", bundleName);
+
+ // Test explicit default locale
+ headers = host.getHeaders(null);
+ bundleName = headers.get(Constants.BUNDLE_NAME);
+ assertEquals("English Bundle Name", bundleName);
+
+ // Test raw headers
+ headers = host.getHeaders("");
+ bundleName = headers.get(Constants.BUNDLE_NAME);
+ assertEquals("%bundle-name", bundleName);
+
+ host.uninstall();
+ assertBundleState(Bundle.UNINSTALLED, host.getState());
+
+ // Test default locale after uninstall
+ headers = host.getHeaders();
+ bundleName = headers.get(Constants.BUNDLE_NAME);
+ assertEquals("English Bundle Name", bundleName);
+ }
+
+ @Test
+ public void testFragmentLocalization() throws Exception
+ {
+ OSGiBundle host = runtime.installBundle("localization-simple-host.jar");
+ OSGiBundle frag = runtime.installBundle("localization-simple-frag.jar");
+
+ host.start();
+ assertBundleState(Bundle.ACTIVE, host.getState());
+ assertBundleState(Bundle.RESOLVED, frag.getState());
+
+ // Test explicit locale
+ Dictionary<String, String> headers = host.getHeaders(Locale.GERMAN.toString());
+ String bundleName = headers.get(Constants.BUNDLE_NAME);
+ assertEquals("Deutscher Bundle Name", bundleName);
+
+ host.uninstall();
+ assertBundleState(Bundle.UNINSTALLED, host.getState());
+
+ frag.uninstall();
+ assertBundleState(Bundle.UNINSTALLED, frag.getState());
+
+ // Test default locale after uninstall
+ headers = host.getHeaders();
+ bundleName = headers.get(Constants.BUNDLE_NAME);
+ assertEquals("English Bundle Name", bundleName);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/localization/LocalizationTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/OSGI-INF/l10n/bundle_de.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/OSGI-INF/l10n/bundle_de.properties (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/OSGI-INF/l10n/bundle_de.properties 2010-01-25 14:31:10 UTC (rev 99902)
@@ -0,0 +1 @@
+bundle-name=Deutscher Bundle Name
Property changes on: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/OSGI-INF/l10n/bundle_de.properties
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/OSGI-INF/l10n/bundle_en.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/OSGI-INF/l10n/bundle_en.properties (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/OSGI-INF/l10n/bundle_en.properties 2010-01-25 14:31:10 UTC (rev 99902)
@@ -0,0 +1 @@
+bundle-name=English Bundle Name
Property changes on: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/OSGI-INF/l10n/bundle_en.properties
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/localization-simple-frag.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/localization-simple-frag.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/localization-simple-frag.bnd 2010-01-25 14:31:10 UTC (rev 99902)
@@ -0,0 +1,8 @@
+# bnd build -classpath target/test-classes -output target/test-libs/simple-l10n.jar src/test/resources/localization/localization-simple-frag.bnd
+
+Bundle-SymbolicName: localization-simple-frag
+Fragment-Host: localization-simple-host
+Include-Resource: OSGI-INF/l10n/bundle_de.properties=OSGI-INF/l10n/bundle_de.properties
+
+-removeheaders: Include-Resource
+
Added: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/localization-simple-host.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/localization-simple-host.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/localization/localization-simple-host.bnd 2010-01-25 14:31:10 UTC (rev 99902)
@@ -0,0 +1,8 @@
+# bnd build -classpath target/test-classes -output target/test-libs/simple-l10n.jar src/test/resources/localization/localization-simple-host.bnd
+
+Bundle-SymbolicName: localization-simple-host
+Bundle-Name: %bundle-name
+Include-Resource: OSGI-INF/l10n/bundle_en.properties=OSGI-INF/l10n/bundle_en.properties
+
+-removeheaders: Include-Resource
+
15 years, 11 months
JBoss-OSGI SVN: r99901 - in projects/jboss-osgi/trunk/testsuite/functional/src/test: java/org/jboss/test/osgi/jbosgi112 and 17 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-25 07:16:28 -0500 (Mon, 25 Jan 2010)
New Revision: 99901
Added:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGi108TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi112/OSGi112TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGi142TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGi143TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi151/OSGi151TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/OSGi161TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/bundle/Activator161.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/OSGi214TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/bundle/Activator214.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGi37TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGi38TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGi39TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGi41TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi92/OSGi92TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGi99TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGi36TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/OSGi58TestCase.java
Removed:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGI108TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi112/OSGI112TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI143TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi151/OSGI151TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/OSGI161TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/bundle/OSGI161Activator.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/OSGI214TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/bundle/OSGI214Activator.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi92/OSGI92TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/OSGI58TestCase.java
Modified:
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi161/jbosgi161-bundle.bnd
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi214/jbosgi214-bundle.bnd
Log:
Use OSGi prefix in test artefacts
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGI108TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGI108TestCase.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGI108TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -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.test.osgi.jbosgi108;
-
-//$Id: OSGI39TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.List;
-
-import org.jboss.osgi.jmx.JMXCapability;
-import org.jboss.osgi.spi.management.MBeanProxy;
-import org.jboss.osgi.testing.OSGiBundle;
-import org.jboss.osgi.testing.OSGiPackageAdmin;
-import org.jboss.osgi.testing.OSGiRuntime;
-import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.test.osgi.jbosgi108.bundleA.SomeBeanMBean;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.osgi.framework.BundleException;
-
-/**
- * [JBOSGI-108] Investigate statics on PackageAdmin.refresh
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-108
- *
- * @author thomas.diesler(a)jboss.com
- * @since 19-Jun-2009
- */
-public class OSGI108TestCase
-{
- private static OSGiRuntime runtime;
-
- @BeforeClass
- public static void beforeClass() throws Exception
- {
- runtime = new OSGiTestHelper().getDefaultRuntime();
- runtime.addCapability(new JMXCapability());
- }
-
- @AfterClass
- public static void afterClass() throws BundleException
- {
- if (runtime != null)
- {
- runtime.shutdown();
- runtime = null;
- }
- }
-
- @Before
- public void setUp()
- {
- OSGiPackageAdmin packageAdmin = runtime.getPackageAdmin();
- packageAdmin.refreshPackages(null);
- }
-
- @Test
- public void testRedeploySingle() throws Exception
- {
- OSGiBundle bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
-
- bundleA.start();
-
- SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, SomeBeanMBean.MBEAN_NAME, runtime.getMBeanServer());
- List<String> messages = report(someBean.getMessages());
- assertEquals("Start messages", 1, messages.size());
-
- bundleA.uninstall();
-
- // Reinstall bundleA
- bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
- bundleA.start();
-
- // The static in bundleA.SomeBean is expected to be recreated
-
- messages = report(someBean.getMessages());
- assertEquals("Start messages", 1, messages.size());
-
- bundleA.uninstall();
- }
-
- @Test
- public void testRedeployWithReference() throws Exception
- {
- OSGiBundle bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
- OSGiBundle bundleB = runtime.installBundle("jbosgi108-bundleB.jar");
-
- bundleA.start();
- bundleB.start();
-
- SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, SomeBeanMBean.MBEAN_NAME, runtime.getMBeanServer());
- List<String> messages = report(someBean.getMessages());
- assertEquals("Start messages", 2, messages.size());
-
- bundleA.uninstall();
-
- // After uninstall bundleA, bundleB still holds a reference on
- // bundleA.SomeBean
-
- // Reinstall bundleA
- bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
- bundleA.start();
-
- // The static in bundleA.SomeBean is expected to be reused
-
- messages = report(someBean.getMessages());
- assertEquals("Start messages", 4, messages.size());
-
- bundleB.uninstall();
- bundleA.uninstall();
- }
-
- @Test
- public void testRedeployWithReferenceAndRefresh() throws Exception
- {
- OSGiBundle bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
- OSGiBundle bundleB = runtime.installBundle("jbosgi108-bundleB.jar");
-
- bundleA.start();
- bundleB.start();
-
- SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, SomeBeanMBean.MBEAN_NAME, runtime.getMBeanServer());
- List<String> messages = report(someBean.getMessages());
- assertEquals("Start messages", 2, messages.size());
-
- bundleA.uninstall();
-
- // After uninstall bundleA, bundleB still holds a reference on
- // bundleA.SomeBean
-
- // Refresh all packages
- OSGiPackageAdmin packageAdmin = runtime.getPackageAdmin();
- packageAdmin.refreshPackages(null);
-
- // Reinstall bundleA
- bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
- bundleA.start();
-
- // The static in bundleA.SomeBean is expected to be recreated
-
- messages = report(someBean.getMessages());
- assertEquals("Start messages", 1, messages.size());
-
- bundleB.uninstall();
- bundleA.uninstall();
- }
-
- private List<String> report(List<String> messages)
- {
- // System.out.println(">>>>>>>>>>>>");
- // for (String aux : messages)
- // System.out.println(aux);
- // System.out.println("<<<<<<<<<<<");
-
- return messages;
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGi108TestCase.java (from rev 99792, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGI108TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGi108TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGi108TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,179 @@
+/*
+ * 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.jbosgi108;
+
+//$Id: OSGI39TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import org.jboss.osgi.jmx.JMXCapability;
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiPackageAdmin;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTestHelper;
+import org.jboss.test.osgi.jbosgi108.bundleA.SomeBeanMBean;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osgi.framework.BundleException;
+
+/**
+ * [JBOSGI-108] Investigate statics on PackageAdmin.refresh
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-108
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 19-Jun-2009
+ */
+public class OSGi108TestCase
+{
+ private static OSGiRuntime runtime;
+
+ @BeforeClass
+ public static void beforeClass() throws Exception
+ {
+ runtime = new OSGiTestHelper().getDefaultRuntime();
+ runtime.addCapability(new JMXCapability());
+ }
+
+ @AfterClass
+ public static void afterClass() throws BundleException
+ {
+ if (runtime != null)
+ {
+ runtime.shutdown();
+ runtime = null;
+ }
+ }
+
+ @Before
+ public void setUp()
+ {
+ OSGiPackageAdmin packageAdmin = runtime.getPackageAdmin();
+ packageAdmin.refreshPackages(null);
+ }
+
+ @Test
+ public void testRedeploySingle() throws Exception
+ {
+ OSGiBundle bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
+
+ bundleA.start();
+
+ SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, SomeBeanMBean.MBEAN_NAME, runtime.getMBeanServer());
+ List<String> messages = report(someBean.getMessages());
+ assertEquals("Start messages", 1, messages.size());
+
+ bundleA.uninstall();
+
+ // Reinstall bundleA
+ bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
+ bundleA.start();
+
+ // The static in bundleA.SomeBean is expected to be recreated
+
+ messages = report(someBean.getMessages());
+ assertEquals("Start messages", 1, messages.size());
+
+ bundleA.uninstall();
+ }
+
+ @Test
+ public void testRedeployWithReference() throws Exception
+ {
+ OSGiBundle bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
+ OSGiBundle bundleB = runtime.installBundle("jbosgi108-bundleB.jar");
+
+ bundleA.start();
+ bundleB.start();
+
+ SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, SomeBeanMBean.MBEAN_NAME, runtime.getMBeanServer());
+ List<String> messages = report(someBean.getMessages());
+ assertEquals("Start messages", 2, messages.size());
+
+ bundleA.uninstall();
+
+ // After uninstall bundleA, bundleB still holds a reference on
+ // bundleA.SomeBean
+
+ // Reinstall bundleA
+ bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
+ bundleA.start();
+
+ // The static in bundleA.SomeBean is expected to be reused
+
+ messages = report(someBean.getMessages());
+ assertEquals("Start messages", 4, messages.size());
+
+ bundleB.uninstall();
+ bundleA.uninstall();
+ }
+
+ @Test
+ public void testRedeployWithReferenceAndRefresh() throws Exception
+ {
+ OSGiBundle bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
+ OSGiBundle bundleB = runtime.installBundle("jbosgi108-bundleB.jar");
+
+ bundleA.start();
+ bundleB.start();
+
+ SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, SomeBeanMBean.MBEAN_NAME, runtime.getMBeanServer());
+ List<String> messages = report(someBean.getMessages());
+ assertEquals("Start messages", 2, messages.size());
+
+ bundleA.uninstall();
+
+ // After uninstall bundleA, bundleB still holds a reference on
+ // bundleA.SomeBean
+
+ // Refresh all packages
+ OSGiPackageAdmin packageAdmin = runtime.getPackageAdmin();
+ packageAdmin.refreshPackages(null);
+
+ // Reinstall bundleA
+ bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
+ bundleA.start();
+
+ // The static in bundleA.SomeBean is expected to be recreated
+
+ messages = report(someBean.getMessages());
+ assertEquals("Start messages", 1, messages.size());
+
+ bundleB.uninstall();
+ bundleA.uninstall();
+ }
+
+ private List<String> report(List<String> messages)
+ {
+ // System.out.println(">>>>>>>>>>>>");
+ // for (String aux : messages)
+ // System.out.println(aux);
+ // System.out.println("<<<<<<<<<<<");
+
+ return messages;
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi112/OSGI112TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi112/OSGI112TestCase.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi112/OSGI112TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,85 +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.test.osgi.jbosgi112;
-
-//$Id: OSGI39TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
-
-import org.jboss.osgi.testing.OSGiBundle;
-import org.jboss.osgi.testing.OSGiRuntime;
-import org.jboss.osgi.testing.OSGiTest;
-import org.jboss.osgi.testing.OSGiTestHelper;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.SynchronousBundleListener;
-
-/**
- * [JBOSGI-112] Investigate Exception in SynchronousBundleListener
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-112
- *
- * @author thomas.diesler(a)jboss.com
- * @since 19-Jun-2009
- */
-public class OSGI112TestCase extends OSGiTest
-{
- private static OSGiRuntime runtime;
-
- @BeforeClass
- public static void beforeClass() throws BundleException
- {
- runtime = new OSGiTestHelper().getDefaultRuntime();
- }
-
- @AfterClass
- public static void afterClass() throws BundleException
- {
- if (runtime != null)
- {
- runtime.shutdown();
- runtime = null;
- }
- }
-
- /**
- * BundleA registers a {@link SynchronousBundleListener} which throws an exception.
- * Start of BundleB is started and expected to be ACTIVE.
- */
- @Test
- public void testInstallBundles() throws Exception
- {
- OSGiBundle bundleA = runtime.installBundle("jbosgi112-bundleA.jar");
- bundleA.start();
-
- OSGiBundle bundleB = runtime.installBundle("jbosgi112-bundleB.jar");
- bundleB.start();
-
- // Exceptions thrown from listeners are logged but otherwise ignored.
- // Throwing an exception from a listener will not prevent the bundle from proceeding with starting.
- // If the BP extender detects some issue with the BP configuration, it can/should log this information
- // but it cannot prevent the bundle from starting.
-
- assertBundleState(Bundle.ACTIVE, bundleB.getState());
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi112/OSGi112TestCase.java (from rev 99792, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi112/OSGI112TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi112/OSGi112TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi112/OSGi112TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,85 @@
+/*
+ * 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.jbosgi112;
+
+//$Id: OSGI39TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
+
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.jboss.osgi.testing.OSGiTestHelper;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.SynchronousBundleListener;
+
+/**
+ * [JBOSGI-112] Investigate Exception in SynchronousBundleListener
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-112
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 19-Jun-2009
+ */
+public class OSGi112TestCase extends OSGiTest
+{
+ private static OSGiRuntime runtime;
+
+ @BeforeClass
+ public static void beforeClass() throws BundleException
+ {
+ runtime = new OSGiTestHelper().getDefaultRuntime();
+ }
+
+ @AfterClass
+ public static void afterClass() throws BundleException
+ {
+ if (runtime != null)
+ {
+ runtime.shutdown();
+ runtime = null;
+ }
+ }
+
+ /**
+ * BundleA registers a {@link SynchronousBundleListener} which throws an exception.
+ * Start of BundleB is started and expected to be ACTIVE.
+ */
+ @Test
+ public void testInstallBundles() throws Exception
+ {
+ OSGiBundle bundleA = runtime.installBundle("jbosgi112-bundleA.jar");
+ bundleA.start();
+
+ OSGiBundle bundleB = runtime.installBundle("jbosgi112-bundleB.jar");
+ bundleB.start();
+
+ // Exceptions thrown from listeners are logged but otherwise ignored.
+ // Throwing an exception from a listener will not prevent the bundle from proceeding with starting.
+ // If the BP extender detects some issue with the BP configuration, it can/should log this information
+ // but it cannot prevent the bundle from starting.
+
+ assertBundleState(Bundle.ACTIVE, bundleB.getState());
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,94 +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.test.osgi.jbosgi142;
-
-//$Id: OSGI142TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
-
-
-import org.jboss.osgi.spi.framework.OSGiBootstrap;
-import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.osgi.testing.OSGiTest;
-import org.jboss.test.osgi.jbosgi142.bundleA.BeanA;
-import org.jboss.test.osgi.jbosgi142.bundleB.BeanB;
-import org.jboss.test.osgi.jbosgi142.bundleX.BeanX;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.launch.Framework;
-
-/**
- * [JBOSGI-142] Investigate classloading space
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-142
- *
- * A imports X
- * B imports X
- *
- * Can X load a class from A or B?
- * Can A load a class from B and vice versa?
- *
- * @author thomas.diesler(a)jboss.com
- * @since 28-Aug-2009
- */
-public class OSGI142TestCase extends OSGiTest
-{
- @Test
- public void testLoadClass() throws Exception
- {
- OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
- Framework framework = bootProvider.getFramework();
- try
- {
- framework.start();
-
- BundleContext sysContext = framework.getBundleContext();
- Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi142-bundleX.jar").toExternalForm());
- bundleX.start();
-
- assertBundleLoadClass(bundleX, BeanX.class.getName(), true);
-
- Bundle bundleA = sysContext.installBundle(getTestArchiveURL("jbosgi142-bundleA.jar").toExternalForm());
- bundleA.start();
-
- assertBundleLoadClass(bundleA, BeanA.class.getName(), true);
-
- Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi142-bundleB.jar").toExternalForm());
- bundleB.start();
-
- assertBundleLoadClass(bundleB, BeanB.class.getName(), true);
-
- assertBundleLoadClass(bundleA, BeanX.class.getName(), true);
- assertBundleLoadClass(bundleB, BeanX.class.getName(), true);
-
- assertBundleLoadClass(bundleX, BeanA.class.getName(), false);
- assertBundleLoadClass(bundleX, BeanB.class.getName(), false);
-
- assertBundleLoadClass(bundleA, BeanB.class.getName(), false);
- assertBundleLoadClass(bundleB, BeanA.class.getName(), false);
- }
- finally
- {
- framework.stop();
- framework.waitForStop(1000);
- }
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGi142TestCase.java (from rev 99792, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGi142TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGi142TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,94 @@
+/*
+ * 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.jbosgi142;
+
+//$Id: OSGI142TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
+
+
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.testing.OSGiTest;
+import org.jboss.test.osgi.jbosgi142.bundleA.BeanA;
+import org.jboss.test.osgi.jbosgi142.bundleB.BeanB;
+import org.jboss.test.osgi.jbosgi142.bundleX.BeanX;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * [JBOSGI-142] Investigate classloading space
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-142
+ *
+ * A imports X
+ * B imports X
+ *
+ * Can X load a class from A or B?
+ * Can A load a class from B and vice versa?
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 28-Aug-2009
+ */
+public class OSGi142TestCase extends OSGiTest
+{
+ @Test
+ public void testLoadClass() throws Exception
+ {
+ OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
+ Framework framework = bootProvider.getFramework();
+ try
+ {
+ framework.start();
+
+ BundleContext sysContext = framework.getBundleContext();
+ Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi142-bundleX.jar").toExternalForm());
+ bundleX.start();
+
+ assertBundleLoadClass(bundleX, BeanX.class.getName(), true);
+
+ Bundle bundleA = sysContext.installBundle(getTestArchiveURL("jbosgi142-bundleA.jar").toExternalForm());
+ bundleA.start();
+
+ assertBundleLoadClass(bundleA, BeanA.class.getName(), true);
+
+ Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi142-bundleB.jar").toExternalForm());
+ bundleB.start();
+
+ assertBundleLoadClass(bundleB, BeanB.class.getName(), true);
+
+ assertBundleLoadClass(bundleA, BeanX.class.getName(), true);
+ assertBundleLoadClass(bundleB, BeanX.class.getName(), true);
+
+ assertBundleLoadClass(bundleX, BeanA.class.getName(), false);
+ assertBundleLoadClass(bundleX, BeanB.class.getName(), false);
+
+ assertBundleLoadClass(bundleA, BeanB.class.getName(), false);
+ assertBundleLoadClass(bundleB, BeanA.class.getName(), false);
+ }
+ finally
+ {
+ framework.stop();
+ framework.waitForStop(1000);
+ }
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI143TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI143TestCase.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI143TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,107 +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.test.osgi.jbosgi143;
-
-//$Id: OSGI143TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import org.jboss.osgi.spi.framework.OSGiBootstrap;
-import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.osgi.testing.OSGiTest;
-import org.jboss.test.osgi.jbosgi143.bundleA.BeanA;
-import org.jboss.test.osgi.jbosgi143.bundleX.BeanX;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.launch.Framework;
-
-/**
- * [JBOSGI-143] Add initial support for DynamicImport-Package
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-143
- *
- * A imports X
- * X has DynamicImport-Package: *
- *
- * Can X load a class from A?
- *
- * @author thomas.diesler(a)jboss.com
- * @since 28-Aug-2009
- */
-public class OSGI143TestCase extends OSGiTest
-{
- @Test
- public void testLoadClass() throws Exception
- {
- OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
- Framework framework = bootProvider.getFramework();
- framework.start();
-
- try
- {
- BundleContext sysContext = framework.getBundleContext();
- Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi143-bundleX.jar").toExternalForm());
- bundleX.start();
-
- assertBundleLoadClass(bundleX, BeanX.class, true);
-
- Bundle bundleA = sysContext.installBundle(getTestArchiveURL("jbosgi143-bundleA.jar").toExternalForm());
- bundleA.start();
-
- assertBundleLoadClass(bundleA, BeanA.class, true);
-
- assertBundleLoadClass(bundleA, BeanX.class, true);
- assertBundleLoadClass(bundleX, BeanA.class, true);
- }
- finally
- {
- framework.stop();
- framework.waitForStop(1000);
- }
- }
-
- private void assertBundleLoadClass(Bundle bundle, Class<?> expClazz, boolean success)
- {
- String message = bundle.getSymbolicName() + " loads " + expClazz.getName();
-
- Class<?> wasClass;
- try
- {
- wasClass = bundle.loadClass(expClazz.getName());
- if (success)
- {
- assertEquals(message, expClazz.getName(), wasClass.getName());
- }
- else
- {
- fail("ClassNotFoundException expected for: " + message);
- }
- }
- catch (ClassNotFoundException ex)
- {
- if (success)
- fail("Unexpected ClassNotFoundException for: " + message);
- }
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGi143TestCase.java (from rev 99792, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI143TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGi143TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGi143TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,107 @@
+/*
+ * 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.jbosgi143;
+
+//$Id: OSGI143TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.testing.OSGiTest;
+import org.jboss.test.osgi.jbosgi143.bundleA.BeanA;
+import org.jboss.test.osgi.jbosgi143.bundleX.BeanX;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * [JBOSGI-143] Add initial support for DynamicImport-Package
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-143
+ *
+ * A imports X
+ * X has DynamicImport-Package: *
+ *
+ * Can X load a class from A?
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 28-Aug-2009
+ */
+public class OSGi143TestCase extends OSGiTest
+{
+ @Test
+ public void testLoadClass() throws Exception
+ {
+ OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
+ Framework framework = bootProvider.getFramework();
+ framework.start();
+
+ try
+ {
+ BundleContext sysContext = framework.getBundleContext();
+ Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi143-bundleX.jar").toExternalForm());
+ bundleX.start();
+
+ assertBundleLoadClass(bundleX, BeanX.class, true);
+
+ Bundle bundleA = sysContext.installBundle(getTestArchiveURL("jbosgi143-bundleA.jar").toExternalForm());
+ bundleA.start();
+
+ assertBundleLoadClass(bundleA, BeanA.class, true);
+
+ assertBundleLoadClass(bundleA, BeanX.class, true);
+ assertBundleLoadClass(bundleX, BeanA.class, true);
+ }
+ finally
+ {
+ framework.stop();
+ framework.waitForStop(1000);
+ }
+ }
+
+ private void assertBundleLoadClass(Bundle bundle, Class<?> expClazz, boolean success)
+ {
+ String message = bundle.getSymbolicName() + " loads " + expClazz.getName();
+
+ Class<?> wasClass;
+ try
+ {
+ wasClass = bundle.loadClass(expClazz.getName());
+ if (success)
+ {
+ assertEquals(message, expClazz.getName(), wasClass.getName());
+ }
+ else
+ {
+ fail("ClassNotFoundException expected for: " + message);
+ }
+ }
+ catch (ClassNotFoundException ex)
+ {
+ if (success)
+ fail("Unexpected ClassNotFoundException for: " + message);
+ }
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi151/OSGI151TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi151/OSGI151TestCase.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi151/OSGI151TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,167 +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.test.osgi.jbosgi151;
-
-import static org.junit.Assert.assertEquals;
-
-import org.jboss.osgi.spi.framework.OSGiBootstrap;
-import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.osgi.testing.OSGiTest;
-import org.jboss.test.osgi.jbosgi151.bundleA.BeanA;
-import org.jboss.test.osgi.jbosgi151.bundleB.BeanB;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.launch.Framework;
-
-/**
- * [JBOSGI-151] Cannot resolve circular dependencies
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-151
- *
- * BundleA
- * exports A
- * imports B
- *
- * BundleB
- * exports B
- * imports A
- *
- * BundleC
- * exports A, B
- * imports A
- *
- * BundleD
- * exports A,
- * imports A, B
- *
- * @author thomas.diesler(a)jboss.com
- * @since 07-Sep-2009
- */
-public class OSGI151TestCase extends OSGiTest
-{
- private static Framework framework;
-
- @BeforeClass
- public static void beforeClass() throws Exception
- {
- OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
- framework = bootProvider.getFramework();
- framework.start();
- }
-
- @AfterClass
- public static void afterClass() throws Exception
- {
- if (framework != null)
- {
- framework.stop();
- framework.waitForStop(2000);
- framework = null;
- }
- }
-
- @Test
- @Ignore
- public void testCircularNoSelfDependency() throws Exception
- {
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleA = sysContext.installBundle(getTestArchiveURL("jbosgi151-bundleA.jar").toExternalForm());
- assertBundleState(Bundle.INSTALLED, bundleA.getState());
-
- Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi151-bundleB.jar").toExternalForm());
- assertBundleState(Bundle.INSTALLED, bundleB.getState());
-
- bundleB.start();
- assertBundleState(Bundle.ACTIVE, bundleB.getState());
- assertBundleState(Bundle.RESOLVED, bundleA.getState());
-
- Class<?> classAA = bundleA.loadClass(BeanA.class.getName());
- Class<?> classAB = bundleB.loadClass(BeanA.class.getName());
- assertEquals("Class for BeanA", classAA, classAB);
-
- Class<?> classBA = bundleA.loadClass(BeanB.class.getName());
- Class<?> classBB = bundleB.loadClass(BeanB.class.getName());
- assertEquals("Class for BeanB", classBA, classBB);
-
- bundleB.uninstall();
- bundleA.uninstall();
- }
-
- @Test
- public void testCircularInstallCbeforeD() throws Exception
- {
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleC = sysContext.installBundle(getTestArchiveURL("jbosgi151-bundleC.jar").toExternalForm());
- assertBundleState(Bundle.INSTALLED, bundleC.getState());
-
- Bundle bundleD = sysContext.installBundle(getTestArchiveURL("jbosgi151-bundleD.jar").toExternalForm());
- assertBundleState(Bundle.INSTALLED, bundleD.getState());
-
- bundleD.start();
- assertBundleState(Bundle.ACTIVE, bundleD.getState());
- assertBundleState(Bundle.RESOLVED, bundleC.getState());
-
- Class<?> classBC = bundleC.loadClass(BeanB.class.getName());
- Class<?> classBD = bundleD.loadClass(BeanB.class.getName());
- assertEquals("Class for BeanB", classBC, classBD);
-
- Class<?> classAC = bundleC.loadClass(BeanA.class.getName());
- Class<?> classAD = bundleD.loadClass(BeanA.class.getName());
- assertEquals("Class for BeanA", classAC, classAD);
-
- bundleD.uninstall();
- bundleC.uninstall();
- }
-
- @Test
- public void testCircularInstallDbeforeC() throws Exception
- {
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleD = sysContext.installBundle(getTestArchiveURL("jbosgi151-bundleD.jar").toExternalForm());
- assertBundleState(Bundle.INSTALLED, bundleD.getState());
-
- Bundle bundleC = sysContext.installBundle(getTestArchiveURL("jbosgi151-bundleC.jar").toExternalForm());
- assertBundleState(Bundle.INSTALLED, bundleC.getState());
-
- bundleD.start();
- assertBundleState(Bundle.ACTIVE, bundleD.getState());
- assertBundleState(Bundle.RESOLVED, bundleC.getState());
-
- Class<?> classBC = bundleC.loadClass(BeanB.class.getName());
- Class<?> classBD = bundleD.loadClass(BeanB.class.getName());
- assertEquals("Class for BeanB", classBC, classBD);
-
- Class<?> classAC = bundleC.loadClass(BeanA.class.getName());
- Class<?> classAD = bundleD.loadClass(BeanA.class.getName());
- assertEquals("Class for BeanA", classAC, classAD);
-
- bundleD.uninstall();
- bundleC.uninstall();
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi151/OSGi151TestCase.java (from rev 99792, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi151/OSGI151TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi151/OSGi151TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi151/OSGi151TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,167 @@
+/*
+ * 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.jbosgi151;
+
+import static org.junit.Assert.assertEquals;
+
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.testing.OSGiTest;
+import org.jboss.test.osgi.jbosgi151.bundleA.BeanA;
+import org.jboss.test.osgi.jbosgi151.bundleB.BeanB;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * [JBOSGI-151] Cannot resolve circular dependencies
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-151
+ *
+ * BundleA
+ * exports A
+ * imports B
+ *
+ * BundleB
+ * exports B
+ * imports A
+ *
+ * BundleC
+ * exports A, B
+ * imports A
+ *
+ * BundleD
+ * exports A,
+ * imports A, B
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 07-Sep-2009
+ */
+public class OSGi151TestCase extends OSGiTest
+{
+ private static Framework framework;
+
+ @BeforeClass
+ public static void beforeClass() throws Exception
+ {
+ OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
+ framework = bootProvider.getFramework();
+ framework.start();
+ }
+
+ @AfterClass
+ public static void afterClass() throws Exception
+ {
+ if (framework != null)
+ {
+ framework.stop();
+ framework.waitForStop(2000);
+ framework = null;
+ }
+ }
+
+ @Test
+ @Ignore
+ public void testCircularNoSelfDependency() throws Exception
+ {
+ BundleContext sysContext = framework.getBundleContext();
+
+ Bundle bundleA = sysContext.installBundle(getTestArchiveURL("jbosgi151-bundleA.jar").toExternalForm());
+ assertBundleState(Bundle.INSTALLED, bundleA.getState());
+
+ Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi151-bundleB.jar").toExternalForm());
+ assertBundleState(Bundle.INSTALLED, bundleB.getState());
+
+ bundleB.start();
+ assertBundleState(Bundle.ACTIVE, bundleB.getState());
+ assertBundleState(Bundle.RESOLVED, bundleA.getState());
+
+ Class<?> classAA = bundleA.loadClass(BeanA.class.getName());
+ Class<?> classAB = bundleB.loadClass(BeanA.class.getName());
+ assertEquals("Class for BeanA", classAA, classAB);
+
+ Class<?> classBA = bundleA.loadClass(BeanB.class.getName());
+ Class<?> classBB = bundleB.loadClass(BeanB.class.getName());
+ assertEquals("Class for BeanB", classBA, classBB);
+
+ bundleB.uninstall();
+ bundleA.uninstall();
+ }
+
+ @Test
+ public void testCircularInstallCbeforeD() throws Exception
+ {
+ BundleContext sysContext = framework.getBundleContext();
+
+ Bundle bundleC = sysContext.installBundle(getTestArchiveURL("jbosgi151-bundleC.jar").toExternalForm());
+ assertBundleState(Bundle.INSTALLED, bundleC.getState());
+
+ Bundle bundleD = sysContext.installBundle(getTestArchiveURL("jbosgi151-bundleD.jar").toExternalForm());
+ assertBundleState(Bundle.INSTALLED, bundleD.getState());
+
+ bundleD.start();
+ assertBundleState(Bundle.ACTIVE, bundleD.getState());
+ assertBundleState(Bundle.RESOLVED, bundleC.getState());
+
+ Class<?> classBC = bundleC.loadClass(BeanB.class.getName());
+ Class<?> classBD = bundleD.loadClass(BeanB.class.getName());
+ assertEquals("Class for BeanB", classBC, classBD);
+
+ Class<?> classAC = bundleC.loadClass(BeanA.class.getName());
+ Class<?> classAD = bundleD.loadClass(BeanA.class.getName());
+ assertEquals("Class for BeanA", classAC, classAD);
+
+ bundleD.uninstall();
+ bundleC.uninstall();
+ }
+
+ @Test
+ public void testCircularInstallDbeforeC() throws Exception
+ {
+ BundleContext sysContext = framework.getBundleContext();
+
+ Bundle bundleD = sysContext.installBundle(getTestArchiveURL("jbosgi151-bundleD.jar").toExternalForm());
+ assertBundleState(Bundle.INSTALLED, bundleD.getState());
+
+ Bundle bundleC = sysContext.installBundle(getTestArchiveURL("jbosgi151-bundleC.jar").toExternalForm());
+ assertBundleState(Bundle.INSTALLED, bundleC.getState());
+
+ bundleD.start();
+ assertBundleState(Bundle.ACTIVE, bundleD.getState());
+ assertBundleState(Bundle.RESOLVED, bundleC.getState());
+
+ Class<?> classBC = bundleC.loadClass(BeanB.class.getName());
+ Class<?> classBD = bundleD.loadClass(BeanB.class.getName());
+ assertEquals("Class for BeanB", classBC, classBD);
+
+ Class<?> classAC = bundleC.loadClass(BeanA.class.getName());
+ Class<?> classAD = bundleD.loadClass(BeanA.class.getName());
+ assertEquals("Class for BeanA", classAC, classAD);
+
+ bundleD.uninstall();
+ bundleC.uninstall();
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/OSGI161TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/OSGI161TestCase.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/OSGI161TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,62 +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.test.osgi.jbosgi161;
-
-//$Id:$
-
-import org.jboss.osgi.spi.capability.LogServiceCapability;
-import org.jboss.osgi.testing.OSGiBundle;
-import org.jboss.osgi.testing.OSGiRuntime;
-import org.jboss.osgi.testing.OSGiTest;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-/**
- * [JBOSGI-161] Cannot use commons logging
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-161
- *
- * @author thomas.diesler(a)jboss.com
- * @since 07-Oct-2009
- */
-public class OSGI161TestCase extends OSGiTest
-{
- @Test
- public void testLogging() throws Exception
- {
- OSGiRuntime runtime = getDefaultRuntime();
- try
- {
- runtime.addCapability(new LogServiceCapability());
-
- OSGiBundle bundleA = runtime.installBundle("jbosgi161-bundle.jar");
- bundleA.start();
-
- assertBundleState(Bundle.ACTIVE, bundleA.getState());
- bundleA.uninstall();
- }
- finally
- {
- runtime.shutdown();
- }
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/OSGi161TestCase.java (from rev 99792, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/OSGI161TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/OSGi161TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/OSGi161TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,62 @@
+/*
+ * 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.jbosgi161;
+
+//$Id:$
+
+import org.jboss.osgi.spi.capability.LogServiceCapability;
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+
+/**
+ * [JBOSGI-161] Cannot use commons logging
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-161
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 07-Oct-2009
+ */
+public class OSGi161TestCase extends OSGiTest
+{
+ @Test
+ public void testLogging() throws Exception
+ {
+ OSGiRuntime runtime = getDefaultRuntime();
+ try
+ {
+ runtime.addCapability(new LogServiceCapability());
+
+ OSGiBundle bundleA = runtime.installBundle("jbosgi161-bundle.jar");
+ bundleA.start();
+
+ assertBundleState(Bundle.ACTIVE, bundleA.getState());
+ bundleA.uninstall();
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/bundle/Activator161.java (from rev 99792, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/bundle/OSGI161Activator.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/bundle/Activator161.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/bundle/Activator161.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,86 @@
+/*
+ * 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.jbosgi161.bundle;
+
+// $Id:$
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Activator161 implements BundleActivator
+{
+ public void start(BundleContext context) throws Exception
+ {
+ assertCommonsLogging(context);
+
+ assertSL4J(context);
+ }
+
+ public void stop(BundleContext context) throws Exception
+ {
+ }
+
+ private void assertCommonsLogging(BundleContext context)
+ {
+ Log log = LogFactory.getLog(Activator161.class);
+
+ String loggerClass = log.getClass().getName();
+
+ List<String> expected = new ArrayList<String>();
+ expected.add("org.apache.commons.logging.impl.SLF4JLog");
+ expected.add("org.apache.commons.logging.impl.Log4JLogger");
+ expected.add("org.apache.commons.logging.impl.SLF4JLocationAwareLog");
+
+ if (expected.contains(loggerClass) == false)
+ throw new IllegalStateException("Unexpected logger: " + loggerClass);
+
+ log.info("*******************************************");
+ log.info("* jcl: " + context.getBundle());
+ log.info("*******************************************");
+ }
+
+ private void assertSL4J(BundleContext context)
+ {
+ Logger log = LoggerFactory.getLogger(Activator161.class);
+
+ String loggerClass = log.getClass().getName();
+
+ List<String> expected = new ArrayList<String>();
+ expected.add("org.jboss.slf4j.JBossLoggerAdapter");
+ expected.add("org.slf4j.impl.Log4jLoggerAdapter");
+ expected.add("org.slf4j.impl.Slf4jLogger");
+
+ if (expected.contains(loggerClass) == false)
+ throw new IllegalStateException("Unexpected logger: " + loggerClass);
+
+ log.info("*******************************************");
+ log.info("* slf4j: " + context.getBundle());
+ log.info("*******************************************");
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/bundle/OSGI161Activator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/bundle/OSGI161Activator.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi161/bundle/OSGI161Activator.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,86 +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.test.osgi.jbosgi161.bundle;
-
-// $Id:$
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class OSGI161Activator implements BundleActivator
-{
- public void start(BundleContext context) throws Exception
- {
- assertCommonsLogging(context);
-
- assertSL4J(context);
- }
-
- public void stop(BundleContext context) throws Exception
- {
- }
-
- private void assertCommonsLogging(BundleContext context)
- {
- Log log = LogFactory.getLog(OSGI161Activator.class);
-
- String loggerClass = log.getClass().getName();
-
- List<String> expected = new ArrayList<String>();
- expected.add("org.apache.commons.logging.impl.SLF4JLog");
- expected.add("org.apache.commons.logging.impl.Log4JLogger");
- expected.add("org.apache.commons.logging.impl.SLF4JLocationAwareLog");
-
- if (expected.contains(loggerClass) == false)
- throw new IllegalStateException("Unexpected logger: " + loggerClass);
-
- log.info("*******************************************");
- log.info("* jcl: " + context.getBundle());
- log.info("*******************************************");
- }
-
- private void assertSL4J(BundleContext context)
- {
- Logger log = LoggerFactory.getLogger(OSGI161Activator.class);
-
- String loggerClass = log.getClass().getName();
-
- List<String> expected = new ArrayList<String>();
- expected.add("org.jboss.slf4j.JBossLoggerAdapter");
- expected.add("org.slf4j.impl.Log4jLoggerAdapter");
- expected.add("org.slf4j.impl.Slf4jLogger");
-
- if (expected.contains(loggerClass) == false)
- throw new IllegalStateException("Unexpected logger: " + loggerClass);
-
- log.info("*******************************************");
- log.info("* slf4j: " + context.getBundle());
- log.info("*******************************************");
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/OSGI214TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/OSGI214TestCase.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/OSGI214TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,126 +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.test.osgi.jbosgi214;
-
-//$Id$
-
-import static org.junit.Assert.assertNotNull;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.osgi.spi.util.ServiceLoader;
-import org.jboss.osgi.testing.OSGiTest;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.launch.Framework;
-import org.osgi.framework.launch.FrameworkFactory;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * [JBOSGI-214] Cannot repeatedly register service bound to an interface from the system classpath
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-214
- *
- * @author thomas.diesler(a)jboss.com
- * @since 03-Dec-2009
- */
-public class OSGI214TestCase extends OSGiTest
-{
- @Test
- public void testFirstRun() throws Exception
- {
- runSystemServiceTest();
- }
-
- @Test
- public void testSecondRun() throws Exception
- {
- runSystemServiceTest();
- }
-
- private void runSystemServiceTest() throws BundleException, InterruptedException
- {
- // Setup some package on the system classpath
- Map<String, String> props = new HashMap<String, String>();
- props.put("org.osgi.framework.system.packages.extra", SomeService.class.getPackage().getName());
- props.put("felix.bootdelegation.implicit", "false");
-
- // Bootstrap and start the framework
- FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
- Framework framework = factory.newFramework(props);
- framework.start();
-
- // Start the ServiceTracker
- BundleContext context = framework.getBundleContext();
- new SomeServiceTracker(context).open();
-
- try
- {
- // Install and start the test bundle
- URL bundleURL = getTestArchiveURL("jbosgi214-bundle.jar");
- Bundle bundle = context.installBundle(bundleURL.toExternalForm());
- bundle.start();
-
- // Verify that the service is there and can be cast to an interface from the system classpath
- ServiceReference sref = context.getServiceReference(SomeService.class.getName());
- SomeService service = (SomeService)context.getService(sref);
- assertNotNull("Service not null", service);
-
- // Uninstall the test bundle
- bundle.uninstall();
- }
- finally
- {
- // Stop the framework
- framework.stop();
- framework.waitForStop(5000);
- }
- }
-
- class SomeServiceTracker extends ServiceTracker
- {
- public SomeServiceTracker(BundleContext context)
- {
- super(context, SomeService.class.getName(), null);
- }
-
- @Override
- public Object addingService(ServiceReference sref)
- {
- Object serviceObj = super.addingService(sref);
- //System.out.println("addingService: " + serviceObj);
- return (SomeService)serviceObj;
- }
-
- @Override
- public void removedService(ServiceReference reference, Object serviceObj)
- {
- //System.out.println("removedService: " + serviceObj);
- super.removedService(reference, serviceObj);
- }
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/OSGi214TestCase.java (from rev 99792, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/OSGI214TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/OSGi214TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/OSGi214TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,126 @@
+/*
+ * 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.jbosgi214;
+
+//$Id$
+
+import static org.junit.Assert.assertNotNull;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.osgi.spi.util.ServiceLoader;
+import org.jboss.osgi.testing.OSGiTest;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * [JBOSGI-214] Cannot repeatedly register service bound to an interface from the system classpath
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-214
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 03-Dec-2009
+ */
+public class OSGi214TestCase extends OSGiTest
+{
+ @Test
+ public void testFirstRun() throws Exception
+ {
+ runSystemServiceTest();
+ }
+
+ @Test
+ public void testSecondRun() throws Exception
+ {
+ runSystemServiceTest();
+ }
+
+ private void runSystemServiceTest() throws BundleException, InterruptedException
+ {
+ // Setup some package on the system classpath
+ Map<String, String> props = new HashMap<String, String>();
+ props.put("org.osgi.framework.system.packages.extra", SomeService.class.getPackage().getName());
+ props.put("felix.bootdelegation.implicit", "false");
+
+ // Bootstrap and start the framework
+ FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+ Framework framework = factory.newFramework(props);
+ framework.start();
+
+ // Start the ServiceTracker
+ BundleContext context = framework.getBundleContext();
+ new SomeServiceTracker(context).open();
+
+ try
+ {
+ // Install and start the test bundle
+ URL bundleURL = getTestArchiveURL("jbosgi214-bundle.jar");
+ Bundle bundle = context.installBundle(bundleURL.toExternalForm());
+ bundle.start();
+
+ // Verify that the service is there and can be cast to an interface from the system classpath
+ ServiceReference sref = context.getServiceReference(SomeService.class.getName());
+ SomeService service = (SomeService)context.getService(sref);
+ assertNotNull("Service not null", service);
+
+ // Uninstall the test bundle
+ bundle.uninstall();
+ }
+ finally
+ {
+ // Stop the framework
+ framework.stop();
+ framework.waitForStop(5000);
+ }
+ }
+
+ class SomeServiceTracker extends ServiceTracker
+ {
+ public SomeServiceTracker(BundleContext context)
+ {
+ super(context, SomeService.class.getName(), null);
+ }
+
+ @Override
+ public Object addingService(ServiceReference sref)
+ {
+ Object serviceObj = super.addingService(sref);
+ //System.out.println("addingService: " + serviceObj);
+ return (SomeService)serviceObj;
+ }
+
+ @Override
+ public void removedService(ServiceReference reference, Object serviceObj)
+ {
+ //System.out.println("removedService: " + serviceObj);
+ super.removedService(reference, serviceObj);
+ }
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/bundle/Activator214.java (from rev 99792, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/bundle/OSGI214Activator.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/bundle/Activator214.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/bundle/Activator214.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,47 @@
+/*
+ * 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.jbosgi214.bundle;
+
+//$Id$
+
+import org.jboss.test.osgi.jbosgi214.SomeService;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * A Service Activator
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 24-Apr-2009
+ */
+public class Activator214 implements BundleActivator
+{
+ public void start(BundleContext context)
+ {
+ // Register a service that is bound to an interface from the system classpath
+ context.registerService(SomeService.class.getName(), new SomeServiceImpl(), null);
+ }
+
+ public void stop(BundleContext context)
+ {
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/bundle/OSGI214Activator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/bundle/OSGI214Activator.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi214/bundle/OSGI214Activator.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,47 +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.test.osgi.jbosgi214.bundle;
-
-//$Id$
-
-import org.jboss.test.osgi.jbosgi214.SomeService;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-/**
- * A Service Activator
- *
- * @author thomas.diesler(a)jboss.com
- * @since 24-Apr-2009
- */
-public class OSGI214Activator implements BundleActivator
-{
- public void start(BundleContext context)
- {
- // Register a service that is bound to an interface from the system classpath
- context.registerService(SomeService.class.getName(), new SomeServiceImpl(), null);
- }
-
- public void stop(BundleContext context)
- {
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,79 +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.test.osgi.jbosgi37;
-
-//$Id: OSGI37TestCase.java 87351 2009-04-15 14:25:32Z thomas.diesler(a)jboss.com $
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.osgi.spi.capability.CompendiumCapability;
-import org.jboss.osgi.testing.OSGiBundle;
-import org.jboss.osgi.testing.OSGiRuntime;
-import org.jboss.osgi.testing.OSGiTest;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-/**
- * [JBOSGI-37] Prevent creation of deployment unit for nested jars
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-37
- *
- * @author thomas.diesler(a)jboss.com
- * @since 09-Apr-2009
- */
-public class OSGI37TestCase extends OSGiTest
-{
- @Test
- public void testNestedBundle() throws Exception
- {
- OSGiRuntime runtime = getDefaultRuntime();
- try
- {
- runtime.addCapability(new CompendiumCapability());
-
- OSGiBundle bundleA = runtime.installBundle("jbosgi37-bundleA.jar");
- bundleA.start();
-
- assertBundleState(Bundle.ACTIVE, bundleA.getState());
-
- List<String> relevant = new ArrayList<String>();
- for (OSGiBundle bundle : runtime.getBundles())
- {
- String symbolicName = bundle.getSymbolicName();
- if (symbolicName.startsWith("jbosgi37"))
- relevant.add(symbolicName);
- }
-
- assertEquals("No Sub Bundle", 1, relevant.size());
- assertEquals("jbosgi37-bundleA", relevant.get(0));
-
- bundleA.uninstall();
- }
- finally
- {
- runtime.shutdown();
- }
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGi37TestCase.java (from rev 99792, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGi37TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGi37TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,79 @@
+/*
+ * 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.jbosgi37;
+
+//$Id: OSGI37TestCase.java 87351 2009-04-15 14:25:32Z thomas.diesler(a)jboss.com $
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.osgi.spi.capability.CompendiumCapability;
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+
+/**
+ * [JBOSGI-37] Prevent creation of deployment unit for nested jars
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-37
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 09-Apr-2009
+ */
+public class OSGi37TestCase extends OSGiTest
+{
+ @Test
+ public void testNestedBundle() throws Exception
+ {
+ OSGiRuntime runtime = getDefaultRuntime();
+ try
+ {
+ runtime.addCapability(new CompendiumCapability());
+
+ OSGiBundle bundleA = runtime.installBundle("jbosgi37-bundleA.jar");
+ bundleA.start();
+
+ assertBundleState(Bundle.ACTIVE, bundleA.getState());
+
+ List<String> relevant = new ArrayList<String>();
+ for (OSGiBundle bundle : runtime.getBundles())
+ {
+ String symbolicName = bundle.getSymbolicName();
+ if (symbolicName.startsWith("jbosgi37"))
+ relevant.add(symbolicName);
+ }
+
+ assertEquals("No Sub Bundle", 1, relevant.size());
+ assertEquals("jbosgi37-bundleA", relevant.get(0));
+
+ bundleA.uninstall();
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,272 +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.test.osgi.jbosgi38;
-
-//$Id: OSGI38TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
-
-import static org.junit.Assert.fail;
-
-import org.jboss.osgi.spi.capability.CompendiumCapability;
-import org.jboss.osgi.testing.OSGiBundle;
-import org.jboss.osgi.testing.OSGiRuntime;
-import org.jboss.osgi.testing.OSGiTest;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-/**
- * [JBOSGI-38] Investigate bundle install/start behaviour with random deployment order
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-38
- *
- * Bundle A depends on bundle B, both share bundle X.
- *
- * A ---> B
- * A ---> X <--- B
- *
- * [TODO] Use default runtime for in container testing
- *
- * @author thomas.diesler(a)jboss.com
- * @since 02-Mar-2009
- */
-public class OSGI38TestCase extends OSGiTest
-{
- @Test
- public void testInstallStartX() throws Exception
- {
- OSGiRuntime runtime = getEmbeddedRuntime();
- try
- {
- runtime.addCapability(new CompendiumCapability());
-
- OSGiBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
- assertBundleState(Bundle.INSTALLED, bundleX.getState());
-
- bundleX.start();
- assertBundleState(Bundle.ACTIVE, bundleX.getState());
-
- bundleX.uninstall();
- assertBundleState(Bundle.UNINSTALLED, bundleX.getState());
- }
- finally
- {
- runtime.shutdown();
- }
- }
-
- /*
- * Install X, B
- */
- @Test
- public void testInstallXBeforeB() throws Exception
- {
- OSGiRuntime runtime = getEmbeddedRuntime();
- try
- {
- runtime.addCapability(new CompendiumCapability());
-
- OSGiBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
- assertBundleState(Bundle.INSTALLED, bundleX.getState());
-
- OSGiBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
- assertBundleState(Bundle.INSTALLED, bundleB.getState());
-
- bundleB.start();
- assertBundleState(Bundle.RESOLVED, bundleX.getState());
- assertBundleState(Bundle.ACTIVE, bundleB.getState());
-
- bundleB.uninstall();
- bundleX.uninstall();
- }
- finally
- {
- runtime.shutdown();
- }
- }
-
- /*
- * Install X, B, A
- */
- @Test
- public void testInstallBBeforeA() throws Exception
- {
- OSGiRuntime runtime = getEmbeddedRuntime();
- try
- {
- runtime.addCapability(new CompendiumCapability());
-
- OSGiBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
- assertBundleState(Bundle.INSTALLED, bundleX.getState());
-
- OSGiBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
- assertBundleState(Bundle.INSTALLED, bundleB.getState());
-
- OSGiBundle bundleA = runtime.installBundle("jbosgi38-bundleA.jar");
- assertBundleState(Bundle.INSTALLED, bundleA.getState());
-
- bundleA.start();
- assertBundleState(Bundle.RESOLVED, bundleX.getState());
- assertBundleState(Bundle.RESOLVED, bundleB.getState());
- assertBundleState(Bundle.ACTIVE, bundleA.getState());
-
- bundleA.uninstall();
- bundleB.uninstall();
- bundleX.uninstall();
- }
- finally
- {
- runtime.shutdown();
- }
- }
-
- /*
- * Install B, X
- */
- @Test
- public void testInstallBBeforeX() throws Exception
- {
- OSGiRuntime runtime = getEmbeddedRuntime();
- try
- {
- runtime.addCapability(new CompendiumCapability());
-
- OSGiBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
- assertBundleState(Bundle.INSTALLED, bundleB.getState());
-
- try
- {
- bundleB.start();
- fail("Unresolved constraint expected");
- }
- catch (BundleException ex)
- {
- // expected
- }
-
- OSGiBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
- assertBundleState(Bundle.INSTALLED, bundleX.getState());
-
- bundleB.start();
- assertBundleState(Bundle.RESOLVED, bundleX.getState());
- assertBundleState(Bundle.ACTIVE, bundleB.getState());
-
- bundleB.uninstall();
- bundleX.uninstall();
- }
- finally
- {
- runtime.shutdown();
- }
- }
-
- /*
- * Install A, B, X
- */
- @Test
- public void testInstallABeforeB() throws Exception
- {
- OSGiRuntime runtime = getEmbeddedRuntime();
- try
- {
- runtime.addCapability(new CompendiumCapability());
-
- OSGiBundle bundleA = runtime.installBundle("jbosgi38-bundleA.jar");
- assertBundleState(Bundle.INSTALLED, bundleA.getState());
-
- OSGiBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
- assertBundleState(Bundle.INSTALLED, bundleB.getState());
-
- try
- {
- bundleB.start();
- fail("Unresolved constraint expected");
- }
- catch (BundleException ex)
- {
- // expected
- }
-
- OSGiBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
- assertBundleState(Bundle.INSTALLED, bundleX.getState());
-
- bundleB.start();
- assertBundleState(Bundle.RESOLVED, bundleX.getState());
- assertBundleState(Bundle.ACTIVE, bundleB.getState());
-
- bundleA.start();
- assertBundleState(Bundle.ACTIVE, bundleA.getState());
-
- bundleA.uninstall();
- bundleB.uninstall();
- bundleX.uninstall();
- }
- finally
- {
- runtime.shutdown();
- }
- }
-
- /*
- * Uninstall X, B stays active
- */
- @Test
- public void testUninstallX() throws Exception
- {
- if ("jbossmc".equals(getFramework()))
- {
- System.out.println("FIXME [JBOSGI-213] Unexpected dependee state changes");
- return;
- }
-
- OSGiRuntime runtime = getEmbeddedRuntime();
- try
- {
- runtime.addCapability(new CompendiumCapability());
-
- OSGiBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
- assertBundleState(Bundle.INSTALLED, bundleX.getState());
-
- OSGiBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
- assertBundleState(Bundle.INSTALLED, bundleB.getState());
-
- bundleB.start();
- assertBundleState(Bundle.RESOLVED, bundleX.getState());
- assertBundleState(Bundle.ACTIVE, bundleB.getState());
-
- bundleX.stop();
- assertBundleState(Bundle.RESOLVED, bundleX.getState());
- assertBundleState(Bundle.ACTIVE, bundleB.getState());
-
- bundleX.uninstall();
- assertBundleState(Bundle.UNINSTALLED, bundleX.getState());
- assertBundleState(Bundle.ACTIVE, bundleB.getState());
-
- bundleB.uninstall();
- assertBundleState(Bundle.UNINSTALLED, bundleB.getState());
- }
- finally
- {
- runtime.shutdown();
- }
- }
-
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGi38TestCase.java (from rev 99792, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGi38TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGi38TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,272 @@
+/*
+ * 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.jbosgi38;
+
+//$Id: OSGI38TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
+
+import static org.junit.Assert.fail;
+
+import org.jboss.osgi.spi.capability.CompendiumCapability;
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * [JBOSGI-38] Investigate bundle install/start behaviour with random deployment order
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-38
+ *
+ * Bundle A depends on bundle B, both share bundle X.
+ *
+ * A ---> B
+ * A ---> X <--- B
+ *
+ * [TODO] Use default runtime for in container testing
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 02-Mar-2009
+ */
+public class OSGi38TestCase extends OSGiTest
+{
+ @Test
+ public void testInstallStartX() throws Exception
+ {
+ OSGiRuntime runtime = getEmbeddedRuntime();
+ try
+ {
+ runtime.addCapability(new CompendiumCapability());
+
+ OSGiBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
+ assertBundleState(Bundle.INSTALLED, bundleX.getState());
+
+ bundleX.start();
+ assertBundleState(Bundle.ACTIVE, bundleX.getState());
+
+ bundleX.uninstall();
+ assertBundleState(Bundle.UNINSTALLED, bundleX.getState());
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+
+ /*
+ * Install X, B
+ */
+ @Test
+ public void testInstallXBeforeB() throws Exception
+ {
+ OSGiRuntime runtime = getEmbeddedRuntime();
+ try
+ {
+ runtime.addCapability(new CompendiumCapability());
+
+ OSGiBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
+ assertBundleState(Bundle.INSTALLED, bundleX.getState());
+
+ OSGiBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
+ assertBundleState(Bundle.INSTALLED, bundleB.getState());
+
+ bundleB.start();
+ assertBundleState(Bundle.RESOLVED, bundleX.getState());
+ assertBundleState(Bundle.ACTIVE, bundleB.getState());
+
+ bundleB.uninstall();
+ bundleX.uninstall();
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+
+ /*
+ * Install X, B, A
+ */
+ @Test
+ public void testInstallBBeforeA() throws Exception
+ {
+ OSGiRuntime runtime = getEmbeddedRuntime();
+ try
+ {
+ runtime.addCapability(new CompendiumCapability());
+
+ OSGiBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
+ assertBundleState(Bundle.INSTALLED, bundleX.getState());
+
+ OSGiBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
+ assertBundleState(Bundle.INSTALLED, bundleB.getState());
+
+ OSGiBundle bundleA = runtime.installBundle("jbosgi38-bundleA.jar");
+ assertBundleState(Bundle.INSTALLED, bundleA.getState());
+
+ bundleA.start();
+ assertBundleState(Bundle.RESOLVED, bundleX.getState());
+ assertBundleState(Bundle.RESOLVED, bundleB.getState());
+ assertBundleState(Bundle.ACTIVE, bundleA.getState());
+
+ bundleA.uninstall();
+ bundleB.uninstall();
+ bundleX.uninstall();
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+
+ /*
+ * Install B, X
+ */
+ @Test
+ public void testInstallBBeforeX() throws Exception
+ {
+ OSGiRuntime runtime = getEmbeddedRuntime();
+ try
+ {
+ runtime.addCapability(new CompendiumCapability());
+
+ OSGiBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
+ assertBundleState(Bundle.INSTALLED, bundleB.getState());
+
+ try
+ {
+ bundleB.start();
+ fail("Unresolved constraint expected");
+ }
+ catch (BundleException ex)
+ {
+ // expected
+ }
+
+ OSGiBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
+ assertBundleState(Bundle.INSTALLED, bundleX.getState());
+
+ bundleB.start();
+ assertBundleState(Bundle.RESOLVED, bundleX.getState());
+ assertBundleState(Bundle.ACTIVE, bundleB.getState());
+
+ bundleB.uninstall();
+ bundleX.uninstall();
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+
+ /*
+ * Install A, B, X
+ */
+ @Test
+ public void testInstallABeforeB() throws Exception
+ {
+ OSGiRuntime runtime = getEmbeddedRuntime();
+ try
+ {
+ runtime.addCapability(new CompendiumCapability());
+
+ OSGiBundle bundleA = runtime.installBundle("jbosgi38-bundleA.jar");
+ assertBundleState(Bundle.INSTALLED, bundleA.getState());
+
+ OSGiBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
+ assertBundleState(Bundle.INSTALLED, bundleB.getState());
+
+ try
+ {
+ bundleB.start();
+ fail("Unresolved constraint expected");
+ }
+ catch (BundleException ex)
+ {
+ // expected
+ }
+
+ OSGiBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
+ assertBundleState(Bundle.INSTALLED, bundleX.getState());
+
+ bundleB.start();
+ assertBundleState(Bundle.RESOLVED, bundleX.getState());
+ assertBundleState(Bundle.ACTIVE, bundleB.getState());
+
+ bundleA.start();
+ assertBundleState(Bundle.ACTIVE, bundleA.getState());
+
+ bundleA.uninstall();
+ bundleB.uninstall();
+ bundleX.uninstall();
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+
+ /*
+ * Uninstall X, B stays active
+ */
+ @Test
+ public void testUninstallX() throws Exception
+ {
+ if ("jbossmc".equals(getFramework()))
+ {
+ System.out.println("FIXME [JBOSGI-213] Unexpected dependee state changes");
+ return;
+ }
+
+ OSGiRuntime runtime = getEmbeddedRuntime();
+ try
+ {
+ runtime.addCapability(new CompendiumCapability());
+
+ OSGiBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
+ assertBundleState(Bundle.INSTALLED, bundleX.getState());
+
+ OSGiBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
+ assertBundleState(Bundle.INSTALLED, bundleB.getState());
+
+ bundleB.start();
+ assertBundleState(Bundle.RESOLVED, bundleX.getState());
+ assertBundleState(Bundle.ACTIVE, bundleB.getState());
+
+ bundleX.stop();
+ assertBundleState(Bundle.RESOLVED, bundleX.getState());
+ assertBundleState(Bundle.ACTIVE, bundleB.getState());
+
+ bundleX.uninstall();
+ assertBundleState(Bundle.UNINSTALLED, bundleX.getState());
+ assertBundleState(Bundle.ACTIVE, bundleB.getState());
+
+ bundleB.uninstall();
+ assertBundleState(Bundle.UNINSTALLED, bundleB.getState());
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,174 +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.test.osgi.jbosgi39;
-
-//$Id: OSGI39TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
-
-import static org.junit.Assert.fail;
-
-import org.jboss.osgi.testing.OSGiBundle;
-import org.jboss.osgi.testing.OSGiPackageAdmin;
-import org.jboss.osgi.testing.OSGiRuntime;
-import org.jboss.osgi.testing.OSGiTest;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-/**
- * [JBOSGI-39] Bundle gets wired to an already uninstalled bundle
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-39
- *
- * Bundle B depends on bundle X.
- *
- * B ---> X
- *
- * @author thomas.diesler(a)jboss.com
- * @since 04-Mar-2009
- */
-public class OSGI39TestCase extends OSGiTest
-{
- private OSGiRuntime runtime;
-
- @Before
- public void setUp()
- {
- runtime = getDefaultRuntime();
-
- OSGiPackageAdmin packageAdmin = runtime.getPackageAdmin();
- packageAdmin.refreshPackages(null);
- }
-
- @After
- public void tearDown()
- {
- runtime.shutdown();
- }
-
- @Test
- public void testVerifyUnresolved() throws Exception
- {
- OSGiBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
- assertBundleState(Bundle.INSTALLED, bundleB.getState());
-
- try
- {
- bundleB.start();
- fail("Unresolved constraint expected");
- }
- catch (BundleException ex)
- {
- // expected
- }
-
- OSGiBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
-
- bundleB.start();
-
- assertBundleState(Bundle.RESOLVED, bundleX.getState());
- assertBundleState(Bundle.ACTIVE, bundleB.getState());
-
- bundleB.uninstall();
- bundleX.uninstall();
- }
-
- /*
- * 4.3.11 Uninstalling Bundles
- *
- * Once this method returns, the state of the OSGi Service Platform must be the same as if the bundle had never been installed, unless:
- *
- * - The uninstalled bundle has exported any packages (via its Export-Package manifest header)
- * - The uninstalled bundle was selected by the Framework as the exporter of these packages.
- *
- * If none of the old exports are used, then the old exports must be removed. Otherwise, all old exports must remain available
- * for existing bundles and future resolves until the refreshPackages method is called or the Framework is restarted.
- */
- @Test
- public void testWiringToUninstalled() throws Exception
- {
- OSGiBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
- OSGiBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
-
- bundleB.start();
-
- assertBundleState(Bundle.RESOLVED, bundleX.getState());
- assertBundleState(Bundle.ACTIVE, bundleB.getState());
-
- // Uninstall X before B
- bundleX.uninstall();
- bundleB.uninstall();
-
- // Install B without X
- bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
-
- bundleB.start();
-
- assertBundleState(Bundle.ACTIVE, bundleB.getState());
-
- bundleB.uninstall();
- }
-
- @Test
- public void testWiringToUninstalledPackageAdmin() throws Exception
- {
- OSGiBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
- OSGiBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
-
- bundleB.start();
-
- assertBundleState(Bundle.RESOLVED, bundleX.getState());
- assertBundleState(Bundle.ACTIVE, bundleB.getState());
-
- // Uninstall X before B
- bundleX.uninstall();
- bundleB.uninstall();
-
- // Forces the update (replacement) or removal of packages exported by the specified bundles.
- OSGiPackageAdmin packAdmin = runtime.getPackageAdmin();
- packAdmin.refreshPackages(null);
-
- // Install B without X
- bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
-
- try
- {
- bundleB.start();
- fail("Unresolved constraint expected");
- }
- catch (BundleException ex)
- {
- // expected
- }
-
- bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
-
- bundleB.start();
-
- assertBundleState(Bundle.RESOLVED, bundleX.getState());
- assertBundleState(Bundle.ACTIVE, bundleB.getState());
-
- bundleB.uninstall();
- bundleX.uninstall();
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGi39TestCase.java (from rev 99792, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGi39TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGi39TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,174 @@
+/*
+ * 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.jbosgi39;
+
+//$Id: OSGI39TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
+
+import static org.junit.Assert.fail;
+
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiPackageAdmin;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * [JBOSGI-39] Bundle gets wired to an already uninstalled bundle
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-39
+ *
+ * Bundle B depends on bundle X.
+ *
+ * B ---> X
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 04-Mar-2009
+ */
+public class OSGi39TestCase extends OSGiTest
+{
+ private OSGiRuntime runtime;
+
+ @Before
+ public void setUp()
+ {
+ runtime = getDefaultRuntime();
+
+ OSGiPackageAdmin packageAdmin = runtime.getPackageAdmin();
+ packageAdmin.refreshPackages(null);
+ }
+
+ @After
+ public void tearDown()
+ {
+ runtime.shutdown();
+ }
+
+ @Test
+ public void testVerifyUnresolved() throws Exception
+ {
+ OSGiBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
+ assertBundleState(Bundle.INSTALLED, bundleB.getState());
+
+ try
+ {
+ bundleB.start();
+ fail("Unresolved constraint expected");
+ }
+ catch (BundleException ex)
+ {
+ // expected
+ }
+
+ OSGiBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
+
+ bundleB.start();
+
+ assertBundleState(Bundle.RESOLVED, bundleX.getState());
+ assertBundleState(Bundle.ACTIVE, bundleB.getState());
+
+ bundleB.uninstall();
+ bundleX.uninstall();
+ }
+
+ /*
+ * 4.3.11 Uninstalling Bundles
+ *
+ * Once this method returns, the state of the OSGi Service Platform must be the same as if the bundle had never been installed, unless:
+ *
+ * - The uninstalled bundle has exported any packages (via its Export-Package manifest header)
+ * - The uninstalled bundle was selected by the Framework as the exporter of these packages.
+ *
+ * If none of the old exports are used, then the old exports must be removed. Otherwise, all old exports must remain available
+ * for existing bundles and future resolves until the refreshPackages method is called or the Framework is restarted.
+ */
+ @Test
+ public void testWiringToUninstalled() throws Exception
+ {
+ OSGiBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
+ OSGiBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
+
+ bundleB.start();
+
+ assertBundleState(Bundle.RESOLVED, bundleX.getState());
+ assertBundleState(Bundle.ACTIVE, bundleB.getState());
+
+ // Uninstall X before B
+ bundleX.uninstall();
+ bundleB.uninstall();
+
+ // Install B without X
+ bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
+
+ bundleB.start();
+
+ assertBundleState(Bundle.ACTIVE, bundleB.getState());
+
+ bundleB.uninstall();
+ }
+
+ @Test
+ public void testWiringToUninstalledPackageAdmin() throws Exception
+ {
+ OSGiBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
+ OSGiBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
+
+ bundleB.start();
+
+ assertBundleState(Bundle.RESOLVED, bundleX.getState());
+ assertBundleState(Bundle.ACTIVE, bundleB.getState());
+
+ // Uninstall X before B
+ bundleX.uninstall();
+ bundleB.uninstall();
+
+ // Forces the update (replacement) or removal of packages exported by the specified bundles.
+ OSGiPackageAdmin packAdmin = runtime.getPackageAdmin();
+ packAdmin.refreshPackages(null);
+
+ // Install B without X
+ bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
+
+ try
+ {
+ bundleB.start();
+ fail("Unresolved constraint expected");
+ }
+ catch (BundleException ex)
+ {
+ // expected
+ }
+
+ bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
+
+ bundleB.start();
+
+ assertBundleState(Bundle.RESOLVED, bundleX.getState());
+ assertBundleState(Bundle.ACTIVE, bundleB.getState());
+
+ bundleB.uninstall();
+ bundleX.uninstall();
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41TestCase.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,95 +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.test.osgi.jbosgi41;
-
-//$Id: OSGI41RemoteTestCase.java 87182 2009-04-13 13:47:53Z thomas.diesler(a)jboss.com $
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-
-import org.jboss.osgi.spi.capability.ConfigAdminCapability;
-import org.jboss.osgi.testing.OSGiBundle;
-import org.jboss.osgi.testing.OSGiRuntime;
-import org.jboss.osgi.testing.OSGiTest;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-/**
- * [JBOSGI-41] Verify persistent file storage
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-41
- *
- * @author thomas.diesler(a)jboss.com
- * @since 05-Mar-2009
- */
-public class OSGI41TestCase extends OSGiTest
-{
- @Test
- public void testFirstRun() throws Exception
- {
- OSGiRuntime runtime = getDefaultRuntime();
- try
- {
- runtime.addCapability(new ConfigAdminCapability());
-
- OSGiBundle bundleA = runtime.installBundle("jbosgi41-bundleA.jar");
- bundleA.start();
-
- assertBundleState(Bundle.ACTIVE, bundleA.getState());
-
- File dataFile = getBundleDataFile(bundleA, "config/jbosgi41.txt");
- assertTrue("File exists: " + dataFile, dataFile.exists());
-
- BufferedReader br = new BufferedReader(new FileReader(dataFile));
- assertEquals("jbosgi41-bundleA", br.readLine());
-
- bundleA.uninstall();
- }
- finally
- {
- runtime.shutdown();
- }
- }
-
- private File getBundleDataFile(OSGiBundle bundleA, String filename)
- {
- OSGiBundle systemBundle = bundleA.getRuntime().getBundle(0);
- String storageRoot = systemBundle.getProperty("org.osgi.framework.storage");
- assertNotNull("Storage dir not null", storageRoot);
-
- File dataFile;
- if ("equinox".equals(getFramework()))
- {
- dataFile = new File(storageRoot + "/org.eclipse.osgi/bundles/" + bundleA.getBundleId() + "/data/" + filename);
- }
- else
- {
- dataFile = new File(storageRoot + "/bundle" + bundleA.getBundleId() + "/data/" + filename);
- }
- return dataFile;
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGi41TestCase.java (from rev 99792, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGi41TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGi41TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,95 @@
+/*
+ * 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.jbosgi41;
+
+//$Id: OSGI41RemoteTestCase.java 87182 2009-04-13 13:47:53Z thomas.diesler(a)jboss.com $
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+
+import org.jboss.osgi.spi.capability.ConfigAdminCapability;
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+
+/**
+ * [JBOSGI-41] Verify persistent file storage
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-41
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-Mar-2009
+ */
+public class OSGi41TestCase extends OSGiTest
+{
+ @Test
+ public void testFirstRun() throws Exception
+ {
+ OSGiRuntime runtime = getDefaultRuntime();
+ try
+ {
+ runtime.addCapability(new ConfigAdminCapability());
+
+ OSGiBundle bundleA = runtime.installBundle("jbosgi41-bundleA.jar");
+ bundleA.start();
+
+ assertBundleState(Bundle.ACTIVE, bundleA.getState());
+
+ File dataFile = getBundleDataFile(bundleA, "config/jbosgi41.txt");
+ assertTrue("File exists: " + dataFile, dataFile.exists());
+
+ BufferedReader br = new BufferedReader(new FileReader(dataFile));
+ assertEquals("jbosgi41-bundleA", br.readLine());
+
+ bundleA.uninstall();
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+
+ private File getBundleDataFile(OSGiBundle bundleA, String filename)
+ {
+ OSGiBundle systemBundle = bundleA.getRuntime().getBundle(0);
+ String storageRoot = systemBundle.getProperty("org.osgi.framework.storage");
+ assertNotNull("Storage dir not null", storageRoot);
+
+ File dataFile;
+ if ("equinox".equals(getFramework()))
+ {
+ dataFile = new File(storageRoot + "/org.eclipse.osgi/bundles/" + bundleA.getBundleId() + "/data/" + filename);
+ }
+ else
+ {
+ dataFile = new File(storageRoot + "/bundle" + bundleA.getBundleId() + "/data/" + filename);
+ }
+ return dataFile;
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi92/OSGI92TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi92/OSGI92TestCase.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi92/OSGI92TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,87 +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.test.osgi.jbosgi92;
-
-//$Id$
-
-import static org.junit.Assert.assertEquals;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.jboss.osgi.testing.OSGiBundle;
-import org.jboss.osgi.testing.OSGiRuntime;
-import org.jboss.osgi.testing.OSGiServiceReference;
-import org.jboss.osgi.testing.OSGiTest;
-import org.jboss.osgi.testing.OSGiTestHelper;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-/**
- * [JBOSGI-92] Class.forName issue with XMLParserActivator
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-92
- *
- * @author thomas.diesler(a)jboss.com
- * @since 21-Jul-2009
- */
-public class OSGI92TestCase extends OSGiTest
-{
- private static OSGiRuntime runtime;
-
- @BeforeClass
- public static void beforeClass() throws BundleException
- {
- runtime = new OSGiTestHelper().getDefaultRuntime();
- }
-
- @AfterClass
- public static void afterClass() throws BundleException
- {
- if (runtime != null)
- {
- runtime.shutdown();
- runtime = null;
- }
- }
-
- @Test
- @Ignore("Fails with apache felix compendium-1.2.0")
- public void testDeployParsers() throws Exception
- {
- OSGiBundle bundleA = runtime.installBundle("jbosgi92-bundleA.jar");
- bundleA.start();
-
- assertBundleState(Bundle.ACTIVE, bundleA.getState());
-
- String filter = "(parser.factoryname=org.jboss.test.osgi.jbosgi92.bundleA.*)";
- OSGiServiceReference[] domRefs = runtime.getServiceReferences(DocumentBuilderFactory.class.getName(), filter);
- assertEquals("DocumentBuilderFactory servce available", 1, domRefs.length);
-
- OSGiServiceReference[] saxRefs = runtime.getServiceReferences(SAXParserFactory.class.getName(), filter);
- assertEquals("SAXParserFactory servce available", 1, saxRefs.length);
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi92/OSGi92TestCase.java (from rev 99792, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi92/OSGI92TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi92/OSGi92TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi92/OSGi92TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,87 @@
+/*
+ * 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.jbosgi92;
+
+//$Id$
+
+import static org.junit.Assert.assertEquals;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiServiceReference;
+import org.jboss.osgi.testing.OSGiTest;
+import org.jboss.osgi.testing.OSGiTestHelper;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * [JBOSGI-92] Class.forName issue with XMLParserActivator
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-92
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 21-Jul-2009
+ */
+public class OSGi92TestCase extends OSGiTest
+{
+ private static OSGiRuntime runtime;
+
+ @BeforeClass
+ public static void beforeClass() throws BundleException
+ {
+ runtime = new OSGiTestHelper().getDefaultRuntime();
+ }
+
+ @AfterClass
+ public static void afterClass() throws BundleException
+ {
+ if (runtime != null)
+ {
+ runtime.shutdown();
+ runtime = null;
+ }
+ }
+
+ @Test
+ @Ignore("Fails with apache felix compendium-1.2.0")
+ public void testDeployParsers() throws Exception
+ {
+ OSGiBundle bundleA = runtime.installBundle("jbosgi92-bundleA.jar");
+ bundleA.start();
+
+ assertBundleState(Bundle.ACTIVE, bundleA.getState());
+
+ String filter = "(parser.factoryname=org.jboss.test.osgi.jbosgi92.bundleA.*)";
+ OSGiServiceReference[] domRefs = runtime.getServiceReferences(DocumentBuilderFactory.class.getName(), filter);
+ assertEquals("DocumentBuilderFactory servce available", 1, domRefs.length);
+
+ OSGiServiceReference[] saxRefs = runtime.getServiceReferences(SAXParserFactory.class.getName(), filter);
+ assertEquals("SAXParserFactory servce available", 1, saxRefs.length);
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,196 +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.test.osgi.jbosgi99;
-
-//$Id: OSGI39TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import org.jboss.osgi.spi.util.ConstantsHelper;
-import org.jboss.osgi.testing.OSGiBundle;
-import org.jboss.osgi.testing.OSGiRuntime;
-import org.jboss.osgi.testing.OSGiTest;
-import org.jboss.osgi.testing.OSGiTestHelper;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * [JBOSGI-99] No explicit control over bundle.start()
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-99
- *
- * @author thomas.diesler(a)jboss.com
- * @since 08-Jul-2009
- */
-public class OSGI99TestCase extends OSGiTest
-{
- // Provide logging
- private static Logger log = LoggerFactory.getLogger(OSGI99TestCase.class);
-
- private static OSGiRuntime runtime;
-
- @BeforeClass
- public static void beforeClass()
- {
- runtime = new OSGiTestHelper().getDefaultRuntime();
- }
-
- @AfterClass
- public static void afterClass()
- {
- if (runtime != null)
- {
- runtime.shutdown();
- runtime = null;
- }
- }
-
- @Test
- public void testAllGood() throws Exception
- {
- OSGiBundle bundle = runtime.installBundle("jbosgi99-allgood.jar");
- assertBundleState(Bundle.INSTALLED, bundle.getState());
-
- bundle.start();
- assertBundleState(Bundle.ACTIVE, bundle.getState());
-
- bundle.uninstall();
-
- if (runtime.isRemoteRuntime() == false)
- assertBundleState(Bundle.UNINSTALLED, bundle.getState());
- }
-
- @Test
- public void testFailOnResolve() throws Exception
- {
- OSGiBundle bundle = runtime.installBundle("jbosgi99-failonresolve.jar");
- assertBundleState(Bundle.INSTALLED, bundle.getState());
-
- try
- {
- bundle.start();
- fail("BundleException expected");
- }
- catch (BundleException ex)
- {
- log.error("State on error: " + ConstantsHelper.bundleState(bundle.getState()), ex);
- assertBundleState(Bundle.INSTALLED, bundle.getState());
- }
-
- bundle.uninstall();
-
- if (runtime.isRemoteRuntime() == false)
- assertBundleState(Bundle.UNINSTALLED, bundle.getState());
- }
-
- @Test
- public void testFailOnStart() throws Exception
- {
- OSGiBundle bundle = runtime.installBundle("jbosgi99-failonstart.jar");
- assertBundleState(Bundle.INSTALLED, bundle.getState());
-
- try
- {
- bundle.start();
- fail("BundleException expected");
- }
- catch (BundleException ex)
- {
- log.error("State on error: " + ConstantsHelper.bundleState(bundle.getState()), ex);
- assertBundleState(Bundle.RESOLVED, bundle.getState());
- }
-
- bundle.uninstall();
-
- if (runtime.isRemoteRuntime() == false)
- assertBundleState(Bundle.UNINSTALLED, bundle.getState());
- }
-
- @Test
- public void testHotDeploy() throws Exception
- {
- if (runtime.isRemoteRuntime() == false)
- return;
-
- File inFile = getTestArchiveFile("jbosgi99-allgood.jar");
-
- // Copy the bundle to the deploy directory
- String outPath = runtime.getBundle(0).getDataFile("dummy").getAbsolutePath();
- outPath = outPath.substring(0, outPath.indexOf("data/osgi-store"));
- File outFile = new File(outPath + "deploy/jbosgi99-allgood.jar");
- copyfile(inFile, outFile);
-
- int timeout = 5000;
- OSGiBundle bundle = null;
- while (timeout > 0)
- {
- bundle = runtime.getBundle("jbosgi99-allgood", null);
- if (bundle != null && bundle.getState() == Bundle.ACTIVE)
- break;
-
- Thread.sleep(200);
- timeout -= 200;
- }
-
- assertNotNull("Bundle not null", bundle);
- assertBundleState(Bundle.ACTIVE, bundle.getState());
-
- // Delete the bundle from the deploy directory
- outFile.delete();
-
- timeout = 5000;
- while (timeout > 0)
- {
- if (bundle.getState() == Bundle.UNINSTALLED)
- break;
-
- Thread.sleep(200);
- timeout -= 200;
- }
-
- assertBundleState(Bundle.UNINSTALLED, bundle.getState());
- }
-
- private void copyfile(File inFile, File outFile) throws IOException
- {
- FileInputStream in = new FileInputStream(inFile);
- FileOutputStream out = new FileOutputStream(outFile);
-
- int c;
- while ((c = in.read()) != -1)
- out.write(c);
-
- in.close();
- out.close();
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGi99TestCase.java (from rev 99897, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGi99TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGi99TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,196 @@
+/*
+ * 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.jbosgi99;
+
+//$Id: OSGI39TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.jboss.osgi.spi.util.ConstantsHelper;
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.jboss.osgi.testing.OSGiTestHelper;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * [JBOSGI-99] No explicit control over bundle.start()
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-99
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 08-Jul-2009
+ */
+public class OSGi99TestCase extends OSGiTest
+{
+ // Provide logging
+ private static Logger log = LoggerFactory.getLogger(OSGi99TestCase.class);
+
+ private static OSGiRuntime runtime;
+
+ @BeforeClass
+ public static void beforeClass()
+ {
+ runtime = new OSGiTestHelper().getDefaultRuntime();
+ }
+
+ @AfterClass
+ public static void afterClass()
+ {
+ if (runtime != null)
+ {
+ runtime.shutdown();
+ runtime = null;
+ }
+ }
+
+ @Test
+ public void testAllGood() throws Exception
+ {
+ OSGiBundle bundle = runtime.installBundle("jbosgi99-allgood.jar");
+ assertBundleState(Bundle.INSTALLED, bundle.getState());
+
+ bundle.start();
+ assertBundleState(Bundle.ACTIVE, bundle.getState());
+
+ bundle.uninstall();
+
+ if (runtime.isRemoteRuntime() == false)
+ assertBundleState(Bundle.UNINSTALLED, bundle.getState());
+ }
+
+ @Test
+ public void testFailOnResolve() throws Exception
+ {
+ OSGiBundle bundle = runtime.installBundle("jbosgi99-failonresolve.jar");
+ assertBundleState(Bundle.INSTALLED, bundle.getState());
+
+ try
+ {
+ bundle.start();
+ fail("BundleException expected");
+ }
+ catch (BundleException ex)
+ {
+ log.error("State on error: " + ConstantsHelper.bundleState(bundle.getState()), ex);
+ assertBundleState(Bundle.INSTALLED, bundle.getState());
+ }
+
+ bundle.uninstall();
+
+ if (runtime.isRemoteRuntime() == false)
+ assertBundleState(Bundle.UNINSTALLED, bundle.getState());
+ }
+
+ @Test
+ public void testFailOnStart() throws Exception
+ {
+ OSGiBundle bundle = runtime.installBundle("jbosgi99-failonstart.jar");
+ assertBundleState(Bundle.INSTALLED, bundle.getState());
+
+ try
+ {
+ bundle.start();
+ fail("BundleException expected");
+ }
+ catch (BundleException ex)
+ {
+ log.error("State on error: " + ConstantsHelper.bundleState(bundle.getState()), ex);
+ assertBundleState(Bundle.RESOLVED, bundle.getState());
+ }
+
+ bundle.uninstall();
+
+ if (runtime.isRemoteRuntime() == false)
+ assertBundleState(Bundle.UNINSTALLED, bundle.getState());
+ }
+
+ @Test
+ public void testHotDeploy() throws Exception
+ {
+ if (runtime.isRemoteRuntime() == false)
+ return;
+
+ File inFile = getTestArchiveFile("jbosgi99-allgood.jar");
+
+ // Copy the bundle to the deploy directory
+ String outPath = runtime.getBundle(0).getDataFile("dummy").getAbsolutePath();
+ outPath = outPath.substring(0, outPath.indexOf("data/osgi-store"));
+ File outFile = new File(outPath + "deploy/jbosgi99-allgood.jar");
+ copyfile(inFile, outFile);
+
+ int timeout = 5000;
+ OSGiBundle bundle = null;
+ while (timeout > 0)
+ {
+ bundle = runtime.getBundle("jbosgi99-allgood", null);
+ if (bundle != null && bundle.getState() == Bundle.ACTIVE)
+ break;
+
+ Thread.sleep(200);
+ timeout -= 200;
+ }
+
+ assertNotNull("Bundle not null", bundle);
+ assertBundleState(Bundle.ACTIVE, bundle.getState());
+
+ // Delete the bundle from the deploy directory
+ outFile.delete();
+
+ timeout = 5000;
+ while (timeout > 0)
+ {
+ if (bundle.getState() == Bundle.UNINSTALLED)
+ break;
+
+ Thread.sleep(200);
+ timeout -= 200;
+ }
+
+ assertBundleState(Bundle.UNINSTALLED, bundle.getState());
+ }
+
+ private void copyfile(File inFile, File outFile) throws IOException
+ {
+ FileInputStream in = new FileInputStream(inFile);
+ FileOutputStream out = new FileOutputStream(outFile);
+
+ int c;
+ while ((c = in.read()) != -1)
+ out.write(c);
+
+ in.close();
+ out.close();
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,112 +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.test.osgi.jbossas.jbosgi36;
-
-//$Id: OSGI36TestCase.java 86968 2009-04-08 15:51:12Z thomas.diesler(a)jboss.com $
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import org.jboss.osgi.jmx.JMXCapability;
-import org.jboss.osgi.spi.management.MBeanProxy;
-import org.jboss.osgi.spi.management.MBeanProxyException;
-import org.jboss.osgi.testing.OSGiTest;
-import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.osgi.testing.internal.RemoteRuntime;
-import org.jboss.test.osgi.jbossas.jbosgi36.mbean.FooMBean;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * [JBOSGI-36] Bundle classes leak into system classloader
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-36
- *
- * @author thomas.diesler(a)jboss.com
- * @since 25-Feb-2009
- */
-public class OSGI36TestCase extends OSGiTest
-{
- private static RemoteRuntime runtime;
-
- @BeforeClass
- public static void setUpClass() throws Exception
- {
- runtime = (RemoteRuntime)new OSGiTestHelper().getRemoteRuntime();
- runtime.addCapability(new JMXCapability());
-
- runtime.installBundle("jbosgi36-bundle.jar");
- runtime.deploy("jbosgi36-mbean.jar");
- }
-
- @AfterClass
- public static void tearDownClass() throws Exception
- {
- if (runtime != null)
- {
- runtime.undeploy("jbosgi36-mbean.jar");
- runtime.shutdown();
- runtime = null;
- }
- }
-
- @Test
- public void testAccessMBean() throws Exception
- {
- assertEquals("hello", getFooMBean().echo("hello"));
- }
-
- @Test
- public void testAccessSomeService() throws Exception
- {
- try
- {
- String loaderName = getFooMBean().accessSomeService();
- fail("Unexpected classloader: " + loaderName);
- }
- catch (ClassNotFoundException ex)
- {
- // expected
- }
- }
-
- @Test
- public void testAccessSomeInternal() throws Exception
- {
- try
- {
- String loaderName = getFooMBean().accessSomeInternal();
- fail("Unexpected classloader: " + loaderName);
- }
- catch (ClassNotFoundException ex)
- {
- // expected
- }
- }
-
- private FooMBean getFooMBean() throws MBeanProxyException
- {
- FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, FooMBean.OBJECT_NAME, runtime.getMBeanServer());
- return foo;
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGi36TestCase.java (from rev 99792, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGi36TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGi36TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,112 @@
+/*
+ * 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.jbossas.jbosgi36;
+
+//$Id: OSGI36TestCase.java 86968 2009-04-08 15:51:12Z thomas.diesler(a)jboss.com $
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.jboss.osgi.jmx.JMXCapability;
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.MBeanProxyException;
+import org.jboss.osgi.testing.OSGiTest;
+import org.jboss.osgi.testing.OSGiTestHelper;
+import org.jboss.osgi.testing.internal.RemoteRuntime;
+import org.jboss.test.osgi.jbossas.jbosgi36.mbean.FooMBean;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * [JBOSGI-36] Bundle classes leak into system classloader
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-36
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 25-Feb-2009
+ */
+public class OSGi36TestCase extends OSGiTest
+{
+ private static RemoteRuntime runtime;
+
+ @BeforeClass
+ public static void setUpClass() throws Exception
+ {
+ runtime = (RemoteRuntime)new OSGiTestHelper().getRemoteRuntime();
+ runtime.addCapability(new JMXCapability());
+
+ runtime.installBundle("jbosgi36-bundle.jar");
+ runtime.deploy("jbosgi36-mbean.jar");
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception
+ {
+ if (runtime != null)
+ {
+ runtime.undeploy("jbosgi36-mbean.jar");
+ runtime.shutdown();
+ runtime = null;
+ }
+ }
+
+ @Test
+ public void testAccessMBean() throws Exception
+ {
+ assertEquals("hello", getFooMBean().echo("hello"));
+ }
+
+ @Test
+ public void testAccessSomeService() throws Exception
+ {
+ try
+ {
+ String loaderName = getFooMBean().accessSomeService();
+ fail("Unexpected classloader: " + loaderName);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ // expected
+ }
+ }
+
+ @Test
+ public void testAccessSomeInternal() throws Exception
+ {
+ try
+ {
+ String loaderName = getFooMBean().accessSomeInternal();
+ fail("Unexpected classloader: " + loaderName);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ // expected
+ }
+ }
+
+ private FooMBean getFooMBean() throws MBeanProxyException
+ {
+ FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, FooMBean.OBJECT_NAME, runtime.getMBeanServer());
+ return foo;
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/OSGI58TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/OSGI58TestCase.java 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/OSGI58TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,75 +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.test.osgi.jbossas.jbosgi58;
-
-//$Id$
-
-import static org.junit.Assert.assertEquals;
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jboss.osgi.testing.OSGiTest;
-import org.jboss.osgi.testing.internal.RemoteRuntime;
-import org.jboss.test.osgi.jbossas.jbosgi58.ejb.StatelessBean;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * [JBOSGI-58] Framework injection in SLSB
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-58
- *
- * @author thomas.diesler(a)jboss.com
- * @since 07-Dec-2009
- */
-@Ignore
-public class OSGI58TestCase extends OSGiTest
-{
- @Test
- public void testEJB() throws Exception
- {
- RemoteRuntime runtime = (RemoteRuntime)getRemoteRuntime();
-
- String location = getTestArchivePath("jbosgi58-ejb.jar");
-
- runtime.deploy(location);
- try
- {
- StatelessBean bean = getRemoteBean(StatelessBean.class);
- String symbolicName = bean.getFraemworkSymbolicName();
- assertEquals("foo", symbolicName);
- }
- finally
- {
- runtime.undeploy(location);
- }
- }
-
- @SuppressWarnings("unchecked")
- private <T> T getRemoteBean(Class<T> beanClass) throws NamingException
- {
- InitialContext initContext = getInitialContext();
- T bean = (T)initContext.lookup(beanClass.getSimpleName() + "/remote");
- return bean;
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/OSGi58TestCase.java (from rev 99792, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/OSGI58TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/OSGi58TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi58/OSGi58TestCase.java 2010-01-25 12:16:28 UTC (rev 99901)
@@ -0,0 +1,75 @@
+/*
+ * 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.jbossas.jbosgi58;
+
+//$Id$
+
+import static org.junit.Assert.assertEquals;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.osgi.testing.OSGiTest;
+import org.jboss.osgi.testing.internal.RemoteRuntime;
+import org.jboss.test.osgi.jbossas.jbosgi58.ejb.StatelessBean;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * [JBOSGI-58] Framework injection in SLSB
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-58
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 07-Dec-2009
+ */
+@Ignore
+public class OSGi58TestCase extends OSGiTest
+{
+ @Test
+ public void testEJB() throws Exception
+ {
+ RemoteRuntime runtime = (RemoteRuntime)getRemoteRuntime();
+
+ String location = getTestArchivePath("jbosgi58-ejb.jar");
+
+ runtime.deploy(location);
+ try
+ {
+ StatelessBean bean = getRemoteBean(StatelessBean.class);
+ String symbolicName = bean.getFraemworkSymbolicName();
+ assertEquals("foo", symbolicName);
+ }
+ finally
+ {
+ runtime.undeploy(location);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T> T getRemoteBean(Class<T> beanClass) throws NamingException
+ {
+ InitialContext initContext = getInitialContext();
+ T bean = (T)initContext.lookup(beanClass.getSimpleName() + "/remote");
+ return bean;
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi161/jbosgi161-bundle.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi161/jbosgi161-bundle.bnd 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi161/jbosgi161-bundle.bnd 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,6 +1,6 @@
# bnd build -classpath target/test-classes -output target/test-libs/jbosgi161-bundle.jar src/test/resources/jbosgi161/bundle.bnd
Bundle-SymbolicName: jbosgi161-bundle
-Bundle-Activator: org.jboss.test.osgi.jbosgi161.bundle.OSGI161Activator
+Bundle-Activator: org.jboss.test.osgi.jbosgi161.bundle.Activator161
Private-Package: org.jboss.test.osgi.jbosgi161.bundle
Import-Package: org.apache.commons.logging, org.slf4j, org.osgi.framework
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi214/jbosgi214-bundle.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi214/jbosgi214-bundle.bnd 2010-01-25 11:49:36 UTC (rev 99900)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi214/jbosgi214-bundle.bnd 2010-01-25 12:16:28 UTC (rev 99901)
@@ -1,6 +1,6 @@
# bnd build -classpath target/test-classes -output target/test-libs/jbosgi214-bundle.jar src/test/resources/jbosgi214/jbosgi214-bundle.bnd
Bundle-SymbolicName: jbosgi214-bundle
-Bundle-Activator: org.jboss.test.osgi.jbosgi214.bundle.OSGI214Activator
+Bundle-Activator: org.jboss.test.osgi.jbosgi214.bundle.Activator214
Export-Package: org.jboss.test.osgi.jbosgi214.bundle
Import-Package: org.jboss.test.osgi.jbosgi214, org.osgi.framework
15 years, 11 months
JBoss-OSGI SVN: r99899 - projects/jboss-osgi/trunk/testsuite/functional.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-25 06:47:59 -0500 (Mon, 25 Jan 2010)
New Revision: 99899
Modified:
projects/jboss-osgi/trunk/testsuite/functional/pom.xml
Log:
[JBOSGI-210] Bundle is only installed but not started in runtime
Modified: projects/jboss-osgi/trunk/testsuite/functional/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2010-01-25 11:45:39 UTC (rev 99898)
+++ projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2010-01-25 11:47:59 UTC (rev 99899)
@@ -269,8 +269,6 @@
<exclude>org/jboss/test/osgi/jbosgi143/**</exclude>
<!-- [JBOSGI-151] Cannot resolve circular dependencies -->
<exclude>org/jboss/test/osgi/jbosgi151/**</exclude>
- <!-- [JBOSGI-204] Failure in Bundle.start() uninstalls the bundle -->
- <exclude>org/jboss/test/osgi/jbosgi99/**</exclude>
<!-- [JBOSGI-206] Wire to an already uninstalled bundle -->
<exclude>org/jboss/test/osgi/jbosgi39/**</exclude>
<exclude>org/jboss/test/osgi/jbosgi108/**</exclude>
@@ -323,8 +321,6 @@
<exclude>org/jboss/test/osgi/jbosgi143/**</exclude>
<!-- [JBOSGI-151] Cannot resolve circular dependencies -->
<exclude>org/jboss/test/osgi/jbosgi151/**</exclude>
- <!-- [JBOSGI-204] Failure in Bundle.start() uninstalls the bundle -->
- <exclude>org/jboss/test/osgi/jbosgi99/**</exclude>
<!-- [JBOSGI-206] Wire to an already uninstalled bundle -->
<exclude>org/jboss/test/osgi/jbosgi39/**</exclude>
<exclude>org/jboss/test/osgi/jbosgi108/**</exclude>
15 years, 11 months
JBoss-OSGI SVN: r99897 - in projects/jboss-osgi: projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal and 6 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-25 06:42:38 -0500 (Mon, 25 Jan 2010)
New Revision: 99897
Modified:
projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml
projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerImpl.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiBundle.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiBundleImpl.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundleMBean.java
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java
Log:
[JBOSGI-210] Bundle is only installed but not started in runtime
Modified: projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml 2010-01-25 11:37:18 UTC (rev 99896)
+++ projects/jboss-osgi/projects/bundles/hotdeploy/trunk/pom.xml 2010-01-25 11:42:38 UTC (rev 99897)
@@ -40,8 +40,8 @@
<!-- Properties -->
<properties>
<version.jboss.osgi.common>1.0.3</version.jboss.osgi.common>
- <version.jboss.osgi.deployment>1.0.0</version.jboss.osgi.deployment>
- <version.jboss.osgi.spi>1.0.3</version.jboss.osgi.spi>
+ <version.jboss.osgi.deployment>1.0.1-SNAPSHOT</version.jboss.osgi.deployment>
+ <version.jboss.osgi.spi>1.0.4-SNAPSHOT</version.jboss.osgi.spi>
<version.osgi>4.2.0</version.osgi>
</properties>
Modified: projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerImpl.java 2010-01-25 11:37:18 UTC (rev 99896)
+++ projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerImpl.java 2010-01-25 11:42:38 UTC (rev 99897)
@@ -39,6 +39,7 @@
import org.jboss.osgi.hotdeploy.DeploymentScannerService;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.Version;
import org.slf4j.Logger;
@@ -167,14 +168,14 @@
Bundle bundle = getBundle(dep);
if (bundle == null)
{
- deploymentCache.remove(dep.getLocation().toExternalForm());
+ deploymentCache.remove(dep.getLocation());
}
else
{
int state = bundle.getState();
if (state == Bundle.INSTALLED || state == Bundle.RESOLVED || state == Bundle.ACTIVE)
{
- deploymentCache.remove(dep.getLocation().toExternalForm());
+ deploymentCache.remove(dep.getLocation());
diff.add(dep);
}
}
@@ -248,10 +249,17 @@
Deployment dep = deploymentCache.get(bundleURL.toExternalForm());
if (dep == null)
{
- // hot-deploy bundles are started automatically
- dep = deployer.createDeployment(bundleURL);
- dep.setAutoStart(true);
-
+ try
+ {
+ // hot-deploy bundles are started automatically
+ dep = deployer.createDeployment(bundleURL);
+ dep.setAutoStart(true);
+ }
+ catch (BundleException ex)
+ {
+ log.error("Cannot create deployment from: " + bundleURL, ex);
+ continue;
+ }
deploymentCache.put(bundleURL.toExternalForm(), dep);
}
bundles.add(dep);
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiBundle.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiBundle.java 2010-01-25 11:37:18 UTC (rev 99896)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiBundle.java 2010-01-25 11:42:38 UTC (rev 99897)
@@ -21,6 +21,7 @@
*/
package org.jboss.osgi.testing;
+import java.io.File;
import java.net.URL;
import java.util.Dictionary;
@@ -75,6 +76,11 @@
* Returns the value of the specified property.
*/
public abstract String getProperty(String key);
+
+ /**
+ * Creates a File object for a file in the persistent storage area provided for the bundle by the Framework.
+ */
+ public abstract File getDataFile(String filename);
/**
* Loads the specified class using this bundle's class loader.
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java 2010-01-25 11:37:18 UTC (rev 99896)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedBundle.java 2010-01-25 11:42:38 UTC (rev 99897)
@@ -21,6 +21,7 @@
*/
package org.jboss.osgi.testing.internal;
+import java.io.File;
import java.net.URL;
import java.util.Dictionary;
@@ -116,6 +117,12 @@
}
@Override
+ public File getDataFile(String filename)
+ {
+ return bundle.getBundleContext().getDataFile(filename);
+ }
+
+ @Override
public OSGiBundle loadClass(String name) throws ClassNotFoundException
{
Class<?> clazz = bundle.loadClass(name);
@@ -161,7 +168,6 @@
OSGiRuntimeImpl runtimeImpl = (OSGiRuntimeImpl)getRuntime();
runtimeImpl.unregisterBundle(this);
- setUninstalled(true);
}
catch (RuntimeException rte)
{
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiBundleImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiBundleImpl.java 2010-01-25 11:37:18 UTC (rev 99896)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiBundleImpl.java 2010-01-25 11:42:38 UTC (rev 99897)
@@ -25,6 +25,7 @@
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
+import org.osgi.framework.Bundle;
/**
* An abstract implementation of a {@link OSGiBundle}
@@ -35,7 +36,6 @@
public abstract class OSGiBundleImpl extends OSGiBundle
{
private OSGiRuntimeImpl runtime;
- private boolean uninstalled;
OSGiBundleImpl(OSGiRuntimeImpl runtime)
{
@@ -47,19 +47,9 @@
return runtime;
}
- boolean isUninstalled()
- {
- return uninstalled;
- }
-
- void setUninstalled(boolean uninstalled)
- {
- this.uninstalled = uninstalled;
- }
-
void assertNotUninstalled()
{
- if (uninstalled == true)
+ if (getState() == Bundle.UNINSTALLED)
throw new IllegalStateException("Bundle already uninstalled: " + getLocation());
}
}
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java 2010-01-25 11:37:18 UTC (rev 99896)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java 2010-01-25 11:42:38 UTC (rev 99897)
@@ -23,6 +23,7 @@
// $Id$
+import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
@@ -30,6 +31,7 @@
import java.net.URLStreamHandler;
import java.util.Dictionary;
+import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import org.jboss.osgi.spi.management.ManagedBundle;
@@ -60,8 +62,10 @@
private long bundleId;
private String symbolicName;
+ private ObjectName objectName;
private Dictionary<String, String> headers;
private Version version;
+ boolean uninstalled;
public RemoteBundle(OSGiRuntimeImpl runtime, ManagedBundleMBean bundle, BundleInfo info)
{
@@ -79,6 +83,7 @@
bundleId = bundle.getBundleId();
symbolicName = bundle.getSymbolicName();
+ objectName = bundle.getObjectName();
location = bundle.getLocation();
headers = bundle.getHeaders();
@@ -89,7 +94,20 @@
@Override
public int getState()
{
- return (isUninstalled() ? Bundle.UNINSTALLED : bundle.getState());
+ if (uninstalled == true)
+ return Bundle.UNINSTALLED;
+
+ boolean isRegistered;
+ try
+ {
+ MBeanServerConnection server = getRuntime().getMBeanServer();
+ isRegistered = server.isRegistered(objectName);
+ }
+ catch (IOException e)
+ {
+ isRegistered = false;
+ }
+ return isRegistered ? bundle.getState() : Bundle.UNINSTALLED;
}
@Override
@@ -145,6 +163,13 @@
}
@Override
+ public File getDataFile(String filename)
+ {
+ assertNotUninstalled();
+ return bundle.getDataFile(filename);
+ }
+
+ @Override
public OSGiBundle loadClass(String name) throws ClassNotFoundException
{
assertNotUninstalled();
@@ -176,7 +201,7 @@
OSGiRuntimeImpl runtimeImpl = (OSGiRuntimeImpl)getRuntime();
runtimeImpl.undeploy(new URL(location));
runtimeImpl.unregisterBundle(this);
- setUninstalled(true);
+ uninstalled = true;
}
catch (RuntimeException rte)
{
@@ -195,7 +220,7 @@
try
{
- return sh == null ? new URL(urlstr) : new URL (null, urlstr, sh);
+ return sh == null ? new URL(urlstr) : new URL(null, urlstr, sh);
}
catch (MalformedURLException ex)
{
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java 2010-01-25 11:37:18 UTC (rev 99896)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java 2010-01-25 11:42:38 UTC (rev 99897)
@@ -27,6 +27,7 @@
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
+import java.lang.reflect.UndeclaredThrowableException;
import java.util.HashMap;
import javax.management.Attribute;
@@ -301,6 +302,8 @@
result = ((RuntimeMBeanException)result).getTargetException();
else if (result instanceof RuntimeErrorException)
result = ((RuntimeErrorException)result).getTargetError();
+ else if (result instanceof UndeclaredThrowableException)
+ result = ((UndeclaredThrowableException)result).getUndeclaredThrowable();
else
// can't decode
break;
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java 2010-01-25 11:37:18 UTC (rev 99896)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java 2010-01-25 11:42:38 UTC (rev 99897)
@@ -25,6 +25,7 @@
import static org.jboss.osgi.spi.OSGiConstants.DOMAIN_NAME;
+import java.io.File;
import java.net.URL;
import java.util.Dictionary;
import java.util.Enumeration;
@@ -141,6 +142,12 @@
return getObjectName(providingBundle);
}
+ public File getDataFile(String filename)
+ {
+ BundleContext context = bundle.getBundleContext();
+ return context.getDataFile(filename);
+ }
+
public void start() throws BundleException
{
bundle.start();
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundleMBean.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundleMBean.java 2010-01-25 11:37:18 UTC (rev 99896)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundleMBean.java 2010-01-25 11:42:38 UTC (rev 99897)
@@ -23,6 +23,7 @@
//$Id$
+import java.io.File;
import java.util.Dictionary;
import javax.management.ObjectName;
@@ -103,6 +104,11 @@
String getResource(String name);
/**
+ * Creates a File object for a file in the persistent storage area provided for the bundle by the Framework.
+ */
+ File getDataFile(String filename);
+
+ /**
* Starts this bundle with no options
*/
void start() throws BundleException;
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2010-01-25 11:37:18 UTC (rev 99896)
+++ projects/jboss-osgi/trunk/pom.xml 2010-01-25 11:42:38 UTC (rev 99897)
@@ -58,7 +58,7 @@
<version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
<version.jboss.osgi.deployment>1.0.1-SNAPSHOT</version.jboss.osgi.deployment>
<version.jboss.osgi.framework>1.0.0-SNAPSHOT</version.jboss.osgi.framework>
- <version.jboss.osgi.hotdeploy>1.0.3</version.jboss.osgi.hotdeploy>
+ <version.jboss.osgi.hotdeploy>1.0.4-SNAPSHOT</version.jboss.osgi.hotdeploy>
<version.jboss.osgi.husky>1.0.3-SNAPSHOT</version.jboss.osgi.husky>
<version.jboss.osgi.jaxb>2.1.10.SP3</version.jboss.osgi.jaxb>
<version.jboss.osgi.jmx>1.0.3-SNAPSHOT</version.jboss.osgi.jmx>
Modified: projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml 2010-01-25 11:37:18 UTC (rev 99896)
+++ projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml 2010-01-25 11:42:38 UTC (rev 99897)
@@ -23,6 +23,8 @@
[JBOSGI-143] Investigate DynamicImport-Package
[JBOSGI-151] Cannot resolve circular dependencies
[JBOSGI-161] Cannot use commons logging
+ [JBOSGI-210] Bundle is only installed but not started in runtime
+ [JBOSGI-214] Cannot repeatedly register service bound to an interface from the system classpath
-->
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java 2010-01-25 11:37:18 UTC (rev 99896)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java 2010-01-25 11:42:38 UTC (rev 99897)
@@ -23,8 +23,14 @@
//$Id: OSGI39TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
import org.jboss.osgi.spi.util.ConstantsHelper;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
@@ -129,4 +135,62 @@
if (runtime.isRemoteRuntime() == false)
assertBundleState(Bundle.UNINSTALLED, bundle.getState());
}
+
+ @Test
+ public void testHotDeploy() throws Exception
+ {
+ if (runtime.isRemoteRuntime() == false)
+ return;
+
+ File inFile = getTestArchiveFile("jbosgi99-allgood.jar");
+
+ // Copy the bundle to the deploy directory
+ String outPath = runtime.getBundle(0).getDataFile("dummy").getAbsolutePath();
+ outPath = outPath.substring(0, outPath.indexOf("data/osgi-store"));
+ File outFile = new File(outPath + "deploy/jbosgi99-allgood.jar");
+ copyfile(inFile, outFile);
+
+ int timeout = 5000;
+ OSGiBundle bundle = null;
+ while (timeout > 0)
+ {
+ bundle = runtime.getBundle("jbosgi99-allgood", null);
+ if (bundle != null && bundle.getState() == Bundle.ACTIVE)
+ break;
+
+ Thread.sleep(200);
+ timeout -= 200;
+ }
+
+ assertNotNull("Bundle not null", bundle);
+ assertBundleState(Bundle.ACTIVE, bundle.getState());
+
+ // Delete the bundle from the deploy directory
+ outFile.delete();
+
+ timeout = 5000;
+ while (timeout > 0)
+ {
+ if (bundle.getState() == Bundle.UNINSTALLED)
+ break;
+
+ Thread.sleep(200);
+ timeout -= 200;
+ }
+
+ assertBundleState(Bundle.UNINSTALLED, bundle.getState());
+ }
+
+ private void copyfile(File inFile, File outFile) throws IOException
+ {
+ FileInputStream in = new FileInputStream(inFile);
+ FileOutputStream out = new FileOutputStream(outFile);
+
+ int c;
+ while ((c = in.read()) != -1)
+ out.write(c);
+
+ in.close();
+ out.close();
+ }
}
\ No newline at end of file
15 years, 11 months
JBoss-OSGI SVN: r99879 - projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-25 02:38:24 -0500 (Mon, 25 Jan 2010)
New Revision: 99879
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml
Log:
Fix TCK setup
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml 2010-01-25 07:37:43 UTC (rev 99878)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml 2010-01-25 07:38:24 UTC (rev 99879)
@@ -62,7 +62,7 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
+ <bean name="OSGiServiceManagerPlugin" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
@@ -154,7 +154,6 @@
<bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
<bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />
- <bean name="OSGiNativeCodePolicyDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodePolicyDeployer" />
<!--
********************************
@@ -173,7 +172,7 @@
<bean name="OSGiClassLoaderFactory" class="org.jboss.osgi.framework.classloading.OSGiClassLoaderFactory" >
<property name="system"><inject bean="OSGiClassLoaderSystem"/></property>
</bean>
- <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleClassLoadingDeployer">
+ <bean name="OSGiClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleClassLoadingDeployer">
<property name="domain"><inject bean="OSGiClassLoaderDomain"/></property>
<property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
</bean>
@@ -181,6 +180,9 @@
<property name="domain"><inject bean="OSGiClassLoaderDomain"/></property>
<property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
</bean>
+ <bean name="OSGiModuleDeployer" class="org.jboss.osgi.framework.deployers.OSGiModuleDeployer">
+ <property name="classLoading"><inject bean="ClassLoading" /></property>
+ </bean>
<bean name="OSGiFragmentAttachmentDeployer" class="org.jboss.osgi.framework.deployers.OSGiFragmentAttachmentDeployer"/>
<bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
@@ -193,9 +195,6 @@
</property>
</bean>
<bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer" />
- <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
- <property name="classLoading"><inject bean="ClassLoading" /></property>
- </bean>
<bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
<property name="classLoading"><inject bean="ClassLoading" /></property>
<property name="system"><inject bean="OSGiClassLoaderSystem" /></property>
15 years, 11 months
JBoss-OSGI SVN: r99814 - projects/jboss-osgi/trunk/reactor/jbossmc-javadoc.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-22 11:31:00 -0500 (Fri, 22 Jan 2010)
New Revision: 99814
Modified:
projects/jboss-osgi/trunk/reactor/jbossmc-javadoc/pom.xml
Log:
excludePackageNames
*.internal:*.plugins:*.test
Modified: projects/jboss-osgi/trunk/reactor/jbossmc-javadoc/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/jbossmc-javadoc/pom.xml 2010-01-22 16:25:17 UTC (rev 99813)
+++ projects/jboss-osgi/trunk/reactor/jbossmc-javadoc/pom.xml 2010-01-22 16:31:00 UTC (rev 99814)
@@ -189,7 +189,7 @@
<configuration>
<quiet>true</quiet>
<sourcepath>target/javadoc-src</sourcepath>
- <excludePackageNames>*.internal:*.integration</excludePackageNames>
+ <excludePackageNames>*.internal:*.plugins:*.test</excludePackageNames>
</configuration>
<executions>
<execution>
15 years, 11 months
JBoss-OSGI SVN: r99809 - projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-22 11:00:24 -0500 (Fri, 22 Jan 2010)
New Revision: 99809
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java
Log:
Prevent CCE with default ClassLoadingMetaData
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java 2010-01-22 15:45:10 UTC (rev 99808)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java 2010-01-22 16:00:24 UTC (rev 99809)
@@ -32,7 +32,9 @@
import org.jboss.classloader.spi.NativeLibraryProvider;
import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
import org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.osgi.framework.bundle.AbstractBundleState;
import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
@@ -61,7 +63,8 @@
if (absBundleState instanceof AbstractDeployedBundleState)
{
AbstractDeployedBundleState depBundleState = (AbstractDeployedBundleState)absBundleState;
- Module module = depBundleState.getDeploymentUnit().getAttachment(Module.class);
+ DeploymentUnit unit = depBundleState.getDeploymentUnit();
+ Module module = unit.getAttachment(Module.class);
if (module instanceof OSGiModule == false)
throw new IllegalStateException("Not an instance of OSGiModule: " + module);
@@ -77,36 +80,56 @@
setBlackListable(osgiModule.isBlackListable());
setDelegates(osgiModule.getDelegates());
- // NativeCode-Library handling
- OSGiClassLoadingMetaData classLoadingMetaData = osgiModule.getClassLoadingMetaData();
- NativeLibraryMetaData libMetaData = classLoadingMetaData.getNativeLibraries();
- if (libMetaData != null && libMetaData.getNativeLibraries() != null)
+ // Bundle-NativeCode handling
+ processNativeLibraryMetaData(depBundleState);
+ }
+ }
+
+ /**
+ * Processes the NativeLibraryMetaData that is part of the OSGiClassLoadingMetaData
+ * and adds the NativeLibraryProviders to the ClassLoaderPolicy
+ */
+ private void processNativeLibraryMetaData(AbstractBundleState absBundleState)
+ {
+ if (absBundleState instanceof OSGiBundleState == false)
+ return;
+
+ OSGiBundleState bundleState = (OSGiBundleState)absBundleState;
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ ClassLoadingMetaData clMetaData = unit.getAttachment(ClassLoadingMetaData.class);
+ if (clMetaData instanceof OSGiClassLoadingMetaData == false)
+ return;
+
+ OSGiClassLoadingMetaData classLoadingMetaData = (OSGiClassLoadingMetaData)clMetaData;
+ NativeLibraryMetaData libMetaData = classLoadingMetaData.getNativeLibraries();
+ if (libMetaData == null || libMetaData.getNativeLibraries() == null)
+ return;
+
+ // Add the native library mappings to the OSGiClassLoaderPolicy
+ for (NativeLibrary library : libMetaData.getNativeLibraries())
+ {
+ String libpath = library.getLibraryPath();
+ String libfile = new File(libpath).getName();
+ String libname = libfile.substring(0, libfile.lastIndexOf('.'));
+
+ // Add the library provider to the policy
+ NativeLibraryProvider libProvider = new OSGiNativeLibraryProvider(bundleState, libname, libpath);
+ addNativeLibrary(libProvider);
+
+ // [TODO] why does the TCK use 'Native' to mean 'libNative' ?
+ if (libname.startsWith("lib"))
{
- OSGiBundleState bundleState = (OSGiBundleState)absBundleState;
-
- // Add the native library mappings to the OSGiClassLoaderPolicy
- for (NativeLibrary library : libMetaData.getNativeLibraries())
- {
- String libpath = library.getLibraryPath();
- String libfile = new File(libpath).getName();
- String libname = libfile.substring(0, libfile.lastIndexOf('.'));
-
- // Add the library provider to the policy
- NativeLibraryProvider libProvider = new OSGiNativeLibraryProvider(bundleState, libname, libpath);
- addNativeLibrary(libProvider);
-
- // [TODO] why does the TCK use 'Native' to mean 'libNative' ?
- if (libname.startsWith("lib"))
- {
- libname = libname.substring(3);
- libProvider = new OSGiNativeLibraryProvider(bundleState, libname, libpath);
- addNativeLibrary(libProvider);
- }
- }
+ libname = libname.substring(3);
+ libProvider = new OSGiNativeLibraryProvider(bundleState, libname, libpath);
+ addNativeLibrary(libProvider);
}
}
}
+ /**
+ * An implementation of NativeLibraryProvider that provides the native library file
+ * location from the bundle that contains the library.
+ */
static class OSGiNativeLibraryProvider implements NativeLibraryProvider
{
private OSGiBundleState bundleState;
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java 2010-01-22 15:45:10 UTC (rev 99808)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java 2010-01-22 16:00:24 UTC (rev 99809)
@@ -37,20 +37,8 @@
/** The serialVersionUID */
private static final long serialVersionUID = 1L;
- private OSGiClassLoadingMetaData metaData;
-
public OSGiModule(DeploymentUnit unit, ClassLoadingMetaData metaData)
{
super(unit);
-
- if (metaData instanceof OSGiClassLoadingMetaData == false)
- throw new IllegalStateException("Not an instance of OSGiClassLoadingMetaData: " + metaData);
-
- this.metaData = (OSGiClassLoadingMetaData)metaData;
}
-
- public OSGiClassLoadingMetaData getClassLoadingMetaData()
- {
- return metaData;
- }
}
15 years, 11 months