summaryrefslogtreecommitdiff
path: root/TAO/interop-tests
diff options
context:
space:
mode:
authorPhil Mesnier <mesnier_p@ociweb.com>2013-08-12 21:08:57 +0000
committerPhil Mesnier <mesnier_p@ociweb.com>2013-08-12 21:08:57 +0000
commit572048a113b32c743c5afbe4ef0b697463b3fa30 (patch)
tree558e74086ba54fbb918528fa61d32e8f20b8be30 /TAO/interop-tests
parenta9cd6e45cbb32b390a05494794feeb2cf9021d11 (diff)
downloadATCD-572048a113b32c743c5afbe4ef0b697463b3fa30.tar.gz
Mon Aug 12 20:50:27 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com>
* interop-tests/AnyTypeCode: * interop-tests/AnyTypeCode/README.txt: * interop-tests/AnyTypeCode/atc.mwc: * interop-tests/AnyTypeCode/build.xml: * interop-tests/AnyTypeCode/idl: * interop-tests/AnyTypeCode/idl/Demo.idl: * interop-tests/AnyTypeCode/jacorb: * interop-tests/AnyTypeCode/jacorb/demo: * interop-tests/AnyTypeCode/jacorb/demo/ATC_TestImpl.java: * interop-tests/AnyTypeCode/jacorb/demo/BaseValueImpl.java: * interop-tests/AnyTypeCode/jacorb/demo/BaseValueValueFactoryImpl.java: * interop-tests/AnyTypeCode/jacorb/demo/Client.java: * interop-tests/AnyTypeCode/jacorb/demo/NestedValueImpl.java: * interop-tests/AnyTypeCode/jacorb/demo/NestedValueValueFactoryImpl.java: * interop-tests/AnyTypeCode/jacorb/demo/Server.java: * interop-tests/AnyTypeCode/tao: * interop-tests/AnyTypeCode/tao/BaseValueFactory.h: * interop-tests/AnyTypeCode/tao/BaseValueFactory.cpp: * interop-tests/AnyTypeCode/tao/BaseValueImpl.h: * interop-tests/AnyTypeCode/tao/BaseValueImpl.cpp: * interop-tests/AnyTypeCode/tao/Client.cpp: * interop-tests/AnyTypeCode/tao/Demo.mpc: * interop-tests/AnyTypeCode/tao/Demo_i.h: * interop-tests/AnyTypeCode/tao/Demo_i.cpp: * interop-tests/AnyTypeCode/tao/NestedValueFactory.h: * interop-tests/AnyTypeCode/tao/NestedValueFactory.cpp: * interop-tests/AnyTypeCode/tao/NestedValueImpl.h: * interop-tests/AnyTypeCode/tao/NestedValueImpl.cpp: * interop-tests/AnyTypeCode/tao/Server.cpp: New test to show that TAO now can unmarshal Anys that carry indirect typecodes. For now TAO still does not generate indirect typecodes.
Diffstat (limited to 'TAO/interop-tests')
-rw-r--r--TAO/interop-tests/AnyTypeCode/README.txt39
-rw-r--r--TAO/interop-tests/AnyTypeCode/atc.mwc3
-rw-r--r--TAO/interop-tests/AnyTypeCode/build.xml129
-rw-r--r--TAO/interop-tests/AnyTypeCode/idl/Demo.idl63
-rw-r--r--TAO/interop-tests/AnyTypeCode/jacorb/demo/ATC_TestImpl.java215
-rw-r--r--TAO/interop-tests/AnyTypeCode/jacorb/demo/BaseValueImpl.java6
-rw-r--r--TAO/interop-tests/AnyTypeCode/jacorb/demo/BaseValueValueFactoryImpl.java28
-rw-r--r--TAO/interop-tests/AnyTypeCode/jacorb/demo/Client.java150
-rw-r--r--TAO/interop-tests/AnyTypeCode/jacorb/demo/NestedValueImpl.java6
-rw-r--r--TAO/interop-tests/AnyTypeCode/jacorb/demo/NestedValueValueFactoryImpl.java16
-rw-r--r--TAO/interop-tests/AnyTypeCode/jacorb/demo/Server.java33
-rw-r--r--TAO/interop-tests/AnyTypeCode/tao/BaseValueFactory.cpp16
-rw-r--r--TAO/interop-tests/AnyTypeCode/tao/BaseValueFactory.h13
-rw-r--r--TAO/interop-tests/AnyTypeCode/tao/BaseValueImpl.cpp18
-rw-r--r--TAO/interop-tests/AnyTypeCode/tao/BaseValueImpl.h15
-rw-r--r--TAO/interop-tests/AnyTypeCode/tao/Client.cpp210
-rw-r--r--TAO/interop-tests/AnyTypeCode/tao/Demo.mpc47
-rw-r--r--TAO/interop-tests/AnyTypeCode/tao/Demo_i.cpp178
-rw-r--r--TAO/interop-tests/AnyTypeCode/tao/Demo_i.h56
-rw-r--r--TAO/interop-tests/AnyTypeCode/tao/NestedValueFactory.cpp8
-rw-r--r--TAO/interop-tests/AnyTypeCode/tao/NestedValueFactory.h11
-rw-r--r--TAO/interop-tests/AnyTypeCode/tao/NestedValueImpl.cpp18
-rw-r--r--TAO/interop-tests/AnyTypeCode/tao/NestedValueImpl.h15
-rw-r--r--TAO/interop-tests/AnyTypeCode/tao/Server.cpp92
24 files changed, 1385 insertions, 0 deletions
diff --git a/TAO/interop-tests/AnyTypeCode/README.txt b/TAO/interop-tests/AnyTypeCode/README.txt
new file mode 100644
index 00000000000..0c694dbddaf
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/README.txt
@@ -0,0 +1,39 @@
+$ID:$
+
+This test demonstrates the interoperation of JacORB and TAO with respect to
+the use of indirection in the type codes marshaled with Anys. These are
+represented by structs, unions, and value types. The test is composed of a
+client and server for both JacORB and TAO, enabling a client of either to
+send to a server of either.
+
+For now, TAO can unmarshal an Any using indirect types, but it cannot generate
+them. The TAO-marshaled Anys are quite a bit larger than those generated by
+JacORB.
+
+Building
+--------
+Use MPC tools to generate a workspace from atc.mwc, then your native C++
+compiler. The result will be a client and server executables in the "tao"
+directory.
+
+Use Ant or equivalent tool to build the Java classes, which will end up in
+a new "build" directory. If you use a Java IDE such as Eclipse, the build
+target path may be different.
+
+Running
+-------
+These are the example test command lines:
+
+TAO -
+ tao/client [-k <ior>] [-ORB...]
+ where <ior> defaults to "file://test.ior"
+ tao/server [-o <iorfile>] [-ORB...]
+ where <iorfile> defaults to "test.ior"
+
+JacORB
+ jaco -classpath build/classes [-Djacorb.interop.indirection_encoding_disable=true] demo.Client [<iorfile>]
+ jaco -classpath build/classes [-Djacorb.interop.indirection_encoding_disable=true] demo.Server [<iorfile>]
+ where <iorfile> defaults to "test.ior"
+ the -Djacorb option disables the use of indirect type ids for that run.
+
+The expected outcome is that with indirection enabled or not, the tests run to completion.
diff --git a/TAO/interop-tests/AnyTypeCode/atc.mwc b/TAO/interop-tests/AnyTypeCode/atc.mwc
new file mode 100644
index 00000000000..52ffa1b80f2
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/atc.mwc
@@ -0,0 +1,3 @@
+workspace {
+ tao/Demo.mpc
+}
diff --git a/TAO/interop-tests/AnyTypeCode/build.xml b/TAO/interop-tests/AnyTypeCode/build.xml
new file mode 100644
index 00000000000..ced65d81318
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/build.xml
@@ -0,0 +1,129 @@
+<project name="TAO-JacORB AnyTypeCode interop test" default="compile" basedir=".">
+
+ <property environment="env"/>
+ <property name="src.dir" value="jacorb"/>
+ <property name="build.dir" value="build"/>
+ <property name="classes.dir" value="${build.dir}/classes"/>
+
+ <property name="idl.dir" value="idl" />
+ <property name="gen.dir" value="${build.dir}/generated" />
+ <property name="resources.dir" value="resources" />
+ <property name="jacorb.dir" value="${env.JACORB_HOME}" />
+
+ <property name="tmp.dir" value="${build.dir}/tmp" />
+
+ <!-- this property can be overridden on the command line to pass in additional args -->
+ <!-- to the started java processes e.g. -Djaco.args=-Djacorb.log.default.verbosity=4 -->
+ <property name="jaco.args" value="-Dignored=value" />
+
+ <path id="jacorb.classpath" >
+ <pathelement location="${jacorb.dir}/classes" />
+ <fileset dir="${jacorb.dir}/lib">
+ <include name="*.jar" />
+ </fileset>
+ </path>
+
+ <path id="demo.classpath" >
+ <pathelement location="${classes.dir}" />
+ <pathelement location="${resources.dir}" />
+ <pathelement location="../common/build/classes" />
+ </path>
+
+ <presetdef name="jaco">
+ <java fork="true" >
+ <jvmarg value="-Xbootclasspath/p:${jacorb.dir}/classes" />
+ <jvmarg value="-Djava.endorsed.dirs=${jacorb.dir}/lib" />
+ <jvmarg value="-Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB" />
+ <jvmarg value="-Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton" />
+ <jvmarg value="${jaco.args}" />
+
+ <classpath refid="demo.classpath" />
+ </java>
+ </presetdef>
+
+ <target name="idl.taskdef">
+ <taskdef name="jacidl" classname="org.jacorb.idl.JacIDL" classpathref="jacorb.classpath"/>
+ </target>
+
+ <target name="idl" depends="idl.taskdef">
+ <mkdir dir="${idl.dir}"/>
+ <jacidl srcdir="${idl.dir}" destdir="${gen.dir}" includes="*.idl" helpercompat="jacorb"
+ includepath="${jacorb.dir}/idl/omg" />
+ </target>
+
+ <target name="compile" depends="idl" >
+ <mkdir dir="${classes.dir}"/>
+
+ <javac destdir="${classes.dir}" debug="true" includeantruntime="false">
+ <src path="${src.dir}" />
+ <src path="${gen.dir}" />
+ <classpath refid="jacorb.classpath" />
+ </javac>
+ </target>
+
+ <macrodef name="run-demo" description="executes server and client process concurrently" >
+ <element name="run-server" description="tasks that are used to start the serverprocess" />
+ <element name="run-client" description="tasks that are used to start the clientprocess" />
+
+ <sequential>
+ <mkdir dir="${tmp.dir}" />
+ <tempfile property="killfile.file" destdir="${tmp.dir}" prefix="kill" />
+ <tempfile property="ior.file" destdir="${tmp.dir}" prefix="server" suffix=".ior" />
+
+ <parallel>
+ <sequential>
+ <run-server />
+ </sequential>
+
+ <sequential>
+ <waitfor maxwait="30" maxwaitunit="second">
+ <available file="${ior.file}"/>
+ </waitfor>
+
+ <run-client />
+
+ <touch file="${killfile.file}" />
+ </sequential>
+
+ </parallel>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="run-default-server" >
+ <attribute name="classname" />
+
+ <sequential>
+ <jaco classname="@{classname}" >
+ <arg value="${ior.file}" />
+ <arg value="${killfile.file}" />
+ </jaco>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="run-default-client">
+ <attribute name="classname" />
+
+ <sequential>
+ <jaco classname="@{classname}" >
+ <arg value="${ior.file}" />
+ </jaco>
+ </sequential>
+ </macrodef>
+
+
+ <target name="clean">
+ <delete dir="${build.dir}"/>
+ </target>
+
+ <target name="demo" depends="compile" >
+ <run-demo>
+ <run-server>
+ <run-default-server classname="demo.Server" />
+ </run-server>
+
+ <run-client>
+ <run-default-client classname="demo.Client" />
+ </run-client>
+ </run-demo>
+ </target>
+</project>
diff --git a/TAO/interop-tests/AnyTypeCode/idl/Demo.idl b/TAO/interop-tests/AnyTypeCode/idl/Demo.idl
new file mode 100644
index 00000000000..e1f6fc1b19e
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/idl/Demo.idl
@@ -0,0 +1,63 @@
+module Demo
+{
+
+ struct BaseStruct
+ {
+ string str;
+ };
+
+ struct NestedStruct;
+
+ typedef sequence<NestedStruct> NestedSeq;
+
+ struct NestedStruct
+ {
+ BaseStruct foo1;
+ BaseStruct foo2;
+ BaseStruct foo3;
+ NestedSeq bars;
+ };
+
+ //------------------------------
+
+ union BaseUnion switch (short)
+ {
+ case 1: string str;
+ case 2: long l;
+ default: short s;
+ };
+
+ union NestedUnion switch (short)
+ {
+ case 1: BaseUnion bar1;
+ case 2: BaseUnion bar2;
+ default: BaseUnion defaultBar;
+ };
+
+ //------------------------------
+
+ valuetype BaseValue
+ {
+ public string str;
+
+ factory create(in string str);
+ };
+
+ valuetype NestedValue
+ {
+ public BaseValue foo1;
+ public BaseValue foo2;
+ };
+
+ //------------------------------
+
+ interface ATC_Test
+ {
+ string do_struct (in any a);
+ string do_union (in any a);
+ string do_value (in any a);
+
+ oneway void shutdown ();
+ };
+
+};
diff --git a/TAO/interop-tests/AnyTypeCode/jacorb/demo/ATC_TestImpl.java b/TAO/interop-tests/AnyTypeCode/jacorb/demo/ATC_TestImpl.java
new file mode 100644
index 00000000000..73338d0bdf8
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/jacorb/demo/ATC_TestImpl.java
@@ -0,0 +1,215 @@
+package demo;
+
+import Demo.*;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TCKind;
+
+import java.util.Arrays;
+
+public class ATC_TestImpl extends Demo.ATC_TestPOA
+{
+ org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
+
+ public ATC_TestImpl(){}
+
+ public void shutdown ()
+ {
+ orb.shutdown (false);
+ }
+
+ public java.lang.String do_struct (Any a)
+ {
+ String result = "<empty>";
+ try
+ {
+ int kind = a.type().kind().value();
+
+ switch( kind )
+ {
+ case TCKind._tk_struct:
+ if (Demo.NestedStructHelper.type().equivalent(a.type()))
+ {
+ Demo.NestedStruct bar = Demo.NestedStructHelper.extract(a);
+ return dumpNestedStruct(bar);
+ }
+ break;
+ case TCKind._tk_any:
+ System.out.println("Any.");
+ Any inner_any = a.extract_any();
+ result = do_struct(inner_any);
+ break;
+ default:
+ System.out.println("Unknown, kind " + a.type().kind().value());
+ }
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
+ System.out.println(result);
+ return result;
+ }
+
+ public java.lang.String do_union (Any a)
+ {
+ String result = "<empty>";
+ try
+ {
+ int kind = a.type().kind().value();
+
+ switch( kind )
+ {
+ case TCKind._tk_union:
+ if (Demo.NestedUnionHelper.type().equivalent(a.type()))
+ {
+ Demo.NestedUnion quux = Demo.NestedUnionHelper.extract(a);
+ return dumpNestedUnion(quux);
+ }
+ break;
+ case TCKind._tk_any:
+ System.out.println("Any.");
+ Any inner_any = a.extract_any();
+ result = do_union(inner_any);
+ break;
+ default:
+ System.out.println("Unknown, kind " + a.type().kind().value());
+ }
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
+ System.out.println(result);
+ return result;
+ }
+
+ public java.lang.String do_value (Any a)
+ {
+ String result = "<empty>";
+ try
+ {
+ int kind = a.type().kind().value();
+
+ switch( kind )
+ {
+ case TCKind._tk_value:
+ if (Demo.NestedValueHelper.type().equivalent(a.type()))
+ {
+ Demo.NestedValue bar = Demo.NestedValueHelper.extract(a);
+ return dumpNestedValue(bar);
+ }
+ break;
+ case TCKind._tk_any:
+ System.out.println ("Any.");
+ Any inner_any = a.extract_any();
+ result = do_value (inner_any);
+ break;
+ default:
+ System.out.println("Unknown, kind " + a.type().kind().value());
+ }
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
+ System.out.println(result);
+ return result;
+ }
+
+ private String dumpNestedStruct(Demo.NestedStruct bar)
+ {
+ return bar.getClass().getName() + "[" +
+ "foo1=" + dumpBaseStruct(bar.foo1) +
+ ",foo2=" + dumpBaseStruct(bar.foo2) +
+ ",foo3=" + dumpBaseStruct(bar.foo3) +
+ ",barz=" + dumpNestedSeq(bar.bars);
+ }
+
+ private String dumpNestedSeq(Demo.NestedStruct[] bars)
+ {
+ StringBuilder sb = new StringBuilder("[");
+ for (Demo.NestedStruct bar : bars) {
+ sb.append(dumpNestedStruct(bar)).append(",");
+ }
+ sb.append("]");
+ return sb.toString();
+ }
+
+ private String dumpBaseStruct(Demo.BaseStruct foo)
+ {
+ return foo.getClass().getName() + "[str=" + foo.str + "]";
+ }
+
+ private String dumpNestedUnion(Demo.NestedUnion quux)
+ {
+ StringBuilder sb = new StringBuilder(quux.getClass().getName())
+ .append("[discriminator=")
+ .append(quux.discriminator());
+ switch (quux.discriminator()) {
+ case 1:
+ sb.append(",bar1=")
+ .append(dumpBaseUnion(quux.bar1()))
+ .append("]");
+ break;
+ case 2:
+ sb.append(",bar2=")
+ .append(dumpBaseUnion(quux.bar2()))
+ .append("]");
+ break;
+ default:
+ sb.append(",defaultBaz=")
+ .append(dumpBaseUnion(quux.defaultBar()))
+ .append("]");
+ break;
+ }
+ return sb.append("]").toString();
+ }
+
+ private String dumpBaseUnion (Demo.BaseUnion bar)
+ {
+ StringBuilder sb = new StringBuilder(bar.getClass().getName())
+ .append("[discriminator=")
+ .append(bar.discriminator());
+ switch (bar.discriminator())
+ {
+ case 1:
+ sb.append(",str=")
+ .append(bar.str())
+ .append("]");
+ break;
+ case 2:
+ sb.append(",l=")
+ .append(bar.l())
+ .append("]");
+ break;
+ default:
+ sb.append(",s=")
+ .append(bar.s())
+ .append("]");
+ break;
+ }
+ return sb.append("]").toString();
+ }
+
+ private String dumpNestedValue(Demo.NestedValue bar)
+ {
+ StringBuilder sb = new StringBuilder(bar.getClass().getName())
+ .append("[foo1=")
+ .append(dumpBaseValue(bar.foo1))
+ .append(",foo2=")
+ .append(dumpBaseValue(bar.foo2))
+ .append("]");
+ return sb.toString();
+ }
+
+ private Object dumpBaseValue(Demo.BaseValue foo)
+ {
+ StringBuilder sb = new StringBuilder(foo.getClass().getName())
+ .append("[str=")
+ .append(foo.str)
+ .append("]");
+ return sb.toString();
+ }
+
+}
diff --git a/TAO/interop-tests/AnyTypeCode/jacorb/demo/BaseValueImpl.java b/TAO/interop-tests/AnyTypeCode/jacorb/demo/BaseValueImpl.java
new file mode 100644
index 00000000000..f8219cf1e14
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/jacorb/demo/BaseValueImpl.java
@@ -0,0 +1,6 @@
+package demo;
+
+import Demo.BaseValue;
+
+public class BaseValueImpl extends BaseValue {
+}
diff --git a/TAO/interop-tests/AnyTypeCode/jacorb/demo/BaseValueValueFactoryImpl.java b/TAO/interop-tests/AnyTypeCode/jacorb/demo/BaseValueValueFactoryImpl.java
new file mode 100644
index 00000000000..2eae8089f7b
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/jacorb/demo/BaseValueValueFactoryImpl.java
@@ -0,0 +1,28 @@
+package demo;
+
+import Demo.BaseValue;
+import Demo.BaseValueValueFactory;
+import org.omg.CORBA_2_3.portable.InputStream;
+
+import java.io.Serializable;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: gaow
+ * Date: 11/28/12
+ * Time: 5:00 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class BaseValueValueFactoryImpl implements BaseValueValueFactory {
+ @Override
+ public BaseValue create(String str) {
+ BaseValueImpl foo = new BaseValueImpl();
+ foo.str = str;
+ return foo;
+ }
+
+ @Override
+ public Serializable read_value(InputStream inputStream) {
+ return inputStream.read_value(new BaseValueImpl());
+ }
+}
diff --git a/TAO/interop-tests/AnyTypeCode/jacorb/demo/Client.java b/TAO/interop-tests/AnyTypeCode/jacorb/demo/Client.java
new file mode 100644
index 00000000000..1423c660c9b
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/jacorb/demo/Client.java
@@ -0,0 +1,150 @@
+package demo;
+
+import Demo.*;
+import org.omg.CORBA.Any;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+
+public class Client
+{
+ public static void main (String[] args)
+ throws Exception
+ {
+ org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
+ String filename = "test.ior";
+ if (args.length == 1)
+ {
+ filename = args[0];
+ }
+ BufferedReader br = new BufferedReader (new FileReader (filename));
+
+ Demo.ATC_Test atc_test =
+ Demo.ATC_TestHelper.narrow (orb.string_to_object (br.readLine ()));
+
+ // struct tests
+ do_struct_tests (atc_test);
+ do_union_tests (atc_test);
+ do_value_tests (atc_test);
+
+ atc_test.shutdown ();
+
+ orb.shutdown (true);
+ }
+
+ private static void do_struct_tests (Demo.ATC_Test atc_test)
+ {
+ System.out.println ("Calling do_struct() with a NestedStruct");
+
+ Demo.BaseStruct foo1 = new Demo.BaseStruct ();
+ foo1.str = "BaseStruct 1";
+
+ Demo.BaseStruct foo2 = new Demo.BaseStruct ();
+ foo2.str = "BaseStruct 2";
+
+ Demo.BaseStruct foo3 = new Demo.BaseStruct ();
+ foo3.str = "BaseStruct 3";
+
+ Demo.NestedStruct bar = new Demo.NestedStruct ();
+ bar.foo1 = foo1;
+ bar.foo2 = foo2;
+ bar.foo3 = foo3;
+
+ Demo.BaseStruct innerBaseStruct1 = new Demo.BaseStruct ();
+ innerBaseStruct1.str = "Inner BaseStruct 1";
+ Demo.BaseStruct innerBaseStruct2 = new Demo.BaseStruct ();
+ innerBaseStruct2.str = "Inner BaseStruct 2";
+ Demo.BaseStruct innerBaseStruct3 = new Demo.BaseStruct ();
+ innerBaseStruct3.str = "Inner BaseStruct 3";
+
+ Demo.NestedStruct innerNestedStruct = new Demo.NestedStruct ();
+ innerNestedStruct.foo1 = innerBaseStruct1;
+ innerNestedStruct.foo2 = innerBaseStruct2;
+ innerNestedStruct.foo3 = innerBaseStruct3;
+ innerNestedStruct.bars = new Demo.NestedStruct[0];
+
+ bar.bars = new Demo.NestedStruct[] {innerNestedStruct};
+
+ Any any = org.omg.CORBA.ORB.init ().create_any ();
+ Demo.NestedStructHelper.insert (any, bar);
+
+ System.out.println (atc_test.do_struct (any));
+ }
+
+ private static void do_union_tests (Demo.ATC_Test atc_test)
+ {
+ Any any = unionWithBar1 ();
+ System.out.println ("Calling do_union() with a Quux with bar1");
+ System.out.println (atc_test.do_union (any));
+
+ any = unionWithBar2();
+ System.out.println ("Calling do_union() with a Quux with bar2");
+ System.out.println (atc_test.do_union (any));
+
+ any = unionWithDefaultBar();
+ System.out.println ("Calling do_union() with a Quux with defaultBar");
+ System.out.println (atc_test.do_union (any));
+
+ }
+
+ private static void do_value_tests (Demo.ATC_Test atc_test)
+ {
+ Demo.BaseValue bval1 = new BaseValueImpl ();
+ bval1.str = "BaseValue 1";
+
+ Demo.BaseValue bval2 = new BaseValueImpl ();
+ bval2.str = "BaseValue 2";
+
+ Demo.NestedValue nval = new NestedValueImpl ();
+ nval.foo1 = bval1;
+ nval.foo2 = bval2;
+
+ Any any = org.omg.CORBA.ORB.init ().create_any ();
+ Demo.NestedValueHelper.insert (any, nval);
+
+ System.out.println ("Calling do_value() with a NestedValue");
+ System.out.println (atc_test.do_value (any));
+ }
+
+ private static Any unionWithBar1 ()
+ {
+ Any any = org.omg.CORBA.ORB.init ().create_any ();
+
+ Demo.BaseUnion bar1 = new Demo.BaseUnion ();
+ bar1.str ("BaseUnion 1");
+
+ Demo.NestedUnion quux = new Demo.NestedUnion ();
+ quux.bar1(bar1);
+
+ Demo.NestedUnionHelper.insert (any, quux);
+ return any;
+ }
+
+ private static Any unionWithBar2 ()
+ {
+ Any any = org.omg.CORBA.ORB.init ().create_any ();
+
+ Demo.BaseUnion bar2 = new Demo.BaseUnion ();
+ bar2.l (9765625);
+
+ Demo.NestedUnion quux = new Demo.NestedUnion ();
+ quux.bar2 (bar2);
+
+ Demo.NestedUnionHelper.insert (any, quux);
+ return any;
+ }
+
+ private static Any unionWithDefaultBar ()
+ {
+ Any any = org.omg.CORBA.ORB.init ().create_any ();
+
+ Demo.BaseUnion defaultBaseUnion = new Demo.BaseUnion ();
+ defaultBaseUnion.s ((short) 1024);
+
+ Demo.NestedUnion quux = new Demo.NestedUnion ();
+ quux.defaultBar (defaultBaseUnion);
+
+ Demo.NestedUnionHelper.insert (any, quux);
+ return any;
+ }
+}
diff --git a/TAO/interop-tests/AnyTypeCode/jacorb/demo/NestedValueImpl.java b/TAO/interop-tests/AnyTypeCode/jacorb/demo/NestedValueImpl.java
new file mode 100644
index 00000000000..c10dc8ddb6c
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/jacorb/demo/NestedValueImpl.java
@@ -0,0 +1,6 @@
+package demo;
+
+import Demo.NestedValue;
+
+public class NestedValueImpl extends NestedValue {
+}
diff --git a/TAO/interop-tests/AnyTypeCode/jacorb/demo/NestedValueValueFactoryImpl.java b/TAO/interop-tests/AnyTypeCode/jacorb/demo/NestedValueValueFactoryImpl.java
new file mode 100644
index 00000000000..1de649c3f30
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/jacorb/demo/NestedValueValueFactoryImpl.java
@@ -0,0 +1,16 @@
+package demo;
+
+import Demo.NestedValue;
+import org.omg.CORBA.portable.ValueFactory;
+import org.omg.CORBA_2_3.portable.InputStream;
+
+import java.io.Serializable;
+
+
+public class NestedValueValueFactoryImpl implements ValueFactory {
+
+ @Override
+ public Serializable read_value(InputStream inputStream) {
+ return inputStream.read_value(new NestedValueImpl());
+ }
+}
diff --git a/TAO/interop-tests/AnyTypeCode/jacorb/demo/Server.java b/TAO/interop-tests/AnyTypeCode/jacorb/demo/Server.java
new file mode 100644
index 00000000000..f6fff61b8e0
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/jacorb/demo/Server.java
@@ -0,0 +1,33 @@
+package demo;
+
+import Demo.*;
+import java.io.*;
+
+public class Server
+{
+ public static void main( String[] args )
+ throws Exception
+ {
+ org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, null);
+
+ org.omg.PortableServer.POA poa =
+ org.omg.PortableServer.POAHelper.narrow (orb.resolve_initial_references ("RootPOA"));
+
+ poa.the_POAManager ().activate ();
+
+ org.omg.CORBA.Object o = poa.servant_to_reference (new ATC_TestImpl ());
+
+ String ior_output_file = "test.ior";
+
+ if ( args.length == 1 )
+ {
+ ior_output_file = args[0];
+ }
+ PrintWriter ps =
+ new PrintWriter(new FileOutputStream(new File( ior_output_file )));
+ ps.println (orb.object_to_string (o));
+ ps.close ();
+
+ orb.run ();
+ }
+}
diff --git a/TAO/interop-tests/AnyTypeCode/tao/BaseValueFactory.cpp b/TAO/interop-tests/AnyTypeCode/tao/BaseValueFactory.cpp
new file mode 100644
index 00000000000..c68408811fb
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/tao/BaseValueFactory.cpp
@@ -0,0 +1,16 @@
+#include "BaseValueFactory.h"
+#include "BaseValueImpl.h"
+
+CORBA::ValueBase*
+Demo_BaseValueFactory::create_for_unmarshal()
+{
+ return new Demo_BaseValueImpl();
+}
+
+Demo::BaseValue*
+Demo_BaseValueFactory::create(const char *str)
+{
+ Demo_BaseValueImpl *baseValueImpl = new Demo_BaseValueImpl();
+ baseValueImpl->str(str);
+ return baseValueImpl;
+}
diff --git a/TAO/interop-tests/AnyTypeCode/tao/BaseValueFactory.h b/TAO/interop-tests/AnyTypeCode/tao/BaseValueFactory.h
new file mode 100644
index 00000000000..6b9793f4e3d
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/tao/BaseValueFactory.h
@@ -0,0 +1,13 @@
+#ifndef BASEVALUEFACTORY_H
+#define BASEVALUEFACTORY_H
+
+#include "DemoC.h"
+
+class Demo_BaseValueFactory : public virtual Demo::BaseValue_init
+{
+public:
+ virtual CORBA::ValueBase* create_for_unmarshal();
+ virtual Demo::BaseValue* create(const char * str);
+};
+
+#endif
diff --git a/TAO/interop-tests/AnyTypeCode/tao/BaseValueImpl.cpp b/TAO/interop-tests/AnyTypeCode/tao/BaseValueImpl.cpp
new file mode 100644
index 00000000000..5acd1250be5
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/tao/BaseValueImpl.cpp
@@ -0,0 +1,18 @@
+#include "BaseValueImpl.h"
+
+Demo_BaseValueImpl::Demo_BaseValueImpl()
+{
+}
+
+Demo_BaseValueImpl::~Demo_BaseValueImpl()
+{
+}
+
+CORBA::ValueBase*
+Demo_BaseValueImpl::_copy_value()
+{
+ Demo_BaseValueImpl *baseValueImpl = new Demo_BaseValueImpl ();
+ baseValueImpl->str (str ());
+ return baseValueImpl;
+}
+
diff --git a/TAO/interop-tests/AnyTypeCode/tao/BaseValueImpl.h b/TAO/interop-tests/AnyTypeCode/tao/BaseValueImpl.h
new file mode 100644
index 00000000000..1beaf291d5d
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/tao/BaseValueImpl.h
@@ -0,0 +1,15 @@
+#ifndef BASEVALUEIMPL_H
+#define BASEVALUEIMPL_H
+
+#include "DemoC.h"
+
+class Demo_BaseValueImpl : public virtual OBV_Demo::BaseValue,
+ public virtual CORBA::DefaultValueRefCountBase
+{
+public:
+ Demo_BaseValueImpl();
+ virtual ~Demo_BaseValueImpl();
+ virtual CORBA::ValueBase* _copy_value();
+};
+
+#endif
diff --git a/TAO/interop-tests/AnyTypeCode/tao/Client.cpp b/TAO/interop-tests/AnyTypeCode/tao/Client.cpp
new file mode 100644
index 00000000000..61868de4fb6
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/tao/Client.cpp
@@ -0,0 +1,210 @@
+// $Id$
+
+#include "DemoC.h"
+#include "BaseValueImpl.h"
+#include "NestedValueImpl.h"
+
+#include "ace/Log_Msg.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/Get_Opt.h"
+
+void unionWithBar1 (CORBA::Any& any)
+{
+ Demo::BaseUnion bar1;
+ bar1.str (CORBA::string_dup ("Bar 1"));
+ Demo::NestedUnion any_union;
+ any_union.bar1 (bar1);
+
+ any <<= any_union;
+}
+
+void unionWithBar2 (CORBA::Any& any)
+{
+ Demo::BaseUnion bar2;
+ bar2.l (9765625);
+ Demo::NestedUnion any_union;
+ any_union.bar2 (bar2);
+
+ any <<= any_union;
+}
+
+void unionWithDefaultBar (CORBA::Any& any)
+{
+ Demo::BaseUnion defaultBar;
+ defaultBar.s (1024);
+ Demo::NestedUnion any_union;
+ any_union.defaultBar (defaultBar);
+
+ any <<= any_union;
+}
+
+const ACE_TCHAR *ior_str = ACE_TEXT ("file://test.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ ior_str = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("usage: %s ")
+ ACE_TEXT ("-k <ior>")
+ ACE_TEXT ("\n"),
+ argv [0]),
+ -1);
+ }
+ // Indicates successful parsing of the command line
+ return 0;
+}
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ Demo::ATC_Test_var test;
+ CORBA::ORB_var orb;
+ try
+ {
+ orb = CORBA::ORB_init (argc, argv);
+
+ if (parse_args (argc, argv) == -1)
+ {
+ return -1;
+ }
+ CORBA::Object_var obj =
+ orb->string_to_object (ACE_TEXT_ALWAYS_CHAR (ior_str));
+ if (CORBA::is_nil (obj.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%P could not get ATC_Test IOR.\n")),
+ -1);
+ }
+
+ test = Demo::ATC_Test::_narrow (obj.in ());
+ if (CORBA::is_nil (test.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%P narrow failed.\n")),
+ -1);
+ }
+ }
+ catch (CORBA::Exception& ex)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%P initialization caught %s.\n"), ex._name()),
+ -1);
+ }
+
+ CORBA::Any any;
+ CORBA::String_var str;
+
+ // union tests
+ try
+ {
+ unionWithBar1 (any);
+ str = test->do_union (any);
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P Union test 1 returned %s\n"), str.in()));
+
+ unionWithBar2 (any);
+ str = test->do_union (any);
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P Union test 2 returned %s\n"), str.in()));
+
+ unionWithDefaultBar (any);
+ str = test->do_union (any);
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P Union test 3 returned %s\n"), str.in()));
+ }
+ catch (CORBA::Exception& ex)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("%P Union test caught %s.\n"), ex._name()));
+ }
+
+ // valuetype tests
+ try
+ {
+ Demo_BaseValueImpl* foo1 = new Demo_BaseValueImpl();
+ foo1->str(CORBA::string_dup("BaseValue 1"));
+
+ Demo_BaseValueImpl* foo2 = new Demo_BaseValueImpl();
+ foo2->str(CORBA::string_dup("BaseValue 2"));
+
+ Demo_NestedValueImpl* bar = new Demo_NestedValueImpl();
+ bar->foo1(foo1);
+ bar->foo2(foo2);
+
+ any <<= bar;
+
+ str = test->do_value (any);
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%P Valuetype test returned %s\n"),
+ str.in()));
+ }
+ catch (CORBA::Exception& ex)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("%P Valuetype test caught %s.\n"), ex._name()));
+ }
+
+ // struct tests
+ try
+ {
+
+ Demo::BaseStruct foo1;
+ foo1.str = CORBA::string_dup("BaseStruct 1");
+
+ Demo::BaseStruct foo2;
+ foo2.str = CORBA::string_dup("BaseStruct 2");
+
+ Demo::BaseStruct foo3;
+ foo3.str = CORBA::string_dup("BaseStruct 3");
+
+ Demo::NestedStruct bar;
+ bar.foo1 = foo1;
+ bar.foo2 = foo2;
+ bar.foo3 = foo3;
+
+ Demo::BaseStruct innerBaseStruct1;
+ innerBaseStruct1.str = CORBA::string_dup("Inner BaseStruct 1");
+
+ Demo::BaseStruct innerBaseStruct2;
+ innerBaseStruct2.str = CORBA::string_dup("Inner BaseStruct 2");
+
+ Demo::BaseStruct innerBaseStruct3;
+ innerBaseStruct3.str = CORBA::string_dup("Inner BaseStruct 3");
+
+ Demo::NestedStruct innerBar;
+ innerBar.foo1 = innerBaseStruct1;
+ innerBar.foo2 = innerBaseStruct2;
+ innerBar.foo3 = innerBaseStruct3;
+
+ Demo::NestedSeq bars;
+ bars.length(1);
+ bars[0] = innerBar;
+
+ bar.bars = bars;
+
+ any <<= bar;
+
+ str = test->do_struct (any);
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%P struct test returned %s\n"),
+ str.in()));
+ }
+ catch (CORBA::Exception& ex)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("%P struct test caught %s.\n"), ex._name()));
+ }
+
+ test->shutdown ();
+
+ return 0;
+}
diff --git a/TAO/interop-tests/AnyTypeCode/tao/Demo.mpc b/TAO/interop-tests/AnyTypeCode/tao/Demo.mpc
new file mode 100644
index 00000000000..977459875a1
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/tao/Demo.mpc
@@ -0,0 +1,47 @@
+project(*idl): taoidldefaults, valuetype {
+ idlflags -= -Sa -St
+ IDL_Files {
+ ../idl/Demo.idl
+ }
+
+ Modify_Custom(IDL) {
+ output_follows_input = 0
+ }
+
+ custom_only = 1
+}
+
+project(*Server): taoserver, valuetype, avoids_minimum_corba {
+ exename=Server
+ after += *idl
+ Source_Files {
+ Demo_i.cpp
+ BaseValueFactory.cpp
+ NestedValueFactory.cpp
+ BaseValueImpl.cpp
+ NestedValueImpl.cpp
+ Server.cpp
+ }
+ Source_Files {
+ DemoC.cpp
+ DemoS.cpp
+ }
+ IDL_Files {
+ }
+}
+
+project(*Client): taoclient, valuetype, avoids_minimum_corba {
+ exename=Client
+ after += *idl
+ libs += TAO_AnyTypeCode
+ Source_Files {
+ Client.cpp
+ BaseValueImpl.cpp
+ NestedValueImpl.cpp
+ }
+ Source_Files {
+ DemoC.cpp
+ }
+ IDL_Files {
+ }
+}
diff --git a/TAO/interop-tests/AnyTypeCode/tao/Demo_i.cpp b/TAO/interop-tests/AnyTypeCode/tao/Demo_i.cpp
new file mode 100644
index 00000000000..9f7c928b53b
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/tao/Demo_i.cpp
@@ -0,0 +1,178 @@
+// -*- C++ -*-
+// $Id$
+
+/**
+ * Code generated by the The ACE ORB (TAO) IDL Compiler v2.1.4
+ * TAO and the TAO IDL Compiler have been developed by:
+ * Center for Distributed Object Computing
+ * Washington University
+ * St. Louis, MO
+ * USA
+ * http://www.cs.wustl.edu/~schmidt/doc-center.html
+ * and
+ * Distributed Object Computing Laboratory
+ * University of California at Irvine
+ * Irvine, CA
+ * USA
+ * and
+ * Institute for Software Integrated Systems
+ * Vanderbilt University
+ * Nashville, TN
+ * USA
+ * http://www.isis.vanderbilt.edu/
+ *
+ * Information about TAO is available at:
+ * http://www.cs.wustl.edu/~schmidt/TAO.html
+ **/
+
+// TAO_IDL - Generated from
+// be/be_codegen.cpp:1673
+
+#include "Demo_i.h"
+#include "ace/Log_Msg.h"
+
+// Implementation skeleton constructor
+ATC_Test_i::ATC_Test_i (void)
+{
+}
+
+// Implementation skeleton destructor
+ATC_Test_i::~ATC_Test_i (void)
+{
+}
+
+char *
+ATC_Test_i::do_union (const ::CORBA::Any & a)
+{
+ Demo::NestedUnion *any_union;
+ const char *result = "do_union called";
+ if (a >>= any_union)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P: a >>= any_union went well\n")));
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%P: The discriminator is %d\n"),
+ any_union->_d ()));
+ switch ( any_union->_d ())
+ {
+ case 1:
+ {
+ Demo::BaseUnion bar1 = any_union->bar1 ();
+ if (bar1._d () == 1)
+ {
+ result = bar1.str ();
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%P: bar1 has str = %s\n"),
+ result));
+ }
+ }
+ break;
+ case 2:
+ {
+ Demo::BaseUnion bar2 = any_union->bar2 ();
+ if (bar2._d () == 2)
+ {
+ CORBA::Long l = bar2.l ();
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%P: bar1 has l = %d\n"),
+ l));
+ result = "bar2 has l";
+ }
+ }
+ break;
+ default:
+ {
+ Demo::BaseUnion defaultBar = any_union->defaultBar ();
+ if (defaultBar._d () != 1 && defaultBar._d () != 2)
+ {
+ CORBA::Short s = defaultBar.s ();
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%P: bar1 has s = %d\n"),
+ s));
+ result = "defaultBar has s";
+ }
+ }
+ break;
+ }
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P: a >>= any_union failed\n")));
+ }
+ return CORBA::string_dup (result);
+}
+
+char *
+ATC_Test_i::do_struct (const ::CORBA::Any & a)
+{
+ Demo::NestedStruct *bar;
+ const char *result = "do_struct called";
+ if (a >>= bar)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P: a >>= any_struct went well\n")));
+ Demo::BaseStruct foo1 = bar->foo1;
+ Demo::BaseStruct foo2 = bar->foo2;
+ Demo::BaseStruct foo3 = bar->foo3;
+ Demo::NestedSeq bars = bar->bars;
+ if (bars.length () > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%P: bars[0].foo1.str = %s\n"),
+ bars[0].foo1.str.in()));
+ }
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%P: foo1.str = %s, foo2.str = %s, ")
+ ACE_TEXT ("foo3.str = %s, bars.length() = %d\n"),
+ foo1.str.in (), foo2.str.in (), foo3.str.in (), bars.length ()));
+
+ if (bars.length() > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%P: returning %s\n"),
+ bars[bars.length() - 1].foo3.str.in ()));
+ return CORBA::string_dup(bars[bars.length() - 1].foo3.str);
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%P: bars.length = 0, returning %s\n"),
+ foo3.str.in()));
+ return CORBA::string_dup(foo3.str);
+ }
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P: a >>= any_struct failed\n")));
+ }
+ return CORBA::string_dup (result);
+}
+
+char *
+ATC_Test_i::do_value (const ::CORBA::Any & a)
+{
+ Demo::NestedValue *bar;
+ const char *result = "do_value called";
+ if (a >>= bar)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P: a >>= any_value went well\n")));
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P: returning %s\n"),
+ bar->foo2()->str() ));
+ return CORBA::string_dup(bar->foo2()->str());
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P: a >>= any_value failed\n")));
+ }
+ return CORBA::string_dup (result);
+}
+
+void
+ATC_Test_i::shutdown (void)
+{
+ int argc = 0;
+ ACE_TCHAR **argv = 0;
+
+ CORBA::ORB_var def_orb = CORBA::ORB_init (argc, argv);
+ def_orb->shutdown (false);
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("%P: shutdown called \n")));
+}
diff --git a/TAO/interop-tests/AnyTypeCode/tao/Demo_i.h b/TAO/interop-tests/AnyTypeCode/tao/Demo_i.h
new file mode 100644
index 00000000000..8ba3e17bae7
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/tao/Demo_i.h
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+// $Id$
+
+/**
+ * Code generated by the The ACE ORB (TAO) IDL Compiler v2.1.4
+ * TAO and the TAO IDL Compiler have been developed by:
+ * Center for Distributed Object Computing
+ * Washington University
+ * St. Louis, MO
+ * USA
+ * http://www.cs.wustl.edu/~schmidt/doc-center.html
+ * and
+ * Distributed Object Computing Laboratory
+ * University of California at Irvine
+ * Irvine, CA
+ * USA
+ * and
+ * Institute for Software Integrated Systems
+ * Vanderbilt University
+ * Nashville, TN
+ * USA
+ * http://www.isis.vanderbilt.edu/
+ *
+ * Information about TAO is available at:
+ * http://www.cs.wustl.edu/~schmidt/TAO.html
+ **/
+
+// TAO_IDL - Generated from
+// be/be_codegen.cpp:1616
+
+#ifndef DEMOI_I6ARGD_H_
+#define DEMOI_I6ARGD_H_
+
+#include "DemoS.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+class ATC_Test_i : public virtual POA_Demo::ATC_Test
+{
+public:
+ ATC_Test_i (void);
+
+ virtual ~ATC_Test_i (void);
+
+ virtual char * do_union (const ::CORBA::Any & a);
+ virtual char * do_struct (const ::CORBA::Any & a);
+ virtual char * do_value (const ::CORBA::Any & a);
+
+ virtual void shutdown (void);
+
+};
+
+
+#endif /* DEMOI_H_ */
diff --git a/TAO/interop-tests/AnyTypeCode/tao/NestedValueFactory.cpp b/TAO/interop-tests/AnyTypeCode/tao/NestedValueFactory.cpp
new file mode 100644
index 00000000000..1eee8431332
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/tao/NestedValueFactory.cpp
@@ -0,0 +1,8 @@
+#include "NestedValueFactory.h"
+#include "NestedValueImpl.h"
+
+CORBA::ValueBase*
+Demo_NestedValueFactory::create_for_unmarshal (void)
+{
+ return new Demo_NestedValueImpl ();
+}
diff --git a/TAO/interop-tests/AnyTypeCode/tao/NestedValueFactory.h b/TAO/interop-tests/AnyTypeCode/tao/NestedValueFactory.h
new file mode 100644
index 00000000000..c28a0c8faa7
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/tao/NestedValueFactory.h
@@ -0,0 +1,11 @@
+#ifndef NESTEDVALUEFACTORY_H
+#define NESTEDVALUEFACTORY_H
+
+#include "DemoC.h"
+
+class Demo_NestedValueFactory : public virtual CORBA::ValueFactoryBase
+{
+ virtual CORBA::ValueBase* create_for_unmarshal();
+};
+
+#endif
diff --git a/TAO/interop-tests/AnyTypeCode/tao/NestedValueImpl.cpp b/TAO/interop-tests/AnyTypeCode/tao/NestedValueImpl.cpp
new file mode 100644
index 00000000000..0ae211131d8
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/tao/NestedValueImpl.cpp
@@ -0,0 +1,18 @@
+#include "NestedValueImpl.h"
+
+Demo_NestedValueImpl::Demo_NestedValueImpl (void)
+{
+}
+
+Demo_NestedValueImpl::~Demo_NestedValueImpl (void)
+{
+}
+
+CORBA::ValueBase*
+Demo_NestedValueImpl::_copy_value (void)
+{
+ Demo_NestedValueImpl *nestedValueImpl = new Demo_NestedValueImpl();
+ nestedValueImpl->foo1 (foo1 ());
+ nestedValueImpl->foo2 (foo2 ());
+ return nestedValueImpl;
+}
diff --git a/TAO/interop-tests/AnyTypeCode/tao/NestedValueImpl.h b/TAO/interop-tests/AnyTypeCode/tao/NestedValueImpl.h
new file mode 100644
index 00000000000..8f2bb0ad3db
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/tao/NestedValueImpl.h
@@ -0,0 +1,15 @@
+#ifndef NESTEDVALUE_H
+#define NESTEDVALUE_H
+
+#include "DemoC.h"
+
+class Demo_NestedValueImpl : public virtual OBV_Demo::NestedValue,
+ public virtual CORBA::DefaultValueRefCountBase
+{
+public:
+ Demo_NestedValueImpl (void);
+ ~Demo_NestedValueImpl (void);
+ virtual CORBA::ValueBase* _copy_value (void);
+};
+
+#endif
diff --git a/TAO/interop-tests/AnyTypeCode/tao/Server.cpp b/TAO/interop-tests/AnyTypeCode/tao/Server.cpp
new file mode 100644
index 00000000000..88b76be5ea2
--- /dev/null
+++ b/TAO/interop-tests/AnyTypeCode/tao/Server.cpp
@@ -0,0 +1,92 @@
+// $Id$
+
+#include "Demo_i.h"
+#include "BaseValueFactory.h"
+#include "NestedValueFactory.h"
+
+#include "ace/Log_Msg.h"
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdio.h"
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("test.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("usage: %s ")
+ ACE_TEXT ("-o <iorfile>")
+ ACE_TEXT ("\n"),
+ argv [0]),
+ -1);
+ }
+ // Indicates successful parsing of the command line
+ return 0;
+}
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ try
+ {
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+
+ if (parse_args (argc, argv) == -1)
+ {
+ return -1;
+ }
+
+ CORBA::ValueFactoryBase_var vf = new Demo_BaseValueFactory();
+ CORBA::String_var repId = Demo::_tc_BaseValue->id();
+ orb->register_value_factory(repId.in(), vf.in());
+
+ vf = new Demo_NestedValueFactory();
+ repId = Demo::_tc_NestedValue->id();
+ orb->register_value_factory(repId.in(), vf.in());
+
+ CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA");
+ PortableServer::POA_var poa = PortableServer::POA::_narrow (obj.in ());
+ PortableServer::POAManager_var mgr = poa->the_POAManager ();
+ mgr->activate ();
+
+ PortableServer::Servant_var<ATC_Test_i> servant = new ATC_Test_i ();
+ PortableServer::ObjectId_var oid = poa->activate_object (servant.in ());
+ obj = poa->id_to_reference (oid.in ());
+ CORBA::String_var ior = orb->object_to_string (obj.in ());
+
+ FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
+ if (output_file == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%P Cannot write IOR file: %s\n"),
+ ior_output_file),
+ 1);
+ ACE_OS::fprintf (output_file, "%s", ior.in ());
+ ACE_OS::fclose (output_file);
+ ACE_DEBUG ( (LM_DEBUG,
+ ACE_TEXT ("%P IOR written to file %C\n"),
+ ior_output_file));
+
+ orb->run ();
+ orb->destroy ();
+ return 0;
+ }
+ catch (CORBA::Exception& ex)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%P Union test server caught %s.\n"), ex._name()),
+ -1);
+ }
+ return 1;
+}