Skip to content

Commit

Permalink
[JBOSGI-184] Allow for overlay of jboss-osgi-bootstrap.xml
Browse files Browse the repository at this point in the history
Add FIXME [JBOSGI-316] Test integrity of the jboss-osgi-framework-all.jar
  • Loading branch information
tdiesler committed Apr 29, 2010
1 parent e8aaf2b commit b688a0c
Show file tree
Hide file tree
Showing 14 changed files with 387 additions and 312 deletions.
5 changes: 1 addition & 4 deletions bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
</dependency>
</dependencies>

<!-- Build -->
<build>
<resources>
<resource>
Expand Down Expand Up @@ -240,10 +241,6 @@
<name>log4j.output.dir</name>
<value>${project.build.directory}</value>
</property>
<property>
<name>org.jboss.osgi.framework.launch.bootstrapPath</name>
<value>bootstrap/jboss-osgi-bootstrap.xml</value>
</property>
<property>
<name>jboss.osgi.framework.properties</name>
<value>${jboss.osgi.framework.properties}</value>
Expand Down
217 changes: 0 additions & 217 deletions bundle/src/etc/osgitck/jboss-osgi-bootstrap.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<deployment xmlns="urn:jboss:bean-deployer:2.0">

<!--
********************************
* *
* OSGi Framework *
* *
********************************
-->

<bean name="OSGiBundleManager" class="org.jboss.osgi.framework.bundle.OSGiBundleManager">
<constructor>
<parameter><inject bean="jboss.kernel:service=Kernel" /></parameter>
Expand All @@ -33,213 +25,4 @@
<uncallback method="removePlugin" />
</bean>

<!--
********************************
* *
* OSGi Framework MDR usage *
* *
********************************
-->

<bean name="MDRService" class="org.jboss.osgi.framework.bundle.MetaDataRetrievalService">
<constructor>
<parameter><inject bean="jboss.kernel:service=Kernel" /></parameter>
<parameter><inject bean="OSGiBundleManager" property="systemBundle" /></parameter>
</constructor>
<property name="factory"><inject bean="InstanceMDRFactory" /></property>
</bean>
<bean name="InstanceMDRFactory" class="org.jboss.osgi.framework.bundle.InstanceMetaDataRetrievalFactory">
<constructor><parameter><inject bean="jboss.kernel:service=Kernel" /></parameter></constructor>
<incallback method="addFactory" />
<uncallback method="removeFactory" />
</bean>
<bean name="OSGiDictionaryFactory" class="org.jboss.osgi.framework.bundle.OSGiServiceStateDictionaryFactory" />
<bean name="KernelDictionaryFactory" class="org.jboss.osgi.framework.bundle.KernelDictionaryFactory">
<constructor><parameter><inject bean="jboss.kernel:service=KernelConfigurator" /></parameter>
</constructor>
</bean>

<!--
********************************
* *
* OSGi Framework Plugins *
* *
********************************
-->

<bean name="OSGiControllerContextPlugin" class="org.jboss.osgi.framework.bundle.ControllerContextPluginImpl">
<constructor>
<parameter><inject bean="OSGiBundleManager" /></parameter>
<parameter><inject bean="OSGiDeploymentRegistry" /></parameter>
</constructor>
</bean>
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="OSGiServiceManagerPlugin" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
<constructor>
<parameter><inject bean="OSGiBundleManager" /></parameter>
<parameter><inject bean="OSGiDeploymentRegistry" /></parameter>
</constructor>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="OSGiSystemPackages" class="org.jboss.osgi.framework.plugins.internal.SystemPackagesPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>

<!--
********************************
* *
* OSGi Service Plugins *
* *
********************************
-->

