cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1517286 - in /cxf/dosgi/trunk: distribution/ distribution/features/src/main/resources/ distribution/multi-bundle2/ distribution/multi-bundle2/src/main/resources/META-INF/ distribution/multi-bundle2/src/main/xsl/ parent/ systests2/multi-bun...
Date Sun, 25 Aug 2013 13:24:56 GMT
Author: cschneider
Date: Sun Aug 25 13:24:55 2013
New Revision: 1517286

URL: http://svn.apache.org/r1517286
Log:
DOSGI-201 Activating new distro in build and tests

Removed:
    cxf/dosgi/trunk/distribution/multi-bundle2/src/main/resources/META-INF/NOTICE.jdom
Modified:
    cxf/dosgi/trunk/distribution/features/src/main/resources/features.xml
    cxf/dosgi/trunk/distribution/multi-bundle2/pom.xml
    cxf/dosgi/trunk/distribution/multi-bundle2/src/main/xsl/felix_distro_config.xslt
    cxf/dosgi/trunk/distribution/pom.xml
    cxf/dosgi/trunk/parent/pom.xml
    cxf/dosgi/trunk/systests2/multi-bundle/pom.xml
    cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java
    cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportService.java
    cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java

Modified: cxf/dosgi/trunk/distribution/features/src/main/resources/features.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/distribution/features/src/main/resources/features.xml?rev=1517286&r1=1517285&r2=1517286&view=diff
==============================================================================
--- cxf/dosgi/trunk/distribution/features/src/main/resources/features.xml (original)
+++ cxf/dosgi/trunk/distribution/features/src/main/resources/features.xml Sun Aug 25 13:24:55
2013
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0">
     <repository>mvn:org.apache.cxf.karaf/apache-cxf/${cxf.version}/xml/features</repository>
+    <repository>mvn:org.apache.karaf.assemblies.features/standard/2.3.1/xml/features</repository>
 
 	<feature name="cxf-dosgi-base" description="base libs needed outside karaf" version="${project.version}"
resolver="(obr)">
 		<bundle start-level="8">mvn:org.osgi/org.osgi.compendium/4.2.0</bundle>

Modified: cxf/dosgi/trunk/distribution/multi-bundle2/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/distribution/multi-bundle2/pom.xml?rev=1517286&r1=1517285&r2=1517286&view=diff
==============================================================================
--- cxf/dosgi/trunk/distribution/multi-bundle2/pom.xml (original)
+++ cxf/dosgi/trunk/distribution/multi-bundle2/pom.xml Sun Aug 25 13:24:55 2013
@@ -21,7 +21,6 @@
 
   <modelVersion>4.0.0</modelVersion>
   <artifactId>cxf-dosgi-ri-multibundle-distribution2</artifactId>
-  <!-- Do not delete version. It is read by the systests (MultiBundleTools) -->
   <name>Distributed OSGI Multi-Bundle Distribution2</name>
   <url>http://cxf.apache.org</url>
 
@@ -65,11 +64,13 @@
               <features>
                 <feature>cxf-dosgi-base</feature>
                 <feature>cxf-dosgi-discovery-distributed</feature>
+                <feature>cxf-dosgi-zookeeper-server</feature>
               </features>
               <repository>target/distribution_bundles</repository>
               <resolveDefinedRepositoriesRecursively>true</resolveDefinedRepositoriesRecursively>
               <flatRepoLayout>true</flatRepoLayout>
               <exportMetaData>true</exportMetaData>
+              <karafVersion>2.3.2</karafVersion>
             </configuration>
           </execution>
         </executions>

Modified: cxf/dosgi/trunk/distribution/multi-bundle2/src/main/xsl/felix_distro_config.xslt
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/distribution/multi-bundle2/src/main/xsl/felix_distro_config.xslt?rev=1517286&r1=1517285&r2=1517286&view=diff
==============================================================================
--- cxf/dosgi/trunk/distribution/multi-bundle2/src/main/xsl/felix_distro_config.xslt (original)
+++ cxf/dosgi/trunk/distribution/multi-bundle2/src/main/xsl/felix_distro_config.xslt Sun Aug
25 13:24:55 2013
@@ -8,6 +8,7 @@ org.ops4j.pax.web.session.timeout=30
 org.osgi.framework.startlevel.beginning=200
 
 <xsl:for-each select="//bundle[not(contains(@name,'cxf-karaf-commands'))]">
+<xsl:sort select="@start-level" data-type="number"/>
 <xsl:variable name="i" select="position() + count(//bundles/felix_deps) + $Offset"/>
 felix.auto.start.<xsl:value-of select="$i"/>=file:dosgi_bundles/<xsl:value-of select="@name"/>
 </xsl:for-each>

