Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/META-INF/MANIFEST.MF20
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/README.md5
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/apache/xmlrpc/webserver/XmlRpcServlet.properties10
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/internal/tests/remoteservice/rpc/Activator.java109
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/internal/tests/remoteservice/rpc/HttpServiceConnector.java58
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/internal/tests/remoteservice/rpc/server/CalcHandler.java21
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/internal/tests/remoteservice/rpc/server/EchoHandler.java20
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/AbstractRpcTestCase.java47
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcConstants.java37
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcContainerInstantiatorTest.java58
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcContainerTest.java53
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcNamespaceTest.java43
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcRemoteServiceAdapterTest.java99
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcRemoteServiceTest.java143
-rw-r--r--tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/common/IEcho.java15
15 files changed, 5 insertions, 733 deletions
diff --git a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/META-INF/MANIFEST.MF b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/META-INF/MANIFEST.MF
index d83ecca02..21c111341 100644
--- a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/META-INF/MANIFEST.MF
+++ b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/META-INF/MANIFEST.MF
@@ -4,27 +4,7 @@ Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.tests.remoteservice.rpc
Automatic-Module-Name: org.eclipse.ecf.tests.remoteservice.rpc
Bundle-Version: 1.1.100.qualifier
-Bundle-Activator: org.eclipse.ecf.internal.tests.remoteservice.rpc.Activator
Bundle-Vendor: %plugin.provider
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.ecf;bundle-version="3.1.0",
- org.eclipse.ecf.tests;bundle-version="2.1.0",
- org.eclipse.ecf.tests.remoteservice;bundle-version="2.0.0",
- org.junit;bundle-version="3.8.2",
- org.eclipse.ecf.remoteservice.rpc;bundle-version="1.0.0",
- org.apache.commons.logging;bundle-version="1.0.4",
- org.apache.ws.commons.util;bundle-version="1.0.0",
- org.apache.xmlrpc;bundle-version="3.0.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
-Import-Package: javax.servlet;version="2.5.0",
- javax.servlet.http;version="2.5.0",
- org.eclipse.ecf.remoteservice;version="6.0.0",
- org.eclipse.ecf.remoteservice.asyncproxy;version="1.0.0",
- org.eclipse.ecf.remoteservice.client;version="6.0.0",
- org.eclipse.ecf.remoteservice.events;version="6.0.0",
- org.eclipse.equinox.concurrent.future;version="1.0.0",
- org.eclipse.equinox.http.jetty;version="1.1.0",
- org.osgi.service.http;version="1.2.1"
Bundle-Localization: plugin
-Export-Package: org.eclipse.ecf.tests.remoteservice.rpc.common
diff --git a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/README.md b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/README.md
new file mode 100644
index 000000000..018a80a5d
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/README.md
@@ -0,0 +1,5 @@
+Note: This plugin has been deprecated in favor of the xmlrpc remote services provider available
+here:
+
+https://github.com/ECF/XmlRpcProvider
+
diff --git a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/apache/xmlrpc/webserver/XmlRpcServlet.properties b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/apache/xmlrpc/webserver/XmlRpcServlet.properties
deleted file mode 100644
index d34b15699..000000000
--- a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/apache/xmlrpc/webserver/XmlRpcServlet.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-############################################################################
-# Copyright (c) 2010-2011 Naumen, IBM Corp, and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-############################################################################
-Echo = org.eclipse.ecf.internal.tests.remoteservice.rpc.server.EchoHandler
-Calc = org.eclipse.ecf.internal.tests.remoteservice.rpc.server.CalcHandler
-org.eclipse.ecf.tests.remoteservice.rpc.common.IEcho = org.eclipse.ecf.internal.tests.remoteservice.rpc.server.EchoHandler \ No newline at end of file
diff --git a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/internal/tests/remoteservice/rpc/Activator.java b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/internal/tests/remoteservice/rpc/Activator.java
deleted file mode 100644
index efe647b02..000000000
--- a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/internal/tests/remoteservice/rpc/Activator.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2011 Naumen. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Pavel Samolisov - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.internal.tests.remoteservice.rpc;
-
-import javax.servlet.ServletConfig;
-
-import org.apache.xmlrpc.XmlRpcConfig;
-import org.apache.xmlrpc.server.XmlRpcHandlerMapping;
-import org.apache.xmlrpc.webserver.XmlRpcServletServer;
-import java.io.InputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.BufferedInputStream;
-import java.io.InputStreamReader;
-import java.io.StringReader;
-import javax.servlet.ServletInputStream;
-import java.util.Enumeration;
-import java.io.IOException;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServlet;
-import org.eclipse.equinox.http.jetty.JettyConfigurator;
-import java.util.Hashtable;
-import java.util.Dictionary;
-import org.apache.xmlrpc.webserver.XmlRpcServlet;
-import org.eclipse.ecf.tests.remoteservice.rpc.RpcConstants;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator {
-
- private static final String HTTP_PORT_KEY = "http.port"; //$NON-NLS-1$
-
- private static final String SERVER_NAME = "xmlrpcserver"; //$NON-NLS-1$
-
- private static BundleContext context;
-
- private HttpServiceConnector httpServiceConnector;
-
- static BundleContext getContext() {
- return context;
- }
-
- class XHttpServlet extends HttpServlet {
-
- private final XmlRpcServlet s = new XmlRpcServlet();
-
- @Override
- public void init(ServletConfig config) throws ServletException {
- // TODO Auto-generated method stub
- super.init(config);
- s.init(config);
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
- //System.out.println("doPost req="+readInputStreamAsString(req.getInputStream()));
- s.doPost(req,resp);
- }
- }
-
- public static String readInputStreamAsString(InputStream in)
- throws IOException {
-
- BufferedInputStream bis = new BufferedInputStream(in);
- ByteArrayOutputStream buf = new ByteArrayOutputStream();
- int result = bis.read();
- while(result != -1) {
- byte b = (byte)result;
- buf.write(b);
- result = bis.read();
- }
- return buf.toString();
- }
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext bundleContext) throws Exception {
- Activator.context = bundleContext;
- httpServiceConnector = new HttpServiceConnector(context, RpcConstants.TEST_SERVLETS_PATH, new XHttpServlet());
-
- Dictionary<String, Object> properties = new Hashtable<String, Object>();
- properties.put(HTTP_PORT_KEY, RpcConstants.HTTP_PORT);
- JettyConfigurator.startServer(SERVER_NAME, properties);
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext bundleContext) throws Exception {
- Activator.context = null;
- JettyConfigurator.stopServer(SERVER_NAME);
-
- if (httpServiceConnector != null) {
- httpServiceConnector.close();
- httpServiceConnector = null;
- }
- }
-}
diff --git a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/internal/tests/remoteservice/rpc/HttpServiceConnector.java b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/internal/tests/remoteservice/rpc/HttpServiceConnector.java
deleted file mode 100644
index e30910702..000000000
--- a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/internal/tests/remoteservice/rpc/HttpServiceConnector.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2011 Naumen. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Pavel Samolisov - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.internal.tests.remoteservice.rpc;
-
-import javax.servlet.http.HttpServlet;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.http.HttpService;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-
-@SuppressWarnings("rawtypes")
-public class HttpServiceConnector extends ServiceTracker implements ServiceTrackerCustomizer {
-
- private String path;
-
- private HttpServlet servlet;
-
- @SuppressWarnings("unchecked")
- public HttpServiceConnector(BundleContext context, String path, HttpServlet servlet) {
- super(context, HttpService.class.getName(), null);
- this.path = path;
- this.servlet = servlet;
-
- open();
- }
-
- public Object addingService(ServiceReference reference) {
- @SuppressWarnings("unchecked")
- HttpService httpService = (HttpService) super.addingService(reference);
- if (httpService == null)
- return null;
-
- try {
- httpService.registerServlet(path, servlet, null, null);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
-
- return httpService;
- }
-
- @SuppressWarnings("unchecked")
- public void removedService(ServiceReference reference, Object service) {
- HttpService httpService = (HttpService) service;
- httpService.unregister(path);
-
- super.removedService(reference, service);
- }
-}
diff --git a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/internal/tests/remoteservice/rpc/server/CalcHandler.java b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/internal/tests/remoteservice/rpc/server/CalcHandler.java
deleted file mode 100644
index e09c583aa..000000000
--- a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/internal/tests/remoteservice/rpc/server/CalcHandler.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2011 Naumen. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Pavel Samolisov - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.internal.tests.remoteservice.rpc.server;
-
-public class CalcHandler {
-
- public int add(int i1, int i2) {
- return i1 + i2;
- }
-
- public int sub(int i1, int i2) {
- return i1 - i2;
- }
-}
diff --git a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/internal/tests/remoteservice/rpc/server/EchoHandler.java b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/internal/tests/remoteservice/rpc/server/EchoHandler.java
deleted file mode 100644
index 89d2151e5..000000000
--- a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/internal/tests/remoteservice/rpc/server/EchoHandler.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2011 Naumen. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Pavel Samolisov - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.internal.tests.remoteservice.rpc.server;
-
-import org.eclipse.ecf.tests.remoteservice.rpc.common.IEcho;
-
-public class EchoHandler implements IEcho {
-
- public String echo(String str) {
- System.out.println(str); // TODO using logger
- return str;
- }
-}
diff --git a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/AbstractRpcTestCase.java b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/AbstractRpcTestCase.java
deleted file mode 100644
index 199f7edc6..000000000
--- a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/AbstractRpcTestCase.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2011 Naumen. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Pavel Samolisov - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.tests.remoteservice.rpc;
-
-import java.util.Dictionary;
-import org.eclipse.ecf.core.ContainerCreateException;
-import org.eclipse.ecf.core.IContainer;
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.identity.IDCreateException;
-import org.eclipse.ecf.remoteservice.IRemoteServiceRegistration;
-import org.eclipse.ecf.remoteservice.client.IRemoteCallable;
-import org.eclipse.ecf.remoteservice.client.IRemoteServiceClientContainerAdapter;
-import org.eclipse.ecf.tests.ECFAbstractTestCase;
-
-public abstract class AbstractRpcTestCase extends ECFAbstractTestCase {
-
- protected IContainer createRpcContainer(String uri) throws ContainerCreateException {
- return getContainerFactory().createContainer(RpcConstants.RPC_CONTAINER_TYPE, uri);
- }
-
- protected IContainer createRpcContainer(ID rpcId) throws ContainerCreateException {
- return getContainerFactory().createContainer(RpcConstants.RPC_CONTAINER_TYPE, rpcId);
- }
-
- protected ID createRpcID(String id) throws IDCreateException {
- return getIDFactory().createID(RpcConstants.NAMESPACE, id);
- }
-
- protected IRemoteServiceClientContainerAdapter getRemoteServiceClientContainerAdapter(IContainer container) {
- return (IRemoteServiceClientContainerAdapter) container.getAdapter(IRemoteServiceClientContainerAdapter.class);
- }
-
- protected IRemoteServiceRegistration registerCallable(IContainer container, IRemoteCallable callable, Dictionary<String, Object> properties) {
- return getRemoteServiceClientContainerAdapter(container).registerCallables(new IRemoteCallable[] { callable }, properties);
- }
-
- protected IRemoteServiceRegistration registerCallable(IContainer container, IRemoteCallable[] callables, Dictionary<String, Object> properties) {
- return getRemoteServiceClientContainerAdapter(container).registerCallables(callables, properties);
- }
-}
diff --git a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcConstants.java b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcConstants.java
deleted file mode 100644
index 8306d2bca..000000000
--- a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcConstants.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2011 Naumen. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Pavel Samolisov - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.tests.remoteservice.rpc;
-
-public interface RpcConstants {
-
- public static final String RPC_CONTAINER_TYPE = "ecf.xmlrpc.client"; //$NON-NLS-1$
-
- public static final String NAMESPACE = "ecf.xmlrpc.namespace"; //$NON-NLS-1$
-
- public static final int HTTP_PORT = 8085;
-
- public static final String TEST_SERVLETS_PATH = "/xmlrpc"; //$NON-NLS-1$
-
- public static final String TEST_ECHO_TARGET = "http://localhost:" + HTTP_PORT + TEST_SERVLETS_PATH; //$NON-NLS-1$ //$NON-NLS-2$
-
- public static final String TEST_ECHO_METHOD = "Echo.echo"; //$NON-NLS-1$
-
- public static final String TEST_ECHO_METHOD_NAME = "echo"; //$NON-NLS-1$
-
- public static final String TEST_ECHO_METHOD_PARAM = "text"; //$NON-NLS-1$
-
- public static final String TEST_CALC_PLUS_METHOD = "Calc.add"; //$NON-NLS-1$
-
- public static final String TEST_CALC_PLUS_METHOD_NAME = "plus"; //$NON-NLS-1$
-
- public static final String TEST_CALC_PLUS_METHOD_PARAM1 = "val1"; //$NON-NLS-1$
-
- public static final String TEST_CALC_PLUS_METHOD_PARAM2 = "val2"; //$NON-NLS-1$
-}
diff --git a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcContainerInstantiatorTest.java b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcContainerInstantiatorTest.java
deleted file mode 100644
index 8c77a756f..000000000
--- a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcContainerInstantiatorTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2011 Naumen. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Pavel Samolisov - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.tests.remoteservice.rpc;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.ecf.core.ContainerTypeDescription;
-import org.eclipse.ecf.core.IContainerFactory;
-import org.eclipse.ecf.tests.ECFAbstractTestCase;
-
-public class RpcContainerInstantiatorTest extends ECFAbstractTestCase {
-
- private IContainerFactory containerFactory;
-
- private ContainerTypeDescription description;
-
- protected void setUp() throws Exception {
- containerFactory = getContainerFactory();
- description = containerFactory.getDescriptionByName(RpcConstants.RPC_CONTAINER_TYPE);
- }
-
- public void testSupportedParameterTypes() {
- Class<?>[][] types = description.getSupportedParameterTypes();
- boolean foundString = false;
- boolean foundInteger = false;
- boolean foundBoolean = false;
- boolean foundDouble = false;
- boolean foundDate = false;
- boolean foundByteArray = false;
- boolean foundObjectArray = false;
- boolean foundList = false;
- boolean foundMap = false;
- for(int i=0; i < types.length; i++) {
- for(int j=0; j < types[i].length; j++) {
- if (types[i][j].equals(String.class)) foundString = true;
- if (types[i][j].equals(Integer.class)) foundInteger = true;
- if (types[i][j].equals(Boolean.class)) foundBoolean = true;
- if (types[i][j].equals(Double.class)) foundDouble = true;
- if (types[i][j].equals(Date.class)) foundDate = true;
- if (types[i][j].equals(byte[].class)) foundByteArray = true;
- if (types[i][j].equals(Object[].class)) foundObjectArray = true;
- if (types[i][j].equals(List.class)) foundList = true;
- if (types[i][j].equals(Map.class)) foundMap = true;
- }
- }
- assertTrue(foundString && foundInteger && foundBoolean && foundDouble && foundDate && foundByteArray
- && foundObjectArray && foundList && foundMap);
- }
-}
diff --git a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcContainerTest.java b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcContainerTest.java
deleted file mode 100644
index ef7a06f12..000000000
--- a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcContainerTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2011 Naumen. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Pavel Samolisov - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.tests.remoteservice.rpc;
-
-import java.net.URI;
-import java.net.URL;
-import org.eclipse.ecf.core.ContainerTypeDescription;
-import org.eclipse.ecf.core.IContainer;
-import org.eclipse.ecf.remoteservice.rpc.client.RpcClientContainer;
-
-public class RpcContainerTest extends AbstractRpcTestCase {
-
- protected void tearDown() throws Exception {
- getContainerManager().removeAllContainers();
- }
-
- public void testCreateContainer() throws Exception {
- IContainer container = createRpcContainer(RpcConstants.TEST_ECHO_TARGET);
- assertNotNull(container);
- assertTrue(container instanceof RpcClientContainer);
- }
-
- public void testCreateContainer1() throws Exception {
- IContainer container = createRpcContainer(RpcConstants.TEST_ECHO_TARGET);
- assertNotNull(container);
- assertTrue(container instanceof RpcClientContainer);
- }
-
- public void testCreateContainer2() throws Exception {
- ContainerTypeDescription description = getContainerFactory()
- .getDescriptionByName(RpcConstants.RPC_CONTAINER_TYPE);
- IContainer container = getContainerFactory().createContainer(description,
- new Object[] { new URL(RpcConstants.TEST_ECHO_TARGET) });
- assertNotNull(container);
- assertTrue(container instanceof RpcClientContainer);
- }
-
- public void testCreateContainer3() throws Exception {
- ContainerTypeDescription description = getContainerFactory()
- .getDescriptionByName(RpcConstants.RPC_CONTAINER_TYPE);
- IContainer container = getContainerFactory().createContainer(description,
- new Object[] { new URI(RpcConstants.TEST_ECHO_TARGET) });
- assertNotNull(container);
- assertTrue(container instanceof RpcClientContainer);
- }
-}
diff --git a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcNamespaceTest.java b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcNamespaceTest.java
deleted file mode 100644
index 370c786b9..000000000
--- a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcNamespaceTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2011 Naumen. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Pavel Samolisov - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.tests.remoteservice.rpc;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.remoteservice.rpc.identity.RpcNamespace;
-
-public class RpcNamespaceTest extends AbstractRpcTestCase {
-
- public void testCreation() {
- String desc = "description";
- RpcNamespace namespace = new RpcNamespace(RpcNamespace.NAME, desc);
- assertEquals(RpcNamespace.NAME, namespace.getName());
- assertEquals(desc, namespace.getDescription());
- }
-
- public void testCreateInstance() {
- RpcNamespace namespace = new RpcNamespace(RpcNamespace.NAME, null);
- Object[] parameters;
- try {
- String url = RpcConstants.TEST_ECHO_TARGET;
- parameters = new Object[] {new URL(url)};
- ID id = namespace.createInstance(parameters);
- assertEquals(url, id.getName());
- } catch (MalformedURLException e) {
- fail();
- }
- }
-
- public void testGetScheme() {
- RpcNamespace namespace = new RpcNamespace(RpcNamespace.NAME, null);
- assertEquals(RpcNamespace.SCHEME, namespace.getScheme());
- }
-}
diff --git a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcRemoteServiceAdapterTest.java b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcRemoteServiceAdapterTest.java
deleted file mode 100644
index 1bc5535e6..000000000
--- a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcRemoteServiceAdapterTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2011 Naumen. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Pavel Samolisov - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.tests.remoteservice.rpc;
-
-import org.eclipse.ecf.core.IContainer;
-import org.eclipse.ecf.remoteservice.Constants;
-import org.eclipse.ecf.remoteservice.IRemoteFilter;
-import org.eclipse.ecf.remoteservice.IRemoteService;
-import org.eclipse.ecf.remoteservice.IRemoteServiceID;
-import org.eclipse.ecf.remoteservice.IRemoteServiceListener;
-import org.eclipse.ecf.remoteservice.IRemoteServiceReference;
-import org.eclipse.ecf.remoteservice.IRemoteServiceRegistration;
-import org.eclipse.ecf.remoteservice.client.IRemoteCallable;
-import org.eclipse.ecf.remoteservice.client.IRemoteServiceClientContainerAdapter;
-import org.eclipse.ecf.remoteservice.client.RemoteCallableFactory;
-import org.eclipse.ecf.remoteservice.events.IRemoteServiceEvent;
-import org.eclipse.ecf.remoteservice.events.IRemoteServiceRegisteredEvent;
-import org.osgi.framework.InvalidSyntaxException;
-
-public class RpcRemoteServiceAdapterTest extends AbstractRpcTestCase {
-
- IContainer container;
-
- protected void setUp() throws Exception {
- super.setUp();
- container = createRpcContainer(RpcConstants.TEST_ECHO_TARGET);
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- container.disconnect();
- container.dispose();
- getContainerManager().removeAllContainers();
- }
-
- IRemoteServiceClientContainerAdapter getRemoteServiceClientContainerAdapter() {
- return super.getRemoteServiceClientContainerAdapter(container);
- }
-
- IRemoteServiceRegistration createRpcRegistration(String method) {
- IRemoteCallable callable = RemoteCallableFactory.createCallable(method);
- return registerCallable(container, callable, null);
- }
-
- public void testGetRemoteService() {
- IRemoteServiceRegistration registration = createRpcRegistration(RpcConstants.TEST_ECHO_METHOD);
- IRemoteServiceReference reference = registration.getReference();
- assertNotNull(reference);
- IRemoteService remoteService = getRemoteServiceClientContainerAdapter().getRemoteService(reference);
- assertNotNull(remoteService);
- }
-
- public void testGetRemoteServiceReference() {
- IRemoteServiceRegistration registration = createRpcRegistration(RpcConstants.TEST_ECHO_METHOD);
- IRemoteServiceReference remoteServiceReference = getRemoteServiceClientContainerAdapter().getRemoteServiceReference(registration.getID());
- assertEquals(registration.getReference(), remoteServiceReference);
- }
-
- public void testUngetRemoteService() {
- IRemoteServiceRegistration registration = createRpcRegistration(RpcConstants.TEST_ECHO_METHOD);
- IRemoteServiceReference reference = registration.getReference();
- getRemoteServiceClientContainerAdapter().getRemoteService(reference);
- assertTrue(getRemoteServiceClientContainerAdapter().ungetRemoteService(reference));
- }
-
- public void testRemoteServiceRegisteredEvent() {
- IRemoteServiceClientContainerAdapter adapter = getRemoteServiceClientContainerAdapter();
- adapter.addRemoteServiceListener(new IRemoteServiceListener() {
- public void handleServiceEvent(IRemoteServiceEvent event) {
- assertTrue(event instanceof IRemoteServiceRegisteredEvent);
- }
- });
- createRpcRegistration(RpcConstants.TEST_ECHO_METHOD);
- }
-
- public void testCreateRemoteFilter() {
- String filter = "(" + Constants.OBJECTCLASS + "=" + IRemoteService.class.getName() + ")";
- try {
- IRemoteFilter remoteFilter = getRemoteServiceClientContainerAdapter().createRemoteFilter(filter);
- assertNotNull(remoteFilter);
- } catch (InvalidSyntaxException e) {
- fail();
- }
- }
-
- public void testGetRemoteServiceID() {
- IRemoteServiceRegistration registration = createRpcRegistration(RpcConstants.TEST_ECHO_METHOD);
- long containerRelativeID = registration.getID().getContainerRelativeID();
- IRemoteServiceID remoteServiceID = getRemoteServiceClientContainerAdapter().getRemoteServiceID(container.getID(), containerRelativeID);
- assertEquals(registration.getID(), remoteServiceID);
- }
-}
diff --git a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcRemoteServiceTest.java b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcRemoteServiceTest.java
deleted file mode 100644
index ba66aed1f..000000000
--- a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/RpcRemoteServiceTest.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2011 Naumen. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Pavel Samolisov - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.tests.remoteservice.rpc;
-
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.ecf.core.IContainer;
-import org.eclipse.ecf.core.util.ECFException;
-import org.eclipse.ecf.internal.tests.remoteservice.rpc.Activator;
-import org.eclipse.ecf.remoteservice.IRemoteCall;
-import org.eclipse.ecf.remoteservice.IRemoteCallListener;
-import org.eclipse.ecf.remoteservice.IRemoteService;
-import org.eclipse.ecf.remoteservice.IRemoteServiceRegistration;
-import org.eclipse.ecf.remoteservice.RemoteCallFactory;
-import org.eclipse.ecf.remoteservice.client.IRemoteCallParameter;
-import org.eclipse.ecf.remoteservice.client.IRemoteCallable;
-import org.eclipse.ecf.remoteservice.client.RemoteCallParameter;
-import org.eclipse.ecf.remoteservice.client.RemoteCallableFactory;
-import org.eclipse.ecf.remoteservice.events.IRemoteCallCompleteEvent;
-import org.eclipse.ecf.remoteservice.events.IRemoteCallEvent;
-import org.eclipse.ecf.tests.remoteservice.rpc.common.IEcho;
-import org.eclipse.equinox.concurrent.future.IFuture;
-
-@SuppressWarnings("restriction")
-public class RpcRemoteServiceTest extends AbstractRpcTestCase {
-
- private static final String ECHO_TEST_DATA = "Hello, world";
-
- IContainer container;
-
- IRemoteServiceRegistration registrationEcho;
-
- IRemoteServiceRegistration registrationEchoProxy;
-
- IRemoteServiceRegistration registrationCalc;
-
- protected void setUp() throws Exception {
- container = createRpcContainer(RpcConstants.TEST_ECHO_TARGET);
-
- IRemoteCallable callableEcho = RemoteCallableFactory.createCallable(RpcConstants.TEST_ECHO_METHOD_NAME, RpcConstants.TEST_ECHO_METHOD,
- new IRemoteCallParameter[]{new RemoteCallParameter(RpcConstants.TEST_ECHO_METHOD_PARAM)});
- registrationEcho = registerCallable(container, callableEcho, null);
-
- IRemoteCallable callableEchoProxy = RemoteCallableFactory.createCallable(IEcho.class.getName());
- registrationEchoProxy = registerCallable(container, callableEchoProxy, null);
-
- IRemoteCallable callableCalc = RemoteCallableFactory.createCallable(RpcConstants.TEST_CALC_PLUS_METHOD_NAME, RpcConstants.TEST_CALC_PLUS_METHOD,
- new IRemoteCallParameter[]{
- new RemoteCallParameter(RpcConstants.TEST_CALC_PLUS_METHOD_PARAM1),
- new RemoteCallParameter(RpcConstants.TEST_CALC_PLUS_METHOD_PARAM2)});
- registrationCalc = registerCallable(container, callableCalc, null);
- }
-
- protected void tearDown() throws Exception {
- registrationEcho.unregister();
- registrationEchoProxy.unregister();
- registrationCalc.unregister();
- container.disconnect();
- }
-
- public void testCallViaProxy() {
- IRemoteService rpcClientService = getRemoteServiceClientContainerAdapter(container).getRemoteService(registrationEchoProxy.getReference());
- try {
- IEcho echo = (IEcho) rpcClientService.getProxy(Activator.class.getClassLoader(), new Class[]{IEcho.class});
- assertNotNull(echo);
- Object result = echo.echo(ECHO_TEST_DATA);
- assertNotNull(result);
- assertEquals(result, ECHO_TEST_DATA);
- }
- catch (ECFException e) {
- e.printStackTrace();
- fail("Could not contact the service");
- }
- }
-
- public void testCallViaProxy2() {
- IRemoteService rpcClientService = getRemoteServiceClientContainerAdapter(container).getRemoteService(registrationEchoProxy.getReference());
- try {
- IEcho echo = (IEcho) rpcClientService.getProxy();
- assertNotNull(echo);
- Object result = echo.echo(ECHO_TEST_DATA);
- assertNotNull(result);
- assertEquals(result, ECHO_TEST_DATA);
- }
- catch (ECFException e) {
- e.printStackTrace();
- fail("Could not contact the service");
- }
- }
-
- public void testSyncCall() {
- IRemoteService rpcClientService = getRemoteServiceClientContainerAdapter(container).getRemoteService(registrationEcho.getReference());
- try {
- Object result = rpcClientService.callSync(getEchoCall());
- assertNotNull(result);
- assertTrue(ECHO_TEST_DATA.equals(result));
- } catch (ECFException e) {
- fail("Could not contact the service");
- }
- }
-
- public void testAsynCall() {
- IRemoteService rpcClientService = getRemoteServiceClientContainerAdapter(container).getRemoteService(registrationCalc.getReference());
- IFuture future = rpcClientService.callAsync(getCalcPlusCall());
- try {
- Object response = future.get();
- assertTrue(response instanceof Integer);
- } catch (OperationCanceledException e) {
- fail(e.getMessage());
- } catch (InterruptedException e) {
- fail(e.getMessage());
- }
- }
-
- public void testAsyncCallWithListener() throws Exception {
- IRemoteService rpcClientService = getRemoteServiceClientContainerAdapter(container).getRemoteService(registrationCalc.getReference());
- rpcClientService.callAsync(getCalcPlusCall(), new IRemoteCallListener() {
- public void handleEvent(IRemoteCallEvent event) {
- if (event instanceof IRemoteCallCompleteEvent) {
- IRemoteCallCompleteEvent cce = (IRemoteCallCompleteEvent) event;
- Object response = cce.getResponse();
- assertTrue(response instanceof Integer);
- syncNotify();
- }
- }
- });
- syncWaitForNotify(10000);
- }
-
- private IRemoteCall getEchoCall() {
- return RemoteCallFactory.createRemoteCall(RpcConstants.TEST_ECHO_METHOD_NAME, new Object[]{ECHO_TEST_DATA});
- }
-
- private IRemoteCall getCalcPlusCall() {
- return RemoteCallFactory.createRemoteCall(RpcConstants.TEST_CALC_PLUS_METHOD_NAME, new Object[]{new Integer(2), new Integer(3)});
- }
-}
diff --git a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/common/IEcho.java b/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/common/IEcho.java
deleted file mode 100644
index f2b8fd319..000000000
--- a/tests/bundles/org.eclipse.ecf.tests.remoteservice.rpc/src/org/eclipse/ecf/tests/remoteservice/rpc/common/IEcho.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2011 Naumen. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Pavel Samolisov - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.tests.remoteservice.rpc.common;
-
-public interface IEcho {
-
- public String echo(String str);
-}

Back to the top