<bean name="MicrocontainerService" class="org.jboss.osgi.framework.service.internal.MicrocontainerServiceImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
<related-class name="org.jboss.osgi.spi.service.MicrocontainerService">OSGi</related-class>
<demand state="PreInstall">MDRService</demand>
</bean>
<bean name="StartLevelService" class="org.jboss.osgi.framework.service.internal.StartLevelImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
<related-class name="org.osgi.service.startlevel.StartLevel">OSGi</related-class>
<demand state="PreInstall">MDRService</demand>
</bean>
<bean name="PackageAdminService" class="org.jboss.osgi.framework.packageadmin.PackageAdminImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
<related-class name="org.osgi.service.packageadmin.PackageAdmin">OSGi</related-class>
<demand state="PreInstall">MDRService</demand>
</bean>
<bean name="LifecycleInterceptorService" class="org.jboss.osgi.framework.service.internal.LifecycleInterceptorServiceImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
<related-class name="org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService">OSGi</related-class>
<demand state="PreInstall">MDRService</demand>
</bean>

<!--
********************************
* *
* OSGi Deployment *
* *
********************************
-->

<!-- The MainDeployer -->
<bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
<property name="structuralDeployers"><inject bean="StructuralDeployers" /></property>
<property name="deployers"><inject bean="Deployers" /></property>
</bean>

<!-- The holder for deployers that determine structure -->
<bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
<property name="structureBuilder">
<!-- The consolidator of the structure information -->
<bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder" />
</property>
<!-- Accept any implementor of structure deployer -->
<incallback method="addDeployer" />
<uncallback method="removeDeployer" />
</bean>

<!-- The holder for deployers that do real deployment -->
<bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
<constructor><parameter><inject bean="jboss.kernel:service=KernelController" /></parameter></constructor>
<!-- Accept any implementor of deployer -->
<incallback method="addDeployer" />
<uncallback method="removeDeployer" />
</bean>

<!-- Bundle Structure -->
<bean name="BundleStructure" class="org.jboss.osgi.deployer.BundleStructureDeployer" />

<!-- JAR & File Structure (needed for negative testing) -->
<bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure" />
<bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure" />

<!-- POJO Deployment -->
<bean name="BeanDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanDeployer" />
<bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer" />
<bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
<constructor>
<parameter class="org.jboss.dependency.spi.Controller"><inject bean="jboss.kernel:service=KernelController" /></parameter>
</constructor>
<property name="deploymentRegistry"><inject bean="OSGiDeploymentRegistry"/></property>
</bean>

<!-- The deployment registry -->
<bean name="OSGiDeploymentRegistry" class="org.jboss.deployers.structure.spi.helpers.AbstractDeploymentRegistry"/>

<!-- OSGI Deployment -->
<bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
<bean name="OSGiBundleStateCreateDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateCreateDeployer">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="OSGiBundleStateInstallDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateInstallDeployer"/>
<bean name="OSGiBundleStateResolveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateResolveDeployer"/>
<bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<bean name="OSGiDeploymentMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiDeploymentMetaDataDeployer" />
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
<bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />

<bean name="OSGiSingletonSchemaResolverFactory">
<constructor factoryClass="org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory" factoryMethod="getInstance" />
</bean>
<bean name="Pojo2OSGiSchema" class="org.jboss.xb.binding.resolver.MutableSchemaResolver">
<constructor factoryMethod="getSchemaBindingResolver"><factory bean="OSGiSingletonSchemaResolverFactory" /></constructor>
<install method="mapURIToClass">
<parameter>urn:jboss:pojo2osgi:1.0</parameter>
<parameter>org.jboss.osgi.framework.metadata.internal.OSGiPojoMetaData</parameter>
</install>
<uninstall method="removeURIToClassMapping">
<parameter>urn:jboss:pojo2osgi:1.0</parameter>
</uninstall>
</bean>

<!--
********************************
* *
* OSGi Classloading *
* *
********************************
-->

<bean name="OSGiClassLoaderSystem" class="org.jboss.osgi.framework.classloading.OSGiClassLoaderSystem" />
<bean name="OSGiClassLoaderDomain" class="org.jboss.osgi.framework.classloading.OSGiClassLoaderDomain" >
<constructor><parameter>OSGiClassLoaderDomain</parameter></constructor>
<property name="classLoaderSystem"><inject bean="OSGiClassLoaderSystem"/></property>
<property name="bundleManager"><inject bean="OSGiBundleManager" /></property>
</bean>
<bean name="OSGiClassLoaderFactory" class="org.jboss.osgi.framework.classloading.OSGiClassLoaderFactory" >
<property name="system"><inject bean="OSGiClassLoaderSystem"/></property>
</bean>
<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>
<bean name="OSGiFragmentClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiFragmentClassLoadingDeployer">
<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">
<incallback method="addModule" state="Configured" />
<uncallback method="removeModule" state="Configured" />
</bean>
<bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
<property name="defaultMetaData">
<classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true" />
</property>
</bean>
<bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer" />
<bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
<property name="classLoading"><inject bean="ClassLoading" /></property>
<property name="system"><inject bean="OSGiClassLoaderSystem" /></property>
</bean>