Modified: cxf/dosgi/trunk/distribution/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/distribution/pom.xml?rev=1517286&r1=1517285&r2=1517286&view=diff
==============================================================================
--- cxf/dosgi/trunk/distribution/pom.xml (original)
+++ cxf/dosgi/trunk/distribution/pom.xml Sun Aug 25 13:24:55 2013
@@ -39,7 +39,7 @@
 
     <modules>
       <module>features</module>
-      <module>multi-bundle</module>
+      <module>multi-bundle2</module>
       <module>sources</module>
     </modules>
 </project>

Modified: cxf/dosgi/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/parent/pom.xml?rev=1517286&r1=1517285&r2=1517286&view=diff
==============================================================================
--- cxf/dosgi/trunk/parent/pom.xml (original)
+++ cxf/dosgi/trunk/parent/pom.xml Sun Aug 25 13:24:55 2013
@@ -174,7 +174,7 @@
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-dependency-plugin</artifactId>
-                    <version>2.2</version>
+                    <version>2.8</version>
                 </plugin>
 
                 <plugin>

Modified: cxf/dosgi/trunk/systests2/multi-bundle/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/multi-bundle/pom.xml?rev=1517286&r1=1517285&r2=1517286&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests2/multi-bundle/pom.xml (original)
+++ cxf/dosgi/trunk/systests2/multi-bundle/pom.xml Sun Aug 25 13:24:55 2013
@@ -176,6 +176,31 @@
 
     <build>
         <plugins>
+    <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+            <execution>
+                <id>unpack</id>
+                <phase>generate-resources</phase>
+                <goals>
+                    <goal>unpack</goal>
+                </goals>
+                <configuration>
+                    <artifactItems>
+                        <artifactItem>
+                            <groupId>org.apache.cxf.dosgi</groupId>
+                            <artifactId>cxf-dosgi-ri-multibundle-distribution2</artifactId>
+                            <version>1.6-SNAPSHOT</version>
+                            <type>zip</type>
+                            <classifier>dir</classifier>
+                        </artifactItem>
+                    </artifactItems>
+                </configuration>
+            </execution>
+        </executions>
+    </plugin>
+
             <!-- use pax exam maven plugin -->
 
             <!-- Note: settings and dependencies for the final osgi runtime

Modified: cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java?rev=1517286&r1=1517285&r2=1517286&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java
(original)
+++ cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java
Sun Aug 25 13:24:55 2013
@@ -26,14 +26,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.TreeMap;
+import java.util.jar.Attributes;
+import java.util.jar.JarInputStream;
+import java.util.jar.Manifest;
 
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Option;
 
