You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by ve...@apache.org on 2012/08/02 18:18:12 UTC
svn commit: r1368576 [4/4] - in /incubator/etch/trunk:
binding-cpp/runtime/src/main/transport/
binding-csharp/runtime/src/main/csharp/Properties/ examples/helloworld/
examples/helloworld/c/ examples/helloworld/c/src/
examples/helloworld/c/src/main/ exa...
Modified: incubator/etch/trunk/examples/helloworld/dist-build.xml
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/examples/helloworld/dist-build.xml?rev=1368576&r1=1368575&r2=1368576&view=diff
==============================================================================
--- incubator/etch/trunk/examples/helloworld/dist-build.xml (original)
+++ incubator/etch/trunk/examples/helloworld/dist-build.xml Thu Aug 2 16:18:09 2012
@@ -17,177 +17,29 @@
* specific language governing permissions and limitations *
* under the License. *
-->
-<project name="etch-HelloWorld-example" basedir="." default="build">
+<project name="etch-helloworld-example" basedir="." default="build" >
<description>HelloWorld Example</description>
-
- <property name="etch.home" location="${basedir}/../.."/>
- <property name="etch.version" value="@EtchVersion@"/>
- <property name="etch.longversion" value="@EtchLongVersion@"/>
- <!-- todo clean up variables etch-java-runtime.jar, etch-csharp-runtime.dll -->
- <property name="etch-java-runtime-name" value="apache-etch-java-runtime-${etch.longversion}.jar"/>
- <property name="etch-csharp-runtime-name" value="ApacheEtchCsharpIncubating.dll"/>
-
- <property name="etch-ant-plugin.jar" location="${etch.home}/lib/apache-etch-ant-plugin-${etch.longversion}.jar"/>
- <property name="etch-java-runtime.jar" location="${etch.home}/binding-java/lib/${etch-java-runtime-name}"/>
- <property name="etch-csharp-runtime.dll" location="${etch.home}/binding-csharp/lib/${etch-csharp-runtime-name}"/>
-
- <property name="src" location="${basedir}/src"/>
- <property name="src-main-etch" location="${src}/main/etch"/>
- <property name="src-main-java" location="${src}/main/java"/>
- <property name="src-main-csharp" location="${src}/main/csharp"/>
- <property name="target" location="${basedir}/target"/>
- <property name="generated-sources" location="${target}/generated-sources"/>
- <property name="gensrc-main-etch-java" location="${generated-sources}/main/etch/java"/>
- <property name="gensrc-main-etch-csharp" location="${generated-sources}/main/etch/csharp"/>
- <property name="gensrc-main-etch-c" location="${generated-sources}/main/etch/c"/>
- <property name="classes" location="${target}/classes"/>
- <property name="bin" location="${target}/bin"/>
-
- <condition property="BUILD.csharp" >
- <os family="windows" />
- </condition>
-
- <taskdef resource="org/apache/etch/tools/ant/etch.xml" classpath="${etch-ant-plugin.jar}"/>
- <taskdef resource="org/apache/ant/dotnet/antlib.xml" classpath="${etch.home}/lib/ant-dotnet-1.1.jar" />
-
- <target name="build" depends="build-java, build-csharp, build-c, done"/>
-
- <target name="build-java" depends="gensrc-java">
- <javac destdir="${classes}" source="1.5" debug="true">
- <classpath>
- <pathelement location="${etch-java-runtime.jar}"/>
- </classpath>
- <src path="${src-main-java}"/>
- <src path="${gensrc-main-etch-java}"/>
- </javac>
-
- <jar jarfile="${bin}/helloworld.jar">
- <manifest>
- <attribute name="Class-Path" value="${etch-java-runtime-name}"/>
- </manifest>
- <fileset dir="${classes}"/>
- </jar>
-
- <copy todir="${bin}" file="${etch-java-runtime.jar}"/>
- </target>
-
- <target name="done">
- <echo>
-
-To run java HelloWorld example, open a cmd window and run these
-commands:
-
-> cd target\bin
-> start java -cp helloworld.jar org.apache.etch.examples.helloworld.MainHelloWorldListener
-> start java -cp helloworld.jar org.apache.etch.examples.helloworld.MainHelloWorldClient
-
-To run csharp example:
-
-> cd target\bin
-> start HelloWorldListener.exe
-> start HelloWorldClient.exe
-
-To run the c example:
-> first build using cmake (see below)
-
-You have to set the following variable in CMake:
-- ETCH_HOME must point to your Etch directory (this is were you installed Etch, or target/Installers/dist if building from trunk)
-
-on the shell, you could do this using:
-
-cd examples/helloworld/target
-cmake .. -DETCH_HOME:string=[YOUR ETCH INSTALLATION DIR]
-make (or open visual studio on win32...)
-
-You also have to set the following environment variable:
-- APR_ICONV_PATH to [YOUR ETCH INSTALLATION DIR]/binding-c/extern/apr/iconv/
-
-To run c example:
-
-> cd target\bin
-> start helloworld-server.exe
-> start helloworld-client.exe
-
-
-You can mix and match the various clients and listeners.
-
- </echo>
- </target>
-
- <target name="build-csharp" depends="gensrc-csharp" if="BUILD.csharp" >
- <csc
- debug="true"
- warnLevel="1"
- unsafe="false"
- targetType="exe"
- incremental="false"
- mainClass = "org.apache.etch.examples.helloworld.MainHelloWorldClient"
- destFile="${bin}/HelloWorldClient.exe">
- <src dir="${src-main-csharp}/HelloWorldClientProj" includes="**/*.cs"/>
- <src dir="${src-main-csharp}/org.apache.etch.examples.helloworld" includes="**/*.cs"/>
- <src dir="${gensrc-main-etch-csharp}" includes="**/*.cs"/>
- <reference file="${etch-csharp-runtime.dll}"/>
- </csc>
-
- <csc
- debug="true"
- warnLevel="1"
- unsafe="false"
- targetType="exe"
- incremental="false"
- mainClass = "org.apache.etch.examples.helloworld.MainHelloWorldListener"
- destFile="${bin}/HelloWorldListener.exe">
- <src dir="${src-main-csharp}/HelloWorldListenerProj" includes="**/*.cs"/>
- <src dir="${src-main-csharp}/org.apache.etch.examples.helloworld" includes="**/*.cs"/>
- <src dir="${gensrc-main-etch-csharp}" includes="**/*.cs"/>
- <reference file="${etch-csharp-runtime.dll}"/>
- </csc>
-
- <copy todir="${bin}" file="${etch-csharp-runtime.dll}"/>
- </target>
-
- <target name="build-c" depends="gensrc-c">
- <echo message="c binding sources can be built with cmake!"/>
- </target>
-
- <target name="gensrc-java" depends="init">
- <etch
- home="${etch.home}"
- binding="java"
- quiet="true"
- outputDir="${gensrc-main-etch-java}"
- file="${src-main-etch}/HelloWorld.etch"/>
+ <target name="clean">
+ <ant dir="java" />
+ <ant dir="csharp" />
+ <ant dir="c" />
+ <ant dir="cpp" />
+ <delete dir="target" />
</target>
- <target name="gensrc-csharp" depends="init">
- <etch
- home="${etch.home}"
- binding="csharp"
- quiet="true"
- outputDir="${gensrc-main-etch-csharp}"
- file="${src-main-etch}/HelloWorld.etch"/>
+ <target name="init">
</target>
- <target name="gensrc-c" depends="init">
- <etch
- home="${etch.home}"
- binding="c"
- quiet="true"
- outputDir="${gensrc-main-etch-c}"
- file="${src-main-etch}/HelloWorld.etch"/>
+ <target name="build">
+ <ant dir="java" />
+ <ant dir="csharp" />
+ <ant dir="c" />
+ <ant dir="cpp" />
</target>
- <target name="init">
- <mkdir dir="${target}"/>
- <mkdir dir="${generated-sources}"/>
- <mkdir dir="${gensrc-main-etch-java}"/>
- <mkdir dir="${gensrc-main-etch-csharp}"/>
- <mkdir dir="${gensrc-main-etch-c}"/>
- <mkdir dir="${classes}"/>
- <mkdir dir="${bin}"/>
+ <target name="postbuild">
</target>
- <target name="clean">
- <delete dir="${target}"/>
+ <target name="help">
</target>
</project>
Copied: incubator/etch/trunk/examples/helloworld/etch/HelloWorld.etch (from r1368575, incubator/etch/trunk/examples/helloworld/src/main/etch/HelloWorld.etch)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/examples/helloworld/etch/HelloWorld.etch?p2=incubator/etch/trunk/examples/helloworld/etch/HelloWorld.etch&p1=incubator/etch/trunk/examples/helloworld/src/main/etch/HelloWorld.etch&r1=1368575&r2=1368576&rev=1368576&view=diff
==============================================================================
--- incubator/etch/trunk/examples/helloworld/src/main/etch/HelloWorld.etch (original)
+++ incubator/etch/trunk/examples/helloworld/etch/HelloWorld.etch Thu Aug 2 16:18:09 2012
@@ -1,34 +1,34 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-//
-
-module org.apache.etch.examples.helloworld
-
-service HelloWorld {
- struct user (
- int id,
- string name
- )
-
- exception UserUnknownException (
- string mes
- )
-
- @Direction(Server)
- string say_hello(user to_whom) throws UserUnknownException
-
-}
+// 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.
+//
+
+module org.apache.etch.examples.helloworld
+
+service HelloWorld {
+ struct user (
+ int id,
+ string name
+ )
+
+ exception UserUnknownException (
+ string mes
+ )
+
+ @Direction(Server)
+ string say_hello(user to_whom) throws UserUnknownException
+
+}
Added: incubator/etch/trunk/examples/helloworld/java/build.xml
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/examples/helloworld/java/build.xml?rev=1368576&view=auto
==============================================================================
--- incubator/etch/trunk/examples/helloworld/java/build.xml (added)
+++ incubator/etch/trunk/examples/helloworld/java/build.xml Thu Aug 2 16:18:09 2012
@@ -0,0 +1,215 @@
+<?xml version="1.0" encoding="utf-8" ?>
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ -->
+<project name="etch-helloworld-example-java" basedir="." default="help" >
+ <description>HelloWorld Example Java</description>
+ <property name="Etch.basedir" location="${basedir}/../../.." />
+ <import file="${Etch.basedir}/build-support/etch.includes.xml" />
+
+ <!-- TODO better computation of etch.home, etch.version -->
+ <property environment="env" />
+
+ <!-- compute ETCH_HOME -->
+ <property name="build.ETCH_HOME" location="${Etch.basedir}/target/Installers/dist" />
+ <condition property="etch.home" value="${env.ETCH_HOME}" >
+ <isset property="${env.ETCH_HOME}" />
+ </condition>
+ <condition property="etch.home" value="${build.ETCH_HOME}" >
+ <not><isset property="etch.home" /></not>
+ </condition>
+
+ <property name="Etch.dependency.junit.jar"
+ location="${default.junit.lib}/junit-4.3.1.jar" />
+
+ <property name="Etch.buildSupportDirectory" location="${Etch.basedir}/build-support" />
+
+ <!-- compute etch.version -->
+ <condition property="etch.version" value="${Etch.version}" >
+ <not><isset property="etch.version" /></not>
+ </condition>
+
+ <condition property="etch.longversion" value="${Etch.longversion}" >
+ <not><isset property="etch.longversion" /></not>
+ </condition>
+
+ <!-- import etch task -->
+ <taskdef
+ onerror="report"
+ resource="org/apache/etch/tools/ant/etch.xml"
+ classpath="${etch.home}/lib/apache-etch-ant-plugin-${etch.longversion}.jar" />
+
+ <!-- set properties -->
+ <property name="src" location="${basedir}/src" />
+ <property name="example-base" location="${basedir}/.." />
+ <property name="main-src-java" location="${src}/main" />
+ <property name="test-src-java" location="${src}/test" />
+ <property name="target" location="${basedir}/target" />
+ <property name="dist-src" location="${target}/dist-src" />
+ <property name="generated-sources" location="${target}/generated-sources" />
+ <property name="gen-src-java" location="${generated-sources}/java" />
+ <property name="bin" location="${target}/bin" />
+ <property name="classes" location="${target}/classes" />
+ <property name="classes-test" location="${target}/classes-test" />
+ <property name="test-results" location="${target}/test-results" />
+ <property name="dist" location="${Etch.basedir}/target/Installers/dist" />
+
+ <!-- initialize -->
+ <target name="init" >
+ <mkdir dir="${target}" />
+ <mkdir dir="${dist-src}" />
+ <mkdir dir="${generated-sources}" />
+ <mkdir dir="${gen-src-java}" />
+ <mkdir dir="${bin}" />
+ <mkdir dir="${classes}" />
+ <mkdir dir="${classes-test}" />
+ <mkdir dir="${test-results}" />
+ </target>
+
+ <!-- build the server -->
+ <target name="generate-sources" depends="init" >
+ <!-- generate sources -->
+ <echo>Generating Java Sources...</echo>
+ <etch home="${etch.home}"
+ file="${example-base}/etch/HelloWorld.etch"
+ binding="java"
+ outputDir="${gen-src-java}" />
+ </target>
+
+ <property name="etch-java-runtime-name"
+ value="apache-etch-java-runtime-${etch.longversion}.jar" />
+
+ <property name="Etch.dependency.java.runtime"
+ location="${etch.home}/binding-java/lib/${etch-java-runtime-name}" />
+
+ <target name="build-java" depends="generate-sources" >
+ <!-- compile sources -->
+
+ <javac target="1.5" destdir="${classes}" >
+ <src path="${gen-src-java}" />
+ <src path="${main-src-java}" />
+ <classpath>
+ <pathelement location="${Etch.dependency.java.runtime}" />
+ </classpath>
+ </javac>
+
+ <javac target="1.5" destdir="${classes-test}" >
+ <src path="${gen-src-java}" />
+ <src path="${main-src-java}" />
+ <src path="${test-src-java}" />
+ <classpath>
+ <pathelement location="${Etch.dependency.java.runtime}" />
+ <pathelement location="${Etch.dependency.junit.jar}" />
+ </classpath>
+ </javac>
+
+ <!-- Create Jar -->
+ <jar jarfile="${bin}/helloworld.jar" >
+ <manifest>
+ <attribute name="Class-Path" value="${etch-java-runtime-name}" />
+ </manifest>
+ <fileset dir="${classes}" >
+ <include name="**/*" />
+ </fileset>
+ </jar>
+
+ <!-- copy in dependencies -->
+ <copy todir="${bin}" file="${Etch.dependency.java.runtime}" />
+ </target>
+
+
+ <target name="build" depends="build-java" />
+
+ <!-- run unit tests -->
+
+ <target name="test-java" depends="build-java" unless="build.skip.tests">
+ <!-- Run Unit Tests -->
+ <junit printsummary="yes" haltonfailure="no" dir="${classes-test}"
+ errorProperty="build.tests.fail" failureProperty="build.tests.fail" >
+ <classpath>
+ <pathelement location="${classes-test}" />
+ <pathelement location="${Etch.dependency.java.runtime}" />
+ <pathelement location="${Etch.dependency.junit.jar}" />
+ </classpath>
+ <formatter type="xml" />
+ <batchtest fork="true" todir="${test-results}" >
+ <fileset dir="${test-src-java}" >
+ <include name="**/Test*.java" />
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+
+ <target name="test" depends="build,test-java,done" >
+ </target>
+
+ <target name="done" depends="build" >
+ <echo>
+ Build Java Complete!
+ ======================
+ To run java example, open a cmd window and run these commands:
+
+ > cd java\target\bin
+ > start java -cp helloworld.jar org.apache.etch.examples.helloworld.MainHelloWorldListener
+ > start java -cp helloworld.jar org.apache.etch.examples.helloworld.MainHelloWorldClient
+
+ You can mix and match the various clients and listeners.
+ </echo>
+ </target>
+
+ <!-- build everything -->
+ <target name="init-debug" >
+ <property name="build.target" value="Debug" />
+ </target>
+
+ <target name="init-release" >
+ <property name="build.target" value="Release" />
+ </target>
+
+ <target name="dist-src" >
+ <copy file="dist-build.xml" tofile="${dist-src}/build.xml" overwrite="true" >
+ <filterset refid="Etch.buildTokens" />
+ </copy>
+
+ <copy todir="${dist-src}/src/main" overwrite="true" >
+ <fileset dir="${main-src-java}" >
+ <exclude name="**/.svn/**" />
+ <include name="**/*.java" />
+ </fileset>
+ </copy>
+
+ <copy todir="${dist}/examples/helloworld/etch" overwrite="true" >
+ <fileset dir="${example-base}/etch" >
+ <exclude name="**/.svn/**" />
+ <include name="**/*.etch" />
+ </fileset>
+ </copy>
+
+ <copy todir="${dist}/examples/helloworld/java" overwrite="true" >
+ <fileset dir="${dist-src}" />
+ </copy>
+ </target>
+
+ <target name="debug" depends="dist-src,init-debug,test" />
+ <target name="release" depends="dist-src,init-release,test" />
+
+ <!-- clean -->
+ <target name="clean" >
+ <delete dir="${target}" quiet="true" />
+ </target>
+</project>
Added: incubator/etch/trunk/examples/helloworld/java/dist-build.xml
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/examples/helloworld/java/dist-build.xml?rev=1368576&view=auto
==============================================================================
--- incubator/etch/trunk/examples/helloworld/java/dist-build.xml (added)
+++ incubator/etch/trunk/examples/helloworld/java/dist-build.xml Thu Aug 2 16:18:09 2012
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ -->
+<project name="etch-helloworld-example-java" basedir="." default="build">
+ <description>HelloWorld Example Java</description>
+
+ <property name="etch.home" location="${basedir}/../../.."/>
+ <property name="etch.version" value="@EtchVersion@"/>
+ <property name="etch.longversion" value="@EtchLongVersion@"/>
+ <property name="etch-java-runtime-name" value="apache-etch-java-runtime-${etch.longversion}.jar"/>
+ <property name="etch-ant-plugin.jar" location="${etch.home}/lib/apache-etch-ant-plugin-${etch.longversion}.jar"/>
+ <property name="etch-java-runtime.jar" location="${etch.home}/binding-java/lib/${etch-java-runtime-name}"/>
+
+ <property name="src" location="${basedir}/src"/>
+ <property name="example-base" location="${basedir}/.." />
+ <property name="src-main-etch" location="${example-base}/etch"/>
+ <property name="src-main-java" location="${src}/main"/>
+ <property name="target" location="${basedir}/target"/>
+ <property name="generated-sources" location="${target}/generated-sources"/>
+ <property name="gensrc-main-etch-java" location="${generated-sources}/java"/>
+ <property name="classes" location="${target}/classes"/>
+ <property name="bin" location="${target}/bin"/>
+
+ <target name="build" depends="build-java, done"/>
+
+ <taskdef
+ resource="org/apache/etch/tools/ant/etch.xml"
+ classpath="${etch-ant-plugin.jar}"/>
+
+ <target name="build-java" depends="gensrc-java">
+ <javac destdir="${classes}" source="1.5" debug="true">
+ <classpath>
+ <pathelement location="${etch-java-runtime.jar}"/>
+ </classpath>
+ <src path="${src-main-java}"/>
+ <src path="${gensrc-main-etch-java}"/>
+ </javac>
+
+ <jar jarfile="${bin}/example.jar">
+ <manifest>
+ <attribute name="Class-Path" value="${etch-java-runtime-name}"/>
+ </manifest>
+ <fileset dir="${classes}"/>
+ </jar>
+
+ <copy todir="${bin}" file="${etch-java-runtime.jar}"/>
+ </target>
+
+ <target name="done">
+ <echo>
+ Build Java Complete!
+ ======================
+ To run java example, open a cmd window and run these commands:
+
+ > cd java\target\bin
+ > start java -cp helloworld.jar org.apache.etch.examples.helloworld.MainHelloWorldListener
+ > start java -cp helloworld.jar org.apache.etch.examples.helloworld.MainHelloWorldClient
+
+ You can mix and match the various clients and listeners.
+ </echo>
+ </target>
+
+ <target name="gensrc" depends="gensrc-java"/>
+
+ <target name="gensrc-java" depends="init">
+ <echo>Generating Java Sources...</echo>
+ <etch
+ home="${etch.home}"
+ binding="java"
+ quiet="true"
+ outputDir="${gensrc-main-etch-java}"
+ file="${src-main-etch}/HelloWorld.etch"/>
+ </target>
+
+ <target name="init">
+ <mkdir dir="${target}"/>
+ <mkdir dir="${generated-sources}"/>
+ <mkdir dir="${gensrc-main-etch-java}"/>
+ <mkdir dir="${classes}"/>
+ <mkdir dir="${bin}"/>
+ </target>
+
+ <target name="clean">
+ <delete dir="${target}"/>
+ </target>
+</project>
Copied: incubator/etch/trunk/examples/helloworld/java/src/main/org/apache/etch/examples/helloworld/ImplHelloWorldClient.java (from r1368575, incubator/etch/trunk/examples/helloworld/src/main/java/org/apache/etch/examples/helloworld/ImplHelloWorldClient.java)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/examples/helloworld/java/src/main/org/apache/etch/examples/helloworld/ImplHelloWorldClient.java?p2=incubator/etch/trunk/examples/helloworld/java/src/main/org/apache/etch/examples/helloworld/ImplHelloWorldClient.java&p1=incubator/etch/trunk/examples/helloworld/src/main/java/org/apache/etch/examples/helloworld/ImplHelloWorldClient.java&r1=1368575&r2=1368576&rev=1368576&view=diff
==============================================================================
--- incubator/etch/trunk/examples/helloworld/src/main/java/org/apache/etch/examples/helloworld/ImplHelloWorldClient.java (original)
+++ incubator/etch/trunk/examples/helloworld/java/src/main/org/apache/etch/examples/helloworld/ImplHelloWorldClient.java Thu Aug 2 16:18:09 2012
@@ -1,57 +1,57 @@
-// This file automatically generated by:
-// Apache Etch 1.1.0-incubating (LOCAL-0) / java 1.1.0-incubating (LOCAL-0)
-// Wed Sep 15 17:22:46 CEST 2010
-// 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.examples.helloworld;
-/*
- *
- * 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.
- *
- */
-
-
-/**
- * Your custom implementation of BaseHelloWorldClient. Add methods here to provide
- * implementations of messages from the server.
- */
-public class ImplHelloWorldClient extends BaseHelloWorldClient
-{
- /**
- * Constructs the ImplHelloWorldClient.
- *
- * @param server a connection to the server session. Use this to send a
- * message to the server.
- */
- public ImplHelloWorldClient( RemoteHelloWorldServer server )
- {
- this.server = server;
- }
-
- /**
- * A connection to the server session. Use this to send a
- * message to the server.
- */
- @SuppressWarnings( "unused" )
- private final RemoteHelloWorldServer server;
-
- // TODO insert methods here to provide implementations of HelloWorldClient
- // messages from the server.
-}
+// This file automatically generated by:
+// Apache Etch 1.1.0-incubating (LOCAL-0) / java 1.1.0-incubating (LOCAL-0)
+// Wed Sep 15 17:22:46 CEST 2010
+// 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.examples.helloworld;
+/*
+ *
+ * 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.
+ *
+ */
+
+
+/**
+ * Your custom implementation of BaseHelloWorldClient. Add methods here to provide
+ * implementations of messages from the server.
+ */
+public class ImplHelloWorldClient extends BaseHelloWorldClient
+{
+ /**
+ * Constructs the ImplHelloWorldClient.
+ *
+ * @param server a connection to the server session. Use this to send a
+ * message to the server.
+ */
+ public ImplHelloWorldClient( RemoteHelloWorldServer server )
+ {
+ this.server = server;
+ }
+
+ /**
+ * A connection to the server session. Use this to send a
+ * message to the server.
+ */
+ @SuppressWarnings( "unused" )
+ private final RemoteHelloWorldServer server;
+
+ // TODO insert methods here to provide implementations of HelloWorldClient
+ // messages from the server.
+}
Copied: incubator/etch/trunk/examples/helloworld/java/src/main/org/apache/etch/examples/helloworld/ImplHelloWorldServer.java (from r1368575, incubator/etch/trunk/examples/helloworld/src/main/java/org/apache/etch/examples/helloworld/ImplHelloWorldServer.java)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/examples/helloworld/java/src/main/org/apache/etch/examples/helloworld/ImplHelloWorldServer.java?p2=incubator/etch/trunk/examples/helloworld/java/src/main/org/apache/etch/examples/helloworld/ImplHelloWorldServer.java&p1=incubator/etch/trunk/examples/helloworld/src/main/java/org/apache/etch/examples/helloworld/ImplHelloWorldServer.java&r1=1368575&r2=1368576&rev=1368576&view=diff
==============================================================================
--- incubator/etch/trunk/examples/helloworld/src/main/java/org/apache/etch/examples/helloworld/ImplHelloWorldServer.java (original)
+++ incubator/etch/trunk/examples/helloworld/java/src/main/org/apache/etch/examples/helloworld/ImplHelloWorldServer.java Thu Aug 2 16:18:09 2012
@@ -1,61 +1,61 @@
-// This file automatically generated by:
-// Apache Etch 1.1.0-incubating (LOCAL-0) / java 1.1.0-incubating (LOCAL-0)
-// Wed Sep 15 17:22:46 CEST 2010
-// 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.examples.helloworld;
-/*
- *
- * 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.
- *
- */
-
-
-/**
- * Your custom implementation of BaseHelloWorldServer. Add methods here to provide
- * implementations of messages from the client.
- */
-public class ImplHelloWorldServer extends BaseHelloWorldServer
-{
- /**
- * Constructs the ImplHelloWorldServer.
- *
- * @param client a connection to the client session. Use this to send a
- * message to the client.
- */
- public ImplHelloWorldServer( RemoteHelloWorldClient client )
- {
- this.client = client;
- }
-
- /**
- * A connection to the client session. Use this to send a
- * message to the client.
- */
- @SuppressWarnings( "unused" )
- private final RemoteHelloWorldClient client;
-
- @Override
- public String say_hello(user u){
- return "Hello " + u.name;
- }
-
-
-}
+// This file automatically generated by:
+// Apache Etch 1.1.0-incubating (LOCAL-0) / java 1.1.0-incubating (LOCAL-0)
+// Wed Sep 15 17:22:46 CEST 2010
+// 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.examples.helloworld;
+/*
+ *
+ * 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.
+ *
+ */
+
+
+/**
+ * Your custom implementation of BaseHelloWorldServer. Add methods here to provide
+ * implementations of messages from the client.
+ */
+public class ImplHelloWorldServer extends BaseHelloWorldServer
+{
+ /**
+ * Constructs the ImplHelloWorldServer.
+ *
+ * @param client a connection to the client session. Use this to send a
+ * message to the client.
+ */
+ public ImplHelloWorldServer( RemoteHelloWorldClient client )
+ {
+ this.client = client;
+ }
+
+ /**
+ * A connection to the client session. Use this to send a
+ * message to the client.
+ */
+ @SuppressWarnings( "unused" )
+ private final RemoteHelloWorldClient client;
+
+ @Override
+ public String say_hello(user u){
+ return "Hello " + u.name;
+ }
+
+
+}
Copied: incubator/etch/trunk/examples/helloworld/java/src/main/org/apache/etch/examples/helloworld/MainHelloWorldClient.java (from r1368575, incubator/etch/trunk/examples/helloworld/src/main/java/org/apache/etch/examples/helloworld/MainHelloWorldClient.java)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/examples/helloworld/java/src/main/org/apache/etch/examples/helloworld/MainHelloWorldClient.java?p2=incubator/etch/trunk/examples/helloworld/java/src/main/org/apache/etch/examples/helloworld/MainHelloWorldClient.java&p1=incubator/etch/trunk/examples/helloworld/src/main/java/org/apache/etch/examples/helloworld/MainHelloWorldClient.java&r1=1368575&r2=1368576&rev=1368576&view=diff
==============================================================================
--- incubator/etch/trunk/examples/helloworld/src/main/java/org/apache/etch/examples/helloworld/MainHelloWorldClient.java (original)
+++ incubator/etch/trunk/examples/helloworld/java/src/main/org/apache/etch/examples/helloworld/MainHelloWorldClient.java Thu Aug 2 16:18:09 2012
@@ -1,69 +1,69 @@
-// This file automatically generated by:
-// Apache Etch 1.1.0-incubating (LOCAL-0) / java 1.1.0-incubating (LOCAL-0)
-// Wed Sep 15 17:22:46 CEST 2010
-// 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.examples.helloworld;
-/*
- *
- * 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.
- *
- */
-
-
-import org.apache.etch.examples.helloworld.HelloWorld.user;
-
-/**
- * Main program for HelloWorldClient. This program makes a connection to the
- * listener created by MainHelloWorldListener.
- */
-public class MainHelloWorldClient implements HelloWorldHelper.HelloWorldClientFactory
-{
- /**
- * Main program for HelloWorldClient.
- *
- * @param args command line arguments.
- * @throws Exception
- */
- public static void main( String[] args ) throws Exception
- {
- // TODO Change to correct URI
- //String uri = "udp://127.0.0.1:4001";
- String uri = "tcp://127.0.0.1:4001";
-
- RemoteHelloWorldServer server = HelloWorldHelper.newServer( uri, null,
- new MainHelloWorldClient() );
-
- // Connect to the service
- server._startAndWaitUp( 4000 );
-
- user u = new user(5, "User");
- System.out.println(server.say_hello(u));
-
- // Disconnect from the service
- server._stopAndWaitDown( 4000 );
- }
-
- public HelloWorldClient newHelloWorldClient( RemoteHelloWorldServer server )
- throws Exception
- {
- return new ImplHelloWorldClient( server );
- }
-}
+// This file automatically generated by:
+// Apache Etch 1.1.0-incubating (LOCAL-0) / java 1.1.0-incubating (LOCAL-0)
+// Wed Sep 15 17:22:46 CEST 2010
+// 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.examples.helloworld;
+/*
+ *
+ * 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.
+ *
+ */
+
+
+import org.apache.etch.examples.helloworld.HelloWorld.user;
+
+/**
+ * Main program for HelloWorldClient. This program makes a connection to the
+ * listener created by MainHelloWorldListener.
+ */
+public class MainHelloWorldClient implements HelloWorldHelper.HelloWorldClientFactory
+{
+ /**
+ * Main program for HelloWorldClient.
+ *
+ * @param args command line arguments.
+ * @throws Exception
+ */
+ public static void main( String[] args ) throws Exception
+ {
+ // TODO Change to correct URI
+ //String uri = "udp://127.0.0.1:4001";
+ String uri = "tcp://127.0.0.1:4001";
+
+ RemoteHelloWorldServer server = HelloWorldHelper.newServer( uri, null,
+ new MainHelloWorldClient() );
+
+ // Connect to the service
+ server._startAndWaitUp( 4000 );
+
+ user u = new user(5, "User");
+ System.out.println(server.say_hello(u));
+
+ // Disconnect from the service
+ server._stopAndWaitDown( 4000 );
+ }
+
+ public HelloWorldClient newHelloWorldClient( RemoteHelloWorldServer server )
+ throws Exception
+ {
+ return new ImplHelloWorldClient( server );
+ }
+}
Copied: incubator/etch/trunk/examples/helloworld/java/src/main/org/apache/etch/examples/helloworld/MainHelloWorldListener.java (from r1368575, incubator/etch/trunk/examples/helloworld/src/main/java/org/apache/etch/examples/helloworld/MainHelloWorldListener.java)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/examples/helloworld/java/src/main/org/apache/etch/examples/helloworld/MainHelloWorldListener.java?p2=incubator/etch/trunk/examples/helloworld/java/src/main/org/apache/etch/examples/helloworld/MainHelloWorldListener.java&p1=incubator/etch/trunk/examples/helloworld/src/main/java/org/apache/etch/examples/helloworld/MainHelloWorldListener.java&r1=1368575&r2=1368576&rev=1368576&view=diff
==============================================================================
--- incubator/etch/trunk/examples/helloworld/src/main/java/org/apache/etch/examples/helloworld/MainHelloWorldListener.java (original)
+++ incubator/etch/trunk/examples/helloworld/java/src/main/org/apache/etch/examples/helloworld/MainHelloWorldListener.java Thu Aug 2 16:18:09 2012
@@ -1,63 +1,63 @@
-// This file automatically generated by:
-// Apache Etch 1.1.0-incubating (LOCAL-0) / java 1.1.0-incubating (LOCAL-0)
-// Wed Sep 15 17:22:46 CEST 2010
-// 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.examples.helloworld;
-/*
- *
- * 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.
- *
- */
-
-
-import org.apache.etch.bindings.java.support.ServerFactory;
-import org.apache.etch.util.core.io.Transport;
-
-/**
- * Main program for HelloWorldServer. This program makes a listener to accept
- * connections from MainHelloWorldClient.
- */
-public class MainHelloWorldListener implements HelloWorldHelper.HelloWorldServerFactory
-{
- /**
- * Main program for HelloWorldServer.
- *
- * @param args command line arguments.
- * @throws Exception
- */
- public static void main( String[] args ) throws Exception
- {
- // TODO Change to correct URI
- //String uri = "udp://127.0.0.1:4001";
- String uri = "tcp://127.0.0.1:4001";
-
- ServerFactory listener = HelloWorldHelper.newListener( uri, null,
- new MainHelloWorldListener() );
-
- // Start the Listener
- listener.transportControl( Transport.START_AND_WAIT_UP, 4000 );
- }
-
- public HelloWorldServer newHelloWorldServer( RemoteHelloWorldClient client )
- {
- return new ImplHelloWorldServer( client );
- }
-}
+// This file automatically generated by:
+// Apache Etch 1.1.0-incubating (LOCAL-0) / java 1.1.0-incubating (LOCAL-0)
+// Wed Sep 15 17:22:46 CEST 2010
+// 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.examples.helloworld;
+/*
+ *
+ * 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.
+ *
+ */
+
+
+import org.apache.etch.bindings.java.support.ServerFactory;
+import org.apache.etch.util.core.io.Transport;
+
+/**
+ * Main program for HelloWorldServer. This program makes a listener to accept
+ * connections from MainHelloWorldClient.
+ */
+public class MainHelloWorldListener implements HelloWorldHelper.HelloWorldServerFactory
+{
+ /**
+ * Main program for HelloWorldServer.
+ *
+ * @param args command line arguments.
+ * @throws Exception
+ */
+ public static void main( String[] args ) throws Exception
+ {
+ // TODO Change to correct URI
+ //String uri = "udp://127.0.0.1:4001";
+ String uri = "tcp://127.0.0.1:4001";
+
+ ServerFactory listener = HelloWorldHelper.newListener( uri, null,
+ new MainHelloWorldListener() );
+
+ // Start the Listener
+ listener.transportControl( Transport.START_AND_WAIT_UP, 4000 );
+ }
+
+ public HelloWorldServer newHelloWorldServer( RemoteHelloWorldClient client )
+ {
+ return new ImplHelloWorldServer( client );
+ }
+}
Copied: incubator/etch/trunk/examples/helloworld/java/src/test/org/apache/etch/examples/helloworld/TestHelloWorldServer.java (from r1368575, incubator/etch/trunk/examples/helloworld/src/test/java/org/apache/etch/examples/helloworld/TestHelloWorldServer.java)
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/examples/helloworld/java/src/test/org/apache/etch/examples/helloworld/TestHelloWorldServer.java?p2=incubator/etch/trunk/examples/helloworld/java/src/test/org/apache/etch/examples/helloworld/TestHelloWorldServer.java&p1=incubator/etch/trunk/examples/helloworld/src/test/java/org/apache/etch/examples/helloworld/TestHelloWorldServer.java&r1=1368575&r2=1368576&rev=1368576&view=diff
==============================================================================
--- incubator/etch/trunk/examples/helloworld/src/test/java/org/apache/etch/examples/helloworld/TestHelloWorldServer.java (original)
+++ incubator/etch/trunk/examples/helloworld/java/src/test/org/apache/etch/examples/helloworld/TestHelloWorldServer.java Thu Aug 2 16:18:09 2012
@@ -1,131 +1,131 @@
-/* $Id: TestHelloWorldServer.java 743147 2009-02-10 22:53:01Z sccomer $
- *
- * 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.etch.examples.helloworld;
-
-import java.util.Date;
-
-import junit.framework.Assert;
-
-import org.apache.etch.bindings.java.support.ServerFactory;
-import org.apache.etch.examples.helloworld.HelloWorld.user;
-import org.apache.etch.util.Log;
-import org.apache.etch.util.core.io.Transport;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/** */
-public class TestHelloWorldServer
-{
-
- /** transport */
- public static ServerFactory listener;
-
- RemoteHelloWorldServer server;
-
- /**
- * @throws Exception
- */
- @BeforeClass
- public static void startListener() throws Exception
- {
- Log.addSink(null);
- Log.report("StartExampleListener");
-
- String uri = "tcp://localhost:4009";
- MainHelloWorldListener implFactory = new MainHelloWorldListener();
- listener = HelloWorldHelper.newListener( uri, null, implFactory );
-
- listener.transportControl( Transport.START_AND_WAIT_UP, 4000 );
-
- Log.report( "StartExampleListener",
- "status", "up",
- "listener", listener );
- }
-
- /**
- * @throws Exception
- */
- @AfterClass
- public static void stopListener() throws Exception
- {
- if (listener != null)
- {
- listener.transportControl( Transport.STOP_AND_WAIT_DOWN, 4000 );
- listener = null;
- }
- }
-
- /**
- * Connect client to serve
- * @throws Exception
- */
- @Before
- public void makeConnection()
- throws Exception
- {
- String uri = "tcp://localhost:4009";
-
- server = HelloWorldHelper.newServer( uri, null, new MainHelloWorldClient() );
-
- server._startAndWaitUp( 4000 );
- }
-
- /**
- * Shutdown connection to server
- * @throws Exception
- */
- @After
- public void shutConnection()
- throws Exception
- {
- if (server != null)
- {
- server._stop();
- }
- }
-
- /**
- * @throws Exception
- */
- @Test
- public void checkConnection() throws Exception
- {
- Assert.assertNotNull(server);
- }
-
- /**
- * @throws Exception
- */
- @Test
- public void testSayHello() throws Exception
- {
- user u = new user(5, "Test");
- String result = server.say_hello(u);
- Assert.assertTrue(result.equals("Hello Test"));
- }
-
-
-
-}
+/* $Id: TestHelloWorldServer.java 743147 2009-02-10 22:53:01Z sccomer $
+ *
+ * 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.etch.examples.helloworld;
+
+import java.util.Date;
+
+import junit.framework.Assert;
+
+import org.apache.etch.bindings.java.support.ServerFactory;
+import org.apache.etch.examples.helloworld.HelloWorld.user;
+import org.apache.etch.util.Log;
+import org.apache.etch.util.core.io.Transport;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/** */
+public class TestHelloWorldServer
+{
+
+ /** transport */
+ public static ServerFactory listener;
+
+ RemoteHelloWorldServer server;
+
+ /**
+ * @throws Exception
+ */
+ @BeforeClass
+ public static void startListener() throws Exception
+ {
+ Log.addSink(null);
+ Log.report("StartExampleListener");
+
+ String uri = "tcp://localhost:4009";
+ MainHelloWorldListener implFactory = new MainHelloWorldListener();
+ listener = HelloWorldHelper.newListener( uri, null, implFactory );
+
+ listener.transportControl( Transport.START_AND_WAIT_UP, 4000 );
+
+ Log.report( "StartExampleListener",
+ "status", "up",
+ "listener", listener );
+ }
+
+ /**
+ * @throws Exception
+ */
+ @AfterClass
+ public static void stopListener() throws Exception
+ {
+ if (listener != null)
+ {
+ listener.transportControl( Transport.STOP_AND_WAIT_DOWN, 4000 );
+ listener = null;
+ }
+ }
+
+ /**
+ * Connect client to serve
+ * @throws Exception
+ */
+ @Before
+ public void makeConnection()
+ throws Exception
+ {
+ String uri = "tcp://localhost:4009";
+
+ server = HelloWorldHelper.newServer( uri, null, new MainHelloWorldClient() );
+
+ server._startAndWaitUp( 4000 );
+ }
+
+ /**
+ * Shutdown connection to server
+ * @throws Exception
+ */
+ @After
+ public void shutConnection()
+ throws Exception
+ {
+ if (server != null)
+ {
+ server._stop();
+ }
+ }
+
+ /**
+ * @throws Exception
+ */
+ @Test
+ public void checkConnection() throws Exception
+ {
+ Assert.assertNotNull(server);
+ }
+
+ /**
+ * @throws Exception
+ */
+ @Test
+ public void testSayHello() throws Exception
+ {
+ user u = new user(5, "Test");
+ String result = server.say_hello(u);
+ Assert.assertTrue(result.equals("Hello Test"));
+ }
+
+
+
+}