You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2009/06/18 19:59:22 UTC

svn commit: r786187 [2/2] - in /cxf/dosgi/trunk: distribution/single-bundle/ dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/ dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/hooks/ dsw/...

Added: cxf/dosgi/trunk/samples/greeter_rest/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter_rest/pom.xml?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/samples/greeter_rest/pom.xml (added)
+++ cxf/dosgi/trunk/samples/greeter_rest/pom.xml Thu Jun 18 17:59:18 2009
@@ -0,0 +1,42 @@
+<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">
+
+<!--
+  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.
+-->
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.cxf.dosgi.samples</groupId>
+    <artifactId>cxf-dosgi-ri-bundles-greeter-rest</artifactId>
+    <packaging>pom</packaging>
+    <name>Distributed OSGI Greeter Rest Bundles</name>
+    <version>1.1-SNAPSHOT</version>
+
+    <parent>
+      <groupId>org.apache.cxf.dosgi</groupId>
+      <artifactId>cxf-dosgi-ri-parent</artifactId>
+      <version>1.1-SNAPSHOT</version>
+      <relativePath>../../parent/pom.xml</relativePath> 
+    </parent>
+
+    <modules>    
+      <module>interface</module>
+      <module>impl</module>
+      <module>client</module>
+    </modules> 
+
+</project>

Propchange: cxf/dosgi/trunk/samples/greeter_rest/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/samples/greeter_rest/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/dosgi/trunk/samples/greeter_rest/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: cxf/dosgi/trunk/samples/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/pom.xml?rev=786187&r1=786186&r2=786187&view=diff
==============================================================================
--- cxf/dosgi/trunk/samples/pom.xml (original)
+++ cxf/dosgi/trunk/samples/pom.xml Thu Jun 18 17:59:18 2009
@@ -18,6 +18,7 @@
 
     <modules>
       <module>greeter</module>
+      <module>greeter_rest</module>
       <module>spring_dm</module>
       <module>ds</module>
       <module>discovery</module>

Added: cxf/dosgi/trunk/systests/common_rest/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/common_rest/pom.xml?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests/common_rest/pom.xml (added)
+++ cxf/dosgi/trunk/systests/common_rest/pom.xml Thu Jun 18 17:59:18 2009
@@ -0,0 +1,110 @@
+<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">
+  <!--
+  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.
+  -->
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.cxf.dosgi.systests</groupId>
+  <artifactId>cxf-dosgi-ri-systests-common-rest</artifactId>
+  <version>1.1-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+  <name>Distributed OSGI RI System Test Rest Common Classes</name>
+
+  <parent>
+    <groupId>org.apache.cxf.dosgi</groupId>
+    <artifactId>cxf-dosgi-ri-parent</artifactId>
+    <version>1.1-SNAPSHOT</version>
+    <relativePath>../../parent/pom.xml</relativePath>  
+  </parent>
+
+  <properties>
+    <topDirectoryLocation>../..</topDirectoryLocation>
+    <bundle.import.package>*</bundle.import.package>
+    <bundle.export.package>
+      org.apache.cxf.dosgi.systests.common.rest;version="${pom.version}" 
+    </bundle.export.package>
+  </properties>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicemix.kernel.testing</groupId>
+      <artifactId>org.apache.servicemix.kernel.testing.support</artifactId>
+      <version>1.0.0</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.apache.felix.framework</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.apache.felix.main</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.osgi.core</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-bundle-minimal</artifactId>
+      <version>${cxf.version}</version>
+    </dependency>
+
+    <dependency> 
+      <groupId>org.apache.cxf.dosgi.samples</groupId>
+      <artifactId>cxf-dosgi-ri-samples-greeter-rest-interface</artifactId>
+      <version>${project.version}</version>
+    </dependency> 
+
+    <dependency> 
+      <groupId>org.apache.cxf.dosgi.samples</groupId>
+      <artifactId>cxf-dosgi-ri-samples-greeter-rest-impl</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <dependency> 
+      <groupId>org.apache.cxf.dosgi.samples</groupId>
+      <artifactId>cxf-dosgi-ri-samples-greeter-rest-client</artifactId>
+      <version>${project.version}</version>
+    </dependency> 
+  
+
+  </dependencies> 
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <configuration>
+          <instructions>
+            <Bundle-Name>CXF DOSGi System Tests Rest Common Bundle</Bundle-Name>
+            <Bundle-Description>This bundle contains common classes used by the system rest tests.</Bundle-Description>
+            <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+            <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
+            <Import-Package>${bundle.import.package}</Import-Package>
+            <Export-Package>${bundle.export.package}</Export-Package> 
+            <DynamicImport-Package>*</DynamicImport-Package>
+          </instructions>
+        </configuration>
+      </plugin> 
+    </plugins>
+  </build>    
+</project>