</deployment>
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,8 @@

import static org.junit.Assert.assertEquals;

import java.io.File;
import java.io.FilenameFilter;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Map;

import org.jboss.osgi.framework.launch.OSGiFrameworkFactory;
import org.jboss.osgi.spi.util.ConstantsHelper;
import org.jboss.osgi.spi.util.ServiceLoader;
import org.junit.Ignore;
import org.junit.Test;
import org.osgi.framework.BundleException;
import org.osgi.framework.launch.Framework;
Expand Down Expand Up @@ -72,10 +63,12 @@ public void testFrameworkLaunch() throws BundleException
assertEquals("ACTIVE", state);
}

@Ignore
@Test
public void testFrameworkAllLaunch() throws Exception
{
// Get the aggregated framework jar
System.out.println("FIXME: [JBOSGI-316] Test integrity of the jboss-osgi-framework-all.jar");

/* Get the aggregated framework jar
File[] files = new File("./target").listFiles(new FilenameFilter()
{
public boolean accept(File dir, String name)
Expand All @@ -84,11 +77,12 @@ public boolean accept(File dir, String name)
}
});
assertEquals(1, files.length);

// Use a classloader that only contains the aggregated framework jar
URL frameworkAllURL = files[0].toURI().toURL();
URLClassLoader loader = new URLClassLoader(new URL[] { frameworkAllURL }, null);
// Load the FrameworkFactory
Class<?> factoryClass = loader.loadClass(OSGiFrameworkFactory.class.getName());
Object frameworkFactory = factoryClass.newInstance();
Expand All @@ -100,5 +94,6 @@ public boolean accept(File dir, String name)
// Start the Framework
method = framework.getClass().getMethod("start", new Class[] {});
method.invoke(framework, new Object[] {});
*/
}
}
48 changes: 48 additions & 0 deletions bundle/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<deployment xmlns="urn:jboss:bean-deployer:2.0">

<!--
********************************
* *
* OSGi Framework *
* *
********************************
-->

<bean name="OSGiBundleManager" class="org.jboss.osgi.framework.bundle.OSGiBundleManager">
<constructor>
<parameter><inject bean="jboss.kernel:service=Kernel" /></parameter>
<parameter><inject bean="MainDeployer" /></parameter>
</constructor>
<property name="properties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
<entry><key>org.osgi.framework.storage</key><value>target/osgi-store</value></entry>
<entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
<entry><key>org.osgi.framework.system.packages.extra</key><value>

<!-- logging -->
org.apache.log4j;version=1.2,
org.jboss.logging;version=2.1,

<!-- jboss -->
org.jboss.beans.metadata.plugins;version=2.2,
org.jboss.beans.metadata.plugins.builder;version=2.2,
org.jboss.beans.metadata.spi;version=2.2,
org.jboss.beans.metadata.spi.builder;version=2.2,
org.jboss.dependency.spi;version=2.2,
org.jboss.kernel.spi.dependency;version=2.2,

<!-- jboss-osgi -->
org.jboss.osgi.spi;version=1.0,
org.jboss.osgi.spi.capability;version=1.0,
org.jboss.osgi.spi.framework;version=1.0,
org.jboss.osgi.spi.service;version=1.0,
org.jboss.osgi.spi.util;version=1.0,
org.jboss.osgi.testing;version=1.0
</value></entry>
</map>
</property>
<incallback method="addPlugin" />
<uncallback method="removePlugin" />
</bean>

</deployment>
2 changes: 2 additions & 0 deletions core/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Expand Down
Loading

0 comments on commit b688a0c

Please sign in to comment.