Author: slaws
Date: Wed Mar 9 12:26:34 2011
New Revision: 1079774
URL: http://svn.apache.org/viewvc?rev=1079774&view=rev
Log:
A bundle test that generates a repository.xml file using the Aries generator.
I'm hoping to use this mechanism to general OBR configuration that describes
our various collections of bundles. I note though from recent Aries ML activity
that Felix has a generator also and they are discussing whether they should
remove the Aries version so we'll have to see.
Added:
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/ (with props)
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/commands.txt
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/pom.xml
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/Helloworld.java
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/impl/
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/impl/HelloworldImpl.java
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/impl/SampleActivator.java
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/sca-contribution.xml
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/services/
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/definitions.xml
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/helloworld.composite
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/test/
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/test/java/
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/test/java/sample/
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/test/java/sample/HelloworldTestCase.java
Propchange: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Mar 9 12:26:34 2011
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target
Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/commands.txt
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/commands.txt?rev=1079774&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/commands.txt
(added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/commands.txt Wed
Mar 9 12:26:34 2011
@@ -0,0 +1,15 @@
+java -jar bin/felix.jar
+
+
+install
file:///D:/sca-java-2.x/modules/sca-api/target/tuscany-sca-api-2.0-SNAPSHOT.jar
+start #
+install
file:///D:/sca-java-2.x/unreleased/testing/itest/bundle/target/bundle-2.0-SNAPSHOT.jar
+start #
+
+mvn org.apache.felix:maven-bundle-plugin:2.1.0:install-file -DpomFile=pom.xml
-Dfile=target\bundle-2.0-SNAPSHOT.jar
+mvn org.apache.felix:maven-bundle-plugin:2.1.0:install-file -DpomFile=pom.xml
-Dfile=target\tuscany-sca-api-2.0-SNAPSHOT.jar
+
+mvn org.apache.felix:maven-bundle-plugin:2.1.0:index -DurlTemplate=maven
+~/.m2/repository/repository.xml
+
+
Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/pom.xml
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/pom.xml?rev=1079774&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/pom.xml (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/pom.xml Wed Mar
9 12:26:34 2011
@@ -0,0 +1,263 @@
+<?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.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>bundle</artifactId>
+ <name>Apache Tuscany SCA iTest Bundle</name>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <tuscany.version>2.0-SNAPSHOT</tuscany.version>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>osgi</artifactId>
+ <version>3.5.0-v20090520</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.api</artifactId>
+ <version>0.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.management</artifactId>
+ <version>0.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.modeller</artifactId>
+ <version>0.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.resolver.obr</artifactId>
+ <version>0.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- Test dependencies -->
+<!--
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+-->
+
+ <!-- Pax Exam test runtime -->
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam</artifactId>
+ <version>1.2.4</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit</artifactId>
+ <version>1.2.4</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-default</artifactId>
+ <version>1.2.4</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-api</artifactId>
+ <version>1.6.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-service</artifactId>
+ <version>1.6.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-mvn</artifactId>
+ <version>1.2.4</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- extra bundles that will be loaded -->
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.bundlerepository</artifactId>
+ <version>1.6.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <version>1.2.4</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries</groupId>
+ <artifactId>org.apache.aries.util</artifactId>
+ <version>0.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint</artifactId>
+ <version>0.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.proxy</groupId>
+ <artifactId>org.apache.aries.proxy</artifactId>
+ <version>0.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.runtime</artifactId>
+ <version>0.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+
<artifactId>org.apache.aries.application.default.local.platform</artifactId>
+ <version>0.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+
<artifactId>org.apache.aries.application.runtime.itest.interfaces</artifactId>
+ <version>0.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm-all</artifactId>
+ <version>3.3.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.2.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>4.2.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+<!--
+ <executions>
+ <execution>
+ <id>generate-obr</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>install</goal>
+ </goals>
+ </execution>
+ </executions>
+-->
+ <configuration>
+<!--
+ <obrRepository>target/obr</obrRepository>
+-->
+ <instructions>
+ <Export-Package>sample</Export-Package>
+ <Private-Package>sample.impl</Private-Package>
+ <Bundle-Activator>sample.impl.SampleActivator</Bundle-Activator>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+ <execution>
+ <id>generate-depends-file</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>
+
+</project>
Added:
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/Helloworld.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/Helloworld.java?rev=1079774&view=auto
==============================================================================
---
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/Helloworld.java
(added)
+++
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/Helloworld.java
Wed Mar 9 12:26:34 2011
@@ -0,0 +1,28 @@
+/*
+ * 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 sample;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface Helloworld {
+
+ String sayHello(String name);
+
+}
Added:
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/impl/HelloworldImpl.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/impl/HelloworldImpl.java?rev=1079774&view=auto
==============================================================================
---
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/impl/HelloworldImpl.java
(added)
+++
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/impl/HelloworldImpl.java
Wed Mar 9 12:26:34 2011
@@ -0,0 +1,43 @@
+/*
+ * 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 sample.impl;
+
+import org.oasisopen.sca.annotation.Property;
+import org.oasisopen.sca.annotation.Reference;
+
+import sample.Helloworld;
+
+public class HelloworldImpl implements Helloworld {
+
+ @Reference(required=false)
+ protected Helloworld hwRef;
+
+ @Property
+ protected String componentName;
+
+ public String sayHello(String name) {
+ String returnString = "Hello " + name + "->" + componentName;
+ if (hwRef != null){
+ return hwRef.sayHello(returnString);
+ } else {
+ return returnString;
+ }
+ }
+
+}
Added:
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/impl/SampleActivator.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/impl/SampleActivator.java?rev=1079774&view=auto
==============================================================================
---
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/impl/SampleActivator.java
(added)
+++
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/java/sample/impl/SampleActivator.java
Wed Mar 9 12:26:34 2011
@@ -0,0 +1,45 @@
+/*
+ * 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 sample.impl;
+
+import java.util.logging.Logger;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+import sample.Helloworld;
+
+public class SampleActivator implements BundleActivator {
+ private Logger logger = Logger.getLogger(SampleActivator.class.getName());
+
+
+ public void start(BundleContext context) throws Exception {
+ logger.info("Starting " + context.getBundle());
+
+ Helloworld hw = new HelloworldImpl();
+ logger.info(hw.sayHello("Fred Bloggs"));
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ logger.info("Stopping " + context.getBundle());
+ // Registered services will be automatically unregistered
+ }
+
+}
Added:
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/sca-contribution.xml
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/sca-contribution.xml?rev=1079774&view=auto
==============================================================================
---
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/sca-contribution.xml
(added)
+++
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/sca-contribution.xml
Wed Mar 9 12:26:34 2011
@@ -0,0 +1,25 @@
+<?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.
+-->
+<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:sample="http://sample">
+
+ <deployable composite="sample:helloworld-contribution" />
+
+</contribution>
Added:
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=1079774&view=auto
==============================================================================
---
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
(added)
+++
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
Wed Mar 9 12:26:34 2011
@@ -0,0 +1,20 @@
+# 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.
+
+sample.ImplementationGenericPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#implementationGenericPolicy,model=sample.ImplementationGenericPolicy
+sample.InteractionGenericPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#interactionGenericPolicy,model=sample.InteractionGenericPolicy
+sample.InteractionBindingWSPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#interactionBindingWSPolicy,model=sample.InteractionBindingWSPolicy
\ No newline at end of file
Added:
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions?rev=1079774&view=auto
==============================================================================
---
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions
(added)
+++
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions
Wed Mar 9 12:26:34 2011
@@ -0,0 +1,17 @@
+# 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.
+definitions.xml
Added:
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory?rev=1079774&view=auto
==============================================================================
---
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
(added)
+++
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
Wed Mar 9 12:26:34 2011
@@ -0,0 +1,18 @@
+# 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.
+
+sample.InteractionBindingWSPolicyProviderFactory;model=sample.InteractionBindingWSPolicy
\ No newline at end of file
Added:
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/definitions.xml
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/definitions.xml?rev=1079774&view=auto
==============================================================================
---
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/definitions.xml
(added)
+++
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/definitions.xml
Wed Mar 9 12:26:34 2011
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<definitions xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.1"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1">
+
+ <intent name="implementation.generic" constrains="implementation">
+ <description>
+ An intent that targets policy interceptors at the
implementation
+ </description>
+ </intent>
+
+ <intent name="interaction.generic" constrains="binding">
+ <description>
+ An intent that targets policy interceptors at the binding
generically
+ </description>
+ </intent>
+
+ <intent name="interaction.bindingws" constrains="binding.ws">
+ <description>
+ An intent that targets policy interceptors at binding.ws
+ </description>
+ </intent>
+
+ <policySet name="ImplementationGeneric"
+ provides="tuscany:implementation.generic"
+ appliesTo="//implementation">
+ <tuscany:implementationGenericPolicy name="ImplementationGeneric"/>
+ </policySet>
+
+ <policySet name="InteractionGeneric"
+ provides="tuscany:interaction.generic"
+ appliesTo="//binding">
+ <tuscany:interactionGenericPolicy name="InteractionGeneric"/>
+ </policySet>
+
+ <policySet name="InteractionBindingWS"
+ provides="tuscany:interaction.bindingws"
+ appliesTo="//binding.ws">
+ <tuscany:interactionBindingWSPolicy name="InteractionBindingWS"/>
+ </policySet>
+
+</definitions>
\ No newline at end of file
Added:
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/helloworld.composite
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/helloworld.composite?rev=1079774&view=auto
==============================================================================
---
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/helloworld.composite
(added)
+++
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/main/resources/helloworld.composite
Wed Mar 9 12:26:34 2011
@@ -0,0 +1,50 @@
+<?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.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ targetNamespace="http://sample"
+ name="helloworld-contribution">
+
+ <component name="HelloworldComponent1">
+ <implementation.java class="sample.HelloworldImpl"/>
+ <reference name="hwRef"
+ target="HelloworldComponent2"
+ requires="tuscany:interaction.bindingws"
+ policySets="tuscany:InteractionBindingWS"/>
+ <property name="componentName" value="HelloworldComponent1"/>
+ </component>
+
+ <component name="HelloworldComponent2">
+ <implementation.java class="sample.HelloworldImpl"/>
+ <service name="Helloworld"
+ requires="tuscany:interaction.bindingws"
+ policySets="tuscany:InteractionBindingWS">
+ <binding.ws/>
+ </service>
+ <reference name="hwRef" target="HelloworldComponent3"/>
+ <property name="componentName" value="HelloworldComponent2"/>
+ </component>
+
+ <component name="HelloworldComponent3">
+ <implementation.java class="sample.HelloworldImpl"/>
+ <property name="componentName" value="HelloworldComponent3"/>
+ </component>
+
+</composite>
Added:
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/test/java/sample/HelloworldTestCase.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/test/java/sample/HelloworldTestCase.java?rev=1079774&view=auto
==============================================================================
---
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/test/java/sample/HelloworldTestCase.java
(added)
+++
tuscany/sca-java-2.x/trunk/unreleased/testing/itest/bundle/src/test/java/sample/HelloworldTestCase.java
Wed Mar 9 12:26:34 2011
@@ -0,0 +1,182 @@
+/*
+ * 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 sample;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.HashSet;
+import java.util.Set;
+
+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 org.apache.aries.application.filesystem.IDirectory;
+import
org.apache.aries.application.management.spi.repository.RepositoryGenerator;
+import org.apache.aries.application.modelling.ModelledResourceManager;
+import org.apache.aries.application.modelling.ModelledResource;
+import org.apache.aries.application.utils.filesystem.FileSystem;
+
+import org.apache.felix.bundlerepository.Repository;
+import org.apache.felix.bundlerepository.RepositoryAdmin;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Inject;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.util.tracker.ServiceTracker;
+
+/* For debugging, uncomment the next two lines and add these imports:
+ */
+import static org.ops4j.pax.exam.CoreOptions.waitForFrameworkStartup;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
+
+
+/**
+ * Note that much of the technical detail/instruction comes from...
+ *
+ *
http://svn.apache.org/repos/asf/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverTest.java
+ *
+ */
+
+@RunWith( JUnit4TestRunner.class )
+public class HelloworldTestCase {
+
+ public static final long DEFAULT_TIMEOUT = 30000;
+
+ @Inject
+ protected BundleContext bundleContext;
+
+ @Configuration
+ public static Option[] configuration() {
+ Option[] options = options(
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
+
systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
+
+ mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
+ mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
+
+ mavenBundle("org.apache.aries.blueprint",
"org.apache.aries.blueprint"),
+ mavenBundle("asm", "asm-all"),
+ mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
+ mavenBundle("org.apache.aries", "org.apache.aries.util"),
+
+ mavenBundle("org.apache.aries.application",
"org.apache.aries.application.api"),
+ mavenBundle("org.apache.aries.application",
"org.apache.aries.application.utils"),
+ mavenBundle("org.apache.aries.application",
"org.apache.aries.application.modeller"),
+ mavenBundle("org.apache.aries.application",
"org.apache.aries.application.default.local.platform"),
+ mavenBundle("org.apache.felix",
"org.apache.felix.bundlerepository"),
+ mavenBundle("org.apache.aries.application",
"org.apache.aries.application.resolver.obr"),
+ mavenBundle("org.apache.aries.application",
"org.apache.aries.application.deployment.management"),
+ mavenBundle("org.apache.aries.application",
"org.apache.aries.application.management"),
+ mavenBundle("org.apache.aries.application",
"org.apache.aries.application.runtime"),
+ mavenBundle("org.apache.aries.application",
"org.apache.aries.application.runtime.itest.interfaces"),
+ mavenBundle("org.osgi", "org.osgi.compendium"),
+ mavenBundle("org.apache.aries.testsupport",
"org.apache.aries.testsupport.unit"),
+
+ mavenBundle("org.apache.tuscany.sca", "tuscany-sca-api"),
+
+ mavenBundle("org.apache.tuscany.sca", "bundle"),
+
+ /* For debugging, uncomment the next two lines
+
vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7777"),
+ waitForFrameworkStartup(),
+ */
+
+ equinox().version("3.5.0"));
+
+ return options;
+ }
+
+ @Test
+ public void testSayHello() {
+ System.out.println("testSayHello - start");
+
+ // get the OBR repository admin service
+ RepositoryAdmin respositoryAdminService =
getOsgiService(RepositoryAdmin.class);
+
+ // print currently registered repos
+ Repository[] repos = respositoryAdminService.listRepositories();
+ System.out.println("initial repos");
+ for (Repository repo : repos) {
+ System.out.println("Repo >>> " + repo.getName());
+ }
+
+ // get the repository generator service
+ System.out.println("XXXXXX get RepositoryGenerator service =");
+ RepositoryGenerator repositoryGenerator =
getOsgiService(RepositoryGenerator.class);
+ System.out.println("XXXXXX" + repositoryGenerator);
+
+ System.out.println("XXXXXX get ModelledResourceManager service =");
+ ModelledResourceManager modelledResourceManager =
getOsgiService(ModelledResourceManager.class);
+ System.out.println("XXXXXX" + modelledResourceManager);
+
+ Set<ModelledResource> mrs = new HashSet<ModelledResource>();
+
+ try {
+ File bundleFile = new
File("D:/sca-java-2.x/distribution/all/target/modules/tuscany-assembly-2.0-SNAPSHOT.jar");
+ IDirectory jarDir = FileSystem.getFSRoot(bundleFile);
+
mrs.add(modelledResourceManager.getModelledResource(bundleFile.toURI().toString(),
jarDir));
+ File outFile = new
File("D://sca-java-2.x//unreleased//testing//itest//bundle//target//myrepository.xml");
+ FileOutputStream fout = new FileOutputStream(outFile);
+ repositoryGenerator.generateRepository("Test repo description",
mrs, fout);
+ fout.close();
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ }
+
+
+ //repositoryAdmin.addRepository(new
File("repository.xml").toURI().toURL());
+
+ System.out.println("testSayHello - end");
+ }
+
+ private <T> T getOsgiService(Class<T> type) {
+ try {
+ String filterString = "(" + Constants.OBJECTCLASS + "=" +
type.getName() + ")";
+ Filter osgiFilter = FrameworkUtil.createFilter(filterString);
+ ServiceTracker tracker = new ServiceTracker(bundleContext,
osgiFilter, null);
+ tracker.open();
+ Object tmp = tracker.waitForService(DEFAULT_TIMEOUT);
+ return type.cast(tmp);
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ private static MavenArtifactProvisionOption mavenBundle(String groupId,
String artifactId) {
+ return
CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).versionAsInProject();
+ }
+}
+
+