Propchange: cxf/dosgi/trunk/systests/common_rest/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests/common_rest/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/dosgi/trunk/systests/common_rest/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractDosgiSystemTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractDosgiSystemTest.java?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractDosgiSystemTest.java (added)
+++ cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractDosgiSystemTest.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,171 @@
+/** 
+  * 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.cxf.dosgi.systests.common.rest;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.jar.Manifest;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.core.io.Resource;
+import org.springframework.osgi.test.AbstractConfigurableBundleCreatorTests;
+
+public abstract class AbstractDosgiSystemTest extends AbstractConfigurableBundleCreatorTests {
+    private Properties dependencies;
+
+    // -------------------------------------------------------------------
+    // These methods are copied from the SMX Kernel Testing component. They
+    // are copied from the 
+    // org.apache.servicemix.kernel.testing.support.AbstractIntegrationTest 
+    // class. SMX Kernel 1.0 doesn't seem to work with Spring-DM 1.2, so 
+    // thats why these methods are duplicated here for the moment...
+    // -------------------------------------------------------------------
+    protected String getBundle(String groupId, String artifactId) {
+        return groupId + "," + artifactId + "," + getBundleVersion(groupId, artifactId);
+    }
+
+    protected String getBundleVersion(String groupId, String artifactId) {
+        if (dependencies == null) {
+            try {
+                File f = new File(System.getProperty("basedir"), "target/classes/META-INF/maven/dependencies.properties");
+                Properties prop = new Properties();
+                prop.load(new FileInputStream(f));
+                dependencies = prop;
+            } catch (IOException e) {
+                throw new IllegalStateException("Unable to load dependencies informations", e);
+            }
+        }
+        String version = dependencies.getProperty(groupId + "/" + artifactId + "/version");
+        if (version == null) {
+            throw new IllegalStateException("Unable to find dependency information for: " + groupId + "/" + artifactId + "/version");
+        }
+        return version;
+    }
+
+    protected File localMavenBundle(String groupId, String artifact, String version, String classifier, String type) {
+        String defaultHome = new File(new File(System.getProperty("user.home")), ".m2/repository").getAbsolutePath();
+        File repositoryHome = new File(System.getProperty("localRepository", defaultHome));
+
+        StringBuffer location = new StringBuffer(groupId.replace('.', '/'));
+        location.append('/');
+        location.append(artifact);
+        location.append('/');
+        location.append(getSnapshot(version));
+        location.append('/');
+        location.append(artifact);
+        location.append('-');
+        location.append(version);
+        if (classifier != null) {
+            location.append('-');
+            location.append(classifier);
+        }
+        location.append(".");
+        location.append(type);
+
+        return new File(repositoryHome, location.toString());
+    }
+
+    protected static boolean isTimestamped(String version) {
+        return version.matches(".+-\\d\\d\\d\\d\\d\\d\\d\\d\\.\\d\\d\\d\\d\\d\\d-\\d+");
+    }
+
+    protected static String getSnapshot(String version) {
+        if (isTimestamped(version)) {
+            return version.substring(0, version.lastIndexOf('-', version.lastIndexOf('-') - 1)) + "-SNAPSHOT";
+        }
+        return version;
+    }
+
+    protected void installBundle(String groupId, String artifactId, String classifier, String type) throws Exception {
+        String version = getBundleVersion(groupId, artifactId);
+        File loc = localMavenBundle(groupId, artifactId, version, classifier, type);
+        Bundle bundle = bundleContext.installBundle(loc.toURI().toString());
+        bundle.start();
+    }    
+    // -------------------------------------------------------------------
+    // End of SMX Kernel methods.
+    // -------------------------------------------------------------------
+    
+
+    protected Manifest getManifest() {
+        // let the testing framework create/load the manifest
+        Manifest mf = super.getManifest();
+        String importP = mf.getMainAttributes().getValue(Constants.IMPORT_PACKAGE);
+        mf.getMainAttributes().putValue(Constants.IMPORT_PACKAGE, importP);
+        mf.getMainAttributes().putValue(Constants.DYNAMICIMPORT_PACKAGE, "*");
+
+        return mf;
+    }       
+
+    @Override
+    protected String[] getTestFrameworkBundlesNames() {
+        List<String> names = new ArrayList<String>(Arrays.asList(super.getTestFrameworkBundlesNames()));        
+        fixLog4J(names);        
+        names.add(getBundle("org.apache.felix", "org.osgi.compendium"));
+        return names.toArray(new String [names.size()]);
+    }
+
+    private void fixLog4J(List<String> names) {
+        for (Iterator<String> it = names.iterator(); it.hasNext(); ) {
+            if (it.next().equals("org.springframework.osgi,log4j.osgi,1.2.15-SNAPSHOT")) {
+                it.remove();
+                break;
+            }
+        }
+        // replace it with a better version
+        names.add("org.apache.log4j,com.springsource.org.apache.log4j,1.2.15");
+    }
+
+    @Override
+    protected Resource[] getTestBundles() {
+        // Return the bundles for the current distribution, filtering out the 
+        // ones that are already installed as part of the testing framework.
+        // At the end the test subclass is called to obtain the test bundles.
+        
+        List<String> frameworkBundleNames = new ArrayList<String>();
+        for (Resource r : getTestFrameworkBundles()) {
+            frameworkBundleNames.add(r.getFilename());
+        }
+
+        
+        try {
+            List<Resource> resources = new ArrayList<Resource>();
+            for (File file : getDistributionBundles()) {
+                if (!frameworkBundleNames.contains(file.getName())) {
+                    resources.add(new FileSystemResource(file));
+                }
+            }
+            
+            resources.addAll(Arrays.asList(super.getTestBundles()));
+            return resources.toArray(new Resource[resources.size()]);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    protected abstract File [] getDistributionBundles() throws Exception;
+}

Propchange: cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractDosgiSystemTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractDosgiSystemTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractJaxRsPublishHookTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractJaxRsPublishHookTest.java?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractJaxRsPublishHookTest.java (added)
+++ cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractJaxRsPublishHookTest.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,122 @@
+/** 
+  * 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.cxf.dosgi.systests.common.rest;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.cxf.dosgi.samples.greeter.rest.GreeterInfo;
+import org.apache.cxf.dosgi.samples.greeter.rest.GreeterService;
+import org.apache.cxf.dosgi.samples.greeter.rest.GreetingPhrase;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
+import org.apache.cxf.jaxrs.provider.AegisElementProvider;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ManagedService;
+
+public abstract class AbstractJaxRsPublishHookTest extends AbstractDosgiSystemTest  {
+    @Override
+    protected String[] getTestBundlesNames() {
+        return new String [] {
+            getBundle("org.apache.cxf.dosgi.systests", "cxf-dosgi-ri-systests-common-rest"),
+            getBundle("org.apache.cxf.dosgi.samples", "cxf-dosgi-ri-samples-greeter-rest-interface"),
+            getBundle("org.apache.servicemix.specs", "org.apache.servicemix.specs.jsr311-api-1.0")};
+        
+    }
+
+    public void testBasicInvocation() throws Exception {
+        
+        Dictionary<String, Object> props = new Hashtable<String, Object>();
+        props.put(Constants.SERVICE_PID, "cxf-dsw");
+        
+        ServiceReference[] srefs
+            = bundleContext.getAllServiceReferences(ManagedService.class.getName(),
+                                                    "(" 
+                                                    + Constants.SERVICE_PID
+                                                    + "="
+                                                    + "cxf-dsw"
+                                                    + ")");
+        assertNotNull(srefs);
+        assertEquals(1, srefs.length);
+        ManagedService ms = (ManagedService)bundleContext.getService(srefs[0]);
+        ms.updated(props);
+        
+        ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(JAXRSClientFactoryBean.class.getClassLoader());
+        installBundle("org.apache.cxf.dosgi.samples", "cxf-dosgi-ri-samples-greeter-rest-impl", null, "jar");
+        
+        // TODO : get this address using a DistributionProvider interface
+        String address = "http://localhost:9090/greeter";
+        waitForEndpoint(address + "/greeter");
+        
+        //do the invocation using a CXF api 
+        GreeterService greeter1 = null;
+        try {
+        	JAXRSClientFactoryBean factory = new JAXRSClientFactoryBean();
+            factory.setServiceClass(GreeterService.class);
+            factory.setAddress(address);
+            factory.setProvider(new AegisElementProvider());
+            greeter1 = (GreeterService)factory.create();
+            useService(greeter1);
+        } finally {
+            Thread.currentThread().setContextClassLoader(contextLoader);
+        }
+            
+    }
+    
+    private void waitForEndpoint(String address) throws Exception {
+        
+        URL wsdlURL = new URL(address + "?_wadl");
+        
+        for (int counter = 1; counter <= 10; counter++) {
+            Thread.sleep(2000);
+            try {
+                BufferedReader is = new BufferedReader(
+                                        new InputStreamReader(wsdlURL.openStream()));
+                String line;
+                while ((line = is.readLine()) != null) {
+                    if (line.contains("application")) {
+                        System.out.println("Waited for endpoint for " + counter * 2 + " secs");
+                        return;
+                    }
+                }
+            } catch (IOException ex) {
+                // continue
+            }
+        }
+        System.out.println("Failed to retrieve service wadl during 20 sec");
+        fail();
+    }
+    
+    private void useService(GreeterService greeter) throws Exception {
+        assertNotNull(greeter);
+        
+        GreeterInfo info = greeter.greetMe("Fred");
+        
+        for (GreetingPhrase greeting: info.getGreetings()) {
+        	assertEquals("Fred", greeting.getName());
+            System.out.println("  " + greeting.getPhrase() 
+                    + " " + greeting.getName());
+        }
+    }
+}

Propchange: cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractJaxRsPublishHookTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractJaxRsPublishHookTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractListenerHookServiceListenerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractListenerHookServiceListenerTest.java?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractListenerHookServiceListenerTest.java (added)
+++ cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractListenerHookServiceListenerTest.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,230 @@
+/** 
+  * 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.cxf.dosgi.systests.common.rest;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.FutureTask;
+
+import org.apache.cxf.dosgi.samples.greeter.rest.GreeterException;
+import org.apache.cxf.dosgi.samples.greeter.rest.GreeterInfo;
+import org.apache.cxf.dosgi.samples.greeter.rest.GreeterService;
+import org.apache.cxf.dosgi.samples.greeter.rest.GreetingPhrase;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
+import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
+import org.apache.cxf.jaxrs.provider.AegisElementProvider;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+import org.springframework.core.io.Resource;
+
+public abstract class AbstractListenerHookServiceListenerTest extends AbstractDosgiSystemTest  {       
+
+    private final static String ADDRESS1 = "http://localhost:9090/greeter";
+    private final static String ADDRESS2 = "http://localhost:9089/greeter";
+    private FutureTask<GreeterInfo> task1;
+    private Object mutex1 = new Object(); 
+    private FutureTask<GreeterInfo> task2;
+    private Object mutex2 = new Object(); 
+
+    @Override
+    protected String[] getTestBundlesNames() {
+        return new String [] {
+            getBundle("org.apache.cxf.dosgi.systests", "cxf-dosgi-ri-systests-common-rest"),
+            getBundle("org.apache.cxf.dosgi.samples", "cxf-dosgi-ri-samples-greeter-rest-interface"),
+            getBundle("org.apache.servicemix.specs", "org.apache.servicemix.specs.jsr311-api-1.0")};
+        
+    }
+    
+    @Override
+    protected Resource[] getTestBundles() {
+        // Remove the CXF DSW bundle for this test as we'll be installing it later in the 
+        // test itself        
+        List<Resource> resources = new ArrayList<Resource>(Arrays.asList(super.getTestBundles()));
+        for (Iterator<Resource> it = resources.iterator(); it.hasNext(); ) {
+            String fn = it.next().getFilename();
+            if (fn.startsWith("cxf-dosgi-ri-dsw-cxf") && fn.endsWith(".jar")) {
+                it.remove();
+            }
+        }
+        return resources.toArray(new Resource[resources.size()]);
+    }
+
+    public void testBasicInvocation() throws Exception {
+
+        Thread.currentThread().setContextClassLoader(JAXRSClientFactoryBean.class.getClassLoader());
+
+        Server server1 = null;
+        Server server2 = null;
+        ServiceTracker tracker = null;
+        try {
+            server1 = startServer(ADDRESS1, 
+                                  GreeterService.class, new GreeterServiceImpl());
+            
+            server2 = startServer(ADDRESS2, 
+                                  GreeterService.class, new GreeterServiceImpl());
+            tracker = new ServiceTracker(bundleContext, 
+                                         GreeterService.class.getName(), null) {
+                @Override
+                public Object addingService(final ServiceReference reference) {
+                    Object result = super.addingService(reference);
+
+                    FutureTask<GreeterInfo> future =
+                        new FutureTask<GreeterInfo>(new Callable<GreeterInfo>() {
+                          public GreeterInfo call() {
+                            return useService(reference);
+                        }});
+                    future.run();
+                    synchronized (mutex1) {
+                        synchronized (mutex2) {
+                            if (task1 == null) {
+                                task1 = future;
+                                mutex1.notify();
+                            } else if (task2 == null) {
+                                task2 = future;
+                                mutex2.notify();
+                            }
+                        }
+                    }
+                    return result;
+                }
+            };
+            tracker.open();
+            // sleep for a bit
+            Thread.sleep(2000);
+            
+            installDswIfNeeded();
+
+            verifyGreeterResponse(task1, mutex1);
+            verifyGreeterResponse(task2, mutex2);
+        } finally {
+            if (tracker != null) {
+                tracker.close();
+            }
+            
+            if (server1 != null) {
+                server1.getDestination().shutdown();
+                server1.stop();
+            }
+
+            if (server2 != null) {
+                server2.getDestination().shutdown();
+                server2.stop();
+            }
+            
+        }
+    }
+
+    public void testMultiServiceProxification() throws Exception {
+
+        Thread.currentThread().setContextClassLoader(JAXRSClientFactoryBean.class.getClassLoader());
+
+        installDswIfNeeded();
+
+        // sleep for a bit
+        Thread.sleep(2000);
+
+        ServiceReference[] srefs =
+            bundleContext.getAllServiceReferences(GreeterService.class.getName(), null);
+        assertNotNull(srefs);
+        assertEquals(2, srefs.length);
+        String addr1 = (String) 
+            srefs[0].getProperty("org.apache.cxf.rs.address");
+        String addr2 = (String)
+            srefs[1].getProperty("org.apache.cxf.rs.address");
+        assertNotNull(addr1);
+        assertNotNull(addr2);
+        assertTrue("unexpected address property: " + addr1,
+                   ADDRESS1.equals(addr1) ^ ADDRESS2.equals(addr1));
+        assertTrue("unexpected address property: " + addr2,
+                   ADDRESS1.equals(addr2) ^ ADDRESS2.equals(addr2));
+    }
+
+    protected abstract boolean usingIntegralDsw();
+
+    private void installDswIfNeeded() throws Exception {
+        if (!usingIntegralDsw()) {
+            // now install dsw
+            installBundle("org.apache.cxf.dosgi", "cxf-dosgi-ri-dsw-cxf", null, "jar");
+        }
+    }
+
+    private GreeterInfo useService(ServiceReference sref) {
+        GreeterService hs = (GreeterService)bundleContext.getService(sref);
+        assertNotNull(hs);
+        try {
+            return hs.greetMe("Fred");
+        } catch (Exception ex) {
+            fail("unexpected exception");
+        }
+        return null; 
+    }
+    
+    private void verifyGreeterResponse(FutureTask<GreeterInfo> task, Object mutex) throws Exception {
+    	GreeterInfo greetings = null;
+        synchronized (mutex) {
+            while (task == null) {
+                mutex.wait(500);    
+            }
+            greetings = task.get();
+        }
+        
+        assertEquals("4 greetings expected", 4, greetings.getGreetings().size());
+    }
+    
+    private class GreeterServiceImpl implements GreeterService {
+
+        private final static String STRANGER_NAME = "Stranger";
+                
+        public GreeterInfo greetMe(String name) throws GreeterException {
+            System.out.println("Invoking: greetMe(" + name + ")");
+            
+            if (name.equals(STRANGER_NAME)) {
+                throw new GreeterException(name);
+            }
+
+            GreeterInfo info = new GreeterInfo();
+            List<GreetingPhrase> list = new ArrayList<GreetingPhrase>();
+            list.add(new GreetingPhrase("Hello", name));
+            list.add(new GreetingPhrase("Hoi", name));
+            list.add(new GreetingPhrase("Hola", name));
+            list.add(new GreetingPhrase("Bonjour", name));
+            info.setGreetings(list);
+            return info;
+        }
+
+    } 
+    
+    private Server startServer(String address, Class<?> type, Object impl) {
+    	JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
+        factory.setServiceClass(type);
+        factory.setAddress(address);
+        factory.setResourceProvider(type, new SingletonResourceProvider(impl));
+        List<Object> providers = new ArrayList<Object>(); 
+	    providers.add(new AegisElementProvider());
+	    factory.setProviders(providers);
+        
+	    return factory.create();
+    }
+    
+}

Propchange: cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractListenerHookServiceListenerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests/common_rest/src/main/java/org/apache/cxf/dosgi/systests/common/rest/AbstractListenerHookServiceListenerTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/multi_bundle_distro_rest/pom.xml?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests/multi_bundle_distro_rest/pom.xml (added)
+++ cxf/dosgi/trunk/systests/multi_bundle_distro_rest/pom.xml Thu Jun 18 17:59:18 2009
@@ -0,0 +1,153 @@
+<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">
+  <!--
+  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.
+  -->
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.cxf.dosgi.systests</groupId>
+  <artifactId>cxf-dosgi-ri-systests-multibundle-distro</artifactId>
+  <version>1.1-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>Distributed OSGI RI Rest System Test using Multi Bundle Distro</name>
+
+  <parent>
+    <groupId>org.apache.cxf.dosgi.systests</groupId>
+    <artifactId>cxf-dosgi-ri-systests</artifactId>
+    <version>1.1-SNAPSHOT</version>
+    <relativePath>../pom.xml</relativePath>  
+  </parent>
+
+  <properties>
+    <topDirectoryLocation>../..</topDirectoryLocation>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.cxf.dosgi.systests</groupId>
+      <artifactId>cxf-dosgi-ri-systests-common-rest</artifactId>
+      <version>${project.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.osgi.core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.apache.felix.framework</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.cxf.dosgi</groupId>
+      <artifactId>cxf-dosgi-ri-dsw-cxf</artifactId>
+      <version>${project.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.apache.felix.framework</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-core</artifactId>
+      <version>${spring.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+      <version>${spring.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-beans</artifactId>
+      <version>${spring.version}</version>
+      <scope>test</scope>
+    </dependency> 
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-test</artifactId>
+      <version>${spring.version}</version>
+      <scope>test</scope>
+    </dependency> 
+    <dependency>
+      <groupId>org.springframework.osgi</groupId>
+      <artifactId>spring-osgi-test</artifactId>
+      <version>${spring.osgi.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.osgi</groupId>
+      <artifactId>spring-osgi-core</artifactId>
+      <version>${spring.osgi.version}</version>
+      <scope>test</scope>
+    </dependency> 
+    <dependency>
+      <groupId>org.springframework.osgi</groupId>
+      <artifactId>spring-osgi-io</artifactId>
+      <version>${spring.osgi.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.osgi</groupId>
+      <artifactId>spring-osgi-extender</artifactId>
+      <version>${spring.osgi.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.osgi</groupId>
+      <artifactId>spring-osgi-annotation</artifactId>
+      <version>${spring.osgi.version}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>com.springsource.slf4j.api</artifactId>
+      <version>${slf4j.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>com.springsource.slf4j.log4j</artifactId>
+      <version>${slf4j.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>com.springsource.slf4j.org.apache.commons.logging</artifactId>
+      <version>${slf4j.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.log4j</groupId>  
+      <artifactId>com.springsource.org.apache.log4j</artifactId>  
+      <version>1.2.15</version> 
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies> 
+</project>

Propchange: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/BasicPublishHookTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/BasicPublishHookTest.java?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/BasicPublishHookTest.java (added)
+++ cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/BasicPublishHookTest.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,38 @@
+/** 
+  * 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.cxf.dosgi.systests.multibundle;
+
+import java.io.File;
+
+import org.apache.cxf.dosgi.systests.common.rest.AbstractJaxRsPublishHookTest;
+
+public class BasicPublishHookTest extends AbstractJaxRsPublishHookTest  {
+    protected File [] getDistributionBundles() throws Exception {
+        return MultiBundleDistributionResolver.getDistribution();
+    }
+    
+    @Override
+    protected String[] getTestBundlesNames() {
+        return new String [] {
+            getBundle("org.apache.cxf.dosgi.systests", "cxf-dosgi-ri-systests-common-rest"),
+            getBundle("org.apache.cxf.dosgi.samples", "cxf-dosgi-ri-samples-greeter-rest-interface")};
+        
+    }
+    
+}

Propchange: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/BasicPublishHookTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/BasicPublishHookTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/ListenerHookServiceListenerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/ListenerHookServiceListenerTest.java?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/ListenerHookServiceListenerTest.java (added)
+++ cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/ListenerHookServiceListenerTest.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,42 @@
+/** 
+  * 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.cxf.dosgi.systests.multibundle;
+
+import java.io.File;
+
+import org.apache.cxf.dosgi.systests.common.rest.AbstractListenerHookServiceListenerTest;
+
+public class ListenerHookServiceListenerTest extends AbstractListenerHookServiceListenerTest  {       
+    protected File [] getDistributionBundles() throws Exception {
+        return MultiBundleDistributionResolver.getDistribution();
+    }
+
+    protected boolean usingIntegralDsw() {
+        return false;
+    }
+
+    @Override
+    protected String[] getTestBundlesNames() {
+        return new String [] {
+            getBundle("org.apache.cxf.dosgi.systests", "cxf-dosgi-ri-systests-common-rest"),
+            getBundle("org.apache.cxf.dosgi.samples", "cxf-dosgi-ri-samples-greeter-rest-interface")};
+        
+    }
+
+}

Propchange: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/ListenerHookServiceListenerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/ListenerHookServiceListenerTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/MultiBundleDistributionResolver.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/MultiBundleDistributionResolver.java?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/MultiBundleDistributionResolver.java (added)
+++ cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/MultiBundleDistributionResolver.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,57 @@
+/** 
+  * 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.cxf.dosgi.systests.multibundle;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+class MultiBundleDistributionResolver {
+    private MultiBundleDistributionResolver() {}
+
+    // Read the distribution from the distribution/multi-bundle module
+    static File [] getDistribution() throws Exception {
+        File distroRoot = new File(System.getProperty("basedir") + "/../../distribution/multi-bundle"); 
+        File distroFile = new File(distroRoot, "target/classes/distro_bundles.xml");
+        
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder builder = factory.newDocumentBuilder();
+        Document doc = builder.parse(distroFile);
+        
+        List<File> files = new ArrayList<File>();        
+        NodeList nodes = doc.getDocumentElement().getChildNodes();
+        for (int i = 0; i < nodes.getLength(); i++) {
+            Node n = nodes.item(i);
+            if ("bundle".equals(n.getNodeName())) {
+                String location = n.getTextContent();
+                File bundleFile = new File(distroRoot, "target/" + location);
+                files.add(bundleFile.getCanonicalFile());
+            }
+        }
+        
+        return files.toArray(new File[files.size()]);
+    }
+}

Propchange: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/MultiBundleDistributionResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/multibundle/MultiBundleDistributionResolver.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/remote-services.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/remote-services.xml?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/remote-services.xml (added)
+++ cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/remote-services.xml Thu Jun 18 17:59:18 2009
@@ -0,0 +1,33 @@
+<?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.
+  -->
+<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
+  <service-description>
+    <provide interface="org.apache.cxf.dosgi.samples.greeter.rest.GreeterService" />
+    <property name="osgi.remote.interfaces">*</property>
+    <property name="osgi.remote.requires.intents">HTTP</property>
+    <property name="osgi.remote.configuration.type">pojo</property>
+    <property name="osgi.remote.configuration.pojo.address">http://localhost:9090/greeter</property>
+    <property name="org.apache.cxf.dosgi.frontend">jaxrs</property> 
+  </service-description>
+  <service-description>
+    <provide interface="org.apache.cxf.dosgi.samples.greeter.rest.GreeterService" />
+    <property name="osgi.remote.interfaces">*</property>
+    <property name="osgi.remote.requires.intents">HTTP</property>
+    <property name="osgi.remote.configuration.type">pojo</property>
+    <property name="osgi.remote.configuration.pojo.address">http://localhost:9089/greeter</property>
+    <property name="org.apache.cxf.dosgi.frontend">jaxrs</property>
+  </service-description>
+</service-descriptions>

Propchange: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/remote-services.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/remote-services.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/remote-services.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: cxf/dosgi/trunk/systests/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/pom.xml?rev=786187&r1=786186&r2=786187&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests/pom.xml (original)
+++ cxf/dosgi/trunk/systests/pom.xml Thu Jun 18 17:59:18 2009
@@ -69,6 +69,8 @@
         <module>common</module>
         <module>multi_bundle_distro</module>
         <module>single_bundle_distro</module>
+        <module>common_rest</module>
+        <module>single_bundle_distro_rest</module>
     </modules>
 
     <build>

Added: cxf/dosgi/trunk/systests/single_bundle_distro_rest/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/single_bundle_distro_rest/pom.xml?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests/single_bundle_distro_rest/pom.xml (added)
+++ cxf/dosgi/trunk/systests/single_bundle_distro_rest/pom.xml Thu Jun 18 17:59:18 2009
@@ -0,0 +1,144 @@
+<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">
+  <!--
+  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.
+  -->
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.cxf.dosgi.systests</groupId>
+  <artifactId>cxf-dosgi-ri-systests-singlebundle-distro-rest</artifactId>
+  <version>1.1-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>Distributed OSGI RI REST System Test using Single Bundle Distro</name>
+
+  <parent>
+    <groupId>org.apache.cxf.dosgi.systests</groupId>
+    <artifactId>cxf-dosgi-ri-systests</artifactId>
+    <version>1.1-SNAPSHOT</version>
+    <relativePath>../pom.xml</relativePath>  
+  </parent>
+
+  <properties>
+    <topDirectoryLocation>../..</topDirectoryLocation>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.cxf.dosgi.systests</groupId>
+      <artifactId>cxf-dosgi-ri-systests-common-rest</artifactId>
+      <version>${project.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.osgi.core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.apache.felix.framework</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-core</artifactId>
+      <version>${spring.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+      <version>${spring.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-beans</artifactId>
+      <version>${spring.version}</version>
+      <scope>test</scope>
+    </dependency> 
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-test</artifactId>
+      <version>${spring.version}</version>
+      <scope>test</scope>
+    </dependency> 
+    <dependency>
+      <groupId>org.springframework.osgi</groupId>
+      <artifactId>spring-osgi-test</artifactId>
+      <version>${spring.osgi.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.osgi</groupId>
+      <artifactId>spring-osgi-core</artifactId>
+      <version>${spring.osgi.version}</version>
+      <scope>test</scope>
+    </dependency> 
+    <dependency>
+      <groupId>org.springframework.osgi</groupId>
+      <artifactId>spring-osgi-io</artifactId>
+      <version>${spring.osgi.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.osgi</groupId>
+      <artifactId>spring-osgi-extender</artifactId>
+      <version>${spring.osgi.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.osgi</groupId>
+      <artifactId>spring-osgi-annotation</artifactId>
+      <version>${spring.osgi.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicemix.specs</groupId>
+      <artifactId>org.apache.servicemix.specs.jsr311-api-1.0</artifactId>
+      <version>${servicemix.specs.version}</version>
+    </dependency>  
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>com.springsource.slf4j.api</artifactId>
+      <version>${slf4j.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>com.springsource.slf4j.log4j</artifactId>
+      <version>${slf4j.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>com.springsource.slf4j.org.apache.commons.logging</artifactId>
+      <version>${slf4j.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.log4j</groupId>  
+      <artifactId>com.springsource.org.apache.log4j</artifactId>  
+      <version>1.2.15</version> 
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies> 
+</project>

Propchange: cxf/dosgi/trunk/systests/single_bundle_distro_rest/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests/single_bundle_distro_rest/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/dosgi/trunk/systests/single_bundle_distro_rest/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/BasicPublishHookTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/BasicPublishHookTest.java?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/BasicPublishHookTest.java (added)
+++ cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/BasicPublishHookTest.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,34 @@
+/** 
+  * 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.cxf.dosgi.systests.singlebundle;
+
+import java.io.File;
+
+import org.apache.cxf.dosgi.systests.common.rest.AbstractJaxRsPublishHookTest;
+
+public class BasicPublishHookTest extends AbstractJaxRsPublishHookTest  {
+    protected File [] getDistributionBundles() throws Exception {
+        return SingleBundleDistributionResolver.getDistribution();
+    }
+    
+    public void testBasicInvocation() throws Exception {
+    	super.testBasicInvocation();
+    }
+    
+}

Propchange: cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/BasicPublishHookTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/BasicPublishHookTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/ListenerHookServiceListenerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/ListenerHookServiceListenerTest.java?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/ListenerHookServiceListenerTest.java (added)
+++ cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/ListenerHookServiceListenerTest.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,33 @@
+/** 
+  * 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.cxf.dosgi.systests.singlebundle;
+
+import java.io.File;
+
+import org.apache.cxf.dosgi.systests.common.rest.AbstractListenerHookServiceListenerTest;
+
+public class ListenerHookServiceListenerTest extends AbstractListenerHookServiceListenerTest  {       
+    protected File [] getDistributionBundles() throws Exception {
+        return SingleBundleDistributionResolver.getDistribution();
+    }
+
+    protected boolean usingIntegralDsw() {
+        return true;
+    }
+}

Propchange: cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/ListenerHookServiceListenerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/ListenerHookServiceListenerTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/SingleBundleDistributionResolver.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/SingleBundleDistributionResolver.java?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/SingleBundleDistributionResolver.java (added)
+++ cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/SingleBundleDistributionResolver.java Thu Jun 18 17:59:18 2009
@@ -0,0 +1,38 @@
+/** 
+  * 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.cxf.dosgi.systests.singlebundle;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+class SingleBundleDistributionResolver {
+    private SingleBundleDistributionResolver() {}
+
+    static File [] getDistribution() throws Exception {
+        File distroRoot = new File(System.getProperty("basedir") + 
+            "/../../distribution/single-bundle").getCanonicalFile();
+        
+        return new File(distroRoot, "target").listFiles(new FilenameFilter() {
+            public boolean accept(File dir, String name) {
+                return name.startsWith("cxf-dosgi-ri-singlebundle-distribution") &&
+                       name.endsWith(".jar");
+            }            
+        });
+    }
+}

Propchange: cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/SingleBundleDistributionResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/java/org/apache/cxf/dosgi/systests/singlebundle/SingleBundleDistributionResolver.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/remote-services.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/remote-services.xml?rev=786187&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/remote-services.xml (added)
+++ cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/remote-services.xml Thu Jun 18 17:59:18 2009
@@ -0,0 +1,31 @@
+<?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.
+  -->
+<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0">
+  <service-description>
+    <provide interface="org.apache.cxf.dosgi.samples.greeter.rest.GreeterService" />
+    <property name="service.exported.interfaces">*</property>
+    <property name="service.exported.intents">HTTP</property>
+    <property name="service.exported.configs">org.apache.cxf.rs</property>
+    <property name="org.apache.cxf.rs.address">http://localhost:9090/greeter</property>
+  </service-description>
+  <service-description>
+    <provide interface="org.apache.cxf.dosgi.samples.greeter.rest.GreeterService" />
+    <property name="service.exported.interfaces">*</property>
+    <property name="service.exported.intents">HTTP</property>
+    <property name="service.exported.configs">org.apache.cxf.rs</property>
+    <property name="org.apache.cxf.rs.address">http://localhost:9089/greeter</property>
+  </service-description>
+</service-descriptions>

Propchange: cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/remote-services.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/remote-services.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/dosgi/trunk/systests/single_bundle_distro_rest/src/test/resources/OSGI-INF/remote-service/remote-services.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml