[jboss-cvs] JBossAS SVN: r97025 - in projects/jboss-osgi/trunk/reactor/blueprint: scripts and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Nov 26 09:35:19 EST 2009
Author: thomas.diesler at jboss.com
Date: 2009-11-26 09:35:19 -0500 (Thu, 26 Nov 2009)
New Revision: 97025
Added:
projects/jboss-osgi/trunk/reactor/blueprint/scripts/
projects/jboss-osgi/trunk/reactor/blueprint/src/main/
projects/jboss-osgi/trunk/reactor/blueprint/src/test/
projects/jboss-osgi/trunk/reactor/blueprint/src/test/resources/jboss-osgi-framework.properties
Removed:
projects/jboss-osgi/trunk/reactor/blueprint/impl/
projects/jboss-osgi/trunk/reactor/blueprint/src/site/
projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/MockBlueprintContext.java
projects/jboss-osgi/trunk/reactor/blueprint/src/test/resources/jboss-osgi-felix.properties
projects/jboss-osgi/trunk/reactor/blueprint/testsuite/
Modified:
projects/jboss-osgi/trunk/reactor/blueprint/.classpath
projects/jboss-osgi/trunk/reactor/blueprint/pom.xml
projects/jboss-osgi/trunk/reactor/blueprint/scripts/antrun-test-jars.xml
projects/jboss-osgi/trunk/reactor/blueprint/scripts/assembly-bundles.xml
projects/jboss-osgi/trunk/reactor/blueprint/src/main/java/org/jboss/osgi/blueprint/parser/BlueprintParser.java
projects/jboss-osgi/trunk/reactor/blueprint/src/main/java/org/jboss/osgi/blueprint/parser/SchemaResolverParser.java
projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/AllElementsParserTestCase.java
projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java
projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java
projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BlueprintContainerParserTestCase.java
projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/RootElementParserTestCase.java
Log:
BP integration tests now part of the main BP build
Modified: projects/jboss-osgi/trunk/reactor/blueprint/.classpath
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/.classpath 2009-11-26 14:23:15 UTC (rev 97024)
+++ projects/jboss-osgi/trunk/reactor/blueprint/.classpath 2009-11-26 14:35:19 UTC (rev 97025)
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Modified: projects/jboss-osgi/trunk/reactor/blueprint/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/pom.xml 2009-11-26 14:23:15 UTC (rev 97024)
+++ projects/jboss-osgi/trunk/reactor/blueprint/pom.xml 2009-11-26 14:35:19 UTC (rev 97025)
@@ -10,18 +10,18 @@
<!-- ====================================================================== -->
<!-- $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 Reactor - Blueprint</name>
<groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-blueprint-parent</artifactId>
- <packaging>pom</packaging>
+ <artifactId>jboss-osgi-blueprint</artifactId>
+ <packaging>bundle</packaging>
<version>1.0.0.Alpha3</version>
-
+
<!-- Parent -->
<parent>
<groupId>org.jboss.osgi</groupId>
@@ -30,16 +30,253 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <!-- Modules -->
- <modules>
- <module>impl</module>
- <module>testsuite</module>
- </modules>
-
<!-- Properties -->
<properties>
</properties>
-
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.osgi.runtime</groupId>
+ <artifactId>jboss-osgi-deployment</artifactId>
+ </dependency>
+
+ <!-- Provided Dependencies -->
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-apache-xerces</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-husky</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jaxb</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-microcontainer</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-xml-binding</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- OSGi Dependencies -->
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <!-- Build -->
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
+ <Bundle-Activator>org.jboss.osgi.blueprint.extender.BlueprintActivator</Bundle-Activator>
+ <Private-Package>
+ org.jboss.osgi.blueprint.*
+ </Private-Package>
+ <Export-Package>
+ org.jboss.osgi.blueprint;version=1.0.0,
+ org.osgi.service.blueprint.*;version=1.0
+ </Export-Package>
+ <Import-Package>
+ javax.xml.bind.annotation,
+ javax.xml.namespace,
+ org.apache.xerces.dom,
+ org.jboss.beans.metadata*,
+ org.jboss.dependency.spi,
+ org.jboss.kernel.spi*,
+ org.jboss.osgi.deployment.interceptor,
+ org.jboss.osgi.jbossxb;version=2.0,
+ org.jboss.osgi.microcontainer;version=1.0,
+ org.jboss.osgi.spi;version=1.0,
+ org.jboss.osgi.spi.capability;version=1.0,
+ org.jboss.osgi.spi.service;version=1.0,
+ org.jboss.osgi.spi.util;version=1.0,
+ org.jboss.reflect.spi,
+ org.jboss.xb.annotations,
+ org.osgi.framework,
+ org.osgi.service.blueprint.container;version=1.0,
+ org.osgi.service.blueprint.reflect;version=1.0,
+ org.osgi.service.log;version=1.3,
+ org.osgi.util.tracker;version=1.4,
+ org.slf4j;version="[1.5,2.0)",
+ org.w3c.dom,
+ org.xml.sax,
+ </Import-Package>
+ </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>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>bundles</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>directory-single</goal>
+ </goals>
+ <configuration>
+ <finalName>test-libs</finalName>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>scripts/assembly-bundles.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ <execution>
+ <id>compendium</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>directory-single</goal>
+ </goals>
+ <configuration>
+ <finalName>test-libs</finalName>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>scripts/assembly-compendium.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-test-jars</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+ <property name="artifactId" value="${artifactId}" />
+ <property name="tests.output.dir" value="${project.build.directory}" />
+ <property name="build.artifact" value="${project.build.finalName}" />
+ <ant antfile="scripts/antrun-test-jars.xml" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-integration-tests</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <argLine>${surefire.jpda.args}</argLine>
+ <systemProperties>
+ <property>
+ <name>java.protocol.handler.pkgs</name>
+ <value>org.jboss.net.protocol|org.jboss.virtual.protocol</value>
+ </property>
+ <property>
+ <name>log4j.output.dir</name>
+ <value>${project.build.directory}</value>
+ </property>
+ <property>
+ <name>org.jboss.osgi.husky.Invoker</name>
+ <value>org.jboss.osgi.husky.internal.OSGiInvoker</value>
+ </property>
+ <property>
+ <name>test.archive.directory</name>
+ <value>${project.build.directory}/test-libs</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
<!-- Profiles -->
<profiles>
@@ -62,6 +299,16 @@
<scope>provided</scope>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</profile>
<!--
@@ -84,32 +331,32 @@
</dependency>
</dependencies>
</profile>
-
- <!--
- Name: framework-jbossmc
- Descr: Setup for JBossMC framework integration testing
- -->
<profile>
- <id>framework-jbossmc</id>
+ <id>framework-felix-default</id>
<activation>
<property>
- <name>framework</name>
- <value>jbossmc</value>
+ <name>!framework</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.jboss.osgi.runtime</groupId>
- <artifactId>jboss-osgi-framework</artifactId>
+ <artifactId>jboss-osgi-runtime-felix</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
+
+ <!--
+ Name: framework-jbossmc
+ Descr: Setup for JBossMC framework integration testing
+ -->
<profile>
- <id>framework-default</id>
+ <id>framework-jbossmc</id>
<activation>
<property>
- <name>!framework</name>
+ <name>framework</name>
+ <value>jbossmc</value>
</property>
</activation>
<dependencies>
@@ -119,7 +366,11 @@
<scope>provided</scope>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ </plugins>
+ </build>
</profile>
</profiles>
-
+
</project>
Copied: projects/jboss-osgi/trunk/reactor/blueprint/scripts (from rev 97013, projects/jboss-osgi/trunk/reactor/blueprint/testsuite/scripts)
Modified: projects/jboss-osgi/trunk/reactor/blueprint/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/scripts/antrun-test-jars.xml 2009-11-26 07:32:06 UTC (rev 97013)
+++ projects/jboss-osgi/trunk/reactor/blueprint/scripts/antrun-test-jars.xml 2009-11-26 14:35:19 UTC (rev 97025)
@@ -32,6 +32,9 @@
</classpath>
</taskdef>
+ <!-- Copy build artifact to test-libs/bundles -->
+ <copy file="${tests.output.dir}/${build.artifact}.jar" tofile="${tests.output.dir}/test-libs/bundles/${artifactId}.jar" overwrite="true"/>
+
</target>
<!-- ================================================================== -->
Modified: projects/jboss-osgi/trunk/reactor/blueprint/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/scripts/assembly-bundles.xml 2009-11-26 07:32:06 UTC (rev 97013)
+++ projects/jboss-osgi/trunk/reactor/blueprint/scripts/assembly-bundles.xml 2009-11-26 14:35:19 UTC (rev 97025)
@@ -15,7 +15,6 @@
<outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
<includes>
<include>*:jboss-osgi-apache-xerces:jar</include>
- <include>*:jboss-osgi-blueprint:jar</include>
<include>*:jboss-osgi-common:jar</include>
<include>*:jboss-osgi-common-core:jar</include>
<include>*:jboss-osgi-deployment:jar</include>
Copied: projects/jboss-osgi/trunk/reactor/blueprint/src/main (from rev 97013, projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main)
Modified: projects/jboss-osgi/trunk/reactor/blueprint/src/main/java/org/jboss/osgi/blueprint/parser/BlueprintParser.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/BlueprintParser.java 2009-11-26 07:32:06 UTC (rev 97013)
+++ projects/jboss-osgi/trunk/reactor/blueprint/src/main/java/org/jboss/osgi/blueprint/parser/BlueprintParser.java 2009-11-26 14:35:19 UTC (rev 97025)
@@ -52,7 +52,6 @@
public BlueprintParser(BlueprintContext context)
{
this.context = context;
-
this.parser = new SchemaResolverParser(context);
}
Modified: projects/jboss-osgi/trunk/reactor/blueprint/src/main/java/org/jboss/osgi/blueprint/parser/SchemaResolverParser.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/SchemaResolverParser.java 2009-11-26 07:32:06 UTC (rev 97013)
+++ projects/jboss-osgi/trunk/reactor/blueprint/src/main/java/org/jboss/osgi/blueprint/parser/SchemaResolverParser.java 2009-11-26 14:35:19 UTC (rev 97025)
@@ -23,16 +23,15 @@
//$Id$
+import java.io.IOException;
import java.net.URL;
import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.BlueprintException;
import org.jboss.osgi.blueprint.parser.xb.TBlueprint;
-import org.jboss.util.xml.JBossEntityResolver;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.osgi.jbossxb.UnmarshallerService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
/**
* The Blueprint descriptor parser.
@@ -42,8 +41,11 @@
*/
public class SchemaResolverParser implements JBossXBParser
{
- public SchemaResolverParser(BlueprintContext context)
+ private BlueprintContext bpContext;
+
+ public SchemaResolverParser(BlueprintContext bpContext)
{
+ this.bpContext = bpContext;
}
/*
@@ -54,39 +56,29 @@
if (xmlURL == null)
throw new IllegalArgumentException("Cannot parse null descriptor URL");
- ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ BundleContext context = bpContext.getBundleContext();
+ ServiceReference sref = context.getServiceReference(UnmarshallerService.class.getName());
+ if (sref == null)
+ throw new IllegalStateException("Cannot obtain: " + UnmarshallerService.class.getName());
+
+ UnmarshallerService unmarshaller = (UnmarshallerService)context.getService(sref);
try
{
- ClassLoader bundleCL = getClass().getClassLoader();
- Thread.currentThread().setContextClassLoader(bundleCL);
-
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
unmarshaller.setSchemaValidation(true);
unmarshaller.setNamespaceAware(true);
unmarshaller.setValidation(true);
-
- // This is EntityResolver that SAX parser (xerces) will use to resolve XSD location for the XML being parsed
- // Here we map schema location specified in the XSD file to the local schema location,
- // which is a path relative to the resources directory visible in the classpath.
- JBossEntityResolver xmlResolver = new JBossEntityResolver();
- xmlResolver.registerLocalEntity("http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd", "schema/blueprint.xsd");
- unmarshaller.setEntityResolver(xmlResolver);
-
- // This is to resolve namespace to class mapping and build the SchemaBinding from the class
- DefaultSchemaResolver schemaBindingResolver = new DefaultSchemaResolver();
- schemaBindingResolver.addClassBinding(BlueprintContext.XMLNS_BLUEPRINT, TBlueprint.class);
-
- TBlueprint tBlueprint = (TBlueprint)unmarshaller.unmarshal(xmlURL.toExternalForm(), schemaBindingResolver);
+ unmarshaller.registerSchemaLocation("http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd", "schema/blueprint.xsd");
+
+ unmarshaller.addClassBinding(BlueprintContext.XMLNS_BLUEPRINT, TBlueprint.class);
+
+ TBlueprint tBlueprint = (TBlueprint)unmarshaller.unmarshal(xmlURL.toExternalForm());
+
return tBlueprint;
}
- catch (JBossXBException ex)
+ catch (IOException ex)
{
throw new BlueprintException("Cannot parse blueprint descriptor: " + xmlURL, ex);
}
- finally
- {
- Thread.currentThread().setContextClassLoader(ctxLoader);
- }
}
}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/reactor/blueprint/src/test (from rev 97013, projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test)
Deleted: projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/MockBlueprintContext.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/MockBlueprintContext.java 2009-11-26 07:32:06 UTC (rev 97013)
+++ projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/MockBlueprintContext.java 2009-11-26 14:35:19 UTC (rev 97025)
@@ -1,100 +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.blueprint;
-
-//$Id$
-
-import org.jboss.osgi.blueprint.BlueprintContext;
-import org.jboss.osgi.blueprint.parser.BlueprintParser;
-import org.jboss.osgi.spi.NotImplementedException;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.log.LogService;
-
-/**
- * A mock {@link BlueprintContext}
- *
- * @author thomas.diesler at jboss.com
- * @since 13-May-2009
- */
-public class MockBlueprintContext implements BlueprintContext
-{
- public BlueprintParser getBlueprintParser()
- {
- throw new NotImplementedException();
- }
-
- public BundleContext getBundleContext()
- {
- throw new NotImplementedException();
- }
-
- public LogService getLog()
- {
- return new LogService()
- {
- public void log(int level, String message)
- {
- System.out.println(logLevel(level) + " - " + message);
- }
-
- public void log(int level, String message, Throwable ex)
- {
- System.out.println(logLevel(level) + " - " + message);
- ex.printStackTrace(System.out);
- }
-
- public void log(ServiceReference arg0, int arg1, String arg2)
- {
- throw new NotImplementedException();
- }
-
- public void log(ServiceReference arg0, int arg1, String arg2, Throwable arg3)
- {
- throw new NotImplementedException();
- }
- };
- }
-
- private String logLevel(int level)
- {
- String logLevel;
- switch (level)
- {
- case LogService.LOG_DEBUG:
- logLevel = "DEBUG";
- break;
- case LogService.LOG_INFO:
- logLevel = "INFO";
- break;
- case LogService.LOG_WARNING:
- logLevel = "WARN";
- break;
- case LogService.LOG_ERROR:
- logLevel = "ERROR";
- break;
- default:
- logLevel = "Level=" + level;
- }
- return logLevel;
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/AllElementsParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/AllElementsParserTestCase.java 2009-11-26 07:32:06 UTC (rev 97013)
+++ projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/AllElementsParserTestCase.java 2009-11-26 14:35:19 UTC (rev 97025)
@@ -51,15 +51,15 @@
* @author thomas.diesler at jboss.com
* @since 13-May-2009
*/
-public class AllElementsParserTestCase
+public class AllElementsParserTestCase extends AbstractParserTestCase
{
private static TBlueprint blueprint;
@BeforeClass
- public static void beforeClass()
+ public static void beforeClass() throws Exception
{
URL xmlURL = new OSGiTestHelper().getResourceURL("parser/blueprint-all-elements.xml");
- blueprint = new BlueprintParser(new MockBlueprintContext()).parse(xmlURL);
+ blueprint = new AllElementsParserTestCase().parse(xmlURL);
}
@Test
Modified: projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java 2009-11-26 07:32:06 UTC (rev 97013)
+++ projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java 2009-11-26 14:35:19 UTC (rev 97025)
@@ -26,18 +26,13 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import java.net.URL;
import java.util.List;
-import org.jboss.osgi.blueprint.parser.BlueprintParser;
import org.jboss.osgi.blueprint.parser.xb.TBean;
import org.jboss.osgi.blueprint.parser.xb.TBlueprint;
import org.jboss.osgi.blueprint.parser.xb.TComponent;
-import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.test.osgi.blueprint.MockBlueprintContext;
import org.jboss.test.osgi.blueprint.parser.common.BeanA;
import org.jboss.test.osgi.blueprint.parser.common.BeanB;
-import org.junit.BeforeClass;
import org.junit.Test;
/**
@@ -46,28 +41,21 @@
* @author thomas.diesler at jboss.com
* @since 13-May-2009
*/
-public class BasicBeansParserTestCase
+public class BasicBeansParserTestCase extends AbstractParserTestCase
{
- static TBlueprint blueprint;
-
- @BeforeClass
- public static void beforeClass()
- {
- URL xmlURL = new OSGiTestHelper().getResourceURL("parser/blueprint-basic-beans.xml");
- blueprint = new BlueprintParser(new MockBlueprintContext()).parse(xmlURL);
- }
-
@Test
public void testBasicBeans() throws Exception
{
+ TBlueprint blueprint = parse(getResourceURL("parser/blueprint-basic-beans.xml"));
+
List<TComponent> compList = blueprint.getComponents();
assertTrue(compList.size() > 0);
-
+
TBean beanA = (TBean)compList.get(0);
assertEquals(BeanA.class.getName(), beanA.getClassName());
assertEquals("beanA", beanA.getId());
assertEquals("BeanA Description", beanA.getDescription());
-
+
TBean beanB = (TBean)compList.get(1);
assertEquals(BeanB.class.getName(), beanB.getClassName());
assertEquals("beanB", beanB.getId());
Modified: projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java 2009-11-26 07:32:06 UTC (rev 97013)
+++ projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java 2009-11-26 14:35:19 UTC (rev 97025)
@@ -26,21 +26,15 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import java.net.URL;
import java.util.List;
-import org.jboss.osgi.blueprint.parser.BlueprintParser;
import org.jboss.osgi.blueprint.parser.xb.TBean;
import org.jboss.osgi.blueprint.parser.xb.TBlueprint;
import org.jboss.osgi.blueprint.parser.xb.TComponent;
import org.jboss.osgi.blueprint.parser.xb.TService;
-import org.jboss.osgi.testing.OSGiTest;
-import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.test.osgi.blueprint.MockBlueprintContext;
import org.jboss.test.osgi.blueprint.parser.common.BeanA;
import org.jboss.test.osgi.blueprint.parser.common.ServiceA;
import org.jboss.test.osgi.blueprint.parser.common.ServiceB;
-import org.junit.BeforeClass;
import org.junit.Test;
/**
@@ -49,37 +43,30 @@
* @author thomas.diesler at jboss.com
* @since 13-May-2009
*/
-public class BasicServiceParserTestCase extends OSGiTest
+public class BasicServiceParserTestCase extends AbstractParserTestCase
{
- static TBlueprint blueprint;
-
- @BeforeClass
- public static void beforeClass()
- {
- URL xmlURL = new OSGiTestHelper().getResourceURL("parser/blueprint-basic-service.xml");
- blueprint = new BlueprintParser(new MockBlueprintContext()).parse(xmlURL);
- }
-
@Test
public void testBasicService() throws Exception
{
+ TBlueprint blueprint = parse(getResourceURL("parser/blueprint-basic-service.xml"));
+
List<TComponent> compList = blueprint.getComponents();
assertTrue(compList.size() > 0);
-
+
TBean beanA = (TBean)compList.get(0);
assertEquals(BeanA.class.getName(), beanA.getClassName());
assertEquals("beanA", beanA.getId());
-
+
TService serviceA = (TService)compList.get(1);
assertEquals("serviceA", serviceA.getId());
-
+
List<String> intfsA = serviceA.getInterfaces().getValues();
assertTrue(intfsA.size() > 0);
assertEquals(ServiceA.class.getName(), intfsA.get(0));
-
+
TService serviceB = (TService)compList.get(2);
assertEquals("serviceB", serviceB.getId());
-
+
List<String> intfsB = serviceB.getInterfaces().getValues();
assertTrue(intfsB.size() > 0);
assertEquals(ServiceB.class.getName(), intfsB.get(0));
Modified: projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BlueprintContainerParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BlueprintContainerParserTestCase.java 2009-11-26 07:32:06 UTC (rev 97013)
+++ projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BlueprintContainerParserTestCase.java 2009-11-26 14:35:19 UTC (rev 97025)
@@ -31,14 +31,12 @@
import javax.management.MBeanServer;
-import org.jboss.osgi.blueprint.parser.BlueprintParser;
import org.jboss.osgi.blueprint.parser.xb.TBean;
import org.jboss.osgi.blueprint.parser.xb.TBlueprint;
import org.jboss.osgi.blueprint.parser.xb.TProperty;
import org.jboss.osgi.blueprint.parser.xb.TReference;
import org.jboss.osgi.blueprint.parser.xb.TService;
import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.test.osgi.blueprint.MockBlueprintContext;
import org.jboss.test.osgi.blueprint.container.bundle.BeanA;
import org.jboss.test.osgi.blueprint.container.bundle.BeanB;
import org.jboss.test.osgi.blueprint.container.bundle.ServiceA;
@@ -52,15 +50,15 @@
* @author thomas.diesler at jboss.com
* @since 13-May-2009
*/
-public class BlueprintContainerParserTestCase
+public class BlueprintContainerParserTestCase extends AbstractParserTestCase
{
private static TBlueprint blueprint;
@BeforeClass
- public static void beforeClass()
+ public static void beforeClass() throws Exception
{
URL xmlURL = new OSGiTestHelper().getResourceURL("container/OSGI-INF/blueprint/basic-service.xml");
- blueprint = new BlueprintParser(new MockBlueprintContext()).parse(xmlURL);
+ blueprint = new BlueprintContainerParserTestCase().parse(xmlURL);
}
@Test
Modified: projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/RootElementParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/RootElementParserTestCase.java 2009-11-26 07:32:06 UTC (rev 97013)
+++ projects/jboss-osgi/trunk/reactor/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/RootElementParserTestCase.java 2009-11-26 14:35:19 UTC (rev 97025)
@@ -26,14 +26,10 @@
import static org.junit.Assert.assertEquals;
import java.math.BigInteger;
-import java.net.URL;
-import org.jboss.osgi.blueprint.parser.BlueprintParser;
import org.jboss.osgi.blueprint.parser.xb.TActivation;
import org.jboss.osgi.blueprint.parser.xb.TAvailability;
import org.jboss.osgi.blueprint.parser.xb.TBlueprint;
-import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.test.osgi.blueprint.MockBlueprintContext;
import org.junit.Test;
/**
@@ -42,13 +38,12 @@
* @author thomas.diesler at jboss.com
* @since 13-May-2009
*/
-public class RootElementParserTestCase
+public class RootElementParserTestCase extends AbstractParserTestCase
{
@Test
public void testBlueprintDefaultAttributes() throws Exception
{
- URL xmlURL = new OSGiTestHelper().getResourceURL("parser/blueprint-root-defaults.xml");
- TBlueprint blueprint = new BlueprintParser(new MockBlueprintContext()).parse(xmlURL);
+ TBlueprint blueprint = parse(getResourceURL("parser/blueprint-root-defaults.xml"));
// assert default attributes
assertEquals("availability", TAvailability.mandatory, blueprint.getDefaultAvailability());
@@ -59,8 +54,7 @@
@Test
public void testBlueprintDescription() throws Exception
{
- URL xmlURL = new OSGiTestHelper().getResourceURL("parser/blueprint-basic-root.xml");
- TBlueprint blueprint = new BlueprintParser(new MockBlueprintContext()).parse(xmlURL);
+ TBlueprint blueprint = parse(getResourceURL("parser/blueprint-basic-root.xml"));
// assert default attributes
assertEquals("availability", TAvailability.optional, blueprint.getDefaultAvailability());
Deleted: projects/jboss-osgi/trunk/reactor/blueprint/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/jboss-osgi-felix.properties 2009-11-26 07:32:06 UTC (rev 97013)
+++ projects/jboss-osgi/trunk/reactor/blueprint/src/test/resources/jboss-osgi-felix.properties 2009-11-26 14:35:19 UTC (rev 97025)
@@ -1,46 +0,0 @@
-#
-# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
-#
-# $Id$
-#
-
-# The OSGiFramework implementation
-org.jboss.osgi.spi.framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
-
-# Properties to configure the Framework
-org.osgi.framework.storage=${test.archive.directory}/../osgi-store
-org.osgi.framework.storage.clean=onFirstInit
-
-# Framework bootdelegation
-# org.osgi.framework.bootdelegation=org.osgi.service.log
-
-# Extra System Packages
-org.osgi.framework.system.packages.extra=\
- org.apache.log4j;version=1.2, \
- org.jboss.logging, \
- org.jboss.osgi.deployment.common;version=1.0, \
- org.jboss.osgi.deployment.deployer;version=1.0, \
- org.jboss.osgi.deployment.interceptor;version=1.0, \
- org.jboss.osgi.spi;version=1.0, \
- org.jboss.osgi.spi.capability;version=1.0, \
- org.jboss.osgi.spi.framework;version=1.0, \
- org.jboss.osgi.spi.management;version=1.0, \
- org.jboss.osgi.spi.service;version=1.0, \
- org.jboss.osgi.spi.util;version=1.0, \
- org.jboss.osgi.testing, \
- org.jboss.virtual, \
- org.jboss.virtual.plugins.registry, \
- org.jboss.virtual.plugins.context.jar, \
- org.jboss.virtual.plugins.vfs.helpers, \
- org.jboss.virtual.protocol, \
- org.osgi.framework;version=1.4
-
-# Bundles that need to be installed with the Framework automatically
-org.jboss.osgi.spi.framework.autoInstall=\
- file://${test.archive.directory}/bundles/org.osgi.compendium.jar
-
-# Bundles that need to be started automatically
-org.jboss.osgi.spi.framework.autoStart=\
- file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
- file://${test.archive.directory}/bundles/jboss-osgi-common.jar
-
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/reactor/blueprint/src/test/resources/jboss-osgi-framework.properties (from rev 97013, projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/jboss-osgi-felix.properties)
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/src/test/resources/jboss-osgi-framework.properties (rev 0)
+++ projects/jboss-osgi/trunk/reactor/blueprint/src/test/resources/jboss-osgi-framework.properties 2009-11-26 14:35:19 UTC (rev 97025)
@@ -0,0 +1,43 @@
+#
+# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
+#
+# $Id$
+#
+
+# Properties to configure the Framework
+org.osgi.framework.storage=${test.archive.directory}/../osgi-store
+org.osgi.framework.storage.clean=onFirstInit
+
+# Framework bootdelegation
+# org.osgi.framework.bootdelegation=org.osgi.service.log
+
+# Extra System Packages
+org.osgi.framework.system.packages.extra=\
+ org.apache.log4j;version=1.2, \
+ org.jboss.logging, \
+ org.jboss.osgi.deployment.common;version=1.0, \
+ org.jboss.osgi.deployment.deployer;version=1.0, \
+ org.jboss.osgi.deployment.interceptor;version=1.0, \
+ org.jboss.osgi.spi;version=1.0, \
+ org.jboss.osgi.spi.capability;version=1.0, \
+ org.jboss.osgi.spi.framework;version=1.0, \
+ org.jboss.osgi.spi.management;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, \
+ org.jboss.virtual;version=2.1, \
+ org.jboss.virtual.plugins.registry;version=2.1, \
+ org.jboss.virtual.plugins.context.jar;version=2.1, \
+ org.jboss.virtual.plugins.vfs.helpers;version=2.1, \
+ org.jboss.virtual.protocol;version=2.1, \
+ org.osgi.framework;version=1.4
+
+# Bundles that need to be installed with the Framework automatically
+org.jboss.osgi.spi.framework.autoInstall=\
+ file://${test.archive.directory}/bundles/org.osgi.compendium.jar
+
+# Bundles that need to be started automatically
+org.jboss.osgi.spi.framework.autoStart=\
+ file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-common.jar
+
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list