You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by zo...@apache.org on 2011/03/24 20:57:23 UTC
svn commit: r1085102 - in /aries/trunk/samples/blueprint: ./ helloworld/
helloworld/helloworld-api/ helloworld/helloworld-client/
helloworld/helloworld-itests/ helloworld/helloworld-itests/src/
helloworld/helloworld-itests/src/test/ helloworld/hellowor...
Author: zoe
Date: Thu Mar 24 19:57:22 2011
New Revision: 1085102
URL: http://svn.apache.org/viewvc?rev=1085102&view=rev
Log:
ARIES-610 add a very simple test for the hw sample
Added:
aries/trunk/samples/blueprint/helloworld/helloworld-itests/
aries/trunk/samples/blueprint/helloworld/helloworld-itests/pom.xml
aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/
aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/
aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/
aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/
aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/apache/
aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/apache/aries/
aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/apache/aries/samples/
aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/apache/aries/samples/blueprint/
aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/apache/aries/samples/blueprint/helloworld/
aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/apache/aries/samples/blueprint/helloworld/itests/
aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/apache/aries/samples/blueprint/helloworld/itests/AbstractIntegrationTest.java
aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/apache/aries/samples/blueprint/helloworld/itests/HelloworldSampleTest.java
Modified:
aries/trunk/samples/blueprint/helloworld/helloworld-api/pom.xml
aries/trunk/samples/blueprint/helloworld/helloworld-client/pom.xml
aries/trunk/samples/blueprint/helloworld/helloworld-server/pom.xml
aries/trunk/samples/blueprint/helloworld/pom.xml
aries/trunk/samples/blueprint/pom.xml
Modified: aries/trunk/samples/blueprint/helloworld/helloworld-api/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/samples/blueprint/helloworld/helloworld-api/pom.xml?rev=1085102&r1=1085101&r2=1085102&view=diff
==============================================================================
--- aries/trunk/samples/blueprint/helloworld/helloworld-api/pom.xml (original)
+++ aries/trunk/samples/blueprint/helloworld/helloworld-api/pom.xml Thu Mar 24 19:57:22 2011
@@ -20,11 +20,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.aries.samples.blueprint.helloworld</groupId>
+ <groupId>org.apache.aries.samples</groupId>
<artifactId>helloworld</artifactId>
<version>0.3.1-SNAPSHOT</version>
</parent>
+ <groupId>org.apache.aries.samples.blueprint.helloworld</groupId>
<artifactId>org.apache.aries.samples.blueprint.helloworld.api</artifactId>
<name>Apache Aries Blueprint HelloWorld API</name>
<packaging>bundle</packaging>
Modified: aries/trunk/samples/blueprint/helloworld/helloworld-client/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/samples/blueprint/helloworld/helloworld-client/pom.xml?rev=1085102&r1=1085101&r2=1085102&view=diff
==============================================================================
--- aries/trunk/samples/blueprint/helloworld/helloworld-client/pom.xml (original)
+++ aries/trunk/samples/blueprint/helloworld/helloworld-client/pom.xml Thu Mar 24 19:57:22 2011
@@ -17,11 +17,12 @@
<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.samples.blueprint.helloworld</groupId>
+ <groupId>org.apache.aries.samples</groupId>
<artifactId>helloworld</artifactId>
<version>0.3.1-SNAPSHOT</version>
</parent>
+ <groupId>org.apache.aries.samples.blueprint.helloworld</groupId>
<artifactId>org.apache.aries.samples.blueprint.helloworld.client</artifactId>
<name>Apache Aries Blueprint HelloWorldClient</name>
<packaging>bundle</packaging>
Added: aries/trunk/samples/blueprint/helloworld/helloworld-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/samples/blueprint/helloworld/helloworld-itests/pom.xml?rev=1085102&view=auto
==============================================================================
--- aries/trunk/samples/blueprint/helloworld/helloworld-itests/pom.xml (added)
+++ aries/trunk/samples/blueprint/helloworld/helloworld-itests/pom.xml Thu Mar 24 19:57:22 2011
@@ -0,0 +1,240 @@
+<!--
+ 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.samples</groupId>
+ <artifactId>helloworld</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.aries.samples.blueprint.helloworld</groupId>
+ <artifactId>org.apache.aries.samples.blueprint.helloworld.itests</artifactId>
+ <name>Apache Aries Blueprint sample iTests</name>
+ <description>
+ Integration test for the blueprint hello world sample
+ </description>
+
+ <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>
+
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>osgi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.proxy</groupId>
+ <artifactId>org.apache.aries.proxy</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries</groupId>
+ <artifactId>org.apache.aries.util</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.samples.blueprint.helloworld</groupId>
+ <artifactId>org.apache.aries.samples.blueprint.helloworld.api</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.samples.blueprint.helloworld</groupId>
+ <artifactId>org.apache.aries.samples.blueprint.helloworld.client</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.samples.blueprint.helloworld</groupId>
+ <artifactId>org.apache.aries.samples.blueprint.helloworld.server</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-default</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit-extender-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.runner</groupId>
+ <artifactId>pax-runner-no-jcl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.swissbox</groupId>
+ <artifactId>pax-swissbox-tinybundles</artifactId>
+ </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>
+ </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>
+
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-mvn</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.cglib</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.equinox</groupId>
+ <artifactId>cm</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.osgi</groupId>
+ <artifactId>services</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <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>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>maven-paxexam-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-config</id>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ <configuration>
+ <outputFile>${project.build.directory}/test-classes/META-INF/maven/dependencies.properties</outputFile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>ci-build-profile</id>
+ <activation>
+ <property>
+ <name>maven.repo.local</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <!--
+ when the local repo location has been specified, we need to pass
+ on this information to PAX mvn url
+ -->
+ <argLine>-Dorg.ops4j.pax.url.mvn.localRepository=${maven.repo.local}</argLine>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
Added: aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/apache/aries/samples/blueprint/helloworld/itests/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/apache/aries/samples/blueprint/helloworld/itests/AbstractIntegrationTest.java?rev=1085102&view=auto
==============================================================================
--- aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/apache/aries/samples/blueprint/helloworld/itests/AbstractIntegrationTest.java (added)
+++ aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/apache/aries/samples/blueprint/helloworld/itests/AbstractIntegrationTest.java Thu Mar 24 19:57:22 2011
@@ -0,0 +1,282 @@
+/*
+ * 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.
+ */
+package org.apache.aries.samples.blueprint.helloworld.itests;
+
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
+import static org.ops4j.pax.exam.OptionUtils.combine;
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.junit.After;
+import org.junit.Before;
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Inject;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
+import org.ops4j.pax.url.mvn.Handler;
+import org.ops4j.pax.url.mvn.ServiceConstants;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+
+
+public abstract class AbstractIntegrationTest {
+
+ private static final int CONNECTION_TIMEOUT = 30000;
+ public static final long DEFAULT_TIMEOUT = 60000;
+
+ @Inject
+ protected BundleContext bundleContext;
+
+ private List<ServiceTracker> srs;
+
+ @Before
+ public void setUp() {
+ srs = new ArrayList<ServiceTracker>();
+ }
+
+ @After
+ public void tearDown() throws Exception{
+ for (ServiceTracker st : srs) {
+ if (st != null) {
+ st.close();
+ }
+ }
+ }
+
+ public static MavenArtifactProvisionOption mavenBundle(String groupId, String artifactId) {
+ return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).versionAsInProject();
+ }
+
+ public static MavenArtifactProvisionOption mavenBundleInTest(String groupId, String artifactId) {
+ return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).version(getArtifactVersion(groupId, artifactId));
+ }
+
+ public static String getArtifactVersion( final String groupId,
+ final String artifactId )
+ {
+ final Properties dependencies = new Properties();
+ try
+ {
+ InputStream in = getFileFromClasspath("META-INF/maven/dependencies.properties");
+ try {
+ dependencies.load(in);
+ } finally {
+ in.close();
+ }
+ final String version = dependencies.getProperty( groupId + "/" + artifactId + "/version" );
+ if( version == null )
+ {
+ throw new RuntimeException(
+ "Could not resolve version. Do you have a dependency for " + groupId + "/" + artifactId
+ + " in your maven project?"
+ );
+ }
+ return version;
+ }
+ catch( IOException e )
+ {
+ // TODO throw a better exception
+ throw new RuntimeException(
+ "Could not resolve version. Did you configured the plugin in your maven project?"
+ + "Or maybe you did not run the maven build and you are using an IDE?"
+ );
+ }
+ }
+
+
+ protected Bundle getInstalledBundle(String symbolicName) {
+ for (Bundle b : bundleContext.getBundles()) {
+ if (b.getSymbolicName().equals(symbolicName)) {
+ return b;
+ }
+ }
+ return null;
+ }
+
+ private static InputStream getFileFromClasspath( final String filePath )
+ throws FileNotFoundException
+ {
+ try
+ {
+ URL fileURL = AbstractIntegrationTest.class.getClassLoader().getResource( filePath );
+ if( fileURL == null )
+ {
+ throw new FileNotFoundException( "File [" + filePath + "] could not be found in classpath" );
+ }
+ return fileURL.openStream();
+ }
+ catch (IOException e)
+ {
+ throw new FileNotFoundException( "File [" + filePath + "] could not be found: " + e.getMessage() );
+ }
+ }
+
+ protected void listBundleServices(Bundle b) {
+ ServiceReference []srb = b.getRegisteredServices();
+ for(ServiceReference sr:srb){
+ System.out.println(b.getSymbolicName() + " SERVICE: "+sr);
+ }
+ }
+
+ protected Boolean isServiceRegistered(Bundle b) {
+ ServiceReference []srb = b.getRegisteredServices();
+ if(srb == null) {
+ return false;
+ }
+ return true;
+ }
+
+ protected void waitForServices(Bundle b, String sclass) {
+ try {
+ BundleContext bc = b.getBundleContext();
+ String bsn = b.getSymbolicName();
+ ServiceTracker st = new ServiceTracker(bc, sclass, null);
+ st.open();
+ Object bac = st.waitForService(DEFAULT_TIMEOUT);
+ /* Uncomment for debug */
+ /*
+ if(bac == null) {
+ System.out.println("SERVICE NOTFOUND " + bsn);
+ } else {
+ System.out.println("SERVICE FOUND " + bsn);
+ }
+ */
+ st.close();
+ return;
+ }
+ catch (Exception e) {
+ System.out.println("Failed to register services for " + b.getSymbolicName() + e.getMessage());
+ }
+ }
+
+
+ protected static Option[] updateOptions(Option[] options) {
+ if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
+ Option[] ibmOptions = options(
+ wrappedBundle(mavenBundle("org.ops4j.pax.exam", "pax-exam-junit"))
+ );
+ options = combine(ibmOptions, options);
+ }
+
+ return options;
+ }
+
+ public static String getHTTPResponse(HttpURLConnection conn) throws IOException
+ {
+ StringBuilder response = new StringBuilder();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream(),
+ "ISO-8859-1"));
+ try {
+ for (String s = reader.readLine(); s != null; s = reader.readLine()) {
+ response.append(s).append("\r\n");
+ }
+ } finally {
+ reader.close();
+ }
+
+ return response.toString();
+ }
+
+ public static HttpURLConnection makeConnection(String contextPath) throws IOException
+ {
+ URL url = new URL(contextPath);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+
+ conn.setConnectTimeout(CONNECTION_TIMEOUT);
+ conn.connect();
+
+ return conn;
+ }
+
+ protected <T> T getOsgiService(Class<T> type, long timeout) {
+ return getOsgiService(type, null, timeout);
+ }
+
+ protected <T> T getOsgiService(Class<T> type) {
+ return getOsgiService(type, null, DEFAULT_TIMEOUT);
+ }
+
+ protected <T> T getOsgiService(Class<T> type, String filter, long timeout) {
+ return getOsgiService(null, type, filter, timeout);
+ }
+
+ protected <T> T getOsgiService(BundleContext bc, Class<T> type,
+ String filter, long timeout) {
+ ServiceTracker tracker = null;
+ try {
+ String flt;
+ if (filter != null) {
+ if (filter.startsWith("(")) {
+ flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")"
+ + filter + ")";
+ } else {
+ flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")("
+ + filter + "))";
+ }
+ } else {
+ flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")";
+ }
+ Filter osgiFilter = FrameworkUtil.createFilter(flt);
+ tracker = new ServiceTracker(bc == null ? bundleContext : bc, osgiFilter,
+ null);
+ tracker.open();
+
+ // add tracker to the list of trackers we close at tear down
+ srs.add(tracker);
+ Object x = tracker.waitForService(timeout);
+ Object svc = type.cast(x);
+ if (svc == null) {
+ throw new RuntimeException("Gave up waiting for service " + flt);
+ }
+ return type.cast(svc);
+ } catch (InvalidSyntaxException e) {
+ throw new IllegalArgumentException("Invalid filter", e);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static URL getUrlToEba(String groupId, String artifactId) throws MalformedURLException {
+ String artifactVersion = getArtifactVersion(groupId, artifactId);
+
+ // Need to use handler from org.ops4j.pax.url.mvn
+ URL urlToEba = new URL(null,
+ ServiceConstants.PROTOCOL + ":" + groupId + "/" +artifactId + "/"
+ + artifactVersion + "/eba", new Handler());
+ return urlToEba;
+ }
+
+}
Added: aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/apache/aries/samples/blueprint/helloworld/itests/HelloworldSampleTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/apache/aries/samples/blueprint/helloworld/itests/HelloworldSampleTest.java?rev=1085102&view=auto
==============================================================================
--- aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/apache/aries/samples/blueprint/helloworld/itests/HelloworldSampleTest.java (added)
+++ aries/trunk/samples/blueprint/helloworld/helloworld-itests/src/test/java/org/apache/aries/samples/blueprint/helloworld/itests/HelloworldSampleTest.java Thu Mar 24 19:57:22 2011
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+package org.apache.aries.samples.blueprint.helloworld.itests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.CoreOptions.bootDelegationPackages;
+import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
+
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+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;
+@RunWith(JUnit4TestRunner.class)
+public class HelloworldSampleTest extends AbstractIntegrationTest {
+
+ @Test
+ public void test() throws Exception {
+
+ /* Check that the HelloWorld Sample bundles are present an started */
+ Bundle bapi = getInstalledBundle("org.apache.aries.samples.blueprint.helloworld.api");
+ assertNotNull(bapi);
+ assertEquals(Bundle.ACTIVE, bapi.getState());
+
+ Bundle bcli = getInstalledBundle("org.apache.aries.samples.blueprint.helloworld.client");
+ assertNotNull(bcli);
+ assertEquals(Bundle.ACTIVE, bcli.getState());
+
+ Bundle bser = getInstalledBundle("org.apache.aries.samples.blueprint.helloworld.server");
+ assertNotNull(bser);
+ assertEquals(Bundle.ACTIVE, bser.getState());
+
+
+ }
+
+ @org.ops4j.pax.exam.junit.Configuration
+ public static Option[] configuration() {
+ Option[] options = options(
+ bootDelegationPackages("javax.transaction",
+ "javax.transaction.*"),
+ vmOption("-Dorg.osgi.framework.system.packages=javax.accessibility,javax.activation,javax.activity,javax.annotation,javax.annotation.processing,javax.crypto,javax.crypto.interfaces,javax.crypto.spec,javax.imageio,javax.imageio.event,javax.imageio.metadata,javax.imageio.plugins.bmp,javax.imageio.plugins.jpeg,javax.imageio.spi,javax.imageio.stream,javax.jws,javax.jws.soap,javax.lang.model,javax.lang.model.element,javax.lang.model.type,javax.lang.model.util,javax.management,javax.management.loading,javax.management.modelmbean,javax.management.monitor,javax.management.openmbean,javax.management.relation,javax.management.remote,javax.management.remote.rmi,javax.management.timer,javax.naming,javax.naming.directory,javax.naming.event,javax.naming.ldap,javax.naming.spi,javax.net,javax.net.ssl,javax.print,javax.print.attribute,javax.print.attribute.standard,javax.print.event,javax.rmi,javax.rmi.CORBA,javax.rmi.ssl,javax.script,javax.security.auth,javax.security.auth.c
allback,javax.security.auth.kerberos,javax.security.auth.login,javax.security.auth.spi,javax.security.auth.x500,javax.security.cert,javax.security.sasl,javax.sound.midi,javax.sound.midi.spi,javax.sound.sampled,javax.sound.sampled.spi,javax.sql,javax.sql.rowset,javax.sql.rowset.serial,javax.sql.rowset.spi,javax.swing,javax.swing.border,javax.swing.colorchooser,javax.swing.event,javax.swing.filechooser,javax.swing.plaf,javax.swing.plaf.basic,javax.swing.plaf.metal,javax.swing.plaf.multi,javax.swing.plaf.synth,javax.swing.table,javax.swing.text,javax.swing.text.html,javax.swing.text.html.parser,javax.swing.text.rtf,javax.swing.tree,javax.swing.undo,javax.tools,javax.xml,javax.xml.bind,javax.xml.bind.annotation,javax.xml.bind.annotation.adapters,javax.xml.bind.attachment,javax.xml.bind.helpers,javax.xml.bind.util,javax.xml.crypto,javax.xml.crypto.dom,javax.xml.crypto.dsig,javax.xml.crypto.dsig.dom,javax.xml.crypto.dsig.keyinfo,javax.xml.crypto.dsig.spec,javax.xml.datatype,javax.
xml.namespace,javax.xml.parsers,javax.xml.soap,javax.xml.stream,javax.xml.stream.events,javax.xml.stream.util,javax.xml.transform,javax.xml.transform.dom,javax.xml.transform.sax,javax.xml.transform.stax,javax.xml.transform.stream,javax.xml.validation,javax.xml.ws,javax.xml.ws.handler,javax.xml.ws.handler.soap,javax.xml.ws.http,javax.xml.ws.soap,javax.xml.ws.spi,javax.xml.xpath,org.ietf.jgss,org.omg.CORBA,org.omg.CORBA.DynAnyPackage,org.omg.CORBA.ORBPackage,org.omg.CORBA.TypeCodePackage,org.omg.CORBA.portable,org.omg.CORBA_2_3,org.omg.CORBA_2_3.portable,org.omg.CosNaming,org.omg.CosNaming.NamingContextExtPackage,org.omg.CosNaming.NamingContextPackage,org.omg.Dynamic,org.omg.DynamicAny,org.omg.DynamicAny.DynAnyFactoryPackage,org.omg.DynamicAny.DynAnyPackage,org.omg.IOP,org.omg.IOP.CodecFactoryPackage,org.omg.IOP.CodecPackage,org.omg.Messaging,org.omg.PortableInterceptor,org.omg.PortableInterceptor.ORBInitInfoPackage,org.omg.PortableServer,org.omg.PortableServer.CurrentPackage,
org.omg.PortableServer.POAManagerPackage,org.omg.PortableServer.POAPackage,org.omg.PortableServer.ServantLocatorPackage,org.omg.PortableServer.portable,org.omg.SendingContext,org.omg.stub.java.rmi,org.w3c.dom,org.w3c.dom.bootstrap,org.w3c.dom.css,org.w3c.dom.events,org.w3c.dom.html,org.w3c.dom.ls,org.w3c.dom.ranges,org.w3c.dom.stylesheets,org.w3c.dom.traversal,org.w3c.dom.views,org.xml.sax,org.xml.sax.ext,org.xml.sax.helpers,javax.transaction;partial=true;mandatory:=partial,javax.transaction.xa;partial=true;mandatory:=partial"),
+ // Log
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
+ // Felix mvn url handler - do we need this?
+ mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
+
+ // this is how you set the default log level when using pax
+ // logging (logProfile)
+ systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level")
+ .value("DEBUG"),
+
+ // Bundles
+ mavenBundle("org.eclipse.equinox", "cm"),
+ mavenBundle("org.eclipse.osgi", "services"),
+
+ mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint" ),
+ mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
+ mavenBundle("org.apache.aries", "org.apache.aries.util" ),
+ mavenBundle("asm", "asm-all" ),
+ mavenBundle("org.apache.aries.samples.blueprint.helloworld", "org.apache.aries.samples.blueprint.helloworld.api"),
+ mavenBundle("org.apache.aries.samples.blueprint.helloworld", "org.apache.aries.samples.blueprint.helloworld.server"),
+ mavenBundle("org.apache.aries.samples.blueprint.helloworld", "org.apache.aries.samples.blueprint.helloworld.client"),
+ /* For debugging, uncomment the next two lines */
+ /*vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7777"),
+ waitForFrameworkStartup(),
+*/
+ /* For debugging, add these imports:
+ import static org.ops4j.pax.exam.CoreOptions.waitForFrameworkStartup;
+ import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
+ */
+ equinox().version("3.5.0")
+ );
+ options = updateOptions(options);
+ return options;
+ }
+
+}
Modified: aries/trunk/samples/blueprint/helloworld/helloworld-server/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/samples/blueprint/helloworld/helloworld-server/pom.xml?rev=1085102&r1=1085101&r2=1085102&view=diff
==============================================================================
--- aries/trunk/samples/blueprint/helloworld/helloworld-server/pom.xml (original)
+++ aries/trunk/samples/blueprint/helloworld/helloworld-server/pom.xml Thu Mar 24 19:57:22 2011
@@ -20,11 +20,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.aries.samples.blueprint.helloworld</groupId>
+ <groupId>org.apache.aries.samples</groupId>
<artifactId>helloworld</artifactId>
<version>0.3.1-SNAPSHOT</version>
</parent>
+ <groupId>org.apache.aries.samples.blueprint.helloworld</groupId>
<artifactId>org.apache.aries.samples.blueprint.helloworld.server</artifactId>
<name>Apache Aries Blueprint HelloWorldServer</name>
<packaging>bundle</packaging>
Modified: aries/trunk/samples/blueprint/helloworld/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/samples/blueprint/helloworld/pom.xml?rev=1085102&r1=1085101&r2=1085102&view=diff
==============================================================================
--- aries/trunk/samples/blueprint/helloworld/pom.xml (original)
+++ aries/trunk/samples/blueprint/helloworld/pom.xml Thu Mar 24 19:57:22 2011
@@ -19,12 +19,11 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.aries.samples.blueprint</groupId>
- <artifactId>blueprint</artifactId>
+ <groupId>org.apache.aries.samples</groupId>
+ <artifactId>blueprint</artifactId>
<version>0.3.1-SNAPSHOT</version>
</parent>
- <groupId>org.apache.aries.samples.blueprint.helloworld</groupId>
<artifactId>helloworld</artifactId>
<name>Apache Aries Blueprint HelloWorld</name>
<packaging>pom</packaging>
@@ -52,6 +51,11 @@
<artifactId>org.apache.aries.samples.blueprint.helloworld.assembly</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.aries.samples.blueprint.helloworld</groupId>
+ <artifactId>org.apache.aries.samples.blueprint.helloworld.itests</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
@@ -61,6 +65,7 @@
<module>helloworld-client</module>
<module>helloworld-assembly</module>
<module>helloworld-eba</module>
+ <module>helloworld-itests</module>
</modules>
</project>
Modified: aries/trunk/samples/blueprint/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/samples/blueprint/pom.xml?rev=1085102&r1=1085101&r2=1085102&view=diff
==============================================================================
--- aries/trunk/samples/blueprint/pom.xml (original)
+++ aries/trunk/samples/blueprint/pom.xml Thu Mar 24 19:57:22 2011
@@ -23,7 +23,6 @@
<version>0.3.1-SNAPSHOT</version>
</parent>
- <groupId>org.apache.aries.samples.blueprint</groupId>
<artifactId>blueprint</artifactId>
<name>Apache Aries Blueprint samples</name>
<packaging>pom</packaging>