You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2011/03/15 14:08:45 UTC

svn commit: r1081763 - in /tuscany/sca-java-2.x/trunk/unreleased/distribution: ./ osgi/ osgi/src/ osgi/src/test/ osgi/src/test/java/ osgi/src/test/java/sample/

Author: slaws
Date: Tue Mar 15 13:08:45 2011
New Revision: 1081763

URL: http://svn.apache.org/viewvc?rev=1081763&view=rev
Log:
A bit of tidying from the itest/bundle example to get the repository.xml files to represent features and to put them in features directories. I not necessarily proposing a separate OSGi distro so it would be good to get this to work in the context of the all distro. Just proved difficult due to the number of dependencies required by pax exam. Maybe we need a simpler way of running OSGi and the aries bundles. 

Added:
    tuscany/sca-java-2.x/trunk/unreleased/distribution/
    tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/
    tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/pom.xml
    tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/src/
    tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/src/test/
    tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/src/test/java/
    tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/src/test/java/sample/
    tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/src/test/java/sample/GenerateFeatureReposTestCase.java
    tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/src/test/java/sample/TestBaseClass.java

Added: tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/pom.xml?rev=1081763&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/pom.xml (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/pom.xml Tue Mar 15 13:08:45 2011
@@ -0,0 +1,428 @@
+<?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>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-distribution</artifactId>
+        <version>2.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>tuscany-distribution-osgi</artifactId>
+    <name>Apache Tuscany SCA OSGI Distribution</name>
+<!-- 
+    <packaging>pom</packaging>
+-->
+
+    <repositories>
+        <repository>
+            <id>java.net2</id>
+            <name>java.net Maven 2.x Repository</name>
+            <url>http://download.java.net/maven/2</url>
+        </repository>
+        <repository>
+            <id>intalio.org</id>
+            <url>http://www.intalio.org/public/maven2</url>
+           <releases>
+               <enabled>true</enabled>
+           </releases>
+           <snapshots>
+               <enabled>false</enabled>
+           </snapshots>
+        </repository>     
+        <repository>
+            <id>openejb-repository</id>
+            <name>OpenEJB Repository</name>
+            <url>http://svn.apache.org/repos/asf/openejb/repo</url>
+            <layout>default</layout>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+        </repository>
+    </repositories>
+
+    <dependencies>
+
+        <!-- module jars for modules directory -->
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-feature-all</artifactId>
+            <type>pom</type>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>        
+
+        <!-- needed for the unit test which produces the feature repository.xml files -->
+       <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>test</scope>
+       </dependency>          
+       
+       <dependency>
+           <groupId>org.apache.aries.application</groupId>
+           <artifactId>org.apache.aries.application.management</artifactId>
+           <version>0.4-SNAPSHOT</version>
+           <scope>test</scope>
+       </dependency> 
+       
+       <dependency>
+           <groupId>org.apache.aries.application</groupId>
+           <artifactId>org.apache.aries.application.modeller</artifactId>
+           <version>0.4-SNAPSHOT</version>
+           <scope>test</scope>
+       </dependency>                  
+       
+       <dependency>
+           <groupId>org.apache.aries.application</groupId>
+           <artifactId>org.apache.aries.application.resolver.obr</artifactId>
+           <version>0.4-SNAPSHOT</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.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.tuscany.maven.plugins</groupId> 
+                <artifactId>maven-bundle-plugin</artifactId> 
+                <version>1.0.7</version>
+                <executions>
+                    <!-- generate the which-jars files -->
+                    <execution>
+                        <id>extensions-build</id>
+                        <phase>process-resources</phase>
+                        <goals>
+                             <goal>generate-meta-data</goal>
+                        </goals>
+                        <configuration>
+                             <generateModules>false</generateModules>
+                             <useDistributionName>false</useDistributionName>
+                             <generateManifestJar>true</generateManifestJar>
+                             <generateConfig>false</generateConfig>
+                             <generateAntScript>true</generateAntScript> 
+                             <generateTargetPlatform>false</generateTargetPlatform>
+                             <generateAggregatedBundle>false</generateAggregatedBundle>
+                             <featuresName>features</featuresName>
+                             <features>
+                                 <feature>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-base-runtime-pom</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </feature>
+                             </features>
+                             <extensions>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-binding-atom-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-binding-commet-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-binding-corba-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-binding-ejb-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-binding-hazelcase-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-binding-jms-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-binding-jsonp-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-binding-rest-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-binding-rmi-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-binding-rss-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-binding-ws-runtime-axis2</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-implementation-bpel-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-implementation-jaxes-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-implementation-osgi-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-implementation-python-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-implementation-script-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-implementation-spring-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-implementation-web-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-implementation-widget-runtime</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+
+                                 <extension>
+                                     <groupId>org.apache.tuscany.sca</groupId>
+                                     <artifactId>tuscany-host-jetty</artifactId>
+                                     <version>2.0-SNAPSHOT</version>
+                                 </extension>
+                             </extensions>
+                            <artifactManifests>
+                            <!--
+                                 <artifactManifest>
+                                     <groupId>org.apache.ws.commons.axiom</groupId>
+                                     <artifactId>axiom-api</artifactId>
+                                     <version>1.2.10</version>
+                                     <manifestFile>${basedir}/manifests/axiom-api-1.2.10.MF</manifestFile>
+                                 </artifactManifest>
+                                 -->
+                                 <artifactManifest>
+                                     <groupId>org.apache.woden</groupId>
+                                     <artifactId>woden-impl-dom</artifactId>
+                                     <version>1.0M8</version>
+                                     <manifestFile>${basedir}/manifests/woden-impl-dom-1.0M8.MF</manifestFile>
+                                 </artifactManifest>
+                                 <artifactManifest>
+                                     <groupId>org.apache.axis2</groupId>
+                                     <artifactId>axis2-kernel</artifactId>
+                                     <version>1.5.3</version>
+                                     <manifestFile>${basedir}/manifests/axis2-kernel-1.5.3.MF</manifestFile>
+                                 </artifactManifest>
+                                 <artifactManifest>
+                                     <groupId>org.apache.axis2</groupId>
+                                     <artifactId>axis2-transport-http</artifactId>
+                                     <version>1.5.3</version>
+                                     <manifestFile>${basedir}/manifests/axis2-transport-http-1.5.3.MF</manifestFile>
+                                 </artifactManifest>
+                                 <artifactManifest>
+                                     <groupId>org.apache.axis2</groupId>
+                                     <artifactId>*</artifactId>
+                                     <version>*</version>
+                                 </artifactManifest>
+                             </artifactManifests>
+                        </configuration>
+                    </execution>
+                </executions>
+                <dependencies>
+                   <dependency>
+                      <groupId>org.eclipse</groupId>
+                      <artifactId>osgi</artifactId>
+                      <version>3.3.0-v20070530</version>
+                   </dependency>
+                </dependencies>
+            </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/distribution/osgi/src/test/java/sample/GenerateFeatureReposTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/src/test/java/sample/GenerateFeatureReposTestCase.java?rev=1081763&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/src/test/java/sample/GenerateFeatureReposTestCase.java (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/src/test/java/sample/GenerateFeatureReposTestCase.java Tue Mar 15 13:08:45 2011
@@ -0,0 +1,37 @@
+/*
+ * 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.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+
+
+@RunWith( JUnit4TestRunner.class )
+public class GenerateFeatureReposTestCase extends TestBaseClass{
+    
+    @Test
+    public void generateBaseRepositoryXML() {
+        generateRepositoryXML("tuscany-base-runtime-pom");
+        generateRepositoryXML("tuscany-binding-ws-runtime-axis2");
+    }
+}
+
+

Added: tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/src/test/java/sample/TestBaseClass.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/src/test/java/sample/TestBaseClass.java?rev=1081763&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/src/test/java/sample/TestBaseClass.java (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/distribution/osgi/src/test/java/sample/TestBaseClass.java Tue Mar 15 13:08:45 2011
@@ -0,0 +1,205 @@
+/*
+ * 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.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+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 static org.ops4j.pax.exam.container.def.PaxRunnerOptions.workingDirectory;
+
+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.container.def.options.WorkingDirectoryOption;
+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 TestBaseClass {
+    
+    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.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(),
+          */
+          
+          workingDirectory("D://sca-java-2.x//unreleased//distribution//osgi//target"),
+          
+          equinox().version("3.5.0")); 
+      
+      return options;
+    }    
+
+    public void generateRepositoryXML(String featureName) {
+        System.out.println("generateRepositoryXML - start");
+        System.out.println("test dir = " + System.getProperty("user.dir"));
+        System.out.println("current dir = " + this.getClass().getProtectionDomain().getCodeSource().getLocation());
+        
+        // get the OBR repository admin service
+        RepositoryAdmin respositoryAdminService = getOsgiService(RepositoryAdmin.class);
+       
+        // get the repository generator service
+        System.out.println("get RepositoryGenerator service =");
+        RepositoryGenerator repositoryGenerator = getOsgiService(RepositoryGenerator.class);
+        System.out.println(repositoryGenerator);
+                
+        System.out.println("get ModelledResourceManager service =");
+        ModelledResourceManager modelledResourceManager = getOsgiService(ModelledResourceManager.class);
+        System.out.println(modelledResourceManager);
+        
+        Set<ModelledResource> mrs = new HashSet<ModelledResource>();
+        
+        try {
+            // create mrs based on base runtime
+            // directories relative to working directory
+            populateMRS(modelledResourceManager,
+                        mrs, 
+                        "../../../../distribution/all/target/features/" + featureName + "/which-jars", 
+                        "../../../../distribution/all/target/modules");
+            FileOutputStream fout = new FileOutputStream("./features/" +featureName + "/repository.xml");
+            repositoryGenerator.generateRepository(featureName + " repository", mrs, fout);
+            fout.close();
+        
+        } catch(Exception ex) {
+            ex.printStackTrace();
+        }
+        
+        System.out.println("generateRepositoryXML - end");
+    }    
+    
+    public void populateMRS(ModelledResourceManager modelledResourceManager,
+                             Set<ModelledResource> mrs, 
+                             String whichJars, 
+                             String modules){
+        try {
+            BufferedReader in = new BufferedReader(new FileReader(whichJars));
+            String line;
+            while ((line = in.readLine()) != null) {
+                if (line.endsWith(".jar")){
+                    int dirSeparatorIndex = line.indexOf("/");
+                    if (dirSeparatorIndex > 0){
+                        line = line.substring(0, dirSeparatorIndex);
+                    }
+                    System.out.println("Processing - " + line);
+                    File bundleFile = new File(modules + "\\" + line);
+                    IDirectory jarDir = FileSystem.getFSRoot(bundleFile);
+                    mrs.add(modelledResourceManager.getModelledResource(bundleFile.toURI().toString(), jarDir));
+                }
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+    
+    public <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);
+        }            
+    }    
+    
+    public static MavenArtifactProvisionOption mavenBundle(String groupId, String artifactId) {
+      return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).versionAsInProject();
+    }    
+}
+
+