You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by jb...@apache.org on 2014/05/30 18:19:08 UTC
svn commit: r1598656 - in /aries/trunk/testsupport: pom.xml
testsupport-unit/pom.xml
testsupport-unit/src/main/java/org/apache/aries/itest/RichBundleContext.java
testsupport-unit/src/main/java/org/apache/aries/mocks/BundleMock.java
Author: jbonofre
Date: Fri May 30 16:19:07 2014
New Revision: 1598656
URL: http://svn.apache.org/r1598656
Log:
[ARIES-1006] Upgrade to the "new" parent pom and OSGi 4.3.1
Modified:
aries/trunk/testsupport/pom.xml
aries/trunk/testsupport/testsupport-unit/pom.xml
aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/itest/RichBundleContext.java
aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/mocks/BundleMock.java
Modified: aries/trunk/testsupport/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/testsupport/pom.xml?rev=1598656&r1=1598655&r2=1598656&view=diff
==============================================================================
--- aries/trunk/testsupport/pom.xml (original)
+++ aries/trunk/testsupport/pom.xml Fri May 30 16:19:07 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
@@ -18,20 +19,20 @@
-->
<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>1.0.1-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
</parent>
- <modelVersion>4.0.0</modelVersion>
<groupId>org.apache.aries.testsupport</groupId>
<artifactId>testsupport</artifactId>
<name>Apache Aries Test Support</name>
<packaging>pom</packaging>
<version>1.0.1-SNAPSHOT</version>
-
<description>
Test Support for OSGi - reactor pom
</description>
Modified: aries/trunk/testsupport/testsupport-unit/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/testsupport/testsupport-unit/pom.xml?rev=1598656&r1=1598655&r2=1598656&view=diff
==============================================================================
--- aries/trunk/testsupport/testsupport-unit/pom.xml (original)
+++ aries/trunk/testsupport/testsupport-unit/pom.xml Fri May 30 16:19:07 2014
@@ -1,48 +1,50 @@
-
- <!--
- 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.
- -->
+<?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.
+-->
<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 />
- </parent>
-
- <groupId>org.apache.aries.testsupport</groupId>
- <artifactId>org.apache.aries.testsupport.unit</artifactId>
- <packaging>bundle</packaging>
- <name>Apache Aries Unit Test Support</name>
- <version>2.0.0-SNAPSHOT</version>
- <description>
- This bundle provides unit test support.
- </description>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/aries/trunk/testsupport/testsupport-unit</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/testsupport/testsupport-unit</developerConnection>
- <url>http://svn.apache.org/viewvc/aries/trunk/testsupport/testsupport-unit</url>
- </scm>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.aries</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ <relativePath>../../parent/pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.aries.testsupport</groupId>
+ <artifactId>org.apache.aries.testsupport.unit</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Aries Unit Test Support</name>
+ <version>2.0.0-SNAPSHOT</version>
+ <description>
+ This bundle provides unit test support.
+ </description>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/aries/trunk/testsupport/testsupport-unit</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/testsupport/testsupport-unit</developerConnection>
+ <url>http://svn.apache.org/viewvc/aries/trunk/testsupport/testsupport-unit</url>
+ </scm>
<properties>
<!-- Export package versions are maintained in packageinfo files -->
-
<aries.osgi.export.pkg>
org.apache.aries.unittest.fixture,
org.apache.aries.mocks,
@@ -51,39 +53,39 @@
org.apache.aries.unittest.junit,
org.apache.aries.itest
</aries.osgi.export.pkg>
- <aries.osgi.private.pkg />
+ <aries.osgi.private.pkg/>
<!-- Don't import org.ops4j.pax.exam.container.def because it is only used for setup -->
<aries.osgi.import.pkg>
- org.ops4j.pax.exam.container.def*;resolution:=optional,
- *
+ org.ops4j.pax.exam.container.def*;resolution:=optional,
+ *
</aries.osgi.import.pkg>
</properties>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>provided</scope>
- </dependency>
- <!-- Dependent projects need OSGi in the classpath before the pax bundles
- or risk an "java.lang.NoClassDefFoundError: org.osgi.vendor.framework
- property not set" error. Use default scope to propagate OSGi as
- a transitive dependency to other projects. -->
- <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>
- <dependency>
- <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- <version>1</version>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <!-- Dependent projects need OSGi in the classpath before the pax bundles
+ or risk an "java.lang.NoClassDefFoundError: org.osgi.vendor.framework
+ property not set" error. Use default scope to propagate OSGi as
+ a transitive dependency to other projects. -->
+ <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>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ </dependency>
+ </dependencies>
</project>
Modified: aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/itest/RichBundleContext.java
URL: http://svn.apache.org/viewvc/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/itest/RichBundleContext.java?rev=1598656&r1=1598655&r2=1598656&view=diff
==============================================================================
--- aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/itest/RichBundleContext.java (original)
+++ aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/itest/RichBundleContext.java Fri May 30 16:19:07 2014
@@ -20,6 +20,7 @@ package org.apache.aries.itest;
import java.io.File;
import java.io.InputStream;
+import java.util.Collection;
import java.util.Dictionary;
import org.osgi.framework.Bundle;
@@ -38,31 +39,30 @@ import org.osgi.util.tracker.ServiceTrac
/**
* {@link BundleContext} wrapper that adds a couple of additional utilities
- * @author vmahrwald
*
*/
public class RichBundleContext implements BundleContext {
public static final long DEFAULT_TIMEOUT = 15000;
-
+
private final BundleContext delegate;
public RichBundleContext(BundleContext delegate) {
this.delegate = delegate;
}
-
+
public <T> T getService(Class<T> type) {
return getService(type, null, DEFAULT_TIMEOUT);
}
-
+
public <T> T getService(Class<T> type, long timeout) {
return getService(type, null, timeout);
}
-
+
public <T> T getService(Class<T> type, String filter) {
return getService(type, filter, DEFAULT_TIMEOUT);
}
-
+
public <T> T getService(Class<T> type, String filter, long timeout) {
ServiceTracker tracker = null;
try {
@@ -79,10 +79,10 @@ public class RichBundleContext implement
Filter osgiFilter = FrameworkUtil.createFilter(flt);
tracker = new ServiceTracker(delegate, osgiFilter, null);
tracker.open();
-
+
Object svc = type.cast(tracker.waitForService(timeout));
if (svc == null) {
- System.out.println("Could not obtain a service in time, service-ref="+
+ System.out.println("Could not obtain a service in time, service-ref="+
tracker.getServiceReference()+
", time="+System.currentTimeMillis());
throw new RuntimeException("Gave up waiting for service " + flt);
@@ -95,7 +95,7 @@ public class RichBundleContext implement
}
}
-
+
public Bundle getBundleByName(String symbolicName) {
for (Bundle b : delegate.getBundles()) {
if (b.getSymbolicName().equals(symbolicName)) {
@@ -105,12 +105,6 @@ public class RichBundleContext implement
return null;
}
-
-
- /*
- * Delegate methods
- */
-
public String getProperty(String key) {
return delegate.getProperty(key);
}
@@ -119,6 +113,8 @@ public class RichBundleContext implement
return delegate.getBundle();
}
+ public Bundle getBundle(String filter) { return delegate.getBundle(filter); }
+
public Bundle installBundle(String location, InputStream input)
throws BundleException {
return delegate.installBundle(location, input);
@@ -177,11 +173,19 @@ public class RichBundleContext implement
return delegate.registerService(clazz, service, properties);
}
+ public ServiceRegistration registerService(Class clazz, Object service, Dictionary props) {
+ return delegate.registerService(clazz, service, props);
+ }
+
public ServiceReference[] getServiceReferences(String clazz, String filter)
throws InvalidSyntaxException {
return delegate.getServiceReferences(clazz, filter);
}
+ public Collection getServiceReferences(Class clazz, String filter) throws InvalidSyntaxException {
+ return delegate.getServiceReferences(clazz, filter);
+ }
+
public ServiceReference[] getAllServiceReferences(String clazz,
String filter) throws InvalidSyntaxException {
return delegate.getAllServiceReferences(clazz, filter);
@@ -191,6 +195,8 @@ public class RichBundleContext implement
return delegate.getServiceReference(clazz);
}
+ public ServiceReference getServiceReference(Class clazz) { return delegate.getServiceReference(clazz); }
+
public Object getService(ServiceReference reference) {
return delegate.getService(reference);
}
Modified: aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/mocks/BundleMock.java
URL: http://svn.apache.org/viewvc/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/mocks/BundleMock.java?rev=1598656&r1=1598655&r2=1598656&view=diff
==============================================================================
--- aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/mocks/BundleMock.java (original)
+++ aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/mocks/BundleMock.java Fri May 30 16:19:07 2014
@@ -395,7 +395,7 @@ public class BundleMock
{
ServiceReference[] result = null;
try {
- result = bc.getServiceReferences(null, null);
+ result = bc.getServiceReferences((String) null, null);
} catch (InvalidSyntaxException isx) {
// no-op: Swallow exception
}