cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r904501 - in /cxf/dosgi/trunk/systests2: common/ common/src/main/java/org/apache/cxf/dosgi/systests2/common/ common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/ common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/...
Date Fri, 29 Jan 2010 14:04:41 GMT
Author: davidb
Date: Fri Jan 29 14:04:40 2010
New Revision: 904501

URL: http://svn.apache.org/viewvc?rev=904501&view=rev
Log:
A system test that uses Discovery. There is a single-bundle and multi-bundle version of it.
The test code is there but it's not enabled yet.

Added:
    cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/AbstractTestDiscoveryRoundtrip.java
  (with props)
    cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/
    cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/Test2Service.java
  (with props)
    cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/
    cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/ClientActivator.java
  (with props)
    cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/Test2ServiceTracker.java
  (with props)
    cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/
    cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/ServerActivator.java
  (with props)
    cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/Test2ServiceImpl.java
  (with props)
    cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestDiscoveryRountrip.java
  (with props)
    cxf/dosgi/trunk/systests2/single-bundle/src/test/java/org/apache/cxf/dosgi/systests2/single/TestDiscoveryRountrip.java
  (with props)
Modified:
    cxf/dosgi/trunk/systests2/common/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
    cxf/dosgi/trunk/systests2/single-bundle/pom.xml

Modified: cxf/dosgi/trunk/systests2/common/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/common/pom.xml?rev=904501&r1=904500&r2=904501&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests2/common/pom.xml (original)
+++ cxf/dosgi/trunk/systests2/common/pom.xml Fri Jan 29 14:04:40 2010
@@ -82,10 +82,11 @@
                         <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
                         <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
                         <!-- The TinyBundles are only used during the 'configure' stage
and are therefore not
-                             needed at runtime. -->
+                             needed at runtime.
+                             Other imports marked as optional as not all tests have the same
dependencies. -->
                         <Import-Package>
                             !org.ops4j.pax.swissbox.tinybundles.*,
-                            *
+                            *;resolution:=optional
                         </Import-Package>
                         <Export-Package>*</Export-Package>
                     </instructions>