@@ -42,26 +38,14 @@ public final class MultiBundleTools {
     private MultiBundleTools() {
     }
 
-    private static int getDistroBundles(Map<Integer, String> bundles, boolean discovery)
throws Exception {
-        File root = getRootDirectory();
-        File mdRoot = new File(root, "distribution/multi-bundle");
-        String pomVersion = getPomVersion(mdRoot);
-
-        return getDistroBundles(mdRoot, pomVersion, bundles, discovery);
-    }
-
     private static int getDistroBundles(File mdRoot,
-                                        String pomVersion,
-                                        Map<Integer,
-                                        String> bundles,
-                                        boolean discovery) throws Exception {
-        File distroDir = new File(mdRoot, "target/cxf-dosgi-ri-multibundle-distribution-"
+ pomVersion + "-dir");
+                                        Map<Integer, String> bundles) throws Exception
{
+        File depRoot = new File(mdRoot, "target/dependency");
+        File distroDir = depRoot.listFiles()[0];
+                                
         Properties p = new Properties();
-        File confDir = new File(distroDir, "apache-cxf-dosgi-ri-" + pomVersion + "/conf");
-        p.load(new FileInputStream(new File(confDir, "felix.config.properties.append")));
-        if (discovery) {
-            p.load(new FileInputStream(new File(confDir, "felix.discovery.config.properties.append")));
-        }
+        File confFile = new File(distroDir, "conf/felix.config.properties.append");
+        p.load(new FileInputStream(confFile));
 
         int startLevel = Integer.parseInt(p.getProperty("org.osgi.framework.startlevel.beginning"));
         for (int i = 0; i <= startLevel; i++) {
@@ -87,38 +71,24 @@ public final class MultiBundleTools {
         File curFile = new File(curURL.getFile());
         String curString = curFile.getAbsolutePath();
         File curBase = new File(curString.substring(0, curString.length() - resourceName.length()));
-        return curBase.getParentFile().getParentFile().getParentFile().getParentFile();
+        return curBase.getParentFile().getParentFile();
     }
 
-    private static String getPomVersion(File mdRoot) throws Exception {
-        File mdPom = new File(mdRoot, "pom.xml");
-        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-        dbf.setNamespaceAware(true);
-        dbf.setValidating(false);
-        DocumentBuilder db = dbf.newDocumentBuilder();
-        Document doc = db.parse(mdPom);
-        Element el = doc.getDocumentElement();
-        String pomVersion = null;
-        NodeList children = el.getChildNodes();
-        for (int i = 0; i < children.getLength(); i++) {
-            Node child = children.item(i);
-            if ("version".equals(child.getLocalName())) {
-                pomVersion = child.getTextContent().trim();
-                break;
-            }
-        }
-        if (pomVersion == null) {
-            throw new RuntimeException("Failed to retrieved version from pom file " + mdPom);
-        }
-        return pomVersion;
-    }
-
-    private static Option[] getDistroBundleOptions(boolean discovery) throws Exception {
+    private static Option[] getDistroBundleOptions() throws Exception {
         Map<Integer, String> bundles = new TreeMap<Integer, String>();
-        getDistroBundles(bundles, discovery);
+        File root = getRootDirectory();
+        getDistroBundles(root, bundles);
         List<Option> opts = new ArrayList<Option>();
         for (Map.Entry<Integer, String> entry : bundles.entrySet()) {
             String bundleUri = entry.getValue();
+            URL bundleURL = new URL(bundleUri);
+            JarInputStream bundleJar = new JarInputStream(bundleURL.openStream());
+            Manifest manifest = bundleJar.getManifest();
+            Attributes host = manifest.getAttributes("Fragment-Host");
+            if (host != null) {
+                System.out.println(bundleUri);
+            }
+            bundleJar.close();
             if (!bundleUri.contains("pax-logging")) {
                 opts.add(CoreOptions.bundle(bundleUri));
             }
@@ -127,10 +97,10 @@ public final class MultiBundleTools {
     }
 
     public static Option getDistroWithDiscovery() throws Exception {
-        return CoreOptions.composite(getDistroBundleOptions(true));
+        return getDistro();
     }
 
     public static Option getDistro() throws Exception {
-        return CoreOptions.composite(getDistroBundleOptions(false));
+        return CoreOptions.composite(getDistroBundleOptions());
     }
 }

Modified: cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportService.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportService.java?rev=1517286&r1=1517285&r2=1517286&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportService.java
(original)
+++ cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportService.java
Sun Aug 25 13:24:55 2013
@@ -30,7 +30,6 @@ import javax.xml.parsers.ParserConfigura
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
-
 import org.apache.cxf.dosgi.samples.greeter.GreeterData;
 import org.apache.cxf.dosgi.samples.greeter.GreeterException;
 import org.apache.cxf.dosgi.samples.greeter.GreeterService;
@@ -57,17 +56,18 @@ public class TestExportService extends A
     @Configuration
     public static Option[] configure() throws Exception {
         return new Option[] {
-                MultiBundleTools.getDistroWithDiscovery(),
-                systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
-                mavenBundle().groupId("org.apache.servicemix.bundles")
-                    .artifactId("org.apache.servicemix.bundles.junit").version("4.9_2"),
-                mavenBundle().groupId("org.apache.cxf.dosgi.samples")
-                    .artifactId("cxf-dosgi-ri-samples-greeter-interface").versionAsInProject(),
-                mavenBundle().groupId("org.apache.cxf.dosgi.samples")
-                    .artifactId("cxf-dosgi-ri-samples-greeter-impl").versionAsInProject(),
-                mavenBundle().groupId("org.apache.cxf.dosgi.systests")
-                    .artifactId("cxf-dosgi-ri-systests2-common").versionAsInProject(),
-                frameworkStartLevel(100)};
+            MultiBundleTools.getDistroWithDiscovery(),
+            systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
+            mavenBundle().groupId("org.apache.servicemix.bundles")
+                .artifactId("org.apache.servicemix.bundles.junit").version("4.9_2"),
+            mavenBundle().groupId("org.apache.cxf.dosgi.samples")
+                .artifactId("cxf-dosgi-ri-samples-greeter-interface").versionAsInProject(),
+            mavenBundle().groupId("org.apache.cxf.dosgi.samples")
+                .artifactId("cxf-dosgi-ri-samples-greeter-impl").versionAsInProject(),
+            mavenBundle().groupId("org.apache.cxf.dosgi.systests")
+                .artifactId("cxf-dosgi-ri-systests2-common").versionAsInProject(), frameworkStartLevel(100),
+            //CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005")
+        };
     }
 
     @Test

Modified: cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java?rev=1517286&r1=1517285&r2=1517286&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java
(original)
+++ cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java
Sun Aug 25 13:24:55 2013
@@ -109,6 +109,7 @@ public class TestImportService extends A
         //    a service property.
 
         // Set up a Server in the test
+        Thread.sleep(10000);
         ServerFactoryBean factory = new ServerFactoryBean();
         factory.setServiceClass(GreeterService.class);
         factory.setAddress("http://localhost:9191/grrr");



Mime
View raw message