You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by sc...@apache.org on 2009/02/27 17:37:19 UTC

svn commit: r748580 [5/5] - in /incubator/etch/branches/router: ./ services/router/ services/router/scripts/ services/router/src/main/etch/ services/router/src/main/java/cisco/ services/router/src/main/java/org/ services/router/src/main/java/org/apache...

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Module.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Module.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/NewDataSet.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/NewDataSet.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/NewDataSet.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/NewDataSet.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,104 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * Licensed 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.
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2008.12.02 at 02:28:29 PM CST 
+//
+
+
+package org.apache.etch.services.router.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;choice maxOccurs="unbounded" minOccurs="0">
+ *         &lt;element ref="{}field"/>
+ *         &lt;element ref="{}exception"/>
+ *         &lt;element ref="{}module"/>
+ *       &lt;/choice>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+    "fieldOrExceptionOrModule"
+})
+@XmlRootElement(name = "NewDataSet")
+public class NewDataSet {
+
+    @XmlElements({
+        @XmlElement(name = "module", type = Module.class),
+        @XmlElement(name = "exception", type = Exception.class),
+        @XmlElement(name = "field", type = Field.class)
+    })
+    protected List<Object> fieldOrExceptionOrModule;
+
+    /**
+     * Gets the value of the fieldOrExceptionOrModule property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the fieldOrExceptionOrModule property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getFieldOrExceptionOrModule().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Module }
+     * {@link Exception }
+     * {@link Field }
+     * 
+     * 
+     */
+    public List<Object> getFieldOrExceptionOrModule() {
+        if (fieldOrExceptionOrModule == null) {
+            fieldOrExceptionOrModule = new ArrayList<Object>();
+        }
+        return this.fieldOrExceptionOrModule;
+    }
+
+}

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/NewDataSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/NewDataSet.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/ObjectFactory.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/ObjectFactory.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/ObjectFactory.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,216 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * Licensed 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.
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2008.12.02 at 02:28:29 PM CST 
+//
+
+
+package org.apache.etch.services.router.xml;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+
+/**
+ * This object contains factory methods for each 
+ * Java content interface and Java element interface 
+ * generated in the cisco.cuae.etchrouter.xml package. 
+ * <p>An ObjectFactory allows you to programatically 
+ * construct new instances of the Java representation 
+ * for XML content. The Java representation of XML 
+ * content can consist of schema derived interfaces 
+ * and classes representing the binding of schema 
+ * type definitions, element declarations and model 
+ * groups.  Factory methods for each of these are 
+ * provided in this class.
+ * 
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+
+    /**
+     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: cisco.cuae.etchrouter.xml
+     * 
+     */
+    public ObjectFactory() {
+    }
+
+    /**
+     * Create an instance of {@link Module.Service.Consts }
+     * 
+     */
+    public Module.Service.Consts createModuleServiceConsts() {
+        return new Module.Service.Consts();
+    }
+
+    /**
+     * Create an instance of {@link Module.Service.Exceptions }
+     * 
+     */
+    public Module.Service.Exceptions createModuleServiceExceptions() {
+        return new Module.Service.Exceptions();
+    }
+
+    /**
+     * Create an instance of {@link Module.Service.Structs }
+     * 
+     */
+    public Module.Service.Structs createModuleServiceStructs() {
+        return new Module.Service.Structs();
+    }
+
+    /**
+     * Create an instance of {@link Module.Service.Enums }
+     * 
+     */
+    public Module.Service.Enums createModuleServiceEnums() {
+        return new Module.Service.Enums();
+    }
+
+    /**
+     * Create an instance of {@link Module.Service.Enums.Enum }
+     * 
+     */
+    public Module.Service.Enums.Enum createModuleServiceEnumsEnum() {
+        return new Module.Service.Enums.Enum();
+    }
+
+    /**
+     * Create an instance of {@link NewDataSet }
+     * 
+     */
+    public NewDataSet createNewDataSet() {
+        return new NewDataSet();
+    }
+
+    /**
+     * Create an instance of {@link Module.Service }
+     * 
+     */
+    public Module.Service createModuleService() {
+        return new Module.Service();
+    }
+
+    /**
+     * Create an instance of {@link Module.Service.Methods.Method }
+     * 
+     */
+    public Module.Service.Methods.Method createModuleServiceMethodsMethod() {
+        return new Module.Service.Methods.Method();
+    }
+
+    /**
+     * Create an instance of {@link Exception }
+     * 
+     */
+    public Exception createException() {
+        return new Exception();
+    }
+
+    /**
+     * Create an instance of {@link Module }
+     * 
+     */
+    public Module createModule() {
+        return new Module();
+    }
+
+    /**
+     * Create an instance of {@link Module.Service.Enums.Enum.Entry }
+     * 
+     */
+    public Module.Service.Enums.Enum.Entry createModuleServiceEnumsEnumEntry() {
+        return new Module.Service.Enums.Enum.Entry();
+    }
+
+    /**
+     * Create an instance of {@link Module.Service.Externs.Extern }
+     * 
+     */
+    public Module.Service.Externs.Extern createModuleServiceExternsExtern() {
+        return new Module.Service.Externs.Extern();
+    }
+
+    /**
+     * Create an instance of {@link Module.Service.Methods.Method.Authorize }
+     * 
+     */
+    public Module.Service.Methods.Method.Authorize createModuleServiceMethodsMethodAuthorize() {
+        return new Module.Service.Methods.Method.Authorize();
+    }
+
+    /**
+     * Create an instance of {@link Field }
+     * 
+     */
+    public Field createField() {
+        return new Field();
+    }
+
+    /**
+     * Create an instance of {@link Module.Service.Externs.Extern.Externmap }
+     * 
+     */
+    public Module.Service.Externs.Extern.Externmap createModuleServiceExternsExternExternmap() {
+        return new Module.Service.Externs.Extern.Externmap();
+    }
+
+    /**
+     * Create an instance of {@link Module.Service.Externs }
+     * 
+     */
+    public Module.Service.Externs createModuleServiceExterns() {
+        return new Module.Service.Externs();
+    }
+
+    /**
+     * Create an instance of {@link Module.Service.Methods.Method.Result }
+     * 
+     */
+    public Module.Service.Methods.Method.Result createModuleServiceMethodsMethodResult() {
+        return new Module.Service.Methods.Method.Result();
+    }
+
+    /**
+     * Create an instance of {@link Module.Service.Structs.Struct }
+     * 
+     */
+    public Module.Service.Structs.Struct createModuleServiceStructsStruct() {
+        return new Module.Service.Structs.Struct();
+    }
+
+    /**
+     * Create an instance of {@link Module.Service.Methods }
+     * 
+     */
+    public Module.Service.Methods createModuleServiceMethods() {
+        return new Module.Service.Methods();
+    }
+
+    /**
+     * Create an instance of {@link Module.Service.Consts.Const }
+     * 
+     */
+    public Module.Service.Consts.Const createModuleServiceConstsConst() {
+        return new Module.Service.Consts.Const();
+    }
+
+}

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/ObjectFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/ObjectFactory.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: incubator/etch/branches/router/services/router/src/test/etch/TestApp.etch
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/test/etch/TestApp.etch?rev=748580&r1=748579&r2=748580&view=diff
==============================================================================
--- incubator/etch/branches/router/services/router/src/test/etch/TestApp.etch (original)
+++ incubator/etch/branches/router/services/router/src/test/etch/TestApp.etch Fri Feb 27 16:37:17 2009
@@ -1,4 +1,4 @@
-module cisco.uc.cuae.etchrouter.test.app
+module org.apache.etch.services.router.test.app
 
 service TestPlugin
 {

Modified: incubator/etch/branches/router/services/router/src/test/etch/TestPlugin.etch
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/test/etch/TestPlugin.etch?rev=748580&r1=748579&r2=748580&view=diff
==============================================================================
--- incubator/etch/branches/router/services/router/src/test/etch/TestPlugin.etch (original)
+++ incubator/etch/branches/router/services/router/src/test/etch/TestPlugin.etch Fri Feb 27 16:37:17 2009
@@ -1,4 +1,4 @@
-module cisco.uc.cuae.etchrouter.test.plugin
+module org.apache.etch.services.router.test.plugin
 
 service TestPlugin
 {

Added: incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/TestEtchRouter.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/TestEtchRouter.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/TestEtchRouter.java (added)
+++ incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/TestEtchRouter.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,182 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * Licensed 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.etch.services.router.test;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.PrintWriter;
+
+import org.apache.etch.services.router.EtchRouterMain;
+import org.apache.etch.services.router.test.app.MainTestPluginClient;
+import org.apache.etch.services.router.test.app.RemoteTestPluginServer;
+import org.apache.etch.services.router.test.app.TestPluginHelper;
+import org.apache.etch.services.router.test.utils.PluginTestServerRunner;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * JUnit test class for Etch Router
+ * 
+ * @author Wei Wang (weiwa@cisco.com)
+ *
+ */
+public class TestEtchRouter
+{
+
+	private static String _routerUrlForClient = "tcp://127.0.0.1:9999/";
+	
+	private static EtchRouterMain _etchRouterRunner = null;
+	
+	private static PluginTestServerRunner _pluginRunner1 = null;
+	
+	private static PluginTestServerRunner _pluginRunner2 = null;
+	
+	private static File _homeDir = null;
+	
+	/**
+	 * 
+	 * @throws Exception
+	 */
+	@BeforeClass
+	public static void setUp() throws Exception
+	{
+		File propFile = new File("EtchRouter-test.properties");
+		if (propFile.exists())
+		{
+			_homeDir = new File(".");
+		}
+		else
+		{
+			propFile = new File("services/router/EtchRouter-test.properties");
+			_homeDir = new File("services/router");
+		}
+		System.out.println("Etch-Router base directory is: "+_homeDir.getAbsolutePath());
+		_pluginRunner1 = new PluginTestServerRunner("runner-4001", "tcp://0.0.0.0:4001" );
+		_pluginRunner2 = new PluginTestServerRunner("runner-4002", "tcp://0.0.0.0:4002" );
+		_pluginRunner1.start();
+		_pluginRunner2.start();
+		
+		System.out.println("Sleeping 30 seconds after starting both plugin listeners...");
+		Thread.sleep( 30000 );
+		
+		createPluginMeta( "roundrobin" );
+		
+		try
+		{
+			_etchRouterRunner = new EtchRouterMain( propFile, null);
+			_etchRouterRunner.run();
+		}
+		catch (Exception e)
+		{
+			e.printStackTrace(System.err);
+			throw e;
+		}
+		
+		System.out.println("Sleeping 60 seconds after starting etch router...");
+		Thread.sleep( 60000 );
+	}
+
+	private static void createPluginMeta( String pluginType ) throws Exception
+	{
+		File metaFile = new File(_homeDir, "target/runtime/plugins/TestPlugin/metadata.txt");
+		PrintWriter w = null;
+		try
+		{
+			w = new PrintWriter( metaFile );
+			w.println( String.format( "plugin.group.type=%s", pluginType ));
+			w.println( "plugin.member.url.no1=tcp://127.0.0.1:4001" );
+			w.println( "plugin.member.metadata.no1=location\\=LA" );
+			w.println( "plugin.member.url.no2=tcp://127.0.0.1:4002" );
+			w.println( "plugin.member.metadata.no2=location\\=LA" );
+			w.println( "" );
+		}
+		catch (Exception e)
+		{
+			e.printStackTrace(System.err);
+			throw e;
+		}
+		finally
+		{
+			if (w!=null)
+			{
+				w.flush();
+				w.close();
+			}
+		}
+		
+	}
+	
+	/**
+	 * 
+	 * @throws Exception
+	 */
+	@AfterClass
+	public static void tearDown() throws Exception
+	{
+		try
+		{
+			_pluginRunner1.stop();
+		}
+		catch (Exception e)
+		{
+			e.printStackTrace(System.out);
+		}
+		_etchRouterRunner.getRouterManager().stop();
+	}
+
+	@Test
+	public void testRoundRobin() throws Exception
+	{
+		RemoteTestPluginServer server1 = TestPluginHelper.newServer( _routerUrlForClient, null,
+			new MainTestPluginClient() );
+		System.out.println("Starting remote server1...");
+		server1._startAndWaitUp( 4000 );
+		RemoteTestPluginServer server2 = TestPluginHelper.newServer( _routerUrlForClient, null,
+			new MainTestPluginClient() );
+		System.out.println("Starting remote server2...");
+		server2._startAndWaitUp( 4000 );
+		
+		System.out.println("Sleep 30 seconds after starting both remote servers...");
+		Thread.sleep( 30000 );
+
+		int result1 = server1.addMethod( 11, 22 );
+		assertTrue( String.format( "server1.addMethod(11,22) failed to return 33: %s", result1), result1==33 );
+		assertTrue( "The call 'server1.addMethod(11,22)' was not routed to plugin listener1 ", _pluginRunner1.getNumCalls()==1);
+
+		int result2 = server2.addMethod( 22, 33 );
+		assertTrue( String.format( "server2.addMethod(22,33) failed to return 55: %s", result2), result2==55 );
+		assertTrue( "The call 'server2.addMethod(22,33)' was not routed to plugin listener2 ", _pluginRunner2.getNumCalls()==1);
+		
+		//This method call doesn't really stop the listener
+		//_pluginRunner2.stop();
+		//System.out.println("Sleep 120 seconds for the plugin service to fail over...");
+		//Thread.sleep( 120000 );
+		
+		//server2.addMethod( 1, 2 );
+		//assertTrue( "After failover, the call 'server2.addMethod(1,2)' was not routed to plugin listener1 ", _pluginRunner1.getNumCalls()==2);
+		
+		System.out.println("Stopping remote server1...");
+		server1._stopAndWaitDown( 4000 );
+		
+		System.out.println("Stopping remote server2...");
+		server2._stopAndWaitDown( 4000 );
+	}
+}

Propchange: incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/TestEtchRouter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/TestEtchRouter.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/plugin/ImplTestPluginServer.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/plugin/ImplTestPluginServer.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/plugin/ImplTestPluginServer.java (added)
+++ incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/plugin/ImplTestPluginServer.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,73 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * Licensed 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.
+ */
+
+// This file automatically generated by:
+//   Etch 1.0.1 (ETCH-SF-19) / java 1.0.1 (ETCH-SF-19)
+//   Mon Jan 26 14:54:40 CST 2009
+// This file is automatically created for your convenience and will not be
+// overwritten once it exists! Please edit this file as necessary to implement
+// your service logic.
+
+package org.apache.etch.services.router.test.plugin;
+
+import org.apache.etch.services.router.test.plugin.BaseTestPluginServer;
+import org.apache.etch.services.router.test.plugin.RemoteTestPluginClient;
+import org.apache.etch.services.router.test.utils.PluginTestServerRunner;
+
+
+/**
+ * Your custom implementation of BaseTestPluginServer. Add methods here to provide
+ * implementations of messages from the client.
+ */
+public class ImplTestPluginServer extends BaseTestPluginServer
+{
+	
+	private PluginTestServerRunner _runner;
+	/**
+	 * Constructs the ImplTestPluginServer.
+	 *
+	 * @param client a connection to the client session. Use this to send a
+	 * message to the client.
+	 */
+	public ImplTestPluginServer( RemoteTestPluginClient client )
+	{
+		this( client, null);
+	}
+	
+	public ImplTestPluginServer( RemoteTestPluginClient client, PluginTestServerRunner runner )
+	{
+		this.client = client;
+		_runner = runner;
+	}
+	
+	/**
+	 * A connection to the client session. Use this to send a
+	 * message to the client.
+	 */
+	@SuppressWarnings( "unused" )
+	private final RemoteTestPluginClient client;
+
+	@Override
+	public Integer addMethod( Integer valA, Integer valB )
+	{
+		System.out.println( String.format( "[%s]ImplTestPluginServer.addMethod - starts", (_runner==null ? "NULL" : _runner.getName())) );
+		if (_runner!=null) _runner.methodCalled();
+		return valA + valB;
+	}
+
+	
+}
\ No newline at end of file

Propchange: incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/plugin/ImplTestPluginServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/plugin/ImplTestPluginServer.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/utils/PluginTestServerRunner.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/utils/PluginTestServerRunner.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/utils/PluginTestServerRunner.java (added)
+++ incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/utils/PluginTestServerRunner.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,75 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * Licensed 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.etch.services.router.test.utils;
+
+import org.apache.etch.bindings.java.support.ServerFactory;
+import org.apache.etch.services.router.test.plugin.ImplTestPluginServer;
+import org.apache.etch.services.router.test.plugin.RemoteTestPluginClient;
+import org.apache.etch.services.router.test.plugin.TestPluginHelper;
+import org.apache.etch.services.router.test.plugin.TestPluginServer;
+import org.apache.etch.util.core.io.Transport;
+
+public class PluginTestServerRunner implements TestPluginHelper.TestPluginServerFactory
+{
+
+	private String _name;
+	private String _url;
+	private int _numCalls = 0;
+	
+	ServerFactory _listener = null;
+	
+	public PluginTestServerRunner( String name, String url )
+	{
+		_name = name;
+		_url = url;
+	}
+	
+	public void start() throws Exception
+	{
+		System.out.println(String.format("Starting plugin \"%s\" with URL \"%s\"...", _name, _url));
+		_listener = TestPluginHelper.newListener( _url, null, this );
+		// Start the Listener
+		_listener.transportControl( Transport.START_AND_WAIT_UP, 4000 );
+	}
+	
+	public void stop() throws Exception
+	{
+		System.out.println(String.format("Stopping plugin \"%s\" with URL \"%s\"...", _name, _url));
+		_listener.transportControl( Transport.STOP_AND_WAIT_DOWN, 4000 );
+	}
+
+	public String getName()
+	{
+		return _name;
+	}
+	
+	public synchronized void methodCalled()
+	{
+		_numCalls++;
+	}
+	
+	public synchronized int getNumCalls()
+	{
+		return _numCalls;
+	}
+	
+	public TestPluginServer newTestPluginServer( RemoteTestPluginClient client )
+	{
+		return new ImplTestPluginServer( client, this );
+	}
+}

Propchange: incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/utils/PluginTestServerRunner.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/utils/PluginTestServerRunner.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"