Added: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/AbstractTestDiscoveryRoundtrip.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/AbstractTestDiscoveryRoundtrip.java?rev=904501&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/AbstractTestDiscoveryRoundtrip.java
(added)
+++ cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/AbstractTestDiscoveryRoundtrip.java
Fri Jan 29 14:04:40 2010
@@ -0,0 +1,133 @@
+/** 
+ * 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.systests2.common;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.ServerSocket;
+import java.util.Hashtable;
+
+import javax.swing.JOptionPane;
+
+import org.apache.cxf.dosgi.systests2.common.test2.Test2Service;
+import org.apache.cxf.dosgi.systests2.common.test2.client.ClientActivator;
+import org.apache.cxf.dosgi.systests2.common.test2.client.Test2ServiceTracker;
+import org.apache.cxf.dosgi.systests2.common.test2.server.ServerActivator;
+import org.apache.cxf.dosgi.systests2.common.test2.server.Test2ServiceImpl;
+import org.junit.Assert;
+import org.ops4j.pax.swissbox.tinybundles.core.TinyBundles;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.util.tracker.ServiceTracker;
+
+public abstract class AbstractTestDiscoveryRoundtrip {
+    protected abstract BundleContext getBundleContext(); 
+
+    protected static InputStream getClientBundle() {
+        return TinyBundles.newBundle()
+            .add(ClientActivator.class)
+            .add(Test2Service.class)
+            .add(Test2ServiceTracker.class)
+            .set(Constants.BUNDLE_SYMBOLICNAME, "test2ClientBundle")
+            .set(Constants.BUNDLE_ACTIVATOR, ClientActivator.class.getName())
+            .build(TinyBundles.withBnd());
+    }
+
+    protected static InputStream getServerBundle() {
+        return TinyBundles.newBundle()
+            .add(ServerActivator.class)
+            .add(Test2Service.class)
+            .add(Test2ServiceImpl.class)
+            .set(Constants.BUNDLE_SYMBOLICNAME, "test2ServerBundle")
+            .set(Constants.BUNDLE_ACTIVATOR, ServerActivator.class.getName())
+            .build(TinyBundles.withBnd());
+    }
+
+    public void baseTestDiscoveryRoundtrip() throws Exception {
+        for( Bundle b : getBundleContext().getBundles() )
+        {
+            System.out.println( "*** Bundle " + b.getBundleId() + " : " + b.getSymbolicName()
);
+        }
+        
+        // Find a free port to run the Zookeeper Server on
+        final int zkPort = new ServerSocket(0).getLocalPort();
+        System.out.println("*** Port for Zookeeper Server: " + zkPort);
+
+        ServiceTracker st = null;
+        try {
+            st = new ServiceTracker(getBundleContext(), ConfigurationAdmin.class.getName(),
null) {
+                @Override
+                public Object addingService(ServiceReference reference) {
+                    Object svc = super.addingService(reference);
+                    if (svc instanceof ConfigurationAdmin) {
+                        try {
+                            ConfigurationAdmin cadmin = (ConfigurationAdmin) svc;
+                            org.osgi.service.cm.Configuration zkServerCfg = 
+                                cadmin.getConfiguration("org.apache.cxf.dosgi.discovery.zookeeper.server",
null);
+                            Hashtable<String, Object> svrProps = new Hashtable<String,
Object>();
+                            svrProps.put("clientPort", zkPort);
+                            zkServerCfg.update(svrProps);                            
+                            
+                            org.osgi.service.cm.Configuration zkClientCfg = 
+                                cadmin.getConfiguration("org.apache.cxf.dosgi.discovery.zookeeper",
null);
+                            Hashtable<String, Object> cliProps = new Hashtable<String,
Object>();
+                            cliProps.put("zookeeper.host", "127.0.0.1");
+                            cliProps.put("zookeeper.port", "" + zkPort);
+                            zkClientCfg.update(cliProps);
+                        } catch (IOException e) {
+                            e.printStackTrace();
+                        }
+                    }
+                    return svc;
+                }            
+            };
+            st.open();
+                                
+            ServiceReference ref = waitService(String.class.getName(), "(testResult=test2)");
+            String trace = (String) ref.getProperty("result");
+            Assert.assertFalse("Stack trace must not contain client packages. " +
+                "Invocation should go through the protocol stack. " +
+                "It should not be directly invoked. " + trace,
+                trace.contains("org.apache.cxf.dosgi.systests2.single.test2.client"));
+            
+            // If gone through the protocol stack the following packages should be 
+            // in there:
+            Assert.assertTrue(trace.contains("org.apache.cxf.transport"));
+            Assert.assertTrue(trace.contains("org.apache.cxf.interceptor"));
+        } finally {
+            st.close();
+        }        
+    }
+    
+    private ServiceReference waitService(String cls, String filter) throws Exception {  
     
+        ServiceReference[] refs = null;
+        for (int i=0; i < 20; i++) {
+            refs = getBundleContext().getServiceReferences(cls, filter);
+            if (refs != null && refs.length > 0) {
+                return refs[0];
+            }
+            System.out.println("Waiting for service: " + cls + filter);
+            Thread.sleep(1000);
+        }
+        throw new Exception("Service not found: " + cls + filter);
+    }    
+}

Propchange: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/AbstractTestDiscoveryRoundtrip.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/AbstractTestDiscoveryRoundtrip.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/Test2Service.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/Test2Service.java?rev=904501&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/Test2Service.java
(added)
+++ cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/Test2Service.java
Fri Jan 29 14:04:40 2010
@@ -0,0 +1,23 @@
+/** 
+ * 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.systests2.common.test2;
+
+public interface Test2Service {
+    public String getRemoteStackTrace();    
+}

Propchange: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/Test2Service.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/Test2Service.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/ClientActivator.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/ClientActivator.java?rev=904501&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/ClientActivator.java
(added)
+++ cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/ClientActivator.java
Fri Jan 29 14:04:40 2010
@@ -0,0 +1,36 @@
+/** 
+ * 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.systests2.common.test2.client;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class ClientActivator implements BundleActivator {
+    private ServiceTracker tracker;
+
+    public void start(final BundleContext bc) throws Exception {
+        tracker = new Test2ServiceTracker(bc);
+        tracker.open();
+    }
+
+    public void stop(BundleContext bc) throws Exception {
+        tracker.close();
+    }
+}

Propchange: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/ClientActivator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/ClientActivator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/Test2ServiceTracker.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/Test2ServiceTracker.java?rev=904501&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/Test2ServiceTracker.java
(added)
+++ cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/Test2ServiceTracker.java
Fri Jan 29 14:04:40 2010
@@ -0,0 +1,71 @@
+/** 
+ * 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.systests2.common.test2.client;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.cxf.dosgi.systests2.common.test2.Test2Service;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class Test2ServiceTracker extends ServiceTracker {
+    public Test2ServiceTracker(BundleContext context) {
+        super(context, getFilter(context), null);
+    }
+
+    private static Filter getFilter(BundleContext context) {
+        Filter f = null;
+        try {
+            // It's very important that the service.imported condition is there too
+            // otherwise the tracker will make a local 'direct' invocation on the service.
+            // The service.imported forces a proxy lookup.
+            f = context.createFilter("(&(objectClass=" + Test2Service.class.getName()
+ ")(service.imported=*))");
+        } catch (InvalidSyntaxException e) {
+            e.printStackTrace();
+        }
+        return f;
+    }
+
+    @Override
+    public Object addingService(ServiceReference reference) {
+        Object svc = super.addingService(reference);        
+        if (svc instanceof Test2Service) {
+            System.out.println("*** Ref: " + reference);
+            for(String key : reference.getPropertyKeys()) {
+                System.out.println("  " + key + "-" + reference.getProperty(key));
+            }
+            
+            invokeRemoteTestService(context, (Test2Service) svc);
+        }
+        return svc;
+    }
+
+    private void invokeRemoteTestService(BundleContext bc, Test2Service svc) {
+        String res = svc.getRemoteStackTrace();
+        
+        Dictionary<String, Object> props = new Hashtable<String, Object>();
+        props.put("result", res);
+        props.put("testResult", "test2");
+        bc.registerService(String.class.getName(), "test2", props);
+    }
+}

Propchange: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/Test2ServiceTracker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/Test2ServiceTracker.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/ServerActivator.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/ServerActivator.java?rev=904501&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/ServerActivator.java
(added)
+++ cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/ServerActivator.java
Fri Jan 29 14:04:40 2010
@@ -0,0 +1,51 @@
+/** 
+ * 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.systests2.common.test2.server;
+
+import java.net.ServerSocket;
+import java.util.Hashtable;
+
+import org.apache.cxf.dosgi.systests2.common.test2.Test2Service;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+public class ServerActivator implements BundleActivator {    
+    private ServiceRegistration reg;
+
+    public void start(BundleContext bc) throws Exception {
+        Test2Service svc = new Test2ServiceImpl();
+                
+        // Dynamically assign a free port
+        int freePort = new ServerSocket(0).getLocalPort();
+        String url = "http://localhost:" + freePort + "/test2";
+        System.out.println("*** Server using URL: " + url);
+        
+        Hashtable<String, Object> props = new Hashtable<String, Object>();
+        props.put("service.exported.interfaces", "*");
+        props.put("service.exported.configs", "org.apache.cxf.ws");
+        props.put("endpoint.id", url);
+        
+        reg = bc.registerService(Test2Service.class.getName(), svc, props);
+    }
+
+    public void stop(BundleContext bc) throws Exception {
+        reg.unregister();
+    }
+}

Propchange: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/ServerActivator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/ServerActivator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/Test2ServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/Test2ServiceImpl.java?rev=904501&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/Test2ServiceImpl.java
(added)
+++ cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/Test2ServiceImpl.java
Fri Jan 29 14:04:40 2010
@@ -0,0 +1,35 @@
+/** 
+ * 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.systests2.common.test2.server;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.apache.cxf.dosgi.systests2.common.test2.Test2Service;
+
+public class Test2ServiceImpl implements Test2Service {
+    public String getRemoteStackTrace() {
+        Throwable th = new Throwable("Throwable created on the server");
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        th.printStackTrace(pw);
+        
+        return sw.toString();
+    }
+}

Propchange: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/Test2ServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/Test2ServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/dosgi/trunk/systests2/multi-bundle/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/multi-bundle/pom.xml?rev=904501&r1=904500&r2=904501&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests2/multi-bundle/pom.xml (original)
+++ cxf/dosgi/trunk/systests2/multi-bundle/pom.xml Fri Jan 29 14:04:40 2010
@@ -66,6 +66,23 @@
             <version>${cxf.version}</version>
             <scope>provided</scope>
         </dependency>
+        <dependency> 
+            <groupId>org.apache.log4j</groupId> 
+            <artifactId>com.springsource.org.apache.log4j</artifactId> 
+            <version>${log4j.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf.dosgi</groupId>
+            <artifactId>cxf-dosgi-ri-discovery-distributed-zookeeper-wrapper</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf.dosgi</groupId>
+            <artifactId>cxf-dosgi-ri-discovery-distributed-zookeeper-server</artifactId>
+            <version>${pom.version}</version>
+            <scope>test</scope>           
+        </dependency>
         <dependency>
             <groupId>org.apache.cxf.dosgi.samples</groupId>
             <artifactId>cxf-dosgi-ri-samples-greeter-impl</artifactId>

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=904501&r1=904500&r2=904501&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
Fri Jan 29 14:04:40 2010
@@ -35,18 +35,22 @@
 public class MultiBundleTools {
     private MultiBundleTools() {}
     
-    static int getDistroBundles(Map<Integer, String> bundles) throws Exception {
+    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);        
+        return getDistroBundles(mdRoot, pomVersion, bundles, discovery);
     }
     
-    private static int getDistroBundles(File mdRoot, String pomVersion, Map<Integer, String>
bundles) throws Exception {
+    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");
         Properties p = new Properties();
-        p.load(new FileInputStream(new File(distroDir, "apache-cxf-dosgi-ri-" + pomVersion
+ "/conf/felix.config.properties.append")));
+        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")));
+        }
         
         int startLevel = Integer.parseInt(p.getProperty("org.osgi.framework.startlevel.beginning"));
         for (int i = 0; i <= startLevel; i++) {

Added: cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestDiscoveryRountrip.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestDiscoveryRountrip.java?rev=904501&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestDiscoveryRountrip.java
(added)
+++ cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestDiscoveryRountrip.java
Fri Jan 29 14:04:40 2010
@@ -0,0 +1,75 @@
+/** 
+ * 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.systests2.multi;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.cxf.dosgi.systests2.common.AbstractTestDiscoveryRoundtrip;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Inject;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.osgi.framework.BundleContext;
+
+@RunWith( JUnit4TestRunner.class )
+public class TestDiscoveryRountrip extends AbstractTestDiscoveryRoundtrip {
+    @Inject
+    BundleContext bundleContext = null;
+
+    @Configuration
+    public static Option[] configure() throws Exception {
+        Map<Integer, String> bundles = new TreeMap<Integer, String>();
+        int startLevel = MultiBundleTools.getDistroBundles(bundles, true);
+        
+        List<Option> opts = new ArrayList<Option>();
+        
+        opts.add(CoreOptions.systemProperty("org.osgi.framework.startlevel.beginning").value(""
+ startLevel));
+        opts.add(CoreOptions.mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").versionAsInProject());
+        for(Map.Entry<Integer, String> entry : bundles.entrySet()) {
+            opts.add(CoreOptions.bundle(entry.getValue()).startLevel(entry.getKey()));
+        }
+      
+        opts.add(CoreOptions.mavenBundle().groupId("org.apache.log4j").artifactId("com.springsource.org.apache.log4j").versionAsInProject());
+        opts.add(CoreOptions.mavenBundle().groupId("org.apache.cxf.dosgi").artifactId("cxf-dosgi-ri-discovery-distributed-zookeeper-server").versionAsInProject());
+
+        // This bundle contains the common system testing code
+        opts.add(CoreOptions.mavenBundle().groupId("org.apache.cxf.dosgi.systests").artifactId("cxf-dosgi-ri-systests2-common").versionAsInProject());
+
+        opts.add(CoreOptions.provision(getClientBundle()));
+        opts.add(CoreOptions.provision(getServerBundle()));
+        
+        return CoreOptions.options(opts.toArray(new Option[opts.size()]));              
 
+    }
+    
+    protected BundleContext getBundleContext() {
+        return bundleContext;
+    }
+
+    @Test
+    public void testDiscoveryRoundtrip() throws Exception {
+        // enabled soon
+        // baseTestDiscoveryRoundtrip();
+    }
+}

Propchange: cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestDiscoveryRountrip.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestDiscoveryRountrip.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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=904501&r1=904500&r2=904501&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
Fri Jan 29 14:04:40 2010
@@ -41,7 +41,7 @@
     @Configuration
     public static Option[] configure() throws Exception {
         Map<Integer, String> bundles = new TreeMap<Integer, String>();
-        int startLevel = MultiBundleTools.getDistroBundles(bundles);
+        int startLevel = MultiBundleTools.getDistroBundles(bundles, false);
         
         List<Option> opts = new ArrayList<Option>();
         opts.add(CoreOptions.systemProperty("org.osgi.framework.startlevel.beginning").value(""
+ startLevel));

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=904501&r1=904500&r2=904501&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
Fri Jan 29 14:04:40 2010
@@ -41,7 +41,7 @@
     @Configuration
     public static Option[] configure() throws Exception {
         Map<Integer, String> bundles = new TreeMap<Integer, String>();
-        int startLevel = MultiBundleTools.getDistroBundles(bundles);
+        int startLevel = MultiBundleTools.getDistroBundles(bundles, false);
         
         List<Option> opts = new ArrayList<Option>();
         opts.add(CoreOptions.systemProperty("org.osgi.framework.startlevel.beginning").value(""
+ startLevel));

Modified: cxf/dosgi/trunk/systests2/single-bundle/pom.xml
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/single-bundle/pom.xml?rev=904501&r1=904500&r2=904501&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests2/single-bundle/pom.xml (original)
+++ cxf/dosgi/trunk/systests2/single-bundle/pom.xml Fri Jan 29 14:04:40 2010
@@ -72,6 +72,23 @@
                 </exclusion>
             </exclusions>
         </dependency>
+        <dependency> 
+            <groupId>org.apache.log4j</groupId> 
+            <artifactId>com.springsource.org.apache.log4j</artifactId> 
+            <version>${log4j.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf.dosgi</groupId>
+            <artifactId>cxf-dosgi-ri-discovery-distributed-zookeeper-wrapper</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf.dosgi</groupId>
+            <artifactId>cxf-dosgi-ri-discovery-distributed-zookeeper-server</artifactId>
+            <version>${pom.version}</version>
+            <scope>test</scope>           
+        </dependency>
         <dependency>
             <groupId>org.apache.cxf.dosgi.samples</groupId>
             <artifactId>cxf-dosgi-ri-samples-greeter-impl</artifactId>

Added: cxf/dosgi/trunk/systests2/single-bundle/src/test/java/org/apache/cxf/dosgi/systests2/single/TestDiscoveryRountrip.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/single-bundle/src/test/java/org/apache/cxf/dosgi/systests2/single/TestDiscoveryRountrip.java?rev=904501&view=auto
==============================================================================
--- cxf/dosgi/trunk/systests2/single-bundle/src/test/java/org/apache/cxf/dosgi/systests2/single/TestDiscoveryRountrip.java
(added)
+++ cxf/dosgi/trunk/systests2/single-bundle/src/test/java/org/apache/cxf/dosgi/systests2/single/TestDiscoveryRountrip.java
Fri Jan 29 14:04:40 2010
@@ -0,0 +1,68 @@
+/** 
+ * 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.systests2.single;
+
+import org.apache.cxf.dosgi.systests2.common.AbstractTestDiscoveryRoundtrip;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Inject;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.osgi.framework.BundleContext;
+
+@RunWith( JUnit4TestRunner.class )
+public class TestDiscoveryRountrip extends AbstractTestDiscoveryRoundtrip {
+    @Inject
+    BundleContext bundleContext = null;
+
+    @Configuration
+    public static Option[] configure() {
+        return CoreOptions.options(
+//                // this just adds all what you write here to java vm argumenents of the
(new) osgi process.
+//                vmOption( "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006"
),
+//                // this is necessary to let junit runner not timout the remote process
before attaching debugger
+//                // setting timeout to 0 means wait as long as the remote service comes
available.
+//                waitForFrameworkStartup(),
+                
+                CoreOptions.mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").versionAsInProject(),
+                CoreOptions.mavenBundle().groupId("org.apache.cxf.dosgi").artifactId("cxf-dosgi-ri-singlebundle-distribution").versionAsInProject(),
+                
+                CoreOptions.mavenBundle().groupId("org.apache.log4j").artifactId("com.springsource.org.apache.log4j").versionAsInProject(),
+                CoreOptions.mavenBundle().groupId("org.apache.cxf.dosgi").artifactId("cxf-dosgi-ri-discovery-distributed-zookeeper-server").versionAsInProject(),
+                
+                // This bundle contains the common system testing code
+                CoreOptions.mavenBundle().groupId("org.apache.cxf.dosgi.systests").artifactId("cxf-dosgi-ri-systests2-common").versionAsInProject(),
+
+                CoreOptions.provision(getClientBundle()),
+                CoreOptions.provision(getServerBundle())
+        );
+    }
+    
+    protected BundleContext getBundleContext() {
+        return bundleContext;
+    }
+
+    @Test
+    public void testDiscoveryRoundtrip() throws Exception {
+        // enabled soon
+        // baseTestDiscoveryRoundtrip();
+    }
+}

Propchange: cxf/dosgi/trunk/systests2/single-bundle/src/test/java/org/apache/cxf/dosgi/systests2/single/TestDiscoveryRountrip.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/dosgi/trunk/systests2/single-bundle/src/test/java/org/apache/cxf/dosgi/systests2/single/TestDiscoveryRountrip.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message