You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by tj...@apache.org on 2014/06/30 18:55:06 UTC
svn commit: r1606837 [7/27] - in /aries/branches/subsystemsR6: ./
application/ application/application-api/ application/application-bundle/
application/application-converters/
application/application-default-local-platform/
application/application-depl...
Modified: aries/branches/subsystemsR6/blueprint/blueprint-core/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-core/pom.xml?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-core/pom.xml (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-core/pom.xml Mon Jun 30 16:54:57 2014
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -17,19 +18,21 @@
under the License.
-->
<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>
+
<parent>
<groupId>org.apache.aries</groupId>
- <artifactId>java5-parent</artifactId>
- <version>1.0.0</version>
- <relativePath />
+ <artifactId>parent</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <relativePath>../../parent/pom.xml</relativePath>
</parent>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.core</artifactId>
<packaging>bundle</packaging>
<name>Apache Aries Blueprint Core</name>
- <version>1.3.1-SNAPSHOT</version>
+ <version>1.4.1-SNAPSHOT</version>
<description>
This bundle contains the core implementation of Blueprint
along with the "ext" namespace handler.
@@ -40,6 +43,7 @@
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/blueprint/blueprint-core</developerConnection>
<url>http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core</url>
</scm>
+
<properties>
<aries.osgi.activator>
org.apache.aries.blueprint.container.BlueprintExtender
@@ -85,14 +89,14 @@
{maven-resources},
org/apache/aries/blueprint/blueprint.xsd=${project.build.directory}/sources/org/osgi/service/blueprint/blueprint.xsd
</aries.osgi.include.resource>
-
<blueprint.annotation.api.version>1.0.0</blueprint.annotation.api.version>
<blueprint.api.version>1.0.0</blueprint.api.version>
- <blueprint.parser.version>1.1.0</blueprint.parser.version>
+ <blueprint.parser.version>1.2.1-SNAPSHOT</blueprint.parser.version>
<proxy.api.version>1.0.0</proxy.api.version>
- <proxy.impl.version>1.0.0</proxy.impl.version>
+ <proxy.impl.version>1.0.3-SNAPSHOT</proxy.impl.version>
<quiesce.api.version>1.0.0</quiesce.api.version>
<util.version>1.0.0</util.version>
+ <lastReleaseVersion>1.4.0</lastReleaseVersion>
</properties>
<profiles>
@@ -101,11 +105,11 @@
<properties>
<blueprint.annotation.api.version>1.0.1-SNAPSHOT</blueprint.annotation.api.version>
<blueprint.api.version>1.0.1-SNAPSHOT</blueprint.api.version>
- <blueprint.parser.version>1.1.0-SNAPSHOT</blueprint.parser.version>
- <proxy.api.version>1.0.1-SNAPSHOT</proxy.api.version>
- <proxy.impl.version>1.0.1-SNAPSHOT</proxy.impl.version>
- <quiesce.api.version>1.0.1-SNAPSHOT</quiesce.api.version>
- <util.version>1.0.1-SNAPSHOT</util.version>
+ <blueprint.parser.version>1.2.1-SNAPSHOT</blueprint.parser.version>
+ <proxy.api.version>1.0.0</proxy.api.version>
+ <proxy.impl.version>1.0.0</proxy.impl.version>
+ <quiesce.api.version>1.0.0</quiesce.api.version>
+ <util.version>1.0.0</util.version>
</properties>
</profile>
</profiles>
@@ -155,9 +159,9 @@
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
- <artifactId>asm-all</artifactId>
+ <artifactId>asm-debug-all</artifactId>
<optional>true</optional>
- <version>4.0</version>
+ <version>5.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.aries.quiesce</groupId>
@@ -186,7 +190,6 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
-
</dependencies>
<build>
@@ -229,7 +232,6 @@
<plugin>
<groupId>org.apache.aries.versioning</groupId>
<artifactId>org.apache.aries.versioning.plugin</artifactId>
- <version>0.1.0</version>
<executions>
<execution>
<id>default-verify</id>
@@ -237,9 +239,6 @@
<goals>
<goal>version-check</goal>
</goals>
- <configuration>
- <oldArtifact>org.apache.aries.blueprint:org.apache.aries.blueprint.core:1.2.0</oldArtifact>
- </configuration>
</execution>
</executions>
</plugin>
Modified: aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java Mon Jun 30 16:54:57 2014
@@ -38,6 +38,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.aries.blueprint.BlueprintConstants;
+import org.apache.aries.blueprint.ExtendedReferenceMetadata;
import org.apache.aries.blueprint.ExtendedServiceReferenceMetadata;
import org.apache.aries.blueprint.di.AbstractRecipe;
import org.apache.aries.blueprint.di.CollectionRecipe;
@@ -135,7 +136,7 @@ public abstract class AbstractServiceRef
// though this may not be sufficient because we don't control ordering of those events
synchronized (tracked) {
getBundleContextForServiceLookup().addServiceListener(this, getOsgiFilter());
- ServiceReference[] references = getBundleContextForServiceLookup().getServiceReferences(null, getOsgiFilter());
+ ServiceReference[] references = getBundleContextForServiceLookup().getServiceReferences((String) null, getOsgiFilter());
tracked.setInitial(references != null ? references : new ServiceReference[0]);
}
tracked.trackInitial();
@@ -626,7 +627,22 @@ public abstract class AbstractServiceRef
interfaceName = runtimeClass.getName();
}
if (interfaceName != null && interfaceName.length() > 0) {
- members.add("(" + Constants.OBJECTCLASS + "=" + interfaceName + ")");
+ if (metadata instanceof ExtendedReferenceMetadata) {
+ ExtendedReferenceMetadata erm = (ExtendedReferenceMetadata)metadata;
+ if (!erm.getExtraInterfaces().isEmpty()) {
+ StringBuilder sb = new StringBuilder("(&");
+ sb.append("(" + Constants.OBJECTCLASS + "=" + interfaceName + ")");
+ for (String s : erm.getExtraInterfaces()) {
+ sb.append("(" + Constants.OBJECTCLASS + "=" + s + ")");
+ }
+ sb.append(")");
+ members.add(sb.toString());
+ } else {
+ members.add("(" + Constants.OBJECTCLASS + "=" + interfaceName + ")");
+ }
+ } else {
+ members.add("(" + Constants.OBJECTCLASS + "=" + interfaceName + ")");
+ }
}
// Handle component name
String componentName = metadata.getComponentName();
Modified: aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BeanRecipe.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BeanRecipe.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BeanRecipe.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BeanRecipe.java Mon Jun 30 16:54:57 2014
@@ -284,7 +284,7 @@ public class BeanRecipe extends Abstract
try {
factoryObj = ((ReferenceRecipe.ServiceProxyWrapper) factoryObj).convert(new ReifiedType(Object.class));
} catch (Exception e) {
- throw new ComponentDefinitionException("Error when instantiating bean " + getName() + " of class " + getType(), getRealCause(e));
+ throw new ComponentDefinitionException("Error when instantiating bean " + getName() + " of class " + getType().getName(), getRealCause(e));
}
} else if (factoryObj instanceof UnwrapperedBeanHolder) {
factoryObj = wrap((UnwrapperedBeanHolder) factoryObj, Object.class);
@@ -297,7 +297,7 @@ public class BeanRecipe extends Abstract
Map.Entry<Method, List<Object>> match = matches.entrySet().iterator().next();
instance = invoke(match.getKey(), factoryObj, match.getValue().toArray());
} catch (Throwable e) {
- throw new ComponentDefinitionException("Error when instantiating bean " + getName() + " of class " + getType(), getRealCause(e));
+ throw new ComponentDefinitionException("Error when instantiating bean " + getName() + " of class " + getType().getName(), getRealCause(e));
}
} else if (matches.size() == 0) {
throw new ComponentDefinitionException("Unable to find a matching factory method " + factoryMethod + " on class " + factoryObj.getClass().getName() + " for arguments " + args + " when instanciating bean " + getName());
@@ -312,7 +312,7 @@ public class BeanRecipe extends Abstract
Map.Entry<Method, List<Object>> match = matches.entrySet().iterator().next();
instance = invoke(match.getKey(), null, match.getValue().toArray());
} catch (Throwable e) {
- throw new ComponentDefinitionException("Error when instantiating bean " + getName() + " of class " + getType(), getRealCause(e));
+ throw new ComponentDefinitionException("Error when instantiating bean " + getName() + " of class " + getType().getName(), getRealCause(e));
}
} else if (matches.size() == 0) {
throw new ComponentDefinitionException("Unable to find a matching factory method " + factoryMethod + " on class " + getType().getName() + " for arguments " + args + " when instanciating bean " + getName());
@@ -330,7 +330,7 @@ public class BeanRecipe extends Abstract
Map.Entry<Constructor, List<Object>> match = matches.entrySet().iterator().next();
instance = newInstance(match.getKey(), match.getValue().toArray());
} catch (Throwable e) {
- throw new ComponentDefinitionException("Error when instantiating bean " + getName() + " of class " + getType(), getRealCause(e));
+ throw new ComponentDefinitionException("Error when instantiating bean " + getName() + " of class " + getType().getName(), getRealCause(e));
}
} else if (matches.size() == 0) {
throw new ComponentDefinitionException("Unable to find a matching constructor on class " + getType().getName() + " for arguments " + args + " when instanciating bean " + getName());
Modified: aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java Mon Jun 30 16:54:57 2014
@@ -848,6 +848,8 @@ public class BlueprintContainerImpl
synchronized (scheduled) {
destroyed.set(true);
}
+ cancelFutureIfPresent();
+
eventDispatcher.blueprintEvent(new BlueprintEvent(BlueprintEvent.DESTROYING, getBundle(), getExtenderBundle()));
executors.shutdownNow();
if (handlerSet != null) {
Modified: aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceRecipe.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceRecipe.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceRecipe.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceRecipe.java Mon Jun 30 16:54:57 2014
@@ -98,6 +98,10 @@ public class ReferenceRecipe extends Abs
Set<Class<?>> interfaces = new HashSet<Class<?>>();
Class<?> clz = getInterfaceClass();
if (clz != null) interfaces.add(clz);
+
+ if (metadata instanceof ExtendedReferenceMetadata) {
+ interfaces.addAll(loadAllClasses(((ExtendedReferenceMetadata)metadata).getExtraInterfaces()));
+ }
proxy = createProxy(new ServiceDispatcher(), interfaces);
Modified: aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ServiceRecipe.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ServiceRecipe.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ServiceRecipe.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ServiceRecipe.java Mon Jun 30 16:54:57 2014
@@ -92,6 +92,7 @@ public class ServiceRecipe extends Abstr
/** Only ever access when holding a lock on <code>monitor</code> */
private boolean quiesce;
private Collection<DestroyCallback> destroyCallbacks = new ArrayList<DestroyCallback>();
+ private boolean initialServiceRegistration = true;
public ServiceRecipe(String name,
BlueprintContainerImpl blueprintContainer,
@@ -193,6 +194,7 @@ public class ServiceRecipe extends Abstr
reg.unregister();
}
}
+ initialServiceRegistration = false;
}
public void unregister() {
@@ -246,10 +248,8 @@ public class ServiceRecipe extends Abstr
*/
private Object internalGetService(Bundle bundle, ServiceRegistration registration) {
LOGGER.debug("Retrieving service for bundle {} and service registration {}", bundle, registration);
- if (this.service == null) {
- createService();
- }
-
+ createService();
+
Object service = this.service;
// We need the real service ...
if (bundle != null) {
@@ -274,35 +274,37 @@ public class ServiceRecipe extends Abstr
private void createService() {
try {
- LOGGER.debug("Creating service instance");
- //We can't use the BlueprintRepository because we don't know what interfaces
- //to use yet! We have to be a bit smarter.
- ExecutionContext old = ExecutionContext.Holder.setContext(blueprintContainer.getRepository());
-
- try {
- Object o = serviceRecipe.create();
-
- if (o instanceof Convertible) {
- o = blueprintContainer.getRepository().convert(o, new ReifiedType(Object.class));
- validateClasses(o);
- } else if (o instanceof UnwrapperedBeanHolder) {
- UnwrapperedBeanHolder holder = (UnwrapperedBeanHolder) o;
- validateClasses(holder.unwrapperedBean);
- o = BeanRecipe.wrap(holder, getClassesForProxying(holder.unwrapperedBean));
- } else {
- validateClasses(o);
+ if (service == null) {
+ LOGGER.debug("Creating service instance");
+ //We can't use the BlueprintRepository because we don't know what interfaces
+ //to use yet! We have to be a bit smarter.
+ ExecutionContext old = ExecutionContext.Holder.setContext(blueprintContainer.getRepository());
+
+ try {
+ Object o = serviceRecipe.create();
+
+ if (o instanceof Convertible) {
+ o = blueprintContainer.getRepository().convert(o, new ReifiedType(Object.class));
+ validateClasses(o);
+ } else if (o instanceof UnwrapperedBeanHolder) {
+ UnwrapperedBeanHolder holder = (UnwrapperedBeanHolder) o;
+ validateClasses(holder.unwrapperedBean);
+ o = BeanRecipe.wrap(holder, getClassesForProxying(holder.unwrapperedBean));
+ } else {
+ validateClasses(o);
+ }
+ service = o;
+ } catch (Exception e) {
+ LOGGER.error("Error retrieving service from " + this, e);
+ throw new ComponentDefinitionException(e);
+ } finally {
+ ExecutionContext.Holder.setContext(old);
}
- service = o;
- } catch (Exception e) {
- LOGGER.error("Error retrieving service from " + this, e);
- throw new ComponentDefinitionException(e);
- } finally {
- ExecutionContext.Holder.setContext(old);
- }
-
- LOGGER.debug("Service created: {}", service);
+ LOGGER.debug("Service created: {}", service);
+ }
+
// When the service is first requested, we need to create listeners and call them
- if (listeners == null) {
+ if (!initialServiceRegistration && listeners == null) {
LOGGER.debug("Creating listeners");
if (listenersRecipe != null) {
listeners = (List) createRecipe(listenersRecipe);
Modified: aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/impl/ExtNamespaceHandler.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/impl/ExtNamespaceHandler.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/impl/ExtNamespaceHandler.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/ext/impl/ExtNamespaceHandler.java Mon Jun 30 16:54:57 2014
@@ -74,6 +74,7 @@ public class ExtNamespaceHandler impleme
public static final String BLUEPRINT_EXT_NAMESPACE_V1_1 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.1.0";
public static final String BLUEPRINT_EXT_NAMESPACE_V1_2 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.2.0";
public static final String BLUEPRINT_EXT_NAMESPACE_V1_3 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.3.0";
+ public static final String BLUEPRINT_EXT_NAMESPACE_V1_4 = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.4.0";
public static final String PROPERTY_PLACEHOLDER_ELEMENT = "property-placeholder";
public static final String DEFAULT_PROPERTIES_ELEMENT = "default-properties";
@@ -106,6 +107,9 @@ public class ExtNamespaceHandler impleme
public static final String DEFAULT_REFERENCE_BEAN = "default";
public static final String FILTER_ATTRIBUTE = "filter";
+
+ public static final String ADDITIONAL_INTERFACES = "additional-interfaces";
+ public static final String INTERFACE_VALUE = "value";
private static final Logger LOGGER = LoggerFactory.getLogger(ExtNamespaceHandler.class);
@@ -126,11 +130,20 @@ public class ExtNamespaceHandler impleme
return getClass().getResource("blueprint-ext-1.2.xsd");
} else if (BLUEPRINT_EXT_NAMESPACE_V1_3.equals(namespace)) {
return getClass().getResource("blueprint-ext-1.3.xsd");
+ } else if (BLUEPRINT_EXT_NAMESPACE_V1_4.equals(namespace)) {
+ return getClass().getResource("blueprint-ext-1.4.xsd");
} else if ("http://www.w3.org/XML/1998/namespace".equals(namespace)) {
return getClass().getResource("xml.xsd");
}
return null;
}
+ public boolean isExtNamespace(String e) {
+ return BLUEPRINT_EXT_NAMESPACE_V1_0.equals(e)
+ || BLUEPRINT_EXT_NAMESPACE_V1_1.equals(e)
+ || BLUEPRINT_EXT_NAMESPACE_V1_2.equals(e)
+ || BLUEPRINT_EXT_NAMESPACE_V1_3.equals(e)
+ || BLUEPRINT_EXT_NAMESPACE_V1_4.equals(e);
+ }
public Set<Class> getManagedClasses() {
return new HashSet<Class>(Arrays.asList(
@@ -158,11 +171,31 @@ public class ExtNamespaceHandler impleme
return decorateDefaultBean(node, component, context);
} else if (node instanceof Attr && nodeNameEquals(node, FILTER_ATTRIBUTE)) {
return decorateFilter(node, component, context);
+ } else if (node instanceof Element && nodeNameEquals(node, ADDITIONAL_INTERFACES)) {
+ return decorateAdditionalInterfaces(node, component, context);
} else {
throw new ComponentDefinitionException("Unsupported node: " + node.getNodeName());
}
}
+ private ComponentMetadata decorateAdditionalInterfaces(Node node, ComponentMetadata component,
+ ParserContext context) {
+ if (!(component instanceof MutableReferenceMetadata)) {
+ throw new ComponentDefinitionException("Expected an instanceof MutableReferenceMetadata");
+ }
+ MutableReferenceMetadata mrm = (MutableReferenceMetadata)component;
+ List<String> list = new ArrayList<String>();
+ Node nd = node.getFirstChild();
+ while (nd != null) {
+ if (nd instanceof Element && nodeNameEquals(nd, INTERFACE_VALUE)) {
+ list.add(((Element)nd).getTextContent());
+ }
+ nd = nd.getNextSibling();
+ }
+ mrm.setExtraInterfaces(list);
+ return component;
+ }
+
private ComponentMetadata decorateDefaultBean(Node node,
ComponentMetadata component, ParserContext context)
{
@@ -296,10 +329,7 @@ public class ExtNamespaceHandler impleme
Node node = nl.item(i);
if (node instanceof Element) {
Element e = (Element) node;
- if (BLUEPRINT_EXT_NAMESPACE_V1_0.equals(e.getNamespaceURI())
- || BLUEPRINT_EXT_NAMESPACE_V1_1.equals(e.getNamespaceURI())
- || BLUEPRINT_EXT_NAMESPACE_V1_2.equals(e.getNamespaceURI())
- || BLUEPRINT_EXT_NAMESPACE_V1_3.equals(e.getNamespaceURI())) {
+ if (isExtNamespace(e.getNamespaceURI())) {
if (nodeNameEquals(e, DEFAULT_PROPERTIES_ELEMENT)) {
if (defaultsRef != null) {
throw new ComponentDefinitionException("Only one of " + DEFAULTS_REF_ATTRIBUTE + " attribute or " + DEFAULT_PROPERTIES_ELEMENT + " element is allowed");
@@ -328,10 +358,7 @@ public class ExtNamespaceHandler impleme
Node node = nl.item(i);
if (node instanceof Element) {
Element e = (Element) node;
- if (BLUEPRINT_EXT_NAMESPACE_V1_0.equals(e.getNamespaceURI())
- || BLUEPRINT_EXT_NAMESPACE_V1_1.equals(e.getNamespaceURI())
- || BLUEPRINT_EXT_NAMESPACE_V1_2.equals(e.getNamespaceURI())
- || BLUEPRINT_EXT_NAMESPACE_V1_3.equals(e.getNamespaceURI())) {
+ if (isExtNamespace(e.getNamespaceURI())) {
if (nodeNameEquals(e, PROPERTY_ELEMENT)) {
BeanProperty prop = context.parseElement(BeanProperty.class, enclosingComponent, e);
props.addEntry(createValue(context, prop.getName(), String.class.getName()), prop.getValue());
Modified: aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/packageinfo
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/packageinfo?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/packageinfo (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/packageinfo Mon Jun 30 16:54:57 2014
@@ -16,4 +16,4 @@
# specific language governing permissions and limitations
# under the License.
#
-version 1.2.0
+version 1.3.0
Modified: aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/resources/OSGI-INF/blueprint/blueprint-ext.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/resources/OSGI-INF/blueprint/blueprint-ext.xml?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/resources/OSGI-INF/blueprint/blueprint-ext.xml (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-core/src/main/resources/OSGI-INF/blueprint/blueprint-ext.xml Mon Jun 30 16:54:57 2014
@@ -42,6 +42,11 @@
<entry key="osgi.service.blueprint.namespace" value="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.3.0"/>
</service-properties>
</service>
+ <service ref="ExtNamespaceHandler" interface="org.apache.aries.blueprint.NamespaceHandler">
+ <service-properties>
+ <entry key="osgi.service.blueprint.namespace" value="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.4.0"/>
+ </service-properties>
+ </service>
<!-- Also provide the "xml" namespace as a core functionality to avoid many bundles registering a handler for this -->
<service ref="ExtNamespaceHandler" interface="org.apache.aries.blueprint.NamespaceHandler">
Modified: aries/branches/subsystemsR6/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/TestBundleContext.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/TestBundleContext.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/TestBundleContext.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/TestBundleContext.java Mon Jun 30 16:54:57 2014
@@ -20,6 +20,7 @@ package org.apache.aries.blueprint;
import java.io.File;
import java.io.InputStream;
+import java.util.Collection;
import java.util.Dictionary;
import org.osgi.framework.Bundle;
@@ -65,6 +66,8 @@ public class TestBundleContext implement
return null;
}
+ public Bundle getBundle(String arg0) { return null; }
+
public Bundle[] getBundles() {
return null;
}
@@ -85,8 +88,15 @@ public class TestBundleContext implement
return null;
}
- public ServiceReference[] getServiceReferences(String arg0, String arg1)
- throws InvalidSyntaxException {
+ public ServiceReference getServiceReference(Class aClass) {
+ return null;
+ }
+
+ public ServiceReference[] getServiceReferences(String arg0, String arg1) throws InvalidSyntaxException {
+ return null;
+ }
+
+ public Collection getServiceReferences(Class arg0, String arg1) throws InvalidSyntaxException {
return null;
}
@@ -106,6 +116,10 @@ public class TestBundleContext implement
return null;
}
+ public <S> ServiceRegistration<S> registerService(Class<S> aClass, S s, Dictionary<String,?> dictionary) {
+ return null;
+ }
+
public void removeBundleListener(BundleListener arg0) {
}
Modified: aries/branches/subsystemsR6/blueprint/blueprint-distro/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-distro/pom.xml?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-distro/pom.xml (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-distro/pom.xml Mon Jun 30 16:54:57 2014
@@ -1,31 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version
- 2.0 (the "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0 Unless required by
- applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- CONDITIONS OF ANY KIND, either express or implied. See the License for
- the specific language governing permissions and limitations under the
- License.
- -->
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
<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>
<parent>
<groupId>org.apache.aries</groupId>
- <artifactId>java5-parent</artifactId>
- <version>0.5</version>
- <relativePath/>
+ <artifactId>parent</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <relativePath>../../parent/pom.xml</relativePath>
</parent>
-
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>blueprint-distro</artifactId>
<name>Blueprint distribution</name>
@@ -37,7 +39,6 @@
<url>http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-distro</url>
</scm>
-
<dependencies>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
@@ -92,4 +93,5 @@
</plugin>
</plugins>
</build>
+
</project>
Modified: aries/branches/subsystemsR6/blueprint/blueprint-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-itests/pom.xml?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-itests/pom.xml (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-itests/pom.xml Mon Jun 30 16:54:57 2014
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -17,12 +18,14 @@
under the License.
-->
<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>
+
<parent>
<groupId>org.apache.aries</groupId>
- <artifactId>java5-parent</artifactId>
- <version>1.0.0</version>
- <relativePath />
+ <artifactId>parent</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <relativePath>../../parent/pom.xml</relativePath>
</parent>
<groupId>org.apache.aries.blueprint</groupId>
@@ -39,34 +42,69 @@
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/blueprint/blueprint-itests</developerConnection>
<url>http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests</url>
</scm>
+
+ <properties>
+ <exam.version>3.4.0</exam.version>
+ <url.version>1.6.0</url.version>
+ </properties>
<dependencies>
<dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ <version>3.8.0.v20120529-1548</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <scope>provided</scope>
+ <artifactId>org.osgi.core</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse</groupId>
- <artifactId>osgi</artifactId>
- <scope>provided</scope>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.core</artifactId>
+ <version>1.4.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
- <artifactId>org.apache.aries.blueprint</artifactId>
- <scope>test</scope>
+ <artifactId>blueprint-parser</artifactId>
+ <version>1.2.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.proxy</groupId>
+ <artifactId>org.apache.aries.proxy.impl</artifactId>
+ <version>1.0.3-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.quiesce</groupId>
+ <artifactId>org.apache.aries.quiesce.api</artifactId>
+ <type>bundle</type>
+ <scope>provided</scope>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.cm</artifactId>
+ <version>1.0.4-SNAPSHOT</version>
+ <type>bundle</type>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.jexl.evaluator</artifactId>
<scope>test</scope>
- <version>1.0.0</version>
+ <version>1.0.1-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.core</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.aries</groupId>
@@ -75,16 +113,22 @@
<version>1.0.0</version>
</dependency>
<dependency>
+ <groupId>org.apache.aries.testsupport</groupId>
+ <artifactId>org.apache.aries.testsupport.unit</artifactId>
+ <scope>test</scope>
+ <version>2.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.sample</artifactId>
<scope>test</scope>
- <version>1.0.0</version>
+ <version>1.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.testbundlea</artifactId>
<scope>test</scope>
- <version>1.0.0</version>
+ <version>1.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
@@ -93,88 +137,84 @@
<version>1.0.2-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>org.apache.aries.testsupport</groupId>
- <artifactId>org.apache.aries.testsupport.unit</artifactId>
- <scope>test</scope>
- <version>1.0.0</version>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.testquiescebundle</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ </dependency>
+
+ <!-- pax exam -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.7</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam</artifactId>
+ <version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-junit</artifactId>
+ <artifactId>pax-exam-container-native</artifactId>
+ <version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-container-default</artifactId>
+ <artifactId>pax-exam-junit4</artifactId>
+ <version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-junit-extender-impl</artifactId>
+ <artifactId>pax-exam-link-mvn</artifactId>
+ <version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.ops4j.pax.runner</groupId>
- <artifactId>pax-runner-no-jcl</artifactId>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-aether</artifactId>
+ <version>${url.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.tinybundles</groupId>
+ <artifactId>tinybundles</artifactId>
+ <version>2.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
+
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.configadmin</artifactId>
<scope>test</scope>
- <version>1.2.4</version>
- <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.ops4j.pax.logging</groupId>
- <artifactId>pax-logging-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.logging</groupId>
- <artifactId>pax-logging-service</artifactId>
- <scope>test</scope>
+ <version>1.8.0</version>
</dependency>
<dependency>
- <groupId>org.ops4j.pax.url</groupId>
- <artifactId>pax-url-mvn</artifactId>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm-debug-all</artifactId>
<scope>test</scope>
+ <version>5.0.3</version>
</dependency>
<dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-all</artifactId>
- <scope>test</scope>
- <version>4.0</version>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-asm4-shaded</artifactId>
+ <version>3.16</version>
</dependency>
<dependency>
- <groupId>org.apache.aries.proxy</groupId>
- <artifactId>org.apache.aries.proxy</artifactId>
- <version>1.0.0</version>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-bundleutils</artifactId>
+ <version>3.16</version>
</dependency>
<dependency>
- <groupId>org.apache.aries.quiesce</groupId>
- <artifactId>org.apache.aries.quiesce.api</artifactId>
- <type>bundle</type>
- <scope>provided</scope>
- <version>1.0.0</version>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-finder-shaded</artifactId>
+ <version>3.16</version>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
@@ -182,6 +222,12 @@
<version>1.0.0</version>
<type>bundle</type>
<scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.core</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
@@ -190,56 +236,56 @@
<scope>compile</scope>
</dependency>
<dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jexl</artifactId>
+ <version>2.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.aries.blueprint</groupId>
- <artifactId>org.apache.aries.blueprint.core</artifactId>
- <version>1.2.1-SNAPSHOT</version>
+ <artifactId>org.apache.aries.blueprint.annotation.api</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
<type>bundle</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
- <artifactId>org.apache.aries.blueprint.cm</artifactId>
- <version>1.0.0</version>
+ <artifactId>org.apache.aries.blueprint.annotation.impl</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
<type>bundle</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
- <artifactId>blueprint-parser</artifactId>
- <scope>provided</scope>
+ <artifactId>org.apache.aries.blueprint.sample-annotation</artifactId>
<version>1.0.0</version>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-jexl</artifactId>
- <version>2.0</version>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.sample-fragment</artifactId>
+ <version>1.0.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-service</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
- <testResources>
- <testResource>
- <directory>${project.build.directory}/test-resources</directory>
- </testResource>
- <testResource>
- <directory>src/test/resources</directory>
- </testResource>
- </testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>pertest</forkMode>
- <excludes>
- <exclude>**/*$*</exclude>
- <exclude>**/Abstract*.java</exclude>
- </excludes>
- <includes>
- <include>**/Test*.java</include>
- <include>**/*Test.java</include>
- </includes>
</configuration>
</plugin>
<plugin>
@@ -248,12 +294,10 @@
<executions>
<execution>
<id>generate-config</id>
+ <phase>generate-resources</phase>
<goals>
<goal>generate-depends-file</goal>
</goals>
- <configuration>
- <outputFile>${project.build.directory}/test-resources/META-INF/maven/dependencies.properties</outputFile>
- </configuration>
</execution>
</executions>
</plugin>
Modified: aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/ASMMultiBundleTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/ASMMultiBundleTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/ASMMultiBundleTest.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/ASMMultiBundleTest.java Mon Jun 30 16:54:57 2014
@@ -18,14 +18,11 @@
*/
package org.apache.aries.blueprint.itests;
-import static org.apache.aries.itest.ExtraOptions.mavenBundle;
-import static org.apache.aries.itest.ExtraOptions.paxLogging;
-import static org.apache.aries.itest.ExtraOptions.testOptions;
+import static org.apache.aries.blueprint.itests.Helper.mvnBundle;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.equinox;
import java.util.ArrayList;
import java.util.List;
@@ -37,16 +34,17 @@ import org.apache.aries.blueprint.testbu
import org.apache.aries.blueprint.testbundlea.ProcessableBean.Phase;
import org.apache.aries.blueprint.testbundleb.OtherBean;
import org.apache.aries.blueprint.testbundleb.TestBean;
-import org.apache.aries.itest.AbstractIntegrationTest;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
import org.osgi.service.blueprint.container.BlueprintContainer;
-@RunWith(JUnit4TestRunner.class)
-public class ASMMultiBundleTest extends AbstractIntegrationTest {
+@RunWith(PaxExam.class)
+public class ASMMultiBundleTest extends AbstractBlueprintIntegrationTest {
private void checkInterceptorLog(String []expected, List<String> log){
assertNotNull("interceptor log should not be null",log);
@@ -82,8 +80,10 @@ public class ASMMultiBundleTest extends
assertTrue("interceptor invocation "+expected[i]+" not found",found[i]);
}
}
-
+
+ // TODO This test seems to fail on some runs. Need to stabilize and reenable
@Test
+ @Ignore
public void multiBundleTest() throws Exception {
//bundlea provides the ns handlers, bean processors, interceptors etc for this test.
@@ -196,15 +196,14 @@ public class ASMMultiBundleTest extends
assertTrue(objOther instanceof OtherBean);
assertEquals("test1value", ((OtherBean)objOther).getTestValue());
}
-
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
- return testOptions(
- paxLogging("DEBUG"),
+
+ @Configuration
+ public Option[] configuration() {
+ return new Option[] {
+ baseOptions(),
Helper.blueprintBundles(),
- mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testbundlea").noStart(),
- mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testbundleb").noStart(),
- equinox().version("3.5.0")
- );
+ mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testbundlea", false),
+ mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.testbundleb", false)
+ };
}
}
Modified: aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BaseBlueprintContainerBTCustomizerTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BaseBlueprintContainerBTCustomizerTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BaseBlueprintContainerBTCustomizerTest.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BaseBlueprintContainerBTCustomizerTest.java Mon Jun 30 16:54:57 2014
@@ -18,64 +18,69 @@
*/
package org.apache.aries.blueprint.itests;
-import static org.apache.aries.itest.ExtraOptions.mavenBundleInTest;
-
+import java.io.IOException;
import java.io.InputStream;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
-import java.util.Hashtable;
import java.util.Map;
-import org.apache.aries.itest.AbstractIntegrationTest;
-import org.apache.aries.itest.RichBundleContext;
+import javax.inject.Inject;
+
+import org.junit.Assert;
+import org.ops4j.pax.exam.CoreOptions;
import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.service.framework.CompositeBundle;
+import org.osgi.service.framework.CompositeBundleFactory;
-public abstract class BaseBlueprintContainerBTCustomizerTest extends AbstractIntegrationTest
+@SuppressWarnings("deprecation")
+public abstract class BaseBlueprintContainerBTCustomizerTest extends AbstractBlueprintIntegrationTest
{
+ @Inject
+ CompositeBundleFactory cbf;
+
+ /**
+ * Make sure to adapt the imports and exports to the imports and exports needed by the sample
+ * bundle. If they are wrong then there might be an error like:
+ * composite bundle could not be resolved: bundle was disabled:null
+ * @return
+ */
protected Map<String, String> getCompositeManifest() {
Map<String, String> compositeManifest = new HashMap<String, String>();
compositeManifest.put(Constants.BUNDLE_SYMBOLICNAME, "test-composite");
compositeManifest.put(Constants.BUNDLE_VERSION, "1.0.0");
// this import-package is used by the blueprint.sample
- compositeManifest.put(Constants.IMPORT_PACKAGE, "org.osgi.service.blueprint;version=\"[1.0.0,2.0.0)\", org.osgi.service.blueprint.container;version=1.0, org.osgi.service.cm");
+ compositeManifest.put(Constants.IMPORT_PACKAGE, "org.osgi.framework;version=\"[1.6,2)\","
+ + "org.osgi.service.cm,"
+ + "org.osgi.service.blueprint;version=\"[1.0.0,2.0.0)\","
+ + "org.osgi.service.blueprint.container;version=\"[1.0,2)\"");
// this export-package is used by pax junit runner as it needs to see the blueprint sample package
// for the test after the blueprint sample is started.
- compositeManifest.put(Constants.EXPORT_PACKAGE, "org.apache.aries.blueprint.sample");
+ compositeManifest.put(Constants.EXPORT_PACKAGE, "org.apache.aries.blueprint.sample;version=\"1.0.1\"");
return compositeManifest;
}
- protected Bundle installConfigurationAdmin(BundleContext ctx) throws Exception {
-
- Bundle configAdminBundle = null;
- // make sure we don't have a config admin already present
- ServiceTracker tracker = new ServiceTracker(ctx, ctx.createFilter("(" + Constants.OBJECTCLASS + "=" + ConfigurationAdmin.class.getName() + ")"), null);
- tracker.open();
- Object cfgAdminService = tracker.waitForService(5000);
- tracker.close();
-
- if (cfgAdminService == null) {
- MavenArtifactProvisionOption cfgAdminOption = mavenBundleInTest(getClass().getClassLoader(), "org.apache.felix", "org.apache.felix.configadmin");
- InputStream cfgAdminStream = new URL(cfgAdminOption.getURL()).openStream();
-
- configAdminBundle = ctx.installBundle(cfgAdminOption.getURL(), cfgAdminStream);
- }
-
- return configAdminBundle;
- }
+ protected MavenArtifactProvisionOption configAdminOption() {
+ return CoreOptions.mavenBundle("org.apache.felix", "org.apache.felix.configadmin").versionAsInProject();
+ }
- protected void applyCommonConfiguration(BundleContext ctx) throws Exception {
-
- ConfigurationAdmin ca = (new RichBundleContext(ctx)).getService(ConfigurationAdmin.class);
- Configuration cf = ca.getConfiguration("blueprint-sample-placeholder", null);
- Hashtable props = new Hashtable();
- props.put("key.b", "10");
- cf.update(props);
+ protected Bundle installBundle(BundleContext bundleContext, String url) throws IOException, MalformedURLException, BundleException {
+ // let's use input stream to avoid invoking mvn url handler which isn't avail in the child framework.
+ InputStream is = new URL(url).openStream();
+ Bundle bundle = bundleContext.installBundle(url, is);
+ Assert.assertNotNull(bundle);
+ return bundle;
}
+
+ protected CompositeBundle createCompositeBundle() throws BundleException {
+ Map<String, String> frameworkConfig = new HashMap<String, String>();
+ Map<String, String> compositeManifest = getCompositeManifest();
+ CompositeBundle cb = cbf.installCompositeBundle(frameworkConfig, "test-composite", compositeManifest);
+ return cb;
+ }
}
Modified: aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java Mon Jun 30 16:54:57 2014
@@ -18,28 +18,16 @@
*/
package org.apache.aries.blueprint.itests;
-import static org.junit.Assert.assertNotNull;
-import static org.ops4j.pax.exam.CoreOptions.equinox;
-import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
import org.apache.aries.itest.RichBundleContext;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
import org.osgi.service.framework.CompositeBundle;
-import org.osgi.service.framework.CompositeBundleFactory;
-
-import static org.apache.aries.itest.ExtraOptions.*;
/**
* This test is based on the BlueprintContainerBTCustomizerTest. but this test starts the
@@ -47,65 +35,37 @@ import static org.apache.aries.itest.Ext
* different code path
*
*/
-@RunWith(JUnit4TestRunner.class)
+@SuppressWarnings("deprecation")
+@RunWith(PaxExam.class)
public class BlueprintContainer2BTCustomizerTest extends BaseBlueprintContainerBTCustomizerTest {
- @Test
+ @Test
+ @Ignore // This test crashes the vm when run from maven. It works fine when run from eclipse
public void test() throws Exception {
+ CompositeBundle cb = createCompositeBundle();
+ BundleContext compositeBundleContext = cb.getCompositeFramework().getBundleContext();
+ Bundle testBundle = installBundle(compositeBundleContext, sampleBundleOption().getURL());
+ Bundle configAdminBundle = installBundle(compositeBundleContext, configAdminOption().getURL());
- ServiceReference sr = bundleContext.getServiceReference("org.osgi.service.framework.CompositeBundleFactory");
- if (sr != null) {
- // install blueprint.sample into the composite context
- CompositeBundleFactory cbf = (CompositeBundleFactory)bundleContext.getService(sr);
-
- Map<String, String> frameworkConfig = new HashMap<String, String>();
- // turn on the line below to enable telnet localhost 10000 to the child framework osgi console
- // frameworkConfig.put("osgi.console", "10000");
-
- // construct composite bundle information
- Map<String, String> compositeManifest = getCompositeManifest();
-
- CompositeBundle cb = cbf.installCompositeBundle(frameworkConfig, "test-composite", compositeManifest);
-
- BundleContext compositeBundleContext = cb.getCompositeFramework().getBundleContext();
- // install the blueprint sample onto the framework associated with the composite bundle
- MavenArtifactProvisionOption mapo = mavenBundleInTest(getClass().getClassLoader(), "org.apache.aries.blueprint", "org.apache.aries.blueprint.sample");
- // let's use input stream to avoid invoking mvn url handler which isn't avail in the child framework.
- InputStream is = new URL(mapo.getURL()).openStream();
- Bundle bundle = compositeBundleContext.installBundle(mapo.getURL(), is);
- assertNotNull(bundle);
- // install and start the cfg admin bundle in the isolated framework
- Bundle cfgAdminBundle = installConfigurationAdmin(compositeBundleContext);
- assertNotNull(cfgAdminBundle);
-
- // start the composite bundle, the config admin then the blueprint sample
- cb.start();
- cfgAdminBundle.start();
- // create a config to check the property placeholder
- applyCommonConfiguration(compositeBundleContext);
- bundle.start();
-
- // start the blueprint bundle and it should detect the previously started blueprint sample
- Bundle blueprintBundle = context().getBundleByName("org.apache.aries.blueprint");
- blueprintBundle.start();
- Thread.sleep(2000);
-
- // do the test
- Helper.testBlueprintContainer(new RichBundleContext(compositeBundleContext), bundle);
-
- // unget the service
- bundleContext.ungetService(sr);
- }
+ // start the composite bundle, config admin then the blueprint sample
+ cb.start();
+ configAdminBundle.start();
+ // create a config to check the property placeholder
+ applyCommonConfiguration(compositeBundleContext);
+ testBundle.start();
+
+ startBlueprintBundles();
+
+ // do the test
+ Helper.testBlueprintContainer(new RichBundleContext(compositeBundleContext), testBundle);
}
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
- return testOptions(
- paxLogging("DEBUG"),
- Helper.blueprintBundles(false),
- //vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006"),
- equinox().version("3.5.0")
- );
+ @Configuration
+ public Option[] configuration() {
+ return new Option[] {
+ baseOptions(),
+ Helper.blueprintBundles(false)
+ };
}
}
Modified: aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2Test.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2Test.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2Test.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2Test.java Mon Jun 30 16:54:57 2014
@@ -18,20 +18,13 @@
*/
package org.apache.aries.blueprint.itests;
-import static org.junit.Assert.assertNotNull;
-import static org.ops4j.pax.exam.CoreOptions.equinox;
-import java.util.Hashtable;
+import static org.apache.aries.blueprint.itests.Helper.mvnBundle;
-import org.apache.aries.itest.AbstractIntegrationTest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-
-import static org.apache.aries.itest.ExtraOptions.*;
/**
* this test is based on blueprint container test, but this test starts the
@@ -39,39 +32,28 @@ import static org.apache.aries.itest.Ext
* different code path
*
*/
-@RunWith(JUnit4TestRunner.class)
-public class BlueprintContainer2Test extends AbstractIntegrationTest {
+@RunWith(PaxExam.class)
+public class BlueprintContainer2Test extends AbstractBlueprintIntegrationTest {
@Test
public void test() throws Exception {
- // Create a config to check the property placeholder
- ConfigurationAdmin ca = context().getService(ConfigurationAdmin.class);
- Configuration cf = ca.getConfiguration("blueprint-sample-placeholder", null);
- Hashtable props = new Hashtable();
- props.put("key.b", "10");
- cf.update(props);
-
- Bundle bundle = context().getBundleByName("org.apache.aries.blueprint.sample");
- Bundle blueprintBundle = context().getBundleByName("org.apache.aries.blueprint");
- assertNotNull(bundle);
+ applyCommonConfiguration(context());
+ Bundle bundle = getSampleBundle();
bundle.start();
- blueprintBundle.start();
+ startBlueprintBundles();
// do the test
Helper.testBlueprintContainer(context(), bundle);
}
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
- return testOptions(
- paxLogging("DEBUG"),
+ @org.ops4j.pax.exam.Configuration
+ public Option[] configuration() {
+ return new Option[] {
+ baseOptions(),
Helper.blueprintBundles(false),
-
- mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample").noStart(),
-
- equinox().version("3.5.0")
- );
+ mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample", false)
+ };
}
}
Modified: aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java Mon Jun 30 16:54:57 2014
@@ -18,28 +18,15 @@
*/
package org.apache.aries.blueprint.itests;
-import static org.junit.Assert.assertNotNull;
-import static org.ops4j.pax.exam.CoreOptions.equinox;
-import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
import org.apache.aries.itest.RichBundleContext;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
+import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
import org.osgi.service.framework.CompositeBundle;
-import org.osgi.service.framework.CompositeBundleFactory;
-
-import static org.apache.aries.itest.ExtraOptions.*;
/**
* This test is based on the BlueprintContainerTest. The difference is that in this test,
@@ -48,59 +35,34 @@ import static org.apache.aries.itest.Ext
* service is avail in the OSGi service registry.
*
*/
-@RunWith(JUnit4TestRunner.class)
+@SuppressWarnings("deprecation")
+@RunWith(PaxExam.class)
public class BlueprintContainerBTCustomizerTest extends BaseBlueprintContainerBTCustomizerTest {
@Test
public void test() throws Exception {
-
- ServiceReference sr = bundleContext.getServiceReference("org.osgi.service.framework.CompositeBundleFactory");
- if (sr != null) {
- // install blueprint.sample into the composite context
- CompositeBundleFactory cbf = (CompositeBundleFactory)bundleContext.getService(sr);
-
- Map<String, String> frameworkConfig = new HashMap<String, String>();
- // turn on the line below to enable telnet localhost 10000 to the child framework osgi console
- // frameworkConfig.put("osgi.console", "10000");
-
- // construct composite bundle information
- Map<String, String> compositeManifest = getCompositeManifest();
-
- CompositeBundle cb = cbf.installCompositeBundle(frameworkConfig, "test-composite", compositeManifest);
-
- BundleContext compositeBundleContext = cb.getCompositeFramework().getBundleContext();
- // install the blueprint sample onto the framework associated with the composite bundle
- MavenArtifactProvisionOption mapo = mavenBundleInTest(getClass().getClassLoader(), "org.apache.aries.blueprint", "org.apache.aries.blueprint.sample");
- // let's use input stream to avoid invoking mvn url handler which isn't avail in the child framework.
- InputStream is = new URL(mapo.getURL()).openStream();
- Bundle bundle = compositeBundleContext.installBundle(mapo.getURL(), is);
- assertNotNull(bundle);
- Bundle configAdminBundle = installConfigurationAdmin(compositeBundleContext);
- assertNotNull(configAdminBundle);
-
- // start the composite bundle, config admin then the blueprint sample
- cb.start();
- configAdminBundle.start();
- applyCommonConfiguration(compositeBundleContext);
- bundle.start();
-
- // do the test
- Helper.testBlueprintContainer(new RichBundleContext(compositeBundleContext), bundle);
-
- // unget the service
- bundleContext.ungetService(sr);
-
- }
+ CompositeBundle cb = createCompositeBundle();
+
+ BundleContext compositeBundleContext = cb.getCompositeFramework().getBundleContext();
+ Bundle testBundle = installBundle(compositeBundleContext, sampleBundleOption().getURL());
+ Bundle configAdminBundle = installBundle(compositeBundleContext, configAdminOption().getURL());
+ // start the composite bundle, config admin then the blueprint sample
+ cb.start();
+ configAdminBundle.start();
+ // create a config to check the property placeholder
+ applyCommonConfiguration(compositeBundleContext);
+ testBundle.start();
+
+ // do the test
+ Helper.testBlueprintContainer(new RichBundleContext(compositeBundleContext), testBundle);
}
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
- return testOptions(
- paxLogging("DEBUG"),
- Helper.blueprintBundles(),
-// vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006"),
- equinox().version("3.5.1")
- );
+ @Configuration
+ public Option[] configuration() {
+ return new Option[] {
+ baseOptions(),
+ Helper.blueprintBundles()
+ };
}
}
Modified: aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerTest.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerTest.java Mon Jun 30 16:54:57 2014
@@ -18,166 +18,33 @@
*/
package org.apache.aries.blueprint.itests;
+import static org.apache.aries.blueprint.itests.Helper.mvnBundle;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.ops4j.pax.exam.CoreOptions.equinox;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.HashSet;
-import java.util.List;
-
-import org.apache.aries.itest.AbstractIntegrationTest;
-import org.apache.aries.unittest.fixture.ArchiveFixture;
-import org.apache.aries.unittest.fixture.ArchiveFixture.Fixture;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
import org.osgi.framework.Bundle;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import static org.apache.aries.itest.ExtraOptions.*;
-
-@RunWith(JUnit4TestRunner.class)
-public class BlueprintContainerTest extends AbstractIntegrationTest {
+public class BlueprintContainerTest extends AbstractBlueprintIntegrationTest {
@Test
public void test() throws Exception {
- // Create a config to check the property placeholder
- ConfigurationAdmin ca = context().getService(ConfigurationAdmin.class);
- Configuration cf = ca.getConfiguration("blueprint-sample-placeholder", null);
- Hashtable props = new Hashtable();
- props.put("key.b", "10");
- cf.update(props);
-
+ applyCommonConfiguration(context());
Bundle bundle = context().getBundleByName("org.apache.aries.blueprint.sample");
assertNotNull(bundle);
-
bundle.start();
// do the test
Helper.testBlueprintContainer(context(), bundle);
}
-
- @Test
- public void testReferenceListenerDeadlock() throws Exception {
- List<Bundle> bundles = new ArrayList<Bundle>();
- int total = 10;
- for (int i=0; i<total; i++) {
- bundles.add(bundleContext.installBundle("sample"+i, getTestBundle(i, total)));
- }
-
- for (Bundle b : bundles) b.start();
-
- // every blueprint container should be up
- for (Bundle b : bundles) {
- assertNotNull(Helper.getBlueprintContainerForBundle(context(), b.getSymbolicName()));
- }
- }
-
- private InputStream getTestBundle(int no, int total) throws Exception {
- StringBuilder blueprint = new StringBuilder();
- blueprint.append("<blueprint xmlns=\"http://www.osgi.org/xmlns/blueprint/v1.0.0\">");
- blueprint.append("<bean id=\"listener\" class=\"org.apache.aries.blueprint.itests.comp.Listener\" />");
-
- for (int i=0; i<total; i++) {
- if (i==no) {
- blueprint.append("<service interface=\"java.util.List\">");
- blueprint.append("<service-properties><entry key=\"no\" value=\""+i+"\" /></service-properties>");
- blueprint.append("<bean class=\"org.apache.aries.blueprint.itests.comp.ListFactory\" factory-method=\"create\">");
- blueprint.append("<argument value=\""+i+"\" />");
- blueprint.append("</bean>");
- blueprint.append("</service>");
- } else {
- blueprint.append("<reference availability=\"optional\" id=\"ref"+i+"\" interface=\"java.util.List\" filter=\"(no="+i+")\">");
- blueprint.append("<reference-listener ref=\"listener\" bind-method=\"bind\" unbind-method=\"unbind\" />");
- blueprint.append("</reference>");
- }
- }
- blueprint.append("</blueprint>");
-
- Fixture jar = ArchiveFixture.newJar()
- .manifest().symbolicName("sample"+no)
- .attribute("Import-Package", "org.osgi.framework")
- .end()
- .binary("org/apache/aries/blueprint/itests/comp/Listener.class",
- getClass().getClassLoader().getResourceAsStream(
- "org/apache/aries/blueprint/itests/comp/Listener.class"))
- .binary("org/apache/aries/blueprint/itests/comp/ListFactory.class",
- getClass().getClassLoader().getResourceAsStream(
- "org/apache/aries/blueprint/itests/comp/ListFactory.class"))
-
- .file("OSGI-INF/blueprint/blueprint.xml", blueprint.toString())
- .end();
-
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- jar.writeOut(bout);
-
- return new ByteArrayInputStream(bout.toByteArray());
- }
-
- @Test
- public void testDeadlock() throws Exception {
- bundleContext.registerService("java.util.Set",new HashSet<Object>(), null);
-
- Bundle bundle = context().getBundleByName("org.apache.aries.blueprint.sample");
- assertNotNull(bundle);
-
- bundle.start();
-
- Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.blueprint.sample");
-
- // no actual assertions, we just don't want to deadlock
- }
-
- @Test
- public void testScheduledExecMemoryLeak() throws Exception {
- Fixture jar = ArchiveFixture.newJar()
- .manifest().symbolicName("test.bundle").end()
- .file("OSGI-INF/blueprint/blueprint.xml")
- .line("<blueprint xmlns=\"http://www.osgi.org/xmlns/blueprint/v1.0.0\">")
- .line("<reference interface=\"java.util.List\" />")
- .line("</blueprint>").end().end();
-
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- jar.writeOut(bout);
-
- Bundle b = bundleContext.installBundle("test.bundle", new ByteArrayInputStream(bout.toByteArray()));
-
- for (int i=0; i<16; i++) System.gc();
- long startFreeMemory = Runtime.getRuntime().freeMemory();
-
- // 3000 iterations on a Mac 1.6 JVM leaks 30+ mb, 2000 leaks a bit more than 20,
- // 10000 iterations would be close to OutOfMemory however by that stage the test runs very slowly
- for (int i=0; i<3000; i++) {
- b.start();
- // give the container some time to operate, otherwise it probably won't even get to create a future
- Thread.sleep(10);
- b.stop();
- }
-
- for (int i=0; i<16; i++) System.gc();
- long endFreeMemory = Runtime.getRuntime().freeMemory();
-
- long lossage = startFreeMemory - endFreeMemory;
- assertTrue("We lost: "+lossage, lossage < 20000000);
- }
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
- return testOptions(
- paxLogging("INFO"),
+ @org.ops4j.pax.exam.Configuration
+ public Option[] configuration() {
+ return new Option[] {
+ baseOptions(),
Helper.blueprintBundles(),
-
- mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample").noStart(),
-
- equinox().version("3.5.0")
- );
+ mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample", false),
+ };
}
}
Modified: aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/FragmentTest.java
URL: http://svn.apache.org/viewvc/aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/FragmentTest.java?rev=1606837&r1=1606836&r2=1606837&view=diff
==============================================================================
--- aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/FragmentTest.java (original)
+++ aries/branches/subsystemsR6/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/FragmentTest.java Mon Jun 30 16:54:57 2014
@@ -18,73 +18,54 @@
*/
package org.apache.aries.blueprint.itests;
-import static org.junit.Assert.assertNotNull;
-import static org.ops4j.pax.exam.CoreOptions.equinox;
-import org.apache.aries.itest.AbstractIntegrationTest;
-import org.apache.aries.unittest.fixture.ArchiveFixture;
-import org.apache.aries.unittest.fixture.ArchiveFixture.ZipFixture;
+import static org.apache.aries.blueprint.itests.Helper.mvnBundle;
+import static org.ops4j.pax.exam.CoreOptions.streamBundle;
+
+import java.io.InputStream;
+
+import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.tinybundles.core.TinyBundles;
import org.osgi.framework.Constants;
import org.osgi.service.blueprint.container.BlueprintContainer;
-import static org.apache.aries.itest.ExtraOptions.*;
-
-@RunWith(JUnit4TestRunner.class)
-public class FragmentTest extends AbstractIntegrationTest
+@RunWith(PaxExam.class)
+public class FragmentTest extends AbstractBlueprintIntegrationTest
{
- @Test
- public void testFragmentProvidesBlueprintFile() throws Exception
- {
- ZipFixture hostJar = ArchiveFixture.newJar().manifest().attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
- .attribute(Constants.BUNDLE_SYMBOLICNAME, "org.apache.aries.test.host").end();
-
- ZipFixture fragmentJar = ArchiveFixture.newJar().manifest().attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
- .attribute(Constants.BUNDLE_SYMBOLICNAME, "org.apache.aries.test.fragment")
- .attribute(Constants.FRAGMENT_HOST, "org.apache.aries.test.host").end()
- .binary("OSGI-INF/blueprint/bp.xml", this.getClass().getResourceAsStream("/bp.xml")).end();
-
- bundleContext.installBundle("fragment", fragmentJar.getInputStream());
- bundleContext.installBundle("host", hostJar.getInputStream()).start();
- Runnable r = context().getService(Runnable.class);
- assertNotNull("Could not find blueprint registered service", r);
- BlueprintContainer bc = Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.test.host");
- assertNotNull("Could not find blueprint container for bundle", bc);
- }
-
@Test
- public void testFragmentWithOverriddenHeader() throws Exception
+ public void testFragmentProvidesBlueprintFile() throws Exception
{
- ZipFixture hostJar = ArchiveFixture.newJar().manifest().attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
- .attribute(Constants.BUNDLE_SYMBOLICNAME, "org.apache.aries.test.host")
- .attribute("Bundle-Blueprint", "META-INF/bp/*.xml").end();
-
- ZipFixture fragmentJar = ArchiveFixture.newJar().manifest().attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
- .attribute(Constants.BUNDLE_SYMBOLICNAME, "org.apache.aries.test.fragment")
- .attribute(Constants.FRAGMENT_HOST, "org.apache.aries.test.host").end()
- .binary("META-INF/bp/bp.xml", this.getClass().getResourceAsStream("/bp.xml")).end();
-
- bundleContext.installBundle("fragment", fragmentJar.getInputStream());
- bundleContext.installBundle("host", hostJar.getInputStream()).start();
-
Runnable r = context().getService(Runnable.class);
- assertNotNull("Could not find blueprint registered service", r);
+ Assert.assertNotNull("Could not find blueprint registered service", r);
BlueprintContainer bc = Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.test.host");
- assertNotNull("Could not find blueprint container for bundle", bc);
+ Assert.assertNotNull("Could not find blueprint container for bundle", bc);
}
- @org.ops4j.pax.exam.junit.Configuration
- public static Option[] configuration() {
- return testOptions(
- paxLogging("DEBUG"),
+ @Configuration
+ public Option[] configuration() {
+ InputStream hostJar = TinyBundles.bundle()
+ .set(Constants.BUNDLE_MANIFESTVERSION, "2")
+ .set(Constants.BUNDLE_SYMBOLICNAME, "org.apache.aries.test.host").build();
+
+ InputStream fragmentJar = TinyBundles.bundle()
+ .set(Constants.BUNDLE_MANIFESTVERSION, "2")
+ .set(Constants.BUNDLE_SYMBOLICNAME, "org.apache.aries.test.fragment")
+ .set(Constants.FRAGMENT_HOST, "org.apache.aries.test.host")
+ .add("OSGI-INF/blueprint/bp.xml", this.getClass().getResourceAsStream("/bp.xml"))
+ .build();
+
+ return new Option[] {
+ baseOptions(),
Helper.blueprintBundles(),
-
- mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample").noStart(),
- equinox().version("3.5.0")
- );
+ streamBundle(fragmentJar).noStart(),
+ streamBundle(hostJar),
+ mvnBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample", false)
+ };
}
}
\ No newline at end of file