diff options
author | Mark Spruiell <mes@zeroc.com> | 2004-07-04 18:13:14 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2004-07-04 18:13:14 +0000 |
commit | 5b3ef96ab7c79403b12267d95bf856ba6f0824cc (patch) | |
tree | 20bb03a867e23ab3a8f291d45fefc76585158a77 | |
parent | check for servantManager (diff) | |
download | ice-5b3ef96ab7c79403b12267d95bf856ba6f0824cc.tar.bz2 ice-5b3ef96ab7c79403b12267d95bf856ba6f0824cc.tar.xz ice-5b3ef96ab7c79403b12267d95bf856ba6f0824cc.zip |
Slice checksum changes
21 files changed, 1404 insertions, 6 deletions
diff --git a/java/allTests.py b/java/allTests.py index b8575c4ed9f..ed0d07d69c6 100755 --- a/java/allTests.py +++ b/java/allTests.py @@ -63,6 +63,7 @@ tests = [ \ "Ice/slicing/exceptions", \ "Ice/slicing/objects", \ "Ice/custom", \ + "Ice/checksum", \ "Freeze/dbmap", \ "Freeze/complex", \ "Freeze/evictor", \ diff --git a/java/ant/Slice2JavaTask.class b/java/ant/Slice2JavaTask.class Binary files differindex 770cac1119d..f97115308aa 100644 --- a/java/ant/Slice2JavaTask.class +++ b/java/ant/Slice2JavaTask.class diff --git a/java/ant/Slice2JavaTask.java b/java/ant/Slice2JavaTask.java index 7ea34743a97..34c03b2915a 100644 --- a/java/ant/Slice2JavaTask.java +++ b/java/ant/Slice2JavaTask.java @@ -67,6 +67,7 @@ public class Slice2JavaTask extends SliceTask { _translator = null; _tie = false; + _checksum = null; } public void @@ -82,6 +83,12 @@ public class Slice2JavaTask extends SliceTask } public void + setChecksum(String checksum) + { + _checksum = checksum; + } + + public void execute() throws BuildException { @@ -196,6 +203,14 @@ public class Slice2JavaTask extends SliceTask cmd.append(" --tie"); } + // + // Add --checksum + // + if(_checksum != null && _checksum.length() > 0) + { + cmd.append(" --checksum " + _checksum); + } + // // Add --ice // @@ -308,4 +323,5 @@ public class Slice2JavaTask extends SliceTask private File _translator; private boolean _tie; + private String _checksum; } diff --git a/java/ant/SliceDefine.class b/java/ant/SliceDefine.class Binary files differindex d1d6c3a05b3..9c698b5e9e7 100644 --- a/java/ant/SliceDefine.class +++ b/java/ant/SliceDefine.class diff --git a/java/ant/SliceTask$SliceDependency.class b/java/ant/SliceTask$SliceDependency.class Binary files differindex 4914aaf219d..3d3934cc090 100644 --- a/java/ant/SliceTask$SliceDependency.class +++ b/java/ant/SliceTask$SliceDependency.class diff --git a/java/ant/SliceTask.class b/java/ant/SliceTask.class Binary files differindex a6f173b460b..35155668b3a 100644 --- a/java/ant/SliceTask.class +++ b/java/ant/SliceTask.class diff --git a/java/build.xml b/java/build.xml index 26d6fc63e4d..70996843617 100644 --- a/java/build.xml +++ b/java/build.xml @@ -72,12 +72,7 @@ <include name="ServantLocator.ice" /> <include name="Locator.ice" /> <include name="FacetMap.ice" /> - </fileset> - <fileset dir="${slice.dir}/Glacier"> - <include name="Router.ice" /> - <include name="Starter.ice" /> - <include name="Session.ice" /> - <include name="SessionManager.ice" /> + <include name="SliceChecksumDict.ice" /> </fileset> <fileset dir="${slice.dir}/Freeze"> <include name="DB.ice" /> @@ -87,14 +82,46 @@ <include name="Evictor.ice" /> <include name="EvictorStorage.ice" /> </fileset> + </slice2java> + + <!-- Generate Slice checksums for the Ice services. --> + + <slice2java ice="on" outputdir="${generated.dir}" checksum="Glacier.SliceChecksums"> + <includepath> + <pathelement path="${slice.dir}" /> + </includepath> + <fileset dir="${slice.dir}/Glacier"> + <include name="Router.ice" /> + <include name="Starter.ice" /> + <include name="Session.ice" /> + <include name="SessionManager.ice" /> + </fileset> + </slice2java> + + <slice2java ice="on" outputdir="${generated.dir}" checksum="IceBox.SliceChecksums"> + <includepath> + <pathelement path="${slice.dir}" /> + </includepath> <fileset dir="${slice.dir}/IceBox"> <include name="IceBox.ice" /> </fileset> + </slice2java> + + <slice2java ice="on" outputdir="${generated.dir}" checksum="IcePack.SliceChecksums"> + <includepath> + <pathelement path="${slice.dir}" /> + </includepath> <fileset dir="${slice.dir}/IcePack"> <include name="Admin.ice" /> <include name="Query.ice" /> <include name="Exception.ice" /> </fileset> + </slice2java> + + <slice2java ice="on" outputdir="${generated.dir}" checksum="IceStorm.SliceChecksums"> + <includepath> + <pathelement path="${slice.dir}" /> + </includepath> <fileset dir="${slice.dir}/IceStorm"> <include name="IceStorm.ice" /> </fileset> diff --git a/java/src/IceBox/ServiceManagerI.java b/java/src/IceBox/ServiceManagerI.java index 591dc518787..08cf1bef9bd 100644 --- a/java/src/IceBox/ServiceManagerI.java +++ b/java/src/IceBox/ServiceManagerI.java @@ -19,6 +19,12 @@ public final class ServiceManagerI extends _ServiceManagerDisp _argv = args; } + public java.util.Map + getSliceChecksums(Ice.Current current) + { + return SliceChecksums.checksums; + } + public void shutdown(Ice.Current current) { diff --git a/java/test/Ice/build.xml b/java/test/Ice/build.xml index cc4ec564ab4..412dc377654 100644 --- a/java/test/Ice/build.xml +++ b/java/test/Ice/build.xml @@ -25,6 +25,7 @@ <ant dir="slicing"/> <ant dir="custom"/> <ant dir="translator"/> + <ant dir="checksum"/> </target> <target name="clean"> @@ -41,6 +42,7 @@ <ant dir="slicing" target="clean"/> <ant dir="custom" target="clean"/> <ant dir="translator" target="clean"/> + <ant dir="checksum" target="clean"/> </target> </project> diff --git a/java/test/Ice/checksum/build.xml b/java/test/Ice/checksum/build.xml new file mode 100644 index 00000000000..627d34baf9f --- /dev/null +++ b/java/test/Ice/checksum/build.xml @@ -0,0 +1,24 @@ +<!-- + ********************************************************************** + + Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. + + This copy of Ice is licensed to you under the terms described in the + ICE_LICENSE file included in this distribution. + + ********************************************************************** +--> + +<project name="test_Ice_checksum" default="all" basedir="."> + + <target name="all"> + <ant dir="client"/> + <ant dir="server"/> + </target> + + <target name="clean"> + <ant dir="client" target="clean"/> + <ant dir="server" target="clean"/> + </target> + +</project> diff --git a/java/test/Ice/checksum/client/AllTests.java b/java/test/Ice/checksum/client/AllTests.java new file mode 100644 index 00000000000..48050f4e44b --- /dev/null +++ b/java/test/Ice/checksum/client/AllTests.java @@ -0,0 +1,91 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +public class AllTests +{ + private static void + test(boolean b) + { + if(!b) + { + throw new RuntimeException(); + } + } + + public static Test.ChecksumPrx + allTests(Ice.Communicator communicator, boolean collocated) + { + String ref = "test:default -p 12345 -t 10000"; + Ice.ObjectPrx base = communicator.stringToProxy(ref); + test(base != null); + + Test.ChecksumPrx checksum = Test.ChecksumPrxHelper.checkedCast(base); + test(checksum != null); + + // + // Verify that no checksums are present for local types. + // + System.out.print("testing checksums... "); + System.out.flush(); + java.util.Iterator p = SliceChecksums.checksums.entrySet().iterator(); + while(p.hasNext()) + { + java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); + String key = (String)entry.getKey(); + int pos = key.indexOf("Local"); + test(pos == -1); + } + + // + // Get server's Slice checksums. + // + java.util.Map d = checksum.getSliceChecksums(); + + // + // Compare the checksums. For a type FooN whose name ends in an integer N, + // we assume that the server's type does not change for N = 1, and does + // change for N > 1. + // + p = d.entrySet().iterator(); + java.util.regex.Pattern patt = java.util.regex.Pattern.compile("\\d+"); + while(p.hasNext()) + { + int n = 0; + java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); + String key = (String)entry.getKey(); + java.util.regex.Matcher m = patt.matcher(key); + if(m.find()) + { + try + { + n = Integer.parseInt(key.substring(m.start(), m.end())); + } + catch(NumberFormatException ex) + { + test(false); + } + } + + String value = (String)SliceChecksums.checksums.get(key); + test(value != null); + + if(n <= 1) + { + test(value.equals(entry.getValue())); + } + else + { + test(!value.equals(entry.getValue())); + } + } + System.out.println("ok"); + + return checksum; + } +} diff --git a/java/test/Ice/checksum/client/Client.java b/java/test/Ice/checksum/client/Client.java new file mode 100644 index 00000000000..b1a1352e914 --- /dev/null +++ b/java/test/Ice/checksum/client/Client.java @@ -0,0 +1,52 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +public class Client +{ + private static int + run(String[] args, Ice.Communicator communicator) + { + Test.ChecksumPrx checksum = AllTests.allTests(communicator, false); + checksum.shutdown(); + return 0; + } + + public static void + main(String[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(args); + status = run(args, communicator); + } + catch(Ice.LocalException ex) + { + ex.printStackTrace(); + status = 1; + } + + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + ex.printStackTrace(); + status = 1; + } + } + + System.exit(status); + } +} diff --git a/java/test/Ice/checksum/client/Test.ice b/java/test/Ice/checksum/client/Test.ice new file mode 100644 index 00000000000..c3974b19e0a --- /dev/null +++ b/java/test/Ice/checksum/client/Test.ice @@ -0,0 +1,27 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef TEST_ICE +#define TEST_ICE + +#include <Ice/SliceChecksumDict.ice> + +module Test +{ + +interface Checksum +{ + nonmutating Ice::SliceChecksumDict getSliceChecksums(); + + void shutdown(); +}; + +}; + +#endif diff --git a/java/test/Ice/checksum/client/Types.ice b/java/test/Ice/checksum/client/Types.ice new file mode 100644 index 00000000000..5162f718775 --- /dev/null +++ b/java/test/Ice/checksum/client/Types.ice @@ -0,0 +1,435 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef CLASS_ICE +#define CLASS_ICE + +// +// TEST: Same +// +const int IntConst1 = 100; + +// +// TEST: Value changed +// +const int IntConst2 = 100; + +// +// TEST: Type changed +// +const int IntConst3 = 100; + +// +// TEST: Same +// +enum Enum1 { Enum11, Enum12, Enum13 }; + +// +// TEST: Add enumerator +// +enum Enum2 { Enum21, Enum22, Enum23 }; + +// +// TEST: Remove enumerator +// +enum Enum3 { Enum31, Enum32, Enum33 }; + +// +// TEST: Change to a different type +// +enum Enum4 { Enum41, Enum42, Enum43 }; + +// +// TEST: Same +// +sequence<int> Sequence1; + +// +// TEST: Change sequence type +// +sequence<int> Sequence2; + +// +// TEST: Change to a different type +// +sequence<int> Sequence3; + +// +// TEST: Same +// +dictionary<string, int> Dictionary1; + +// +// TEST: Change key type +// +dictionary<string, int> Dictionary2; + +// +// TEST: Change value type +// +dictionary<string, int> Dictionary3; + +// +// TEST: Change to a different type +// +dictionary<string, int> Dictionary4; + +// +// TEST: Same +// +struct Struct1 +{ + string str; + bool b; +}; + +// +// TEST: Add member +// +struct Struct2 +{ + string str; + bool b; +}; + +// +// TEST: Change member type +// +struct Struct3 +{ + string str; + bool b; +}; + +// +// TEST: Remove member +// +struct Struct4 +{ + string str; + bool b; +}; + +// +// TEST: Change to a different type +// +struct Struct5 +{ + string str; + bool b; +}; + +// +// TEST: Same +// +interface Interface1 +{ +}; + +// +// TEST: Change interface to class +// +interface Interface2 +{ +}; + +// +// TEST: Add base interface +// +interface Interface3 +{ +}; + +// +// TEST: Add operation +// +interface Interface4 +{ +}; + +// +// TEST: Same +// +class EmptyClass1 +{ +}; + +// +// TEST: Add data member +// +class EmptyClass2 +{ +}; + +// +// TEST: Add operation +// +class EmptyClass3 +{ +}; + +// +// TEST: Add base class +// +class EmptyClass4 +{ +}; + +// +// TEST: Add interface +// +class EmptyClass5 +{ +}; + +// +// TEST: Same +// +class SimpleClass1 +{ + string str; + float f; +}; + +// +// TEST: Add operation +// +class SimpleClass2 +{ + string str; + float f; +}; + +// +// TEST: Rename member +// +class SimpleClass3 +{ + string str; + float f; +}; + +// +// TEST: Add member +// +class SimpleClass4 +{ + string str; + float f; +}; + +// +// TEST: Remove member +// +class SimpleClass5 +{ + string str; + float f; +}; + +// +// TEST: Reorder members +// +class SimpleClass6 +{ + string str; + float f; +}; + +// +// TEST: Change member type +// +class SimpleClass7 +{ + string str; + float f; +}; + +// +// TEST: Same +// +exception Exception1 +{ + string str; + bool b; +}; + +// +// TEST: Add member +// +exception Exception2 +{ + string str; + bool b; +}; + +// +// TEST: Change member type +// +exception Exception3 +{ + string str; + bool b; +}; + +// +// TEST: Remove member +// +exception Exception4 +{ + string str; + bool b; +}; + +// +// TEST: Add base exception +// +exception Exception5 +{ +}; + +// +// TEST: Change to a different type +// +exception Exception6 +{ + string str; + bool b; +}; + +// +// TEST: Same +// +class BaseClass1 +{ + void baseOp1(); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Change return type +// +class BaseClass2 +{ + void baseOp(); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Add parameter +// +class BaseClass3 +{ + void baseOp(); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Add exception +// +class BaseClass4 +{ + void baseOp(); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Change out parameter to in parameter +// +class BaseClass5 +{ + void baseOp(); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Remove parameter +// +class BaseClass6 +{ + void baseOp(); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Remove exception +// +class BaseClass7 +{ + void baseOp(); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Remove operation +// +class BaseClass8 +{ + void baseOp(); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Add base class +// +class BaseClass9 +{ + void baseOp(); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Add interface +// +class BaseClass10 +{ + void baseOp(); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Add base class and interface +// +class BaseClass11 +{ + void baseOp(); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Local +// +local enum LocalEnum { LocalEnum1, LocalEnum2, LocalEnum3 }; + +// +// TEST: Local +// +local sequence<string> LocalSequence; + +// +// TEST: Local +// +local dictionary<string, string> LocalDictionary; + +// +// TEST: Local +// +local struct LocalStruct +{ + string str; +}; + +// +// TEST: Local +// +local class LocalClass +{ +}; + +#endif diff --git a/java/test/Ice/checksum/client/build.xml b/java/test/Ice/checksum/client/build.xml new file mode 100644 index 00000000000..91312d059d2 --- /dev/null +++ b/java/test/Ice/checksum/client/build.xml @@ -0,0 +1,72 @@ +<!-- + ********************************************************************** + + Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. + + This copy of Ice is licensed to you under the terms described in the + ICE_LICENSE file included in this distribution. + + ********************************************************************** +--> + +<project name="test_Ice_checksum_server" default="all" basedir="."> + + <!-- get access to env variables globally --> + <property environment="env" /> + + <!-- set global properties for this build --> + <property name="top.dir" value="../../../.."/> + <property name="lib.dir" value="${top.dir}/lib"/> + <property name="class.dir" value="classes"/> + <property name="generated.dir" value="generated"/> + + <!-- set common build properties for this build --> + <property file="${top.dir}/config/build.properties"/> + + <!-- install slice2java task --> + <taskdef name="slice2java" classpath="${top.dir}/ant" classname="Slice2JavaTask" /> + + <target name="init"> + <!-- Create the time stamp --> + <tstamp/> + + <!-- Define the slice.dir property --> + <condition property="slice.dir" value="slice"> <available file="slice" type="dir"/> + </condition> + <condition property="slice.dir" value="${env.ICE_HOME}/slice"> + <and> + <available type="dir" file="${env.ICE_HOME}/slice"/> + <not> + <available file="slice" type="dir"/> + </not> + </and> + </condition> + <fail message="Slice source directory not found" unless="slice.dir"/> + </target> + + <target name="generate" depends="init"> + <!-- Create the output directory for generated code --> + <mkdir dir="${generated.dir}"/> + <slice2java outputdir="${generated.dir}" checksum="SliceChecksums"> + <fileset dir="." includes="Test.ice Types.ice"/> + <includepath> + <pathelement path="${slice.dir}" /> + </includepath> + </slice2java> + </target> + + <target name="compile" depends="generate"> + <mkdir dir="${class.dir}"/> + <javac srcdir="${generated.dir}" destdir="${class.dir}" source="1.4" classpath="${lib.dir}" debug="${debug}"/> + <javac srcdir="." destdir="${class.dir}" source="1.4" classpath="${lib.dir}" excludes="generated/**" + debug="${debug}"/> + </target> + + <target name="all" depends="compile"/> + + <target name="clean"> + <delete dir="${generated.dir}"/> + <delete dir="${class.dir}"/> + </target> + +</project> diff --git a/java/test/Ice/checksum/run.py b/java/test/Ice/checksum/run.py new file mode 100755 index 00000000000..f33c81d9014 --- /dev/null +++ b/java/test/Ice/checksum/run.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +import os, sys + +for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")): + break +else: + raise "can't find toplevel directory!" + +sys.path.append(os.path.join(toplevel, "config")) +import TestUtil + +name = os.path.join("Ice", "checksum") +testdir = os.path.join(toplevel, "test", name) + +TestUtil.clientServerTestWithClasspath(os.path.join(testdir, "server", "classes"), + os.path.join(testdir, "client", "classes")) + +sys.exit(0) diff --git a/java/test/Ice/checksum/server/ChecksumI.java b/java/test/Ice/checksum/server/ChecksumI.java new file mode 100644 index 00000000000..c6ff56f3005 --- /dev/null +++ b/java/test/Ice/checksum/server/ChecksumI.java @@ -0,0 +1,31 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +public final class ChecksumI extends Test._ChecksumDisp +{ + public + ChecksumI(Ice.ObjectAdapter adapter) + { + _adapter = adapter; + } + + public java.util.Map + getSliceChecksums(Ice.Current __current) + { + return SliceChecksums.checksums; + } + + public void + shutdown(Ice.Current __current) + { + _adapter.getCommunicator().shutdown(); + } + + private Ice.ObjectAdapter _adapter; +} diff --git a/java/test/Ice/checksum/server/Server.java b/java/test/Ice/checksum/server/Server.java new file mode 100644 index 00000000000..22a2533bc13 --- /dev/null +++ b/java/test/Ice/checksum/server/Server.java @@ -0,0 +1,56 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +public class Server +{ + private static int + run(String[] args, Ice.Communicator communicator) + { + communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 10000"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Object object = new ChecksumI(adapter); + adapter.add(object, Ice.Util.stringToIdentity("test")); + adapter.activate(); + communicator.waitForShutdown(); + return 0; + } + + public static void + main(String[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(args); + status = run(args, communicator); + } + catch(Ice.LocalException ex) + { + ex.printStackTrace(); + status = 1; + } + + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + ex.printStackTrace(); + status = 1; + } + } + + System.exit(status); + } +} diff --git a/java/test/Ice/checksum/server/Test.ice b/java/test/Ice/checksum/server/Test.ice new file mode 100644 index 00000000000..c3974b19e0a --- /dev/null +++ b/java/test/Ice/checksum/server/Test.ice @@ -0,0 +1,27 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef TEST_ICE +#define TEST_ICE + +#include <Ice/SliceChecksumDict.ice> + +module Test +{ + +interface Checksum +{ + nonmutating Ice::SliceChecksumDict getSliceChecksums(); + + void shutdown(); +}; + +}; + +#endif diff --git a/java/test/Ice/checksum/server/Types.ice b/java/test/Ice/checksum/server/Types.ice new file mode 100644 index 00000000000..0dd61483918 --- /dev/null +++ b/java/test/Ice/checksum/server/Types.ice @@ -0,0 +1,430 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef CLASS_ICE +#define CLASS_ICE + +// +// TEST: Same +// +const int IntConst1 = 100; + +// +// TEST: Value changed +// +const int IntConst2 = 1000; + +// +// TEST: Type changed +// +const short IntConst3 = 100; + +// +// TEST: Same +// +enum Enum1 { Enum11, Enum12, Enum13 }; + +// +// TEST: Add enumerator +// +enum Enum2 { Enum21, Enum22, Enum23, Enum24 }; + +// +// TEST: Remove enumerator +// +enum Enum3 { Enum32, Enum33 }; + +// +// TEST: Change to a different type +// +class Enum4 {}; + +// +// TEST: Same +// +sequence<int> Sequence1; + +// +// TEST: Change sequence type +// +sequence<short> Sequence2; + +// +// TEST: Change to a different type +// +class Sequence3 {}; + +// +// TEST: Same +// +dictionary<string, int> Dictionary1; + +// +// TEST: Change key type +// +dictionary<long, int> Dictionary2; + +// +// TEST: Change value type +// +dictionary<string, bool> Dictionary3; + +// +// TEST: Change to a different type +// +class Dictionary4 {}; + +// +// TEST: Same +// +struct Struct1 +{ + string str; + bool b; +}; + +// +// TEST: Add member +// +struct Struct2 +{ + string str; + bool b; + float f; +}; + +// +// TEST: Change member type +// +struct Struct3 +{ + string str; + double b; +}; + +// +// TEST: Remove member +// +struct Struct4 +{ + bool b; +}; + +// +// TEST: Change to a different type +// +class Struct5 {}; + +// +// TEST: Same +// +interface Interface1 +{ +}; + +// +// TEST: Change interface to class +// +class Interface2 +{ +}; + +// +// TEST: Add base interface +// +interface Interface3 extends Interface1 +{ +}; + +// +// TEST: Add operation +// +interface Interface4 +{ + void opInterface4(); +}; + +// +// TEST: Same +// +class EmptyClass1 +{ +}; + +// +// TEST: Add data member +// +class EmptyClass2 +{ + double d; +}; + +// +// TEST: Add operation +// +class EmptyClass3 +{ + void newOp(); +}; + +// +// TEST: Add base class +// +class EmptyClass4 extends EmptyClass1 +{ +}; + +// +// TEST: Add interface +// +class EmptyClass5 implements Interface1 +{ +}; + +// +// TEST: Same +// +class SimpleClass1 +{ + string str; + float f; +}; + +// +// TEST: Add operation +// +class SimpleClass2 +{ + string str; + float f; + void newOp(); +}; + +// +// TEST: Rename member +// +class SimpleClass3 +{ + string str; + float g; +}; + +// +// TEST: Add member +// +class SimpleClass4 +{ + string str; + float f; + bool b; +}; + +// +// TEST: Remove member +// +class SimpleClass5 +{ + string str; +}; + +// +// TEST: Reorder members +// +class SimpleClass6 +{ + float f; + string str; +}; + +// +// TEST: Change member type +// +class SimpleClass7 +{ + string str; + double f; +}; + +// +// TEST: Same +// +exception Exception1 +{ + string str; + bool b; +}; + +// +// TEST: Add member +// +exception Exception2 +{ + string str; + bool b; + float f; +}; + +// +// TEST: Change member type +// +exception Exception3 +{ + string str; + double b; +}; + +// +// TEST: Remove member +// +exception Exception4 +{ + bool b; +}; + +// +// TEST: Add base exception +// +exception Exception5 extends Exception1 +{ +}; + +// +// TEST: Change to a different type +// +class Exception6 {}; + +// +// TEST: Same +// +class BaseClass1 +{ + void baseOp1(); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Change return type +// +class BaseClass2 +{ + int baseOp(); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Add parameter +// +class BaseClass3 +{ + void baseOp(Object o); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Add exception +// +class BaseClass4 +{ + void baseOp(); + void baseOp2(int i, out string s) throws Exception1, Exception2; +}; + +// +// TEST: Change out parameter to in parameter +// +class BaseClass5 +{ + void baseOp(); + void baseOp2(int i, string s) throws Exception1; +}; + +// +// TEST: Remove parameter +// +class BaseClass6 +{ + void baseOp(); + void baseOp2(out string s) throws Exception1; +}; + +// +// TEST: Remove exception +// +class BaseClass7 +{ + void baseOp(); + void baseOp2(int i, out string s); +}; + +// +// TEST: Remove operation +// +class BaseClass8 +{ + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Add base class +// +class BaseClass9 extends EmptyClass1 +{ + void baseOp(); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Add interface +// +class BaseClass10 implements Interface1 +{ + void baseOp(); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Add base class and interface +// +class BaseClass11 extends EmptyClass1 implements Interface1 +{ + void baseOp(); + void baseOp2(int i, out string s) throws Exception1; +}; + +// +// TEST: Local +// +local enum LocalEnum { LocalEnum1, LocalEnum2, LocalEnum3 }; + +// +// TEST: Local +// +local sequence<string> LocalSequence; + +// +// TEST: Local +// +local dictionary<string, string> LocalDictionary; + +// +// TEST: Local +// +local struct LocalStruct +{ + string str; +}; + +// +// TEST: Local +// +local class LocalClass +{ +}; + +#endif diff --git a/java/test/Ice/checksum/server/build.xml b/java/test/Ice/checksum/server/build.xml new file mode 100644 index 00000000000..91312d059d2 --- /dev/null +++ b/java/test/Ice/checksum/server/build.xml @@ -0,0 +1,72 @@ +<!-- + ********************************************************************** + + Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. + + This copy of Ice is licensed to you under the terms described in the + ICE_LICENSE file included in this distribution. + + ********************************************************************** +--> + +<project name="test_Ice_checksum_server" default="all" basedir="."> + + <!-- get access to env variables globally --> + <property environment="env" /> + + <!-- set global properties for this build --> + <property name="top.dir" value="../../../.."/> + <property name="lib.dir" value="${top.dir}/lib"/> + <property name="class.dir" value="classes"/> + <property name="generated.dir" value="generated"/> + + <!-- set common build properties for this build --> + <property file="${top.dir}/config/build.properties"/> + + <!-- install slice2java task --> + <taskdef name="slice2java" classpath="${top.dir}/ant" classname="Slice2JavaTask" /> + + <target name="init"> + <!-- Create the time stamp --> + <tstamp/> + + <!-- Define the slice.dir property --> + <condition property="slice.dir" value="slice"> <available file="slice" type="dir"/> + </condition> + <condition property="slice.dir" value="${env.ICE_HOME}/slice"> + <and> + <available type="dir" file="${env.ICE_HOME}/slice"/> + <not> + <available file="slice" type="dir"/> + </not> + </and> + </condition> + <fail message="Slice source directory not found" unless="slice.dir"/> + </target> + + <target name="generate" depends="init"> + <!-- Create the output directory for generated code --> + <mkdir dir="${generated.dir}"/> + <slice2java outputdir="${generated.dir}" checksum="SliceChecksums"> + <fileset dir="." includes="Test.ice Types.ice"/> + <includepath> + <pathelement path="${slice.dir}" /> + </includepath> + </slice2java> + </target> + + <target name="compile" depends="generate"> + <mkdir dir="${class.dir}"/> + <javac srcdir="${generated.dir}" destdir="${class.dir}" source="1.4" classpath="${lib.dir}" debug="${debug}"/> + <javac srcdir="." destdir="${class.dir}" source="1.4" classpath="${lib.dir}" excludes="generated/**" + debug="${debug}"/> + </target> + + <target name="all" depends="compile"/> + + <target name="clean"> + <delete dir="${generated.dir}"/> + <delete dir="${class.dir}"/> + </target> + +</project> |