You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
(7) |
Dec
(18) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(20) |
Feb
(7) |
Mar
|
Apr
(8) |
May
(9) |
Jun
(7) |
Jul
(23) |
Aug
(3) |
Sep
|
Oct
(16) |
Nov
|
Dec
(3) |
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(6) |
Jun
(8) |
Jul
|
Aug
|
Sep
|
Oct
(5) |
Nov
(2) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(1) |
Oct
(30) |
Nov
|
Dec
|
2012 |
Jan
(4) |
Feb
(2) |
Mar
(1) |
Apr
(23) |
May
(4) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
(7) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <ope...@li...> - 2007-12-12 15:40:16
|
Revision: 106 http://openfast.svn.sourceforge.net/openfast/?rev=106&view=rev Author: jacob_northey Date: 2007-12-12 07:39:48 -0800 (Wed, 12 Dec 2007) Log Message: ----------- Fixed tail operator bug. Modified Paths: -------------- trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java trunk/src/test/java/org/openfast/template/operator/TailOperatorCodecTest.java trunk/src/test/java/org/openfast/test/OpenFastTestCase.java Modified: trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java =================================================================== --- trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java 2007-12-11 18:15:45 UTC (rev 105) +++ trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java 2007-12-12 15:39:48 UTC (rev 106) @@ -19,6 +19,8 @@ public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { if (value == null) { + if (priorValue == null) + return null; if (priorValue.isUndefined() && field.getDefaultValue().isUndefined()) return null; return ScalarValue.NULL; @@ -39,6 +41,8 @@ if (val.length > prior.length) return value; + if (val.length < prior.length) + Global.handleError(FastConstants.D3_CANT_ENCODE_VALUE, "The value " + val + " cannot be encoded by a tail operator with previous value " + priorValue); while (index < val.length && val[index] == prior[index]) index++; Modified: trunk/src/test/java/org/openfast/template/operator/TailOperatorCodecTest.java =================================================================== --- trunk/src/test/java/org/openfast/template/operator/TailOperatorCodecTest.java 2007-12-11 18:15:45 UTC (rev 105) +++ trunk/src/test/java/org/openfast/template/operator/TailOperatorCodecTest.java 2007-12-12 15:39:48 UTC (rev 106) @@ -4,11 +4,69 @@ import org.openfast.ByteVectorValue; import org.openfast.ScalarValue; import org.openfast.StringValue; +import org.openfast.error.FastConstants; +import org.openfast.error.FastException; import org.openfast.template.Scalar; import org.openfast.template.type.Type; import org.openfast.test.OpenFastTestCase; public class TailOperatorCodecTest extends OpenFastTestCase { + private static final OperatorCodec TAIL_CODEC = Operator.TAIL.getCodec(Type.ASCII); + private static final Scalar OPT_NO_DEFAULT = new Scalar("noDefault", Type.ASCII, Operator.TAIL, ScalarValue.UNDEFINED, true); + private static final Scalar OPT_DEFAULT = new Scalar("noDefault", Type.ASCII, Operator.TAIL, new StringValue("abc"), true); + private static final Scalar MAND_NO_DEFAULT = new Scalar("noDefault", Type.ASCII, Operator.TAIL, ScalarValue.UNDEFINED, false); + private static final Scalar MAND_DEFAULT = new Scalar("noDefault", Type.ASCII, Operator.TAIL, new StringValue("abc"), false); + + public void testGetValueToEncodeAllCasesForOptionalNoInitialValue() { + // VALUE PREVIOUS + assertEquals(null, TAIL_CODEC.getValueToEncode(null, UNDEF, OPT_NO_DEFAULT)); + assertEquals(string("abcd"), TAIL_CODEC.getValueToEncode(string("abcd"), UNDEF, OPT_NO_DEFAULT)); + assertEquals(string("e"), TAIL_CODEC.getValueToEncode(string("abce"), string("abcd"), OPT_NO_DEFAULT)); + assertEquals(null, TAIL_CODEC.getValueToEncode(string("abce"), string("abce"), OPT_NO_DEFAULT)); + assertEquals(string("abcef"), TAIL_CODEC.getValueToEncode(string("abcef"), string("abce"), OPT_NO_DEFAULT)); + assertEquals(NULL, TAIL_CODEC.getValueToEncode(null, string("abcef"), OPT_NO_DEFAULT)); + assertEquals(null, TAIL_CODEC.getValueToEncode(null, null, OPT_NO_DEFAULT)); + assertEquals(string("z"), TAIL_CODEC.getValueToEncode(string("z"), null, OPT_NO_DEFAULT)); + } + + public void testGetValueToEncodeAllCasesForMandatoryNoInitialValue() { + // VALUE PREVIOUS + assertEquals(string("abcd"), TAIL_CODEC.getValueToEncode(string("abcd"), UNDEF, MAND_NO_DEFAULT)); + assertEquals(string("e"), TAIL_CODEC.getValueToEncode(string("abce"), string("abcd"), MAND_NO_DEFAULT)); + assertEquals(string("abcef"), TAIL_CODEC.getValueToEncode(string("abcef"), string("abce"), MAND_NO_DEFAULT)); + assertEquals(string("z"), TAIL_CODEC.getValueToEncode(string("z"), null, MAND_NO_DEFAULT)); + } + + public void testGetValueToEncodeAllCasesForOptionalDefaultABC() { + // VALUE PREVIOUS + assertEquals(null, TAIL_CODEC.getValueToEncode(string("abc"), UNDEF, OPT_DEFAULT)); + assertEquals(NULL, TAIL_CODEC.getValueToEncode(null, UNDEF, OPT_DEFAULT)); + assertEquals(string("abcd"), TAIL_CODEC.getValueToEncode(string("abcd"), null, OPT_DEFAULT)); + assertEquals(string("e"), TAIL_CODEC.getValueToEncode(string("abce"), string("abcd"), OPT_DEFAULT)); + assertEquals(null, TAIL_CODEC.getValueToEncode(string("abce"), string("abce"), OPT_DEFAULT)); + assertEquals(string("abcef"), TAIL_CODEC.getValueToEncode(string("abcef"), string("abce"), OPT_DEFAULT)); + assertEquals(NULL, TAIL_CODEC.getValueToEncode(null, string("abcef"), OPT_DEFAULT)); + assertEquals(null, TAIL_CODEC.getValueToEncode(null, null, OPT_DEFAULT)); + assertEquals(string("z"), TAIL_CODEC.getValueToEncode(string("z"), null, OPT_DEFAULT)); + } + + public void testGetValueToEncodeAllCasesForMandatoryDefaultABC() { + // VALUE PREVIOUS + assertEquals(null, TAIL_CODEC.getValueToEncode(string("abc"), UNDEF, MAND_DEFAULT)); + assertEquals(string("d"), TAIL_CODEC.getValueToEncode(string("abd"), UNDEF, MAND_DEFAULT)); + assertEquals(string("e"), TAIL_CODEC.getValueToEncode(string("abce"), string("abcd"), MAND_DEFAULT)); + assertEquals(string("abcef"), TAIL_CODEC.getValueToEncode(string("abcef"), string("abce"), MAND_DEFAULT)); + assertEquals(string("z"), TAIL_CODEC.getValueToEncode(string("z"), null, MAND_DEFAULT)); + } + + public void testUnencodableValue() { + try { + TAIL_CODEC.getValueToEncode(new StringValue("a"), new StringValue("abce"), OPT_NO_DEFAULT); + fail(); + } catch (FastException e) { + assertEquals(FastConstants.D3_CANT_ENCODE_VALUE, e.getCode()); + } + } public void testGetValueToEncodeForByteVector() throws Exception { Scalar byteVectorField = new Scalar("bv", Type.BYTE_VECTOR, Operator.TAIL, ScalarValue.UNDEFINED, true); Modified: trunk/src/test/java/org/openfast/test/OpenFastTestCase.java =================================================================== --- trunk/src/test/java/org/openfast/test/OpenFastTestCase.java 2007-12-11 18:15:45 UTC (rev 105) +++ trunk/src/test/java/org/openfast/test/OpenFastTestCase.java 2007-12-12 15:39:48 UTC (rev 106) @@ -60,6 +60,8 @@ public abstract class OpenFastTestCase extends TestCase { + protected static final ScalarValue NULL = ScalarValue.NULL; + protected static final ScalarValue UNDEF = ScalarValue.UNDEFINED; public static DecimalValue d(double value) { return new DecimalValue(value); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2007-12-11 18:15:41
|
Revision: 105 http://openfast.svn.sourceforge.net/openfast/?rev=105&view=rev Author: jacob_northey Date: 2007-12-11 10:15:45 -0800 (Tue, 11 Dec 2007) Log Message: ----------- Fixed string zero preamble encoding/decoding. Fixed tail operator bug. Modified Paths: -------------- trunk/pom.xml trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java trunk/src/main/java/org/openfast/template/type/codec/AsciiString.java trunk/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java trunk/src/site/resources/css/site.css trunk/src/test/java/org/openfast/submitted/OptionalInitialValueTest.java trunk/src/test/java/org/openfast/template/type/codec/AsciiStringTest.java Added Paths: ----------- trunk/src/test/java/org/openfast/submitted/StringNullTest.java Removed Paths: ------------- trunk/etc/tagVersion.bat trunk/etc/tagVersion.sh Deleted: trunk/etc/tagVersion.bat =================================================================== --- trunk/etc/tagVersion.bat 2007-12-08 01:00:16 UTC (rev 104) +++ trunk/etc/tagVersion.bat 2007-12-11 18:15:45 UTC (rev 105) @@ -1,4 +0,0 @@ -@echo off -svn propset major.version %1 . -svn propset minor.version %2 . -echo "Set version to %1.%2" \ No newline at end of file Deleted: trunk/etc/tagVersion.sh =================================================================== --- trunk/etc/tagVersion.sh 2007-12-08 01:00:16 UTC (rev 104) +++ trunk/etc/tagVersion.sh 2007-12-11 18:15:45 UTC (rev 105) @@ -1,4 +0,0 @@ -#!/bin/sh -svn propset major.version $1 . -svn propset minor.version $2 . -echo Set version to $1.$2 \ No newline at end of file Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-12-08 01:00:16 UTC (rev 104) +++ trunk/pom.xml 2007-12-11 18:15:45 UTC (rev 105) @@ -164,6 +164,7 @@ <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.2</version> + <scope>test</scope> </dependency> </dependencies> Modified: trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java =================================================================== --- trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java 2007-12-08 01:00:16 UTC (rev 104) +++ trunk/src/main/java/org/openfast/template/operator/TailOperatorCodec.java 2007-12-11 18:15:45 UTC (rev 105) @@ -19,7 +19,9 @@ public ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field) { if (value == null) { - return ScalarValue.NULL; + if (priorValue.isUndefined() && field.getDefaultValue().isUndefined()) + return null; + return ScalarValue.NULL; } if (priorValue == null) { @@ -45,17 +47,13 @@ return (ScalarValue) field.createValue(new String(val, index, val.length-index)); } - public ScalarValue decodeValue(ScalarValue newValue, - ScalarValue previousValue, Scalar field) { + public ScalarValue decodeValue(ScalarValue newValue, ScalarValue previousValue, Scalar field) { StringValue base; if ((previousValue == null) && !field.isOptional()) { - Global.handleError(FastConstants.D6_MNDTRY_FIELD_NOT_PRESENT, - ""); - + Global.handleError(FastConstants.D6_MNDTRY_FIELD_NOT_PRESENT, ""); return null; - } else if ((previousValue == null) || - previousValue.isUndefined()) { + } else if ((previousValue == null) || previousValue.isUndefined()) { base = (StringValue) field.getBaseValue(); } else { base = (StringValue) previousValue; @@ -76,9 +74,9 @@ return new StringValue(root + delta); } - public ScalarValue decodeEmptyValue(ScalarValue previousValue, - Scalar field) { + public ScalarValue decodeEmptyValue(ScalarValue previousValue, Scalar field) { if (previousValue.isUndefined()) { + if (field.getDefaultValue().isUndefined()) return null; return field.getBaseValue(); } Modified: trunk/src/main/java/org/openfast/template/type/codec/AsciiString.java =================================================================== --- trunk/src/main/java/org/openfast/template/type/codec/AsciiString.java 2007-12-08 01:00:16 UTC (rev 104) +++ trunk/src/main/java/org/openfast/template/type/codec/AsciiString.java 2007-12-11 18:15:45 UTC (rev 105) @@ -38,6 +38,8 @@ final class AsciiString extends TypeCodec { private static final long serialVersionUID = 1L; + private static final String ZERO_TERMINATOR = "\u0000"; + private static final byte[] ZERO_PREAMBLE = new byte[] { 0, 0 }; AsciiString() { } @@ -56,7 +58,9 @@ if ((string != null) && (string.length() == 0)) { return TypeCodec.NULL_VALUE_ENCODING; } - + if (string.startsWith(ZERO_TERMINATOR)) { + return ZERO_PREAMBLE; + } return string.getBytes(); } @@ -84,6 +88,8 @@ if (bytes[0] == 0) { if (!ByteUtil.isEmpty(bytes)) Global.handleError(FastConstants.R9_STRING_OVERLONG, null); + if (bytes.length > 1 && bytes[1] == 0) + return new StringValue("\u0000"); return new StringValue(""); } Modified: trunk/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java =================================================================== --- trunk/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java 2007-12-08 01:00:16 UTC (rev 104) +++ trunk/src/main/java/org/openfast/template/type/codec/NullableAsciiString.java 2007-12-11 18:15:45 UTC (rev 105) @@ -39,6 +39,7 @@ final class NullableAsciiString extends TypeCodec { private static final long serialVersionUID = 1L; private static final byte[] NULLABLE_EMPTY_STRING = new byte[] { 0x00, 0x00 }; + private static final byte[] ZERO_ENCODING = new byte[] { 0x00, 0x00, 0x00 }; NullableAsciiString() { } @@ -58,6 +59,8 @@ return NULLABLE_EMPTY_STRING; } + if (string.startsWith("\u0000")) + return ZERO_ENCODING; return string.getBytes(); } @@ -87,8 +90,10 @@ Global.handleError(FastConstants.R9_STRING_OVERLONG, null); if ((bytes.length == 1)) { return null; - } else { + } else if (bytes.length == 2 && bytes[1] == 0){ return new StringValue(""); + } else if (bytes.length == 3 && bytes[2] == 0) { + return new StringValue("\u0000"); } } Modified: trunk/src/site/resources/css/site.css =================================================================== --- trunk/src/site/resources/css/site.css 2007-12-08 01:00:16 UTC (rev 104) +++ trunk/src/site/resources/css/site.css 2007-12-11 18:15:45 UTC (rev 105) @@ -49,5 +49,5 @@ } #navcolumn h5 { - background-image: transparent url(../images/h5.gif); + background-image: url(../images/h5.gif); } \ No newline at end of file Modified: trunk/src/test/java/org/openfast/submitted/OptionalInitialValueTest.java =================================================================== --- trunk/src/test/java/org/openfast/submitted/OptionalInitialValueTest.java 2007-12-08 01:00:16 UTC (rev 104) +++ trunk/src/test/java/org/openfast/submitted/OptionalInitialValueTest.java 2007-12-11 18:15:45 UTC (rev 105) @@ -45,4 +45,18 @@ Message decoded = decoder(template, encoding).readMessage(); assertEquals(m, decoded); } + + public void testOptionalInitialValueForTail() throws Exception { + MessageTemplate template = template("<template name=\"OptCopyInit\" id=\"520\" dictionary=\"template\">" + + "<string id=\"1\" presence=\"optional\" name=\"Line1\"><tail/></string>" + + "<string id=\"1\" presence=\"optional\" name=\"Line2\"><tail value=\"abc\"/></string>" + + "</template>"); + FastEncoder encoder = encoder(template); + Message m = new Message(template); // all fields null + byte[] encoding = encoder.encode(m); + assertEquals("11010000 10000001 10000000", encoding); + + Message decoded = decoder(template, encoding).readMessage(); + assertEquals(m, decoded); + } } Added: trunk/src/test/java/org/openfast/submitted/StringNullTest.java =================================================================== --- trunk/src/test/java/org/openfast/submitted/StringNullTest.java (rev 0) +++ trunk/src/test/java/org/openfast/submitted/StringNullTest.java 2007-12-11 18:15:45 UTC (rev 105) @@ -0,0 +1,57 @@ +package org.openfast.submitted; + +import org.openfast.Message; +import org.openfast.ScalarValue; +import org.openfast.codec.FastDecoder; +import org.openfast.codec.FastEncoder; +import org.openfast.template.Field; +import org.openfast.template.MessageTemplate; +import org.openfast.template.Scalar; +import org.openfast.template.operator.Operator; +import org.openfast.template.type.Type; +import org.openfast.test.OpenFastTestCase; + +public class StringNullTest extends OpenFastTestCase { + + public void testMandatoryStringWithEmptyString() throws Exception { + MessageTemplate template = new MessageTemplate("template", new Field[] { + new Scalar("string", Type.ASCII, Operator.COPY, ScalarValue.UNDEFINED, false) + }); + FastEncoder encoder = encoder(template); + Message message = new Message(template); + message.setString("string", "\u0000"); + byte[] encoding = encoder.encode(message); + assertEquals("11100000 10000001 00000000 10000000", encoding); + + FastDecoder decoder = decoder(template, encoding); + assertEquals("\u0000", decoder.readMessage().getString(1)); + + message.setString("string", ""); + encoder.reset(); + encoding = encoder.encode(message); + assertEquals("11100000 10000001 10000000", encoding); + decoder = decoder(template, encoding); + assertEquals("", decoder.readMessage().getString(1)); + } + + public void testOptionalStringWithEmptyString() throws Exception { + MessageTemplate template = new MessageTemplate("template", new Field[] { + new Scalar("string", Type.ASCII, Operator.COPY, ScalarValue.UNDEFINED, true) + }); + FastEncoder encoder = encoder(template); + Message message = new Message(template); + message.setString("string", "\u0000"); + byte[] encoding = encoder.encode(message); + assertEquals("11100000 10000001 00000000 00000000 10000000", encoding); + + FastDecoder decoder = decoder(template, encoding); + assertEquals("\u0000", decoder.readMessage().getString(1)); + + message.setString("string", ""); + encoder.reset(); + encoding = encoder.encode(message); + assertEquals("11100000 10000001 00000000 10000000", encoding); + decoder = decoder(template, encoding); + assertEquals("", decoder.readMessage().getString(1)); + } +} Modified: trunk/src/test/java/org/openfast/template/type/codec/AsciiStringTest.java =================================================================== --- trunk/src/test/java/org/openfast/template/type/codec/AsciiStringTest.java 2007-12-08 01:00:16 UTC (rev 104) +++ trunk/src/test/java/org/openfast/template/type/codec/AsciiStringTest.java 2007-12-11 18:15:45 UTC (rev 105) @@ -12,7 +12,7 @@ TypeCodec coder = Type.ASCII.getCodec(Operator.NONE, false); assertEquals(string(""), coder.decode(bitStream("10000000"))); - assertEquals(string(""), coder.decode(bitStream("00000000 10000000"))); + assertEquals(string("\u0000"), coder.decode(bitStream("00000000 10000000"))); try { coder.decode(bitStream("00000000 11000001")); @@ -21,5 +21,4 @@ assertEquals(FastConstants.R9_STRING_OVERLONG, e.getCode()); } } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2007-12-08 01:00:17
|
Revision: 104 http://openfast.svn.sourceforge.net/openfast/?rev=104&view=rev Author: jacob_northey Date: 2007-12-07 17:00:16 -0800 (Fri, 07 Dec 2007) Log Message: ----------- Updated web site to use Maven site generation. Fixed broken tests, by adding test data back in. Modified Paths: -------------- trunk/pom.xml trunk/src/main/java/org/openfast/util/RecordingInputStream.java trunk/src/test/java/org/openfast/submitted/ComposedDecimalNullPointerTest.java trunk/src/test/java/org/openfast/submitted/OpraFeedTest.java Added Paths: ----------- trunk/src/site/ trunk/src/site/apt/ trunk/src/site/apt/contributions.apt trunk/src/site/apt/support.apt trunk/src/site/fml/ trunk/src/site/fml/faq.fml trunk/src/site/resources/ trunk/src/site/resources/css/ trunk/src/site/resources/css/site.css trunk/src/site/resources/images/ trunk/src/site/resources/images/h5.gif trunk/src/site/resources/images/icon_arrowfolderopen2_sml.gif trunk/src/site/resources/images/openfast-logo.png trunk/src/site/site.xml trunk/src/site/xdoc/ trunk/src/site/xdoc/index.xml trunk/src/test/resources/FPL/FASTTestTemplate.xml trunk/src/test/resources/FPL/data.xml trunk/src/test/resources/FPL/messages.fast Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-12-07 17:05:44 UTC (rev 103) +++ trunk/pom.xml 2007-12-08 01:00:16 UTC (rev 104) @@ -15,6 +15,40 @@ <description>OpenFAST is a 100% Java implementation of the FAST Protocol.</description> + <developers> + <developer> + <name>Jacob Northey</name> + <organization>Lasalletech</organization> + <organizationUrl>http://www.lasalletech.com/</organizationUrl> + <roles> + <role>architect</role> + <role>developer</role> + </roles> + <timezone>-5</timezone> + </developer> + <developer> + <name>Craig Otis</name> + <organization>Lasalletech</organization> + <organizationUrl>http://www.lasalletech.com/</organizationUrl> + <roles> + <role>developer</role> + </roles> + <timezone>-5</timezone> + </developer> + </developers> + + <contributors> + <contributor> + <name>Stefan Schwendiman</name> + <organization>Swiss Exchange</organization> + <organizationUrl>http://www.swx.com</organizationUrl> + <roles> + <role>tester</role> + </roles> + <timezone>+1</timezone> + </contributor> + </contributors> + <licenses> <license> <name>Mozilla Public License Version 1.1</name> @@ -144,5 +178,10 @@ <name>Sourceforge.net Snapshot Repository</name> <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/htdocs/maven/snapshot</url> </snapshotRepository> + <site> + <id>sourceforge.net</id> + <name>Sourceforge.net OpenFAST Web Site</name> + <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/htdocs/</url> + </site> </distributionManagement> </project> \ No newline at end of file Modified: trunk/src/main/java/org/openfast/util/RecordingInputStream.java =================================================================== --- trunk/src/main/java/org/openfast/util/RecordingInputStream.java 2007-12-07 17:05:44 UTC (rev 103) +++ trunk/src/main/java/org/openfast/util/RecordingInputStream.java 2007-12-08 01:00:16 UTC (rev 104) @@ -41,7 +41,6 @@ public int read() throws IOException { int read = in.read(); buffer[index++] = (byte) read; - return read; } Added: trunk/src/site/apt/contributions.apt =================================================================== --- trunk/src/site/apt/contributions.apt (rev 0) +++ trunk/src/site/apt/contributions.apt 2007-12-08 01:00:16 UTC (rev 104) @@ -0,0 +1,26 @@ + ------ + Contributing to OpenFAST + ------ + Jacob Northey + ------ + 2007. 12. 07. + +Contributing to OpenFAST + +* Becoming a Committer + + * Send an e-mail to {{{mailto:su...@op...}su...@op...}} requesting to be added to the project + + * Include some background information and what you are currently using OpenFAST for + +* Submitting bugs/patches + + * Open up a {{{issue-tracking.html}bug report}} on the SourceForge project page + + * Attach any patches and comments to the bug report + +* Documentation + + * To contribute to under-documented Javadocs, see becoming a committer above. + + * Additional documentation can be added to the {{{http://openfast.wiki.sourceforge.net/}OpenFAST Wiki}} \ No newline at end of file Added: trunk/src/site/apt/support.apt =================================================================== --- trunk/src/site/apt/support.apt (rev 0) +++ trunk/src/site/apt/support.apt 2007-12-08 01:00:16 UTC (rev 104) @@ -0,0 +1,24 @@ + ------ + Support + ------ + Jacob Northey + ------ + 2007. 12. 07. + +Getting Help + +* General help with the FAST Protocol + + * Visit the FAST Protocol discussion forum: {{http://fixprotocol.org/discuss/46/all}} + +* Support using OpenFAST + + * Read the {{{faq.html}FAQ}} + + * Subscribe to {{{mail-lists.html}ope...@li...}} and submit a message + + * Send an e-mail to {{{mailto:su...@op...}su...@op...}} + +* OpenFAST Consulting + + * {{{http://www.lasalletech.com/openfast}Lasalletech}} - Originators of OpenFAST can provide support contracts and consulting services. \ No newline at end of file Added: trunk/src/site/fml/faq.fml =================================================================== --- trunk/src/site/fml/faq.fml (rev 0) +++ trunk/src/site/fml/faq.fml 2007-12-08 01:00:16 UTC (rev 104) @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<faqs title="Frequently Asked Questions" toplink="false"> + + <part id="background"> + <title>Background</title> + <faq id="fast-what"> + <question>What is the FAST Protocol?</question> + <answer> + OpenFAST is a 100% Java implementation of the FAST Protocol (FIX Adapted for STreaming). The FAST protocol is used to optimize communications in the electronic exchange of financial data. OpenFAST is flexible and extensible through high volume - low latency transmissions. + + The FAST protocol uses a data compression algorithm to decrease the size of data by two processes. + <ul> + <li><em>First Process: Field Encoding</em> - Data the is simliar or redundant is removed.</li> + <li><em>Second Process: Transfer Encoding</em> - Serialize remaining data through binary encoded.</li> + </ul> + The FAST protocol also uses templates to enhance data compression and decompression. The only specification among the templates is that the creator and end-user must agree upon a template before data can be streamed. Any template guide may be used, such as XML or a basic text file. + </answer> + </faq> + <faq id="fix-what"> + <question>What is FIX?</question> + <answer> + Visit <a href="http://www.fixprotocol.org/what-is-fix.shtml">http://www.fixprotocol.org/what-is-fix.shtml</a> for a complete rundown of the FIX Protocol. + </answer> + </faq> + <faq id="speed"> + <question> + Why create an implementation of a latency/throughput-reducing specification and not optimize it for speed? + </question> + <answer> + One of the main goals of OpenFAST is to provide an open implementation of fast that is easy to understand. + Optimizations will be made where it does not compromise the readability or architecture of the API. + </answer> + </faq> + </part> + + <part id="development"> + <title>Development</title> + + <faq id="fix-over-fast"> + <question>How do I send FIX messages through OpenFAST?</question> + <answer> + OpenFAST is implemented using a generic messaging model. There aren't any specific message protocols currently + built-in. There is a tentative plan to create an extensions module for OpenFAST that will support different + messaging protocols with at least support for FIX. Keep checking back for more information. + </answer> + </faq> + + <faq id="security"> + <question>Is there support for security in OpenFAST?</question> + <answer> + SCP 1.0 and SCP 1.1 have been implemented. There aren't any security mechanisms currently defined in either + session protocol. If you are having trouble integrating security with OpenFAST, feel free to contact us at + <a href="mailto:su...@op...">su...@op...</a>. + </answer> + </faq> + </part> + +</faqs> \ No newline at end of file Added: trunk/src/site/resources/css/site.css =================================================================== --- trunk/src/site/resources/css/site.css (rev 0) +++ trunk/src/site/resources/css/site.css 2007-12-08 01:00:16 UTC (rev 104) @@ -0,0 +1,53 @@ +a.side:link {color:#646464; text-decoration:none;} +a.side:visited {color:#646464; text-decoration:none;} +a.side:hover {color:#646464; text-decoration:underline;} + +body { + margin-left: 0px; + background-color: #EBEBEB; +} +#downloadbox { + float: right; + margin: 1em 0em 2em 1em; + padding: 1em; + border: 1px solid #999; + background-color: #fff; +} + +#downloadbox h5 { + color: #000; + margin: 0; + border-bottom: 1px solid #aaaaaa; + font-size: smaller; + padding: 0; +} + +#downloadbox p { + margin-top: 1em; + margin-bottom: 0; +} + +#downloadbox p a { + color: #47a; + font-weight: inherit; +} + +#downloadbox ul { + margin-top: 0; + margin-bottom: 1em; + list-style-type: disc; +} + +#downloadbox li { + font-size: smaller; +} + +#banner { + background: transparent url(../images/spacer.gif) repeat scroll 0%; + height: 100px; + background-color: #fff; +} + +#navcolumn h5 { + background-image: transparent url(../images/h5.gif); +} \ No newline at end of file Added: trunk/src/site/resources/images/h5.gif =================================================================== (Binary files differ) Property changes on: trunk/src/site/resources/images/h5.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/site/resources/images/icon_arrowfolderopen2_sml.gif =================================================================== (Binary files differ) Property changes on: trunk/src/site/resources/images/icon_arrowfolderopen2_sml.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/site/resources/images/openfast-logo.png =================================================================== (Binary files differ) Property changes on: trunk/src/site/resources/images/openfast-logo.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/site/site.xml =================================================================== --- trunk/src/site/site.xml (rev 0) +++ trunk/src/site/site.xml 2007-12-08 01:00:16 UTC (rev 104) @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<project name="OpenFAST"> + <bannerLeft> + <name>OpenFAST</name> + <src>images/openfast-logo.png</src> + <href>http://www.openfast.org/</href> + </bannerLeft> + <body> + <head> + <meta name="keywords" content="openfast, open fast, fast 1.1, fix, fpl, fix adapted for streaming, lasalletech, lasalle technology group"/> + </head> + <links> + <item name="OpenFAST @ SourceForge" href="https://sourceforge.net/projects/openfast" /> + <item name="FAST Interoperability Portal" href="http://technical-fixprotocol.net/fast-portal/" /> + <item name="FPL FAST" href="http://www.fixprotocol.org/fast" /> + <item name="FAST Forum" href="http://fixprotocol.org/discuss/46/all" /> + <item name="Lasalletech" href="http://www.lasalletech.com"/> + </links> + + <menu name="OpenFAST"> + <item name="Download" href="http://sourceforge.net/project/showfiles.php?group_id=198357&package_id=240515"/> + <item name="License" href="license.html"/> + </menu> + + <menu name="About OpenFAST"> + <item name="About" href="index.html"/> + <item name="FAQ" href="faq.html"/> + </menu> + + <menu name="Documentation"> + <item name="15-minute Guide" href="http://openfast.wiki.sourceforge.net/FifteenMinute"/> + <item name="Wiki" href="http://openfast.wiki.sourceforge.net/"/> + </menu> + + <menu name="Developers"> + <item name="How to Contribute" href="contributions.html"/> + <item name="Getting Help" href="support.html"/> + </menu> + + <menu ref="reports"/> + </body> + <skin> + <groupId>org.apache.maven.skins</groupId> + <artifactId>maven-stylus-skin</artifactId> + <version>1.0.1</version> + </skin> + <poweredBy> + <logo name="SourceForge" href="http://sourceforge.net" img="http://sflogo.sourceforge.net/sflogo.php?group_id=198357&type=1"/> + <logo name="Maven" href="http://maven.apache.org/" img="images/logos/maven-feather.png"/> + </poweredBy> +</project> \ No newline at end of file Added: trunk/src/site/xdoc/index.xml =================================================================== --- trunk/src/site/xdoc/index.xml (rev 0) +++ trunk/src/site/xdoc/index.xml 2007-12-08 01:00:16 UTC (rev 104) @@ -0,0 +1,61 @@ +<?xml version="1.0"?> +<document> + <properties> + <title>About</title> + <author>Jacob Northey</author> + </properties> + + <body> + <div id="downloadbox"> + <h5>Download OpenFAST 0.9.4</h5> + <p> + <img valign="top" src="images/icon_arrowfolderopen2_sml.gif" border="0" alt="" title="download"/> + <a href="http://sourceforge.net/project/showfiles.php?group_id=198357&package_id=240515"> + Download + </a> + OpenFAST 0.9.4 + </p> + <ul> + <li> + <a href="http://openfast.wiki.sourceforge.net/FifteenMinute">Getting Started</a> + </li> + <li> + <a href="license.html">License</a> + </li> + </ul> + </div> + <section name="OpenFAST"> + <subsection name="What is OpenFAST?"> + OpenFAST is a 100% Java implementation of the FAST Protocol (FIX Adapted for STreaming). + The FAST protocol is used to optimize communications in the electronic exchange of financial data. + OpenFAST is flexible and extensible through high volume - low latency transmissions. + The FAST protocol uses a data compression algorithm to decrease the size of data by two processes. + <ul> + <li><em>First Process: Field Encoding</em> - Data that is simliar or redundant is removed.</li> + <li><em>Second Process: Transfer Encoding</em> - Serialize remaining data through binary encoding.</li> + </ul> + The FAST protocol also uses templates to enhance data compression and decompression. The only specification + among the templates is that the creator and end-user must agree upon a template before data can be streamed. + Any template guide may be used, such as XML or a basic text file. + To learn more about OpenFAST and the FAST protocol, visit the FAQ. + </subsection> + <subsection name="Goals"> + <ul> + <li>Provide a complete implementation of the current FAST Specification</li> + <li>Create an implementation that follows Object Oriented Design principles</li> + <li>Extensible so that new types, codecs, and operators can be created easily</li> + </ul> + </subsection> + <subsection name="Features"> + <ul> + <li>100% Java Implementation of the FAST protocol - using the <a href="http://www.fixprotocol.org/fastspec">current 1.x.1 specification</a>.</li> + <li>Using a protocol that is market proven by: Archipelago Exchange, London Stock Exchange, CME, and others.</li> + <li>Easily creatable data template using existing specifications such as XML or develop your own.</li> + <li>SCP 1.0 implementation</li> + <li>SCP 1.1 implementation</li> + <li>Licensed under the <a href="http://www.mozilla.org/MPL/MPL-1.1.html">Mozilla Public License</a></li> + </ul> + </subsection> + </section> + </body> +</document> \ No newline at end of file Modified: trunk/src/test/java/org/openfast/submitted/ComposedDecimalNullPointerTest.java =================================================================== --- trunk/src/test/java/org/openfast/submitted/ComposedDecimalNullPointerTest.java 2007-12-07 17:05:44 UTC (rev 103) +++ trunk/src/test/java/org/openfast/submitted/ComposedDecimalNullPointerTest.java 2007-12-08 01:00:16 UTC (rev 104) @@ -1,6 +1,5 @@ package org.openfast.submitted; -import java.io.FileNotFoundException; import java.io.InputStream; import org.openfast.Message; @@ -9,15 +8,16 @@ import org.openfast.template.loader.MessageTemplateLoader; import org.openfast.template.loader.XMLMessageTemplateLoader; import org.openfast.test.OpenFastTestCase; +import org.openfast.util.RecordingInputStream; public class ComposedDecimalNullPointerTest extends OpenFastTestCase { - public void testNullPointerOnTwinValue() throws FileNotFoundException { - InputStream templateSource = resource("FASTTestTemplate.xml"); + public void testNullPointerOnTwinValue() throws Exception { + InputStream templateSource = resource("FPL/FASTTestTemplate.xml"); MessageTemplateLoader templateLoader = new XMLMessageTemplateLoader(); MessageTemplate[] templates = templateLoader.load(templateSource); - InputStream is = resource("messages.fast"); - MessageInputStream mis = new MessageInputStream(is); + InputStream is = resource("FPL/messages.fast"); + MessageInputStream mis = new MessageInputStream(new RecordingInputStream(is)); mis.registerTemplate(35, templates[0]); Message msg = mis.readMessage(); msg = mis.readMessage(); Modified: trunk/src/test/java/org/openfast/submitted/OpraFeedTest.java =================================================================== --- trunk/src/test/java/org/openfast/submitted/OpraFeedTest.java 2007-12-07 17:05:44 UTC (rev 103) +++ trunk/src/test/java/org/openfast/submitted/OpraFeedTest.java 2007-12-08 01:00:16 UTC (rev 104) @@ -16,18 +16,14 @@ try { if (bytesLeft == 0) { bytesLeft = ((in.read() << 24) + (in.read() << 16) + (in.read() << 8) + (in.read() << 0)); - System.out.println("New block: " + bytesLeft + " bytes"); in.read(); // read SOH byte bytesLeft--; } int msgLen =(0x000000FF & in.read()); // read message length bytesLeft--; if (msgLen == 3) { - System.out.println("End of block."); return readBlock(in); } else { - System.out.println("Bytes left in block: " + bytesLeft); - System.out.println("Message length: " + msgLen); bytesLeft-=msgLen; } return true; @@ -47,11 +43,9 @@ MessageInputStream in = new MessageInputStream(resource("OPRA/messages.fast")); OpraBlockReader opraBlockReader = new OpraBlockReader(); in.setBlockReader(opraBlockReader); - in.getContext().setTraceEnabled(true); in.setTemplateRegistry(loader.getTemplateRegistry()); Message msg = in.readMessage(); while (msg != null) { - System.out.println(msg); msg = in.readMessage(); } } Added: trunk/src/test/resources/FPL/FASTTestTemplate.xml =================================================================== --- trunk/src/test/resources/FPL/FASTTestTemplate.xml (rev 0) +++ trunk/src/test/resources/FPL/FASTTestTemplate.xml 2007-12-08 01:00:16 UTC (rev 104) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<template name="MDIncRefresh" id="35" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <typeRef name="MDIncRefresh"/> + <string name="ApplVerID" id="1128"> <constant value="FIX.5.0"/> </string> + <string name="MessageType" id="35"> <constant value="X"/> </string> + <string name="SenderCompID" id="49"> <constant value="CME"/> </string> + <int32 name="MsgSeqNum" id="34"> <increment/> </int32> + <int64 name="SendingTime" id="52"> <delta/> </int64> + <sequence name="MDEntries"> <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> <default value="0"/> </uInt32> + <string name="MDEntryType" id="269"> <copy/> </string> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> <increment value="1"/> + </uInt32> + <string name="SecurityDesc" id="107"> <copy/> </string> + <decimal name="MDEntryPx" id="270"> + <exponent><default value="-3"/></exponent> + <mantissa><delta/></mantissa></decimal> + <uInt32 name="MDEntrySize" id="271"> <delta/> </uInt32> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> <delta/> </uInt32> + <string name="QuoteCondition" id="276" presence="optional"> <default/> </string> + <string name="TradeCondition" id="277" presence="optional"> <default/> </string> + </sequence> + </template> \ No newline at end of file Added: trunk/src/test/resources/FPL/data.xml =================================================================== --- trunk/src/test/resources/FPL/data.xml (rev 0) +++ trunk/src/test/resources/FPL/data.xml 2007-12-08 01:00:16 UTC (rev 104) @@ -0,0 +1,134 @@ +<messages> +<MDIncRefresh> + <BeginString>FIX.5.0</BeginString> + <MessageType>X</MessageType> <SenderCompID>CME</SenderCompID> + <MsgSeqNum>123456701</MsgSeqNum> + <SendingTime>20061101132712123</SendingTime> + <MDEntries> + <MDEntry> + <MDUpdateAction>0</MDUpdateAction> + <MDEntryType>0</MDEntryType> + <MDPriceLevel>1</MDPriceLevel> + <SecurityDesc>GEZ6</SecurityDesc> + <MDEntryPx>94.325</MDEntryPx> + <MDEntrySize>50</MDEntrySize> + <NumberOfOrders>5</NumberOfOrders> + <QuoteCondition>K</QuoteCondition> + </MDEntry> + <MDEntry> + <MDUpdateAction>0</MDUpdateAction> + <MDEntryType>0</MDEntryType> + <MDPriceLevel>2</MDPriceLevel> + <SecurityDesc>GEZ6</SecurityDesc> + <MDEntryPx>94.300</MDEntryPx> + <MDEntrySize>75</MDEntrySize> + <NumberOfOrders>7</NumberOfOrders> + </MDEntry> + <MDEntry> + <MDUpdateAction>0</MDUpdateAction> + <MDEntryType>0</MDEntryType> + <MDPriceLevel>3</MDPriceLevel> + <SecurityDesc>GEZ6</SecurityDesc> + <MDEntryPx>94.275</MDEntryPx> + <MDEntrySize>20</MDEntrySize> + <NumberOfOrders>4</NumberOfOrders> + </MDEntry> + </MDEntries> + </MDIncRefresh> + +<MDIncRefresh> + <BeginString>FIX.5.0</BeginString> + <MessageType>X</MessageType> <SenderCompID>CME</SenderCompID> + <MsgSeqNum>123456702</MsgSeqNum> + <SendingTime>20061101132712187</SendingTime> + <MDEntries> + <MDEntry> + <MDUpdateAction>0</MDUpdateAction> + <MDEntryType>1</MDEntryType> + <MDPriceLevel>1</MDPriceLevel> + <SecurityDesc>GEZ6</SecurityDesc> + <MDEntryPx>94.350</MDEntryPx> + <MDEntrySize>145</MDEntrySize> + <NumberOfOrders>14</NumberOfOrders> + </MDEntry> + <MDEntry> + <MDUpdateAction>0</MDUpdateAction> + <MDEntryType>1</MDEntryType> + <MDPriceLevel>2</MDPriceLevel> + <SecurityDesc>GEZ6</SecurityDesc> + <MDEntryPx>94.375</MDEntryPx> + <MDEntrySize>120</MDEntrySize> + <NumberOfOrders>9</NumberOfOrders> + </MDEntry> + <MDEntry> + <MDUpdateAction>0</MDUpdateAction> + <MDEntryType>1</MDEntryType> + <MDPriceLevel>3</MDPriceLevel> + <SecurityDesc>GEZ6</SecurityDesc> + <MDEntryPx>94.400</MDEntryPx> + <MDEntrySize>87</MDEntrySize> + <NumberOfOrders>4</NumberOfOrders> + </MDEntry> + </MDEntries> + </MDIncRefresh> + + <MDIncRefresh> + <BeginString>FIX.5.0</BeginString> + <MessageType>X</MessageType> <SenderCompID>CME</SenderCompID> + <MsgSeqNum>123456703</MsgSeqNum> + <SendingTime>20061101132712204</SendingTime> + <MDEntries> +<MDEntry> + <MDUpdateAction>0</MDUpdateAction> + <MDEntryType>2</MDEntryType> + <SecurityDesc>GEZ6</SecurityDesc> + <MDEntryPx>94.325</MDEntryPx> + <MDEntrySize>5</MDEntrySize> + <TradeCondition>X</TradeCondition> + </MDEntry> + <MDEntry> + <MDUpdateAction>0</MDUpdateAction> + <MDEntryType>2</MDEntryType> + <SecurityDesc>GEZ6</SecurityDesc> + <MDEntryPx>94.300</MDEntryPx> + <MDEntrySize>11</MDEntrySize> + </MDEntry> + <MDEntry> + <MDUpdateAction>0</MDUpdateAction> + <MDEntryType>0</MDEntryType> + <MDPriceLevel>1</MDPriceLevel> + <SecurityDesc>GEZ6</SecurityDesc> + <MDEntryPx>94.275</MDEntryPx> + <MDEntrySize>50</MDEntrySize> + <NumberOfOrders>5</NumberOfOrders> + </MDEntry> + <MDEntry> + <MDUpdateAction>0</MDUpdateAction> + <MDEntryType>0</MDEntryType> + <MDPriceLevel>2</MDPriceLevel> + <SecurityDesc>GEZ6</SecurityDesc> + <MDEntryPx>94.250</MDEntryPx> + <MDEntrySize>75</MDEntrySize> + <NumberOfOrders>7</NumberOfOrders> + </MDEntry> + <MDEntry> + <MDUpdateAction>1</MDUpdateAction> + <MDEntryType>0</MDEntryType> + <MDPriceLevel>3</MDPriceLevel> + <SecurityDesc>GEZ6</SecurityDesc> + <MDEntryPx>94.225</MDEntryPx> + <MDEntrySize>20</MDEntrySize> + <NumberOfOrders>4</NumberOfOrders> + </MDEntry> + <MDEntry> + <MDUpdateAction>0</MDUpdateAction> + <MDEntryType>1</MDEntryType> + <MDPriceLevel>1</MDPriceLevel> + <SecurityDesc>GEZ6</SecurityDesc> + <MDEntryPx>94.350</MDEntryPx> + <MDEntrySize>150</MDEntrySize> + <NumberOfOrders>15</NumberOfOrders> + </MDEntry> + </MDEntries> + </MDIncRefresh> +</messages> \ No newline at end of file Added: trunk/src/test/resources/FPL/messages.fast =================================================================== (Binary files differ) Property changes on: trunk/src/test/resources/FPL/messages.fast ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2007-12-07 17:05:41
|
Revision: 103 http://openfast.svn.sourceforge.net/openfast/?rev=103&view=rev Author: jacob_northey Date: 2007-12-07 09:05:44 -0800 (Fri, 07 Dec 2007) Log Message: ----------- Moved repositories to publicly accessible www directory on SourceForge; Fixed increment encoding bug Modified Paths: -------------- trunk/pom.xml trunk/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java Added Paths: ----------- trunk/src/test/java/org/openfast/submitted/IncrementOperatorTest.java Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-12-06 20:03:28 UTC (rev 102) +++ trunk/pom.xml 2007-12-07 17:05:44 UTC (rev 103) @@ -137,12 +137,12 @@ <repository> <id>sourceforge.net</id> <name>Sourceforge.net Repository</name> - <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/maven/release</url> + <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/htdocs/maven/release</url> </repository> <snapshotRepository> <id>sourceforge.net</id> <name>Sourceforge.net Snapshot Repository</name> - <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/maven/snapshot</url> + <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/htdocs/maven/snapshot</url> </snapshotRepository> </distributionManagement> </project> \ No newline at end of file Modified: trunk/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java =================================================================== --- trunk/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java 2007-12-06 20:03:28 UTC (rev 102) +++ trunk/src/main/java/org/openfast/template/operator/IncrementIntegerOperatorCodec.java 2007-12-07 17:05:44 UTC (rev 103) @@ -22,10 +22,9 @@ if (value == null) { if (field.isOptional()) { - if (priorValue == ScalarValue.UNDEFINED) { - return null; + if (priorValue == ScalarValue.UNDEFINED && field.getDefaultValue().isUndefined()) { + return null; } - return ScalarValue.NULL; } else { throw new IllegalArgumentException(); Added: trunk/src/test/java/org/openfast/submitted/IncrementOperatorTest.java =================================================================== --- trunk/src/test/java/org/openfast/submitted/IncrementOperatorTest.java (rev 0) +++ trunk/src/test/java/org/openfast/submitted/IncrementOperatorTest.java 2007-12-07 17:05:44 UTC (rev 103) @@ -0,0 +1,36 @@ +package org.openfast.submitted; + +import org.openfast.IntegerValue; +import org.openfast.Message; +import org.openfast.ScalarValue; +import org.openfast.codec.FastEncoder; +import org.openfast.template.Field; +import org.openfast.template.MessageTemplate; +import org.openfast.template.Scalar; +import org.openfast.template.operator.Operator; +import org.openfast.template.type.Type; +import org.openfast.test.OpenFastTestCase; + +public class IncrementOperatorTest extends OpenFastTestCase { + public void testOptionalIncrementWithNoInitialValue() { + MessageTemplate template = new MessageTemplate("t", new Field[] { + new Scalar("1", Type.U32, Operator.INCREMENT, ScalarValue.UNDEFINED, true), + }); + FastEncoder encoder = encoder(template); + Message message = new Message(template); + assertEquals("11000000 10000001", encoder.encode(message)); + } + + public void testOptionalIncrementWithInitialValue() { + MessageTemplate template = new MessageTemplate("t", new Field[] { + new Scalar("1", Type.U32, Operator.INCREMENT, new IntegerValue(1), true), + }); + FastEncoder encoder = encoder(template); + Message message = new Message(template); + assertEquals("11100000 10000001 10000000", encoder.encode(message)); + + encoder.reset(); + message.setFieldValue(1, new IntegerValue(1)); + assertEquals("11000000 10000001", encoder.encode(message)); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2007-12-06 20:03:25
|
Revision: 102 http://openfast.svn.sourceforge.net/openfast/?rev=102&view=rev Author: jacob_northey Date: 2007-12-06 12:03:28 -0800 (Thu, 06 Dec 2007) Log Message: ----------- Deleted unused test resources; Organized existing resources Modified Paths: -------------- trunk/src/test/java/org/openfast/scenario/CmeTemplateTest.java trunk/src/test/java/org/openfast/submitted/OpraFeedTest.java trunk/src/test/java/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java Added Paths: ----------- trunk/src/test/resources/CME/ trunk/src/test/resources/CME/messages.fast trunk/src/test/resources/CME/templates.xml trunk/src/test/resources/FPL/ trunk/src/test/resources/FPL/mdIncrementalRefreshTemplate.xml trunk/src/test/resources/OPRA/ trunk/src/test/resources/OPRA/OPRATemplate.xml trunk/src/test/resources/OPRA/messages.fast Removed Paths: ------------- trunk/src/test/resources/1.fast trunk/src/test/resources/DumpBinary.java trunk/src/test/resources/FASTTestTemplate.xml trunk/src/test/resources/HexDump.java trunk/src/test/resources/OPRATemplate.xml trunk/src/test/resources/OpraFeed.java trunk/src/test/resources/mdIncrementalRefreshTemplate.xml trunk/src/test/resources/messages.fast trunk/src/test/resources/templates.xml trunk/src/test/resources/testmsgs.encoded Modified: trunk/src/test/java/org/openfast/scenario/CmeTemplateTest.java =================================================================== --- trunk/src/test/java/org/openfast/scenario/CmeTemplateTest.java 2007-12-06 19:43:37 UTC (rev 101) +++ trunk/src/test/java/org/openfast/scenario/CmeTemplateTest.java 2007-12-06 20:03:28 UTC (rev 102) @@ -8,14 +8,13 @@ import org.openfast.test.OpenFastTestCase; public class CmeTemplateTest extends OpenFastTestCase { - public void testDeltas() throws Exception { - InputStream templateSource = resource("templates.xml"); + InputStream templateSource = resource("CME/templates.xml"); XMLMessageTemplateLoader templateLoader = new XMLMessageTemplateLoader(); templateLoader.setLoadTemplateIdFromAuxId(true); templateLoader.load(templateSource); - InputStream is = resource("1.fast"); + InputStream is = resource("CME/messages.fast"); MessageInputStream mis = new MessageInputStream(is); mis.setTemplateRegistry(templateLoader.getTemplateRegistry()); Message md = mis.readMessage(); Modified: trunk/src/test/java/org/openfast/submitted/OpraFeedTest.java =================================================================== --- trunk/src/test/java/org/openfast/submitted/OpraFeedTest.java 2007-12-06 19:43:37 UTC (rev 101) +++ trunk/src/test/java/org/openfast/submitted/OpraFeedTest.java 2007-12-06 20:03:28 UTC (rev 102) @@ -41,10 +41,10 @@ public void testReadFeed() { XMLMessageTemplateLoader loader = new XMLMessageTemplateLoader(); - loader.load(resource("OPRATemplate.xml")); + loader.load(resource("OPRA/OPRATemplate.xml")); loader.getTemplateRegistry().register(0, "OPRA"); - MessageInputStream in = new MessageInputStream(resource("testmsgs.encoded")); + MessageInputStream in = new MessageInputStream(resource("OPRA/messages.fast")); OpraBlockReader opraBlockReader = new OpraBlockReader(); in.setBlockReader(opraBlockReader); in.getContext().setTraceEnabled(true); Modified: trunk/src/test/java/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java =================================================================== --- trunk/src/test/java/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java 2007-12-06 19:43:37 UTC (rev 101) +++ trunk/src/test/java/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java 2007-12-06 20:03:28 UTC (rev 102) @@ -133,7 +133,7 @@ } public void testLoadMdIncrementalRefreshTemplate() { - InputStream templateStream = resource("mdIncrementalRefreshTemplate.xml"); + InputStream templateStream = resource("FPL/mdIncrementalRefreshTemplate.xml"); MessageTemplateLoader loader = new XMLMessageTemplateLoader(); MessageTemplate messageTemplate = loader.load(templateStream)[0]; Deleted: trunk/src/test/resources/1.fast =================================================================== --- trunk/src/test/resources/1.fast 2007-12-06 19:43:37 UTC (rev 101) +++ trunk/src/test/resources/1.fast 2007-12-06 20:03:28 UTC (rev 102) @@ -1,2 +0,0 @@ -\xC0\xA1;\xEB#SR M\x83 I\xA0$\xA9\xF6 -8\xC1\x90X\xDFK\xA3[Hi\xD0 \ No newline at end of file Copied: trunk/src/test/resources/CME/messages.fast (from rev 100, trunk/src/test/resources/1.fast) =================================================================== --- trunk/src/test/resources/CME/messages.fast (rev 0) +++ trunk/src/test/resources/CME/messages.fast 2007-12-06 20:03:28 UTC (rev 102) @@ -0,0 +1,2 @@ +\xC0\xA1;\xEB#SR M\x83 I\xA0$\xA9\xF6 +8\xC1\x90X\xDFK\xA3[Hi\xD0 \ No newline at end of file Copied: trunk/src/test/resources/CME/templates.xml (from rev 100, trunk/src/test/resources/templates.xml) =================================================================== --- trunk/src/test/resources/CME/templates.xml (rev 0) +++ trunk/src/test/resources/CME/templates.xml 2007-12-06 20:03:28 UTC (rev 102) @@ -0,0 +1,1465 @@ +<?xml version="1.0" encoding="UTF-8"?> +<templates> + <template name="MDIncRefresh_30" id="30" dictionary="30" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <default value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <delta/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <default/> + </uInt32> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="QuoteCondition" id="276" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_32" id="32" dictionary="32" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <increment/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <uInt32 name="NumberOfOrders" id="346"> + <delta/> + </uInt32> + <string name="TradingSessionID" id="336"> + <default value="2"/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_33" id="33" dictionary="33" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <default value="0"/> + </uInt32> + <string name="MDEntryType" id="269"> + <default value="2"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <delta/> + </uInt32> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_34" id="34" dictionary="34" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <copy value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <string name="QuoteCondition" id="276" presence="optional"> + <copy value="K"/> + </string> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <default/> + </uInt32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <default/> + </uInt32> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_35" id="35" dictionary="35" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <copy value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <delta/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <string name="QuoteCondition" id="276" presence="optional"> + <copy value="K"/> + </string> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <copy/> + </uInt32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <string name="TradingSessionID" id="336"> + <default value="2"/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_36" id="36" dictionary="36" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <copy value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <string name="QuoteCondition" id="276"> + <copy value="K"/> + </string> + <string name="TradingSessionID" id="336"> + <default value="2"/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_37" id="37" dictionary="37" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <default value="0"/> + </uInt32> + <string name="MDEntryType" id="269"> + <default value="2"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <delta/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <delta/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="-1"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default value="-1"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <delta/> + </uInt32> + <string name="TradeCondition" id="277" presence="optional"> + <copy value="1"/> + </string> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_38" id="38" dictionary="38" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <increment/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <default/> + </uInt32> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <default/> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="QuoteCondition" id="276" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_39" id="39" dictionary="39" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <increment/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <string name="TradingSessionID" id="336"> + <default value="2"/> + </string> + <uInt32 name="NumberOfOrders" id="346"> + <delta/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_40" id="40" dictionary="40" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <default value="0"/> + </uInt32> + <string name="MDEntryType" id="269"> + <default value="2"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <delta/> + </uInt32> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_41" id="41" dictionary="41" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <constant value="5"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <constant value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="1"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <delta/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <delta/> + </uInt32> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <uInt32 name="MDEntryTime" id="273"> + <delta/> + </uInt32> + <string name="TradingSessionID" id="336"> + <default value="2"/> + </string> + <uInt32 name="NumberOfOrders" id="346"> + <copy value="1"/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_42" id="42" dictionary="42" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <default value="5"/> + </uInt32> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <copy value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="1"/> + </string> + <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <default value="1"/> + </uInt32> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <default/> + </uInt32> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="QuoteCondition" id="276" presence="optional"> + <default/> + </string> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_43" id="43" dictionary="43" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <constant value="5"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <constant value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="1"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <delta/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <delta/> + </uInt32> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <uInt32 name="NumberOfOrders" id="346"> + <copy/> + </uInt32> + <uInt32 name="MDQuoteType" id="1070" presence="optional"> + <default/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_44" id="44" dictionary="44" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <constant value="5"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <constant value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="1"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <uInt32 name="NumberOfOrders" id="346"> + <copy/> + </uInt32> + <uInt32 name="MDQuoteType" id="1070" presence="optional"> + <constant value="0"/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_45" id="45" dictionary="45" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="5"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <copy value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="1"/> + </string> + <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <copy value="1"/> + </uInt32> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <default/> + </uInt32> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="QuoteCondition" id="276" presence="optional"> + <default/> + </string> + <uInt32 name="MDQuoteType" id="1070" presence="optional"> + <default/> + </uInt32> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDSecurityDefinition" id="46" dictionary="46" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + + <string name="MessageType" id="35"> + <constant value="d"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="MDTotalNum" id="911" presence="optional"/> + <sequence name="Events" presence="optional"> + <length name="NoEvents" id="864"/> + <uInt32 name="EventType" id="865" presence="optional"> + <delta/> + </uInt32> + <uInt64 name="EventDate" id="866" presence="optional"> + <delta/> + </uInt64> + <uInt64 name="EventTime" id="1145" presence="optional"> + <delta/> + </uInt64> + </sequence> + + <decimal name="TradingReferencePrice" id="1150" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <decimal name="HighLimitPx" id="1149" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <decimal name="LowLimitPx" id="1148" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <string name="SecurityGroup" id="1151" presence="optional"/> + <string name="Symbol" id="55" presence="optional"/> + <string name="SecurityDesc" id="107" presence="optional"/> + <uInt32 name="SecurityID" id="48" presence="optional"/> + <uInt32 name="SecurityIDSource" id="22" presence="optional"> + <constant value="8"/> + </uInt32> + <string name="CFICode" id="461" presence="optional"/> + <string name="UnderlyingProduct" id="462" presence="optional"/> + <string name="SecurityExchange" id="207" presence="optional"/> + <string name="PricingModel" id="9853" presence="optional"/> + <decimal name="MinCabPrice" id="9850" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <uInt32 name="ExpirationCycle" id="827" presence="optional"/> + <string name="UnitOfMeasureQty" id="1147" presence="optional"/> + <decimal name="StrikePrice" id="202" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <string name="StrikeCurrency" id="947" presence="optional"/> + <uInt64 name="MinTradeVol" id="562" presence="optional"/> + <uInt64 name="MaxTradeVol" id="1140" presence="optional"/> + <string name="Currency" id="15" presence="optional"/> + <string name="SettlCurrency" id="120" presence="optional"/> + <sequence name="MDFeedTypes" presence="optional"> + <length name="NoMDFeedTypes" id="1141"/> + <string name="MDFeedType" id="1022"> + <constant value="GBX"/> + </string> + <uInt32 name="MarketDepth" id="264"/> + </sequence> + <string name="MatchAlgo" id="1142" presence="optional"/> + <string name="SecuritySubType" id="762" presence="optional"/> + + <sequence name="Underlyings" presence="optional"> + <length name="NoUnderlyings" id="711"/> + <string name="UnderlyingSymbol" id="311"> + <constant value="[N/A]"/> + </string> + <uInt32 name="UnderlyingSecurityID" id="309"> + <delta/> + </uInt32> + <uInt32 name="UnderlyingSecurityIDSource" id="305"> + <constant value="8"/> + </uInt32> + </sequence> + <string name="MaxPriceVariation" id="1143" presence="optional"/> + <string name="ImpliedMarketIndicator" id="1144" presence="optional"/> + + <sequence name="InstrAttrib" presence="optional"> + <length name="NoInstrAttrib" id="870"/> + <uInt64 name="InstrAttribType" id="871"> + <delta/> + </uInt64> + <string name="InstrAttribValue" id="872" presence="optional"> + <copy/> + </string> + </sequence> + <uInt64 name="MaturityDate" id="200" presence="optional"/> + <decimal name="MinPriceIncrement" id="969" presence="optional"> + <exponent> + <copy value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <decimal name="MinPriceIncrementAmount" id="1146" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <decimal name="DisplayFactor" id="9787" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + + <sequence name="Legs" presence="optional"> + <length name="NoLegs" id="555"/> + <string name="LegSymbol" id="600"> + <default value="[N/A]"/> + </string> + <uInt32 name="LegRatioQty" id="623"> + <copy/> + </uInt32> + <uInt64 name="LegSecurityID" id="602"> + <delta/> + </uInt64> + <uInt32 name="LegSecurityIDSource" id="603"> + <constant value="8"/> + </uInt32> + <string name="LegSide" id="624" presence="optional"> + <default value="1"/> + </string> + <string name="LegCFICode" id="608" presence="optional"> + <copy/> + </string> + <string name="LegSecuritySubType" id="764" presence="optional"> + <copy/> + </string> + <string name="LegCurrency" id="556" presence="optional"> + <copy/> + </string> + <uInt64 name="LegMaturityMonthYear" id="610" presence="optional"> + <delta/> + </uInt64> + <decimal name="LegStrikePrice" id="612" presence="optional"> + <exponent> + <copy value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <string name="LegStrikeCurrency" id="942" presence="optional"> + <copy/> + </string> + <decimal name="LegPrice" id="566" presence="optional"> + <exponent> + <copy value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <decimal name="LegOptionDelta" id="1017" presence="optional"> + <exponent> + <copy value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + </sequence> + </template> + + <template name="MDQuoteRequest" id="47" dictionary="47" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="R"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <sequence name="RelatedSym"> + <length name="NoRelatedSym" id="146"/> + <string name="Symbol" id="55"> + <constant value="[N/A]"/> + </string> + <uInt64 name="OrderQty" id="38" presence="optional"/> + + <uInt32 name="Side" id="54" presence="optional"> + <default value="1"/> + </uInt32> + + <uInt64 name="TransactTime" id="60"/> + + <uInt32 name="QuoteType" id="537"> + <default value="1"/> + </uInt32> + + <string name="QuoteReqID" id="131" presence="optional"/> + + <uInt32 name="SecurityID" id="48"/> + + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + </sequence> + </template> + + <template name="MDSecurityStatus" id="48" dictionary="48" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="f"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="SecurityID" id="48" presence="optional"/> + <uInt32 name="SecurityIDSource" id="22" presence="optional"> + <constant value="8"/> + </uInt32> + <decimal name="HighPx" id="332" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <decimal name="LowPx" id="333" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <string name="Symbol" id="55" presence="optional"/> + <uInt32 name="SecurityTradingStatus" id="326" presence="optional"/> + </template> + + <template name="MDNewsMessage" id="49" dictionary="49" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="B"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="Headline" id="147"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <sequence name="LinesOfText"> + <length name="NoLinesOfText" id="33"/> + <string name="text" id="58"> + <copy/> + </string> + </sequence> + </template> + + + <template name="MDHeartbeat" id="50" dictionary="50" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="0"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + </template> + + <template name="MDSnapshotFullRefresh_51" id="51" dictionary="51" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="MessageType" id="35"> + <constant value="W"/> + </string> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt64 name="SendingTime" id="52"/> + + + <uInt32 name="LastMsgSeqNumProcessed" id="369"/> + <uInt32 name="TotalNumReports" id="911"/> + <uInt32 name="MDBookType" id="1021"/> + <uInt32 name="SecurityID" id="48"> + <delta/> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + + + + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <string name="MDEntryType" id="269"> + <default value="2"/> + </string> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <string name="QuoteCondition" id="276" presence="optional"> + <default value="K"/> + </string> + <string name="TradeCondition" id="277" presence="optional"> + <constant value="U"/> + </string> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <copy value="1"/> + </uInt32> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <copy/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <delta/> + </uInt32> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + </sequence> + </template> + + <template name="MDLogon" id="1" dictionary="1" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="A"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="applFeedId" id="1180"> + <constant value="REPLAY"/> + </string> + <uInt32 name="encryptMethod" id="98"> + <constant value="0"/> + </uInt32> + <uInt32 name="heartbeatInt" id="108"/> + <string name="DefaultApplVerID" id="1137"> + <constant value="8"/> + </string> + </template> + + <template name="MDLogout" id="2" dictionary="2" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="5"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="applFeedId" id="1180"> + <constant value="REPLAY"/> + </string> + <string name="text" id="58" presence="optional"/> + </template> + +</templates> \ No newline at end of file Deleted: trunk/src/test/resources/DumpBinary.java =================================================================== --- trunk/src/test/resources/DumpBinary.java 2007-12-06 19:43:37 UTC (rev 101) +++ trunk/src/test/resources/DumpBinary.java 2007-12-06 20:03:28 UTC (rev 102) @@ -1,37 +0,0 @@ -package com.nywe.test; - -public class DumpBinary -{ - public static void dump ( byte[] byteArray ) - { - int line = 0; - - for ( int i=0; i<byteArray.length; i++) - { - byte tByte = byteArray[i]; - - for ( int j=0; j<8; j++) - { - byte tst =(byte)(0x80 & tByte); - - String ss = ( Math.abs(tst) == 0x80 ) ? "1" : "0"; - tByte = (byte)(tByte << 1); - - System.err.print(ss); - } - - if ( line > 3 ) - { - System.err.println(); - line = 0; - } - else - { - System.err.print(" "); - line++; - } - - } - } -} - Deleted: trunk/src/test/resources/FASTTestTemplate.xml =================================================================== --- trunk/src/test/resources/FASTTestTemplate.xml 2007-12-06 19:43:37 UTC (rev 101) +++ trunk/src/test/resources/FASTTestTemplate.xml 2007-12-06 20:03:28 UTC (rev 102) @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<template name="MDIncRefresh" id="35" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.fixprotocol.org/ns/fast/td/1.1 T:\dev05\MDS\MDST\source\mdst\config\FAST\FASTTemplate.xsd"> - <typeRef name="MDIncRefresh"/> - <string name="ApplVerID" id="1128"> <constant value="FIX.5.0"/> </string> - <string name="MessageType" id="35"> <constant value="X"/> </string> - <string name="SenderCompID" id="49"> <constant value="CME"/> </string> - <int32 name="MsgSeqNum" id="34"> <increment/> </int32> - <int64 name="SendingTime" id="52"> <delta/> </int64> - <sequence name="MDEntries"> <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> <default value="0"/> </uInt32> - <string name="MDEntryType" id="269"> <copy/> </string> - <uInt32 name="MDPriceLevel" id="1023" presence="optional"> <increment value="1"/> - </uInt32> - <string name="SecurityDesc" id="107"> <copy/> </string> - <decimal name="MDEntryPx" id="270"> - <exponent><default value="-3"/></exponent> - <mantissa><delta/></mantissa></decimal> - <uInt32 name="MDEntrySize" id="271"> <delta/> </uInt32> - <uInt32 name="NumberOfOrders" id="346" presence="optional"> <delta/> </uInt32> - <string name="QuoteCondition" id="276" presence="optional"> <default/> </string> - <string name="TradeCondition" id="277" presence="optional"> <default/> </string> - </sequence> - </template> \ No newline at end of file Copied: trunk/src/test/resources/FPL/mdIncrementalRefreshTemplate.xml (from rev 100, trunk/src/test/resources/mdIncrementalRefreshTemplate.xml) =================================================================== --- trunk/src/test/resources/FPL/mdIncrementalRefreshTemplate.xml (rev 0) +++ trunk/src/test/resources/FPL/mdIncrementalRefreshTemplate.xml 2007-12-06 20:03:28 UTC (rev 102) @@ -0,0 +1,35 @@ +<templates xmlns="http://www.fixprotocol.org/ns/template-definition" + ns="http://www.fixprotocol.org/ns/templates/sample"> + <template name="MDRefreshSample"> + <typeRef name="MDIncrementalRefresh"/> + <string name="8"><constant value="FIX4.4"/></string> + <uInt32 name="9"><constant value="1"/></uInt32> + <string name="35"><constant value="X"/></string> + <string name="49"><constant value="CME"/></string> + <uInt32 name="34"><increment value="1"/></uInt32> + <string name="52"><delta/></string> + <uInt32 name="75"><copy/></uInt32> + <sequence name="MDEntries"> + <typeRef name="MDEntries"/> + <length name="268"/> + <decimal name="270"><delta/></decimal> + <int32 name="271"><delta/></int32> + <uInt32 name="273"><delta/></uInt32> + <uInt32 name="346" presence="optional"/> + <uInt32 name="1023"><increment value="1"/></uInt32> + <string name="279"><copy/></string> + <string name="269"><copy/></string> + <string name="107"><copy/></string> + <string name="48"><delta/></string> + <string name="276"><copy/></string> + <string name="274"><copy/></string> + <decimal name="451"><copy/></decimal> + <string name="277"><default value="F"/></string> + <uInt32 name="1020" presence="optional"/> + <int32 name="537"><default value="1"/></int32> + <string name="1024"><default value="0"/></string> + <string name="336"><default value="2"/></string> + </sequence> + <string name="10"/> + </template> +</templates> \ No newline at end of file Deleted: trunk/src/test/resources/HexDump.java =================================================================== --- trunk/src/test/resources/HexDump.java 2007-12-06 19:43:37 UTC (rev 101) +++ trunk/src/test/resources/HexDump.java 2007-12-06 20:03:28 UTC (rev 102) @@ -1,152 +0,0 @@ -package com.nywe.test; - - -import java.io.OutputStreamWriter; -import java.io.PrintStream; -import java.io.PrintWriter; - - -public class HexDump - { - private static final int ROW_BYTES = 16; - private static final int ROW_QTR1 = 3; - private static final int ROW_HALF = 7; - private static final int ROW_QTR2 = 11; - - - public static void dumpHexData( byte[] buf ) - { - dumpHexData ( System.err,"HexDump", buf, buf.length ); - } - - public static void dumpHexData( String pTitle, byte[] buf ) - { - dumpHexData ( System.err, pTitle, buf, buf.length ); - } - - public static void dumpHexData( PrintStream out, String title, byte[] buf, int numBytes ) - { - PrintWriter wrtr = - new PrintWriter( new OutputStreamWriter( out ) ); - - HexDump.dumpHexData( wrtr, title, buf, 0, numBytes ); - } - - public static void - dumpHexData( - PrintWriter out, String title, - byte[] buf, int offset, int numBytes ) - { - int rows, residue, i, j; - byte[] save_buf= new byte[ ROW_BYTES+2 ]; - char[] hex_buf = new char[ 4 ]; - char[] idx_buf = new char[ 8 ]; - char[] hex_chars = new char[20]; - - hex_chars[0] = '0'; - hex_chars[1] = '1'; - hex_chars[2] = '2'; - hex_chars[3] = '3'; - hex_chars[4] = '4'; - hex_chars[5] = '5'; - hex_chars[6] = '6'; - hex_chars[7] = '7'; - hex_chars[8] = '8'; - hex_chars[9] = '9'; - hex_chars[10] = 'A'; - hex_chars[11] = 'B'; - hex_chars[12] = 'C'; - hex_chars[13] = 'D'; - hex_chars[14] = 'E'; - hex_chars[15] = 'F'; - - out.println( title + " - " + numBytes + " bytes." ); - rows = numBytes >> 4; - residue = numBytes & 0x0000000F; - for ( i = 0 ; i < rows ; i++ ) - { - int hexVal = (i * ROW_BYTES); - idx_buf[0] = hex_chars[ ((hexVal >> 12) & 15) ]; - idx_buf[1] = hex_chars[ ((hexVal >> 8) & 15) ]; - idx_buf[2] = hex_chars[ ((hexVal >> 4) & 15) ]; - idx_buf[3] = hex_chars[ (hexVal & 15) ]; - - String idxStr = new String( idx_buf, 0, 4 ); - out.print( idxStr + ": " ); - - for ( j = 0 ; j < ROW_BYTES ; j++ ) - { - save_buf[j] = buf[ offset + (i * ROW_BYTES) + j ]; - - hex_buf[0] = hex_chars[ (save_buf[j] >> 4) & 0x0F ]; - hex_buf[1] = hex_chars[ save_buf[j] & 0x0F ]; - - out.print( hex_buf[0] ); - out.print( hex_buf[1] ); - out.print( ' ' ); - - if ( j == ROW_QTR1 || j == ROW_HALF || j == ROW_QTR2 ) - out.print( " " ); - - if ( save_buf[j] < 0x20 || save_buf[j] > 0x7E ) - save_buf[j] = (byte) '.'; - } - - String saveStr = new String( save_buf, 0, j ); - out.println( " | " + saveStr + " |" ); - } - - if ( residue > 0 ) - { - int hexVal = (i * ROW_BYTES); - idx_buf[0] = hex_chars[ ((hexVal >> 12) & 15) ]; - idx_buf[1] = hex_chars[ ((hexVal >> 8) & 15) ]; - idx_buf[2] = hex_chars[ ((hexVal >> 4) & 15) ]; - idx_buf[3] = hex_chars[ (hexVal & 15) ]; - - String idxStr = new String( idx_buf, 0, 4 ); - out.print( idxStr + ": " ); - - for ( j = 0 ; j < residue ; j++ ) - { - save_buf[j] = buf[ offset + (i * ROW_BYTES) + j ]; - - hex_buf[0] = hex_chars[ (save_buf[j] >> 4) & 0x0F ]; - hex_buf[1] = hex_chars[ save_buf[j] & 0x0F ]; - - out.print( (char)hex_buf[0] ); - out.print( (char)hex_buf[1] ); - out.print( ' ' ); - - if ( j == ROW_QTR1 || j == ROW_HALF || j == ROW_QTR2 ) - out.print( " " ); - - if ( save_buf[j] < 0x20 || save_buf[j] > 0x7E ) - save_buf[j] = (byte) '.'; - } - - for ( /*j INHERITED*/ ; j < ROW_BYTES ; j++ ) - { - save_buf[j] = (byte) ' '; - out.print( " " ); - if ( j == ROW_QTR1 || j == ROW_HALF || j == ROW_QTR2 ) - out.print( " " ); - } - - String saveStr = new String( save_buf, 0, j ); - out.println( " | " + saveStr + " |" ); - } - - out.flush(); - } - - static public void main( String[] args ) - { - byte[] data = new byte[132]; - for ( int i = 0 ; i < 132 ; ++i ) data[i] = (byte)i; - - HexDump.dumpHexData( System.err, "Test HexDump", data, 132 ); - } - - } - Copied: trunk/src/test/resources/OPRA/OPRATemplate.xml (from rev 101, trunk/src/test/resources/OPRATemplate.xml) =================================================================== --- trunk/src/test/resources/OPRA/OPRATemplate.xml (rev 0) +++ trunk/src/test/resources/OPRA/OPRATemplate.xml 2007-12-06 20:03:28 UTC (rev 102) @@ -0,0 +1,59 @@ +<templates xmlns="http://www.fixprotocol.org/ns/template-definition" + ns="http://www.fixprotocol.org/ns/templates/sample"> + <template name="OPRA"> + <typeRef name="OPRAFast"/> + <uInt32 name="MESSAGE_CATEGORY"><copy/></uInt32> + <uInt32 name="MESSAGE_TYPE"><copy/></uInt32> + <uInt32 name="PARTICIPANT_ID"><copy/></uInt32> + <uInt32 name="RETRANSMISSION_REQUESTER" presence="optional"><copy/></uInt32> + <uInt32 name="MESSAGE_SEQUENCE_NUMBER"><increment/></uInt32> + <uInt32 name="TIME"><copy/></uInt32> + <string name="SECURITY_SYMBOL" presence="optional"><copy/></string> + <uInt32 name="EXPIRATION_DATE" presence="optional"><copy/></uInt32> + <uInt32 name="YEAR" presence="optional" ><copy/></uInt32> + <uInt32 name="STRIKE_PRICE_CODE" presence="optional"><copy/></uInt32> + <uInt32 name="STRIKE_PRICE_DENOMINATOR_CODE" presence="optional"><copy/></uInt32> + <uInt32 name="EXPLICIT_STRIKE_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="PREMIUM_PRICE_DENOMINATOR_CODE" presence="optional"><copy/></uInt32> + <uInt32 name="BID_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="BID_SIZE" presence="optional"><copy/></uInt32> + <uInt32 name="OFFER_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="OFFER_SIZE" presence="optional"><copy/></uInt32> + <uInt32 name="SESSION_INDICATOR" presence="optional"><copy/></uInt32> + <uInt32 name="BBO_INDICATOR" presence="optional"><copy/></uInt32> + <uInt32 name="BEST_BID_PARTICIPANT_ID" presence="optional"><copy/></uInt32> + <uInt32 name="BEST_BID_PRICE_DENOMINATOR_CODE" presence="optional"><copy/></uInt32> + <uInt32 name="BEST_BID_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="BEST_BID_SIZE" presence="optional"><copy/></uInt32> + <uInt32 name="BEST_OFFER_PARTICIPANT_ID" presence="optional"><copy/></uInt32> + <uInt32 name="BEST_OFFER_PRICE_DENOMINATOR_CODE" presence="optional"><copy/></uInt32> + <uInt32 name="BEST_OFFER_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="BEST_OFFER_SIZE" presence="optional"><copy/></uInt32> + <string name="RESERVED_FIELD_1" presence="optional"><copy/></string> + <string name="RESERVED_FIELD_2" presence="optional"><copy/></string> + <string name="RESERVED_FIELD_3" presence="optional"><copy/></string> + <uInt32 name="OPEN_INT_VOLUME" presence="optional"><copy/></uInt32> + <uInt32 name="VOLUME" presence="optional"><copy/></uInt32> + <uInt32 name="PREMIUM_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="OPEN_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="HIGH_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="LOW_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="LAST_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="NET_CHANGE_INDICATOR" presence="optional"><copy/></uInt32> + <uInt32 name="NET_CHANGE" presence="optional"><copy/></uInt32> + <uInt32 name="UNDERLYING_PRICE_DENOM" presence="optional"><copy/></uInt32> + <uInt32 name="UNDERLYING_STOCK_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="NUMBER_OF_INDICES_IN_GROUP" presence="optional"><copy/></uInt32> + ... [truncated message content] |
From: <ope...@li...> - 2007-12-06 19:43:35
|
Revision: 101 http://openfast.svn.sourceforge.net/openfast/?rev=101&view=rev Author: jacob_northey Date: 2007-12-06 11:43:37 -0800 (Thu, 06 Dec 2007) Log Message: ----------- Added MessageBlockReader.java for reading multicast messages. Modified Paths: -------------- trunk/src/main/java/org/openfast/MessageInputStream.java Added Paths: ----------- trunk/src/main/java/org/openfast/MessageBlockReader.java trunk/src/test/java/org/openfast/submitted/OpraFeedTest.java trunk/src/test/resources/DumpBinary.java trunk/src/test/resources/HexDump.java trunk/src/test/resources/OPRATemplate.xml trunk/src/test/resources/OpraFeed.java trunk/src/test/resources/testmsgs.encoded Removed Paths: ------------- trunk/test/ Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - bin build doc build_sf target .classpath .project + bin build doc build_sf target .classpath .project .settings Added: trunk/src/main/java/org/openfast/MessageBlockReader.java =================================================================== --- trunk/src/main/java/org/openfast/MessageBlockReader.java (rev 0) +++ trunk/src/main/java/org/openfast/MessageBlockReader.java 2007-12-06 19:43:37 UTC (rev 101) @@ -0,0 +1,18 @@ +package org.openfast; + +import java.io.InputStream; + +public interface MessageBlockReader { + + MessageBlockReader NULL = new MessageBlockReader(){ + public boolean readBlock(InputStream in) { + return true; + } + + public void messageRead(InputStream in, Message message) { + }}; + + boolean readBlock(InputStream in); + void messageRead(InputStream in, Message message); + +} Modified: trunk/src/main/java/org/openfast/MessageInputStream.java =================================================================== --- trunk/src/main/java/org/openfast/MessageInputStream.java 2007-12-06 17:26:54 UTC (rev 100) +++ trunk/src/main/java/org/openfast/MessageInputStream.java 2007-12-06 19:43:37 UTC (rev 101) @@ -42,6 +42,7 @@ private Context context; private Map templateHandlers = Collections.EMPTY_MAP; private List handlers = Collections.EMPTY_LIST; + private MessageBlockReader blockReader = MessageBlockReader.NULL; public MessageInputStream(InputStream inputStream) { this(inputStream, new Context()); @@ -61,11 +62,18 @@ if (context.isTraceEnabled()) context.startTrace(); + boolean keepReading = blockReader.readBlock(in); + + if (!keepReading) return null; + Message message = decoder.readMessage(); if (message == null) { return null; } + + blockReader.messageRead(in, message); + if (!handlers.isEmpty()) { for (int i=0; i<handlers.size(); i++) { ((MessageHandler) handlers.get(i)).handleMessage(message, context, decoder); @@ -130,4 +138,8 @@ public Context getContext() { return context; } + + public void setBlockReader(MessageBlockReader messageBlockReader) { + this.blockReader = messageBlockReader; + } } Added: trunk/src/test/java/org/openfast/submitted/OpraFeedTest.java =================================================================== --- trunk/src/test/java/org/openfast/submitted/OpraFeedTest.java (rev 0) +++ trunk/src/test/java/org/openfast/submitted/OpraFeedTest.java 2007-12-06 19:43:37 UTC (rev 101) @@ -0,0 +1,58 @@ +package org.openfast.submitted; + +import java.io.IOException; +import java.io.InputStream; + +import org.openfast.Message; +import org.openfast.MessageBlockReader; +import org.openfast.MessageInputStream; +import org.openfast.template.loader.XMLMessageTemplateLoader; +import org.openfast.test.OpenFastTestCase; + +public class OpraFeedTest extends OpenFastTestCase { + private final class OpraBlockReader implements MessageBlockReader { + private int bytesLeft; + public boolean readBlock(InputStream in) { + try { + if (bytesLeft == 0) { + bytesLeft = ((in.read() << 24) + (in.read() << 16) + (in.read() << 8) + (in.read() << 0)); + System.out.println("New block: " + bytesLeft + " bytes"); + in.read(); // read SOH byte + bytesLeft--; + } + int msgLen =(0x000000FF & in.read()); // read message length + bytesLeft--; + if (msgLen == 3) { + System.out.println("End of block."); + return readBlock(in); + } else { + System.out.println("Bytes left in block: " + bytesLeft); + System.out.println("Message length: " + msgLen); + bytesLeft-=msgLen; + } + return true; + } catch (IOException ioe) { + return false; + } + } + public void messageRead(InputStream in, Message message) { + } + } + + public void testReadFeed() { + XMLMessageTemplateLoader loader = new XMLMessageTemplateLoader(); + loader.load(resource("OPRATemplate.xml")); + loader.getTemplateRegistry().register(0, "OPRA"); + + MessageInputStream in = new MessageInputStream(resource("testmsgs.encoded")); + OpraBlockReader opraBlockReader = new OpraBlockReader(); + in.setBlockReader(opraBlockReader); + in.getContext().setTraceEnabled(true); + in.setTemplateRegistry(loader.getTemplateRegistry()); + Message msg = in.readMessage(); + while (msg != null) { + System.out.println(msg); + msg = in.readMessage(); + } + } +} Added: trunk/src/test/resources/DumpBinary.java =================================================================== --- trunk/src/test/resources/DumpBinary.java (rev 0) +++ trunk/src/test/resources/DumpBinary.java 2007-12-06 19:43:37 UTC (rev 101) @@ -0,0 +1,37 @@ +package com.nywe.test; + +public class DumpBinary +{ + public static void dump ( byte[] byteArray ) + { + int line = 0; + + for ( int i=0; i<byteArray.length; i++) + { + byte tByte = byteArray[i]; + + for ( int j=0; j<8; j++) + { + byte tst =(byte)(0x80 & tByte); + + String ss = ( Math.abs(tst) == 0x80 ) ? "1" : "0"; + tByte = (byte)(tByte << 1); + + System.err.print(ss); + } + + if ( line > 3 ) + { + System.err.println(); + line = 0; + } + else + { + System.err.print(" "); + line++; + } + + } + } +} + Added: trunk/src/test/resources/HexDump.java =================================================================== --- trunk/src/test/resources/HexDump.java (rev 0) +++ trunk/src/test/resources/HexDump.java 2007-12-06 19:43:37 UTC (rev 101) @@ -0,0 +1,152 @@ +package com.nywe.test; + + +import java.io.OutputStreamWriter; +import java.io.PrintStream; +import java.io.PrintWriter; + + +public class HexDump + { + private static final int ROW_BYTES = 16; + private static final int ROW_QTR1 = 3; + private static final int ROW_HALF = 7; + private static final int ROW_QTR2 = 11; + + + public static void dumpHexData( byte[] buf ) + { + dumpHexData ( System.err,"HexDump", buf, buf.length ); + } + + public static void dumpHexData( String pTitle, byte[] buf ) + { + dumpHexData ( System.err, pTitle, buf, buf.length ); + } + + public static void dumpHexData( PrintStream out, String title, byte[] buf, int numBytes ) + { + PrintWriter wrtr = + new PrintWriter( new OutputStreamWriter( out ) ); + + HexDump.dumpHexData( wrtr, title, buf, 0, numBytes ); + } + + public static void + dumpHexData( + PrintWriter out, String title, + byte[] buf, int offset, int numBytes ) + { + int rows, residue, i, j; + byte[] save_buf= new byte[ ROW_BYTES+2 ]; + char[] hex_buf = new char[ 4 ]; + char[] idx_buf = new char[ 8 ]; + char[] hex_chars = new char[20]; + + hex_chars[0] = '0'; + hex_chars[1] = '1'; + hex_chars[2] = '2'; + hex_chars[3] = '3'; + hex_chars[4] = '4'; + hex_chars[5] = '5'; + hex_chars[6] = '6'; + hex_chars[7] = '7'; + hex_chars[8] = '8'; + hex_chars[9] = '9'; + hex_chars[10] = 'A'; + hex_chars[11] = 'B'; + hex_chars[12] = 'C'; + hex_chars[13] = 'D'; + hex_chars[14] = 'E'; + hex_chars[15] = 'F'; + + out.println( title + " - " + numBytes + " bytes." ); + rows = numBytes >> 4; + residue = numBytes & 0x0000000F; + for ( i = 0 ; i < rows ; i++ ) + { + int hexVal = (i * ROW_BYTES); + idx_buf[0] = hex_chars[ ((hexVal >> 12) & 15) ]; + idx_buf[1] = hex_chars[ ((hexVal >> 8) & 15) ]; + idx_buf[2] = hex_chars[ ((hexVal >> 4) & 15) ]; + idx_buf[3] = hex_chars[ (hexVal & 15) ]; + + String idxStr = new String( idx_buf, 0, 4 ); + out.print( idxStr + ": " ); + + for ( j = 0 ; j < ROW_BYTES ; j++ ) + { + save_buf[j] = buf[ offset + (i * ROW_BYTES) + j ]; + + hex_buf[0] = hex_chars[ (save_buf[j] >> 4) & 0x0F ]; + hex_buf[1] = hex_chars[ save_buf[j] & 0x0F ]; + + out.print( hex_buf[0] ); + out.print( hex_buf[1] ); + out.print( ' ' ); + + if ( j == ROW_QTR1 || j == ROW_HALF || j == ROW_QTR2 ) + out.print( " " ); + + if ( save_buf[j] < 0x20 || save_buf[j] > 0x7E ) + save_buf[j] = (byte) '.'; + } + + String saveStr = new String( save_buf, 0, j ); + out.println( " | " + saveStr + " |" ); + } + + if ( residue > 0 ) + { + int hexVal = (i * ROW_BYTES); + idx_buf[0] = hex_chars[ ((hexVal >> 12) & 15) ]; + idx_buf[1] = hex_chars[ ((hexVal >> 8) & 15) ]; + idx_buf[2] = hex_chars[ ((hexVal >> 4) & 15) ]; + idx_buf[3] = hex_chars[ (hexVal & 15) ]; + + String idxStr = new String( idx_buf, 0, 4 ); + out.print( idxStr + ": " ); + + for ( j = 0 ; j < residue ; j++ ) + { + save_buf[j] = buf[ offset + (i * ROW_BYTES) + j ]; + + hex_buf[0] = hex_chars[ (save_buf[j] >> 4) & 0x0F ]; + hex_buf[1] = hex_chars[ save_buf[j] & 0x0F ]; + + out.print( (char)hex_buf[0] ); + out.print( (char)hex_buf[1] ); + out.print( ' ' ); + + if ( j == ROW_QTR1 || j == ROW_HALF || j == ROW_QTR2 ) + out.print( " " ); + + if ( save_buf[j] < 0x20 || save_buf[j] > 0x7E ) + save_buf[j] = (byte) '.'; + } + + for ( /*j INHERITED*/ ; j < ROW_BYTES ; j++ ) + { + save_buf[j] = (byte) ' '; + out.print( " " ); + if ( j == ROW_QTR1 || j == ROW_HALF || j == ROW_QTR2 ) + out.print( " " ); + } + + String saveStr = new String( save_buf, 0, j ); + out.println( " | " + saveStr + " |" ); + } + + out.flush(); + } + + static public void main( String[] args ) + { + byte[] data = new byte[132]; + for ( int i = 0 ; i < 132 ; ++i ) data[i] = (byte)i; + + HexDump.dumpHexData( System.err, "Test HexDump", data, 132 ); + } + + } + Added: trunk/src/test/resources/OPRATemplate.xml =================================================================== --- trunk/src/test/resources/OPRATemplate.xml (rev 0) +++ trunk/src/test/resources/OPRATemplate.xml 2007-12-06 19:43:37 UTC (rev 101) @@ -0,0 +1,59 @@ +<templates xmlns="http://www.fixprotocol.org/ns/template-definition" + ns="http://www.fixprotocol.org/ns/templates/sample"> + <template name="OPRA"> + <typeRef name="OPRAFast"/> + <uInt32 name="MESSAGE_CATEGORY"><copy/></uInt32> + <uInt32 name="MESSAGE_TYPE"><copy/></uInt32> + <uInt32 name="PARTICIPANT_ID"><copy/></uInt32> + <uInt32 name="RETRANSMISSION_REQUESTER" presence="optional"><copy/></uInt32> + <uInt32 name="MESSAGE_SEQUENCE_NUMBER"><increment/></uInt32> + <uInt32 name="TIME"><copy/></uInt32> + <string name="SECURITY_SYMBOL" presence="optional"><copy/></string> + <uInt32 name="EXPIRATION_DATE" presence="optional"><copy/></uInt32> + <uInt32 name="YEAR" presence="optional" ><copy/></uInt32> + <uInt32 name="STRIKE_PRICE_CODE" presence="optional"><copy/></uInt32> + <uInt32 name="STRIKE_PRICE_DENOMINATOR_CODE" presence="optional"><copy/></uInt32> + <uInt32 name="EXPLICIT_STRIKE_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="PREMIUM_PRICE_DENOMINATOR_CODE" presence="optional"><copy/></uInt32> + <uInt32 name="BID_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="BID_SIZE" presence="optional"><copy/></uInt32> + <uInt32 name="OFFER_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="OFFER_SIZE" presence="optional"><copy/></uInt32> + <uInt32 name="SESSION_INDICATOR" presence="optional"><copy/></uInt32> + <uInt32 name="BBO_INDICATOR" presence="optional"><copy/></uInt32> + <uInt32 name="BEST_BID_PARTICIPANT_ID" presence="optional"><copy/></uInt32> + <uInt32 name="BEST_BID_PRICE_DENOMINATOR_CODE" presence="optional"><copy/></uInt32> + <uInt32 name="BEST_BID_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="BEST_BID_SIZE" presence="optional"><copy/></uInt32> + <uInt32 name="BEST_OFFER_PARTICIPANT_ID" presence="optional"><copy/></uInt32> + <uInt32 name="BEST_OFFER_PRICE_DENOMINATOR_CODE" presence="optional"><copy/></uInt32> + <uInt32 name="BEST_OFFER_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="BEST_OFFER_SIZE" presence="optional"><copy/></uInt32> + <string name="RESERVED_FIELD_1" presence="optional"><copy/></string> + <string name="RESERVED_FIELD_2" presence="optional"><copy/></string> + <string name="RESERVED_FIELD_3" presence="optional"><copy/></string> + <uInt32 name="OPEN_INT_VOLUME" presence="optional"><copy/></uInt32> + <uInt32 name="VOLUME" presence="optional"><copy/></uInt32> + <uInt32 name="PREMIUM_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="OPEN_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="HIGH_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="LOW_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="LAST_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="NET_CHANGE_INDICATOR" presence="optional"><copy/></uInt32> + <uInt32 name="NET_CHANGE" presence="optional"><copy/></uInt32> + <uInt32 name="UNDERLYING_PRICE_DENOM" presence="optional"><copy/></uInt32> + <uInt32 name="UNDERLYING_STOCK_PRICE" presence="optional"><copy/></uInt32> + <uInt32 name="NUMBER_OF_INDICES_IN_GROUP" presence="optional"><copy/></uInt32> + <string name="INDEX_SYMBOL" presence="optional"><copy/></string> + <string name="INDEX_VALUE" presence="optional"><copy/></string> + <string name="BID_INDEX_VALUE" presence="optional"><copy/></string> + <string name="OFFER_INDEX_VALUE" presence="optional"><copy/></string> + <uInt32 name="NUMBER_OF_FOREIGN_CURRENCY_SPOT_VALUES_IN_GROUP" presence="optional" ><copy/></uInt32> + <string name="FCO_SYMBOL" presence="optional"><copy/></string> + <uInt32 name="DECIMAL_PLACEMENT_INDICATOR" presence="optional"><copy/></uInt32> + <uInt32 name="FOREIGN_CURRENCY_SPOT_VALUE" presence="optional"><copy/></uInt32> + <string name="TEXT" presence="optional"><copy/></string> + <string name="DEF_MSG" presence="optional"><copy/></string> + </template> +</templates> + Added: trunk/src/test/resources/OpraFeed.java =================================================================== --- trunk/src/test/resources/OpraFeed.java (rev 0) +++ trunk/src/test/resources/OpraFeed.java 2007-12-06 19:43:37 UTC (rev 101) @@ -0,0 +1,304 @@ +package com.nywe.test; +/** + * Name: OpraFeed.java + * + * Description: A little test program to read a FAST FIX encoded OPRA + * File and decode it using the OPEN FAST Java decoder. The + * File is provided by SIAC to help an application developer test + * their FAST FIX implementation. There is 4 byte lenght field + * in front of each packet in the file, there are also + * some control characters and a one byte length field in front of + * each encoded msg ( see the code, pretty simple ). + * + * + * Author: Tom Clark + * + * + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataInput; +import java.io.DataInputStream; +import java.io.EOFException; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.openfast.Context; +import org.openfast.Message; +import org.openfast.codec.FastDecoder; +import org.openfast.template.MessageTemplate; +import org.openfast.template.loader.MessageTemplateLoader; +import org.openfast.template.loader.XMLMessageTemplateLoader; +import org.w3c.dom.Document; + +public class OpraFeed +{ +private int mMsgsRead = 0; +private MessageTemplate mTemplate = null; +private InputStream mFileInputStream = null; +private DataInput mDataInputStream; +private Context mContext; +private String mOPRAEncodedFile; + + public static void main ( String args[] ) + { + if ( args.length < 2 ) + { + System.err.println("Invalid Args, usage: [OPRAEncodedFile OPRATemplateXMLFile"); + System.exit(-1); + } + + new OpraFeed (args[0],args[1]); + + } + + /** + * + * Constructor: + * + * @param pOPRAEncodedFile + * @param pFASTFIXTemplateFile + */ + + public OpraFeed ( String pOPRAEncodedFile, + String pFASTFIXTemplateFile ) + { + mOPRAEncodedFile = pOPRAEncodedFile; + + System.out.println("Starting Fast FIX OPRA Test\n" + + "Using Encoded File " + mOPRAEncodedFile + "\n" + + "Using FAST Template " + pFASTFIXTemplateFile ); + + mFileInputStream = null; + //OutputStream tFileOutputStream = null; + + try + { + mFileInputStream = new FileInputStream ( pOPRAEncodedFile ); + //tFileOutputStream = new FileOutputStream ( args[0]+ ".out" ); + } + catch ( Throwable t ) + { + System.err.println("Error Opening File " + pOPRAEncodedFile); + t.printStackTrace(); + System.exit(-1); + } + + // Wrap the FileInputStream wityh a DataInputStream to allow for easy reading of the stream + mDataInputStream = new DataInputStream ( mFileInputStream ); + + + mTemplate = getTemplateFromXMLFile ( pFASTFIXTemplateFile ); + mTemplate.setId("0"); + + mContext = new Context(); + mContext.registerTemplate(0, mTemplate); + + readAndDecodeFile(); + + } + + /** + * + * This is the guts of the program, this is where + * we read and decode the file + * + */ + + public void readAndDecodeFile() + { + int tLen = 0; + + try + { + while ( true ) + { + tLen = mDataInputStream.readInt(); // Read 4 byte packet len, Multiple msgs are packed into a single packet. + System.err.println("Packet Read, Len = " + tLen ); + + byte tSOH = mDataInputStream.readByte(); // Soh + tLen--; + + if ( tSOH != 1 ) // Every packet message must start with an SOH. + { + System.err.println("Invalid Message, No SOH"); + System.exit(-1); + break; + } + + // + // Loop thru the messages in the packet. + // + + // mContext.reset(); // should reset between packets + + while ( tLen > 0 ) + { + // one byte field denotes size of decoded data. + + int tMsgLen = (int)mDataInputStream.readByte(); // len + tMsgLen = (0x000000FF & tMsgLen ); // unsigned. + + tLen--; + + System.err.println("Len of decoded data msg = " + tMsgLen ); + + + if ( tMsgLen == 3 ) // ETX + { + System.err.println("ETX Reached, End Of Packet Data"); + break; + } + + tLen -= tMsgLen; + + byte[] byteArray = new byte[tMsgLen]; + + + mDataInputStream.readFully(byteArray); // We are reading the "Encoded Message" here!!!! + + InputStream tInput = null; + FastDecoder tDecoder = null; + Message tMessage = null; + + //HexDump.dumpHexData("FAST FIX Dump ",byteArray); + //DumpBinary.dump(byteArray); + + //tFileOutputStream.write(byteArray); // write raw encoded data file + tInput = new ByteArrayInputStream( byteArray ); + tDecoder = new FastDecoder(mContext, tInput); + tMessage = tDecoder.readMessage(); + + dumpMessage( tMessage ); + } + + } + } + catch ( EOFException e ) + { + System.err.println("End Of File Reached " + mMsgsRead + " Messages Decoded" ); + System.exit(-1); + } + catch ( Throwable t ) + { + System.err.println("Error Reading File " + mOPRAEncodedFile + " Error = " + t.getMessage() ); + t.printStackTrace(); + System.exit(-1); + } + } + + /** + * + * Method: dumpMessage() + * + * + * @param pMessage + */ + + protected void dumpMessage ( Message pMessage ) + { + System.err.println("--------- Message # [" + (++mMsgsRead) + "]------------ "); + + for ( int i=0; i<pMessage.getFieldCount(); i++ ) + { + if ( pMessage.isDefined(i) ) + { + if (i == 1 || i == 2 ) // 1 = CATEGORY 2 = MESSAGE TYPE + System.err.println("["+i+"] " + mTemplate.getField(i).getName()+ " = " + (char)Byte.parseByte(pMessage.getValue(i).toString())); + else + System.err.println("["+i+"] " + mTemplate.getField(i).getName()+ " = " + pMessage.getValue(i).toString()); + } + } + } + + /** + * + * Method: getTemplateFromXMLFile + * + * @param pFASTFIXTemplateFile + * @return + */ + + protected MessageTemplate getTemplateFromXMLFile ( String pFASTFIXTemplateFile ) + { + try + { + Document tDoc = loadDocFromFile ( pFASTFIXTemplateFile ); + byte[] templateXml = docToByteArray( tDoc ); + + MessageTemplateLoader loader = new XMLMessageTemplateLoader(); + MessageTemplate[] templates = loader.load(new ByteArrayInputStream(templateXml)); + + return templates[0]; // Only one Template Defined + } + catch ( Throwable t ) + { + System.err.println("Error Loading Template " + t.getMessage()); + t.printStackTrace(); + System.exit(-1); + } + + return null; // never reached, keep compiler happy. + } + + /** + * + * + * @param pXMLFilename + * @return + * @throws Exception + */ + + + public static Document loadDocFromFile ( String pXMLFilename ) throws Exception + { + DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); + + DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); + + Document doc = docBuilder.parse (new File(pXMLFilename)); + + return doc; + + } + + /** + * + * + * @param pDoc + * @return + * @throws Exception + */ + + public static byte[] docToByteArray( Document pDoc ) throws Exception + { + // TODO: look into doing this only once!!! + // TODO: Performance check!!!! + TransformerFactory xformFactory = TransformerFactory.newInstance(); + Transformer idTransform = xformFactory.newTransformer(); + + Source input = new DOMSource(pDoc); + + ByteArrayOutputStream tArray = new ByteArrayOutputStream(); + Result output = new StreamResult( tArray ); + + idTransform.transform(input, output); + + return tArray.toByteArray(); + + } + + + +} Added: trunk/src/test/resources/testmsgs.encoded =================================================================== (Binary files differ) Property changes on: trunk/src/test/resources/testmsgs.encoded ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2007-12-06 17:27:32
|
Revision: 100 http://openfast.svn.sourceforge.net/openfast/?rev=100&view=rev Author: jacob_northey Date: 2007-12-06 09:26:54 -0800 (Thu, 06 Dec 2007) Log Message: ----------- Moved test resources to new resources src path to follow maven conventions Modified Paths: -------------- trunk/pom.xml trunk/src/test/java/org/openfast/TemplateTest.java trunk/src/test/java/org/openfast/scenario/CmeTemplateTest.java trunk/src/test/java/org/openfast/submitted/ComposedDecimalNullPointerTest.java trunk/src/test/java/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java trunk/src/test/java/org/openfast/test/OpenFastTestCase.java Added Paths: ----------- trunk/src/test/resources/1.fast trunk/src/test/resources/FASTTestTemplate.xml trunk/src/test/resources/components.xml trunk/src/test/resources/mdIncrementalRefreshTemplate.xml trunk/src/test/resources/messages.fast trunk/src/test/resources/preTrade.xml trunk/src/test/resources/session.xml trunk/src/test/resources/template.xml trunk/src/test/resources/templates.xml Removed Paths: ------------- trunk/.settings/ trunk/src/test/java/org/openfast/components.xml trunk/src/test/java/org/openfast/preTrade.xml trunk/src/test/java/org/openfast/scenario/1.fast trunk/src/test/java/org/openfast/scenario/templates.xml trunk/src/test/java/org/openfast/session.xml trunk/src/test/java/org/openfast/submitted/FASTTestTemplate.xml trunk/src/test/java/org/openfast/submitted/messages.fast trunk/src/test/java/org/openfast/template/loader/mdIncrementalRefreshTemplate.xml trunk/src/test/java/org/openfast/template.xml Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - bin build doc build_sf target + bin build doc build_sf target .classpath .project Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-12-06 17:11:51 UTC (rev 99) +++ trunk/pom.xml 2007-12-06 17:26:54 UTC (rev 100) @@ -62,6 +62,14 @@ </mailingLists> <build> + <resources> + <resource> + <directory>src/main/resources</directory> + </resource> + <resource> + <directory>src/test/resources</directory> + </resource> + </resources> <extensions> <extension> <groupId>org.apache.maven.wagon</groupId> Modified: trunk/src/test/java/org/openfast/TemplateTest.java =================================================================== --- trunk/src/test/java/org/openfast/TemplateTest.java 2007-12-06 17:11:51 UTC (rev 99) +++ trunk/src/test/java/org/openfast/TemplateTest.java 2007-12-06 17:26:54 UTC (rev 100) @@ -1,12 +1,12 @@ package org.openfast; -import junit.framework.TestCase; import org.openfast.template.MessageTemplate; import org.openfast.template.loader.MessageTemplateLoader; import org.openfast.template.loader.XMLMessageTemplateLoader; +import org.openfast.test.OpenFastTestCase; -public class TemplateTest extends TestCase { +public class TemplateTest extends OpenFastTestCase { private static final String SCP_1_1_NS = "http://www.fixprotocol.org/ns/fast/scp/1.1"; private static final String PRE_TRADE_NS = "http://www.openfast.org/fix44/preTrade"; private static final String SESSION_NS = "http://www.openfast.org/fix44/session"; @@ -17,11 +17,11 @@ protected void setUp() throws Exception { loader = new XMLMessageTemplateLoader(true); - loader.load(this.getClass().getResourceAsStream("components.xml")); - loader.load(this.getClass().getResourceAsStream("preTrade.xml")); - loader.load(this.getClass().getResourceAsStream("session.xml")); + loader.load(resource("components.xml")); + loader.load(resource("preTrade.xml")); + loader.load(resource("session.xml")); } - + public void testTemplates() { MessageTemplate quote = loader.getTemplateRegistry().get(new QName("Quote", PRE_TRADE_NS)); Deleted: trunk/src/test/java/org/openfast/components.xml =================================================================== --- trunk/src/test/java/org/openfast/components.xml 2007-12-06 17:11:51 UTC (rev 99) +++ trunk/src/test/java/org/openfast/components.xml 2007-12-06 17:26:54 UTC (rev 100) @@ -1,11 +0,0 @@ -<templates templateNs="http://www.openfast.org/fix44/components" ns="http://www.openfast.org/fix44/fields"> - <template name="Instrument"> - <ascii name="Symbol" id="55"><copy dictionary="named" /></ascii> - <ascii name="SecurityID" id="48"><copy dictionary="named" /></ascii> - </template> - <template name="Batch"> - <sequence name="Messages"> - <templateRef/> - </sequence> - </template> -</templates> \ No newline at end of file Deleted: trunk/src/test/java/org/openfast/preTrade.xml =================================================================== --- trunk/src/test/java/org/openfast/preTrade.xml 2007-12-06 17:11:51 UTC (rev 99) +++ trunk/src/test/java/org/openfast/preTrade.xml 2007-12-06 17:26:54 UTC (rev 100) @@ -1,11 +0,0 @@ -<templates templateNs="http://www.openfast.org/fix44/preTrade" ns="http://www.openfast.org/fix44"> - <template name="Quote" id="S"> - <ascii name="QuoteID" id="117"><delta/></ascii> - <templateRef name="Instrument" templateNs="http://www.openfast.org/fix44/components"/> - <decimal name="BidPx" id="132"><delta/></decimal> - <int32 name="BidSize" id="134"><delta/></int32> - <decimal name="OfferPx" id="133"><delta/></decimal> - <int32 name="OfferSize" id="135"><delta/></int32> - <ascii name="Group" ns="http://www.openfast.org/ext"><copy/></ascii> - </template> -</templates> \ No newline at end of file Deleted: trunk/src/test/java/org/openfast/scenario/1.fast =================================================================== --- trunk/src/test/java/org/openfast/scenario/1.fast 2007-12-06 17:11:51 UTC (rev 99) +++ trunk/src/test/java/org/openfast/scenario/1.fast 2007-12-06 17:26:54 UTC (rev 100) @@ -1,2 +0,0 @@ -\xC0\xA1;\xEB#SR M\x83 I\xA0$\xA9\xF6 -8\xC1\x90X\xDFK\xA3[Hi\xD0 \ No newline at end of file Modified: trunk/src/test/java/org/openfast/scenario/CmeTemplateTest.java =================================================================== --- trunk/src/test/java/org/openfast/scenario/CmeTemplateTest.java 2007-12-06 17:11:51 UTC (rev 99) +++ trunk/src/test/java/org/openfast/scenario/CmeTemplateTest.java 2007-12-06 17:26:54 UTC (rev 100) @@ -10,12 +10,12 @@ public class CmeTemplateTest extends OpenFastTestCase { public void testDeltas() throws Exception { - InputStream templateSource = this.getClass().getResourceAsStream("templates.xml"); + InputStream templateSource = resource("templates.xml"); XMLMessageTemplateLoader templateLoader = new XMLMessageTemplateLoader(); templateLoader.setLoadTemplateIdFromAuxId(true); templateLoader.load(templateSource); - InputStream is = this.getClass().getResourceAsStream("1.fast"); + InputStream is = resource("1.fast"); MessageInputStream mis = new MessageInputStream(is); mis.setTemplateRegistry(templateLoader.getTemplateRegistry()); Message md = mis.readMessage(); Deleted: trunk/src/test/java/org/openfast/scenario/templates.xml =================================================================== --- trunk/src/test/java/org/openfast/scenario/templates.xml 2007-12-06 17:11:51 UTC (rev 99) +++ trunk/src/test/java/org/openfast/scenario/templates.xml 2007-12-06 17:26:54 UTC (rev 100) @@ -1,1465 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<templates> - <template name="MDIncRefresh_30" id="30" dictionary="30" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="X"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="TradeDate" id="75"/> - <sequence name="MDEntries"> - <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> - <copy value="1"/> - </uInt32> - <uInt32 name="MDPriceLevel" id="1023" presence="optional"> - <default value="1"/> - </uInt32> - <string name="MDEntryType" id="269"> - <copy value="0"/> - </string> - <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> - </uInt32> - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - <uInt32 name="SecurityID" id="48"> - <copy/> - </uInt32> - <uInt32 name="RptSeq" id="83"> - <increment/> - </uInt32> - <decimal name="MDEntryPx" id="270"> - <exponent> - <default value="0"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <uInt32 name="MDEntryTime" id="273"> - <copy/> - </uInt32> - <int32 name="MDEntrySize" id="271" presence="optional"> - <delta/> - </int32> - <uInt32 name="NumberOfOrders" id="346" presence="optional"> - <delta/> - </uInt32> - <string name="TradingSessionID" id="336" presence="optional"> - <default value="2"/> - </string> - <decimal name="NetChgPrevDay" id="451" presence="optional"> - <exponent> - <default/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <uInt32 name="TradeVolume" id="1020" presence="optional"> - <default/> - </uInt32> - <string name="TradeCondition" id="277" presence="optional"> - <default/> - </string> - <string name="TickDirection" id="274" presence="optional"> - <default/> - </string> - <string name="QuoteCondition" id="276" presence="optional"> - <default/> - </string> - </sequence> - </template> - - <template name="MDIncRefresh_32" id="32" dictionary="32" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="X"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="TradeDate" id="75"/> - <sequence name="MDEntries"> - <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> - <copy value="1"/> - </uInt32> - <uInt32 name="MDPriceLevel" id="1023"> - <increment/> - </uInt32> - <string name="MDEntryType" id="269"> - <copy value="0"/> - </string> - <uInt32 name="MDEntryTime" id="273"> - <copy/> - </uInt32> - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - <uInt32 name="SecurityID" id="48"> - <copy/> - </uInt32> - <uInt32 name="RptSeq" id="83"> - <increment/> - </uInt32> - <decimal name="MDEntryPx" id="270"> - <exponent> - <default value="0"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <int32 name="MDEntrySize" id="271"> - <delta/> - </int32> - <uInt32 name="NumberOfOrders" id="346"> - <delta/> - </uInt32> - <string name="TradingSessionID" id="336"> - <default value="2"/> - </string> - </sequence> - </template> - - <template name="MDIncRefresh_33" id="33" dictionary="33" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="X"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="TradeDate" id="75"/> - <sequence name="MDEntries"> - <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> - <default value="0"/> - </uInt32> - <string name="MDEntryType" id="269"> - <default value="2"/> - </string> - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - <uInt32 name="SecurityID" id="48"> - <copy/> - </uInt32> - <uInt32 name="RptSeq" id="83"> - <increment/> - </uInt32> - <decimal name="MDEntryPx" id="270"> - <exponent> - <default value="0"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <int32 name="MDEntrySize" id="271" presence="optional"> - <delta/> - </int32> - <decimal name="NetChgPrevDay" id="451" presence="optional"> - <exponent> - <default value="0"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <uInt32 name="TradeVolume" id="1020" presence="optional"> - <delta/> - </uInt32> - <string name="TickDirection" id="274" presence="optional"> - <default/> - </string> - <string name="TradeCondition" id="277" presence="optional"> - <default/> - </string> - <uInt32 name="MDEntryTime" id="273"> - <copy/> - </uInt32> - </sequence> - </template> - - <template name="MDIncRefresh_34" id="34" dictionary="34" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="X"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="TradeDate" id="75"/> - <sequence name="MDEntries"> - <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> - <copy value="1"/> - </uInt32> - <uInt32 name="MDPriceLevel" id="1023" presence="optional"> - <copy value="1"/> - </uInt32> - <string name="MDEntryType" id="269"> - <copy value="0"/> - </string> - <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> - </uInt32> - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - <uInt32 name="SecurityID" id="48"> - <copy/> - </uInt32> - <uInt32 name="RptSeq" id="83"> - <increment/> - </uInt32> - <string name="QuoteCondition" id="276" presence="optional"> - <copy value="K"/> - </string> - <decimal name="MDEntryPx" id="270"> - <exponent> - <default value="-2"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <uInt32 name="NumberOfOrders" id="346" presence="optional"> - <default/> - </uInt32> - <uInt32 name="MDEntryTime" id="273"> - <copy/> - </uInt32> - <int32 name="MDEntrySize" id="271" presence="optional"> - <delta/> - </int32> - <string name="TradingSessionID" id="336" presence="optional"> - <default value="2"/> - </string> - <decimal name="NetChgPrevDay" id="451" presence="optional"> - <exponent> - <default value="-2"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <uInt32 name="TradeVolume" id="1020" presence="optional"> - <default/> - </uInt32> - <string name="TradeCondition" id="277" presence="optional"> - <default/> - </string> - <string name="TickDirection" id="274" presence="optional"> - <default/> - </string> - </sequence> - </template> - - <template name="MDIncRefresh_35" id="35" dictionary="35" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="X"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="TradeDate" id="75"/> - <sequence name="MDEntries"> - <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> - <copy value="1"/> - </uInt32> - <uInt32 name="MDPriceLevel" id="1023"> - <copy value="1"/> - </uInt32> - <string name="MDEntryType" id="269"> - <copy value="0"/> - </string> - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - <uInt32 name="SecurityID" id="48"> - <delta/> - </uInt32> - <uInt32 name="RptSeq" id="83"> - <increment/> - </uInt32> - <string name="QuoteCondition" id="276" presence="optional"> - <copy value="K"/> - </string> - <decimal name="MDEntryPx" id="270"> - <exponent> - <default value="-2"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <uInt32 name="NumberOfOrders" id="346" presence="optional"> - <copy/> - </uInt32> - <uInt32 name="MDEntryTime" id="273"> - <copy/> - </uInt32> - <int32 name="MDEntrySize" id="271"> - <delta/> - </int32> - <string name="TradingSessionID" id="336"> - <default value="2"/> - </string> - </sequence> - </template> - - <template name="MDIncRefresh_36" id="36" dictionary="36" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="X"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="TradeDate" id="75"/> - <sequence name="MDEntries"> - <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> - <copy value="1"/> - </uInt32> - <uInt32 name="MDPriceLevel" id="1023"> - <copy value="1"/> - </uInt32> - <string name="MDEntryType" id="269"> - <copy value="0"/> - </string> - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - <uInt32 name="SecurityID" id="48"> - <copy/> - </uInt32> - <uInt32 name="RptSeq" id="83"> - <increment/> - </uInt32> - <decimal name="MDEntryPx" id="270"> - <exponent> - <default value="-2"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <uInt32 name="MDEntryTime" id="273"> - <copy/> - </uInt32> - <int32 name="MDEntrySize" id="271"> - <delta/> - </int32> - <string name="QuoteCondition" id="276"> - <copy value="K"/> - </string> - <string name="TradingSessionID" id="336"> - <default value="2"/> - </string> - </sequence> - </template> - - <template name="MDIncRefresh_37" id="37" dictionary="37" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="X"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="TradeDate" id="75"/> - <sequence name="MDEntries"> - <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> - <default value="0"/> - </uInt32> - <string name="MDEntryType" id="269"> - <default value="2"/> - </string> - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - <uInt32 name="SecurityID" id="48"> - <delta/> - </uInt32> - <uInt32 name="RptSeq" id="83"> - <delta/> - </uInt32> - <decimal name="MDEntryPx" id="270"> - <exponent> - <default value="-1"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <uInt32 name="MDEntryTime" id="273"> - <copy/> - </uInt32> - <int32 name="MDEntrySize" id="271" presence="optional"> - <delta/> - </int32> - <decimal name="NetChgPrevDay" id="451" presence="optional"> - <exponent> - <default value="-1"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <uInt32 name="TradeVolume" id="1020" presence="optional"> - <delta/> - </uInt32> - <string name="TradeCondition" id="277" presence="optional"> - <copy value="1"/> - </string> - <string name="TickDirection" id="274" presence="optional"> - <default/> - </string> - </sequence> - </template> - - <template name="MDIncRefresh_38" id="38" dictionary="38" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="X"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="TradeDate" id="75"/> - <sequence name="MDEntries"> - <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> - <copy value="1"/> - </uInt32> - <uInt32 name="MDPriceLevel" id="1023" presence="optional"> - <increment/> - </uInt32> - <string name="MDEntryType" id="269"> - <copy value="0"/> - </string> - <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> - </uInt32> - <string name="TradingSessionID" id="336" presence="optional"> - <default value="2"/> - </string> - <decimal name="NetChgPrevDay" id="451" presence="optional"> - <exponent> - <default/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <uInt32 name="TradeVolume" id="1020" presence="optional"> - <default/> - </uInt32> - <uInt32 name="NumberOfOrders" id="346" presence="optional"> - <default/> - </uInt32> - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - <uInt32 name="SecurityID" id="48"> - <copy/> - </uInt32> - <uInt32 name="RptSeq" id="83"> - <increment/> - </uInt32> - <uInt32 name="MDEntryTime" id="273"> - <copy/> - </uInt32> - <decimal name="MDEntryPx" id="270"> - <exponent> - <default value="0"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <int32 name="MDEntrySize" id="271" presence="optional"> - <delta/> - </int32> - <string name="TradeCondition" id="277" presence="optional"> - <default/> - </string> - <string name="TickDirection" id="274" presence="optional"> - <default/> - </string> - <string name="QuoteCondition" id="276" presence="optional"> - <default/> - </string> - </sequence> - </template> - - <template name="MDIncRefresh_39" id="39" dictionary="39" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="X"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="TradeDate" id="75"/> - <sequence name="MDEntries"> - <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> - <copy value="1"/> - </uInt32> - <uInt32 name="MDPriceLevel" id="1023"> - <increment/> - </uInt32> - <string name="MDEntryType" id="269"> - <copy value="0"/> - </string> - <uInt32 name="MDEntryTime" id="273"> - <copy/> - </uInt32> - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - <uInt32 name="SecurityID" id="48"> - <copy/> - </uInt32> - <uInt32 name="RptSeq" id="83"> - <increment/> - </uInt32> - <decimal name="MDEntryPx" id="270"> - <exponent> - <default value="0"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <int32 name="MDEntrySize" id="271"> - <delta/> - </int32> - <string name="TradingSessionID" id="336"> - <default value="2"/> - </string> - <uInt32 name="NumberOfOrders" id="346"> - <delta/> - </uInt32> - </sequence> - </template> - - <template name="MDIncRefresh_40" id="40" dictionary="40" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="X"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="TradeDate" id="75"/> - <sequence name="MDEntries"> - <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> - <default value="0"/> - </uInt32> - <string name="MDEntryType" id="269"> - <default value="2"/> - </string> - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - <uInt32 name="SecurityID" id="48"> - <copy/> - </uInt32> - <uInt32 name="RptSeq" id="83"> - <increment/> - </uInt32> - <decimal name="MDEntryPx" id="270"> - <exponent> - <default value="0"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <int32 name="MDEntrySize" id="271" presence="optional"> - <delta/> - </int32> - <decimal name="NetChgPrevDay" id="451" presence="optional"> - <exponent> - <default value="0"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <uInt32 name="TradeVolume" id="1020" presence="optional"> - <delta/> - </uInt32> - <string name="TickDirection" id="274" presence="optional"> - <default/> - </string> - <string name="TradeCondition" id="277" presence="optional"> - <default/> - </string> - <uInt32 name="MDEntryTime" id="273"> - <copy/> - </uInt32> - </sequence> - </template> - - <template name="MDIncRefresh_41" id="41" dictionary="41" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="X"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="TradeDate" id="75"/> - <sequence name="MDEntries"> - <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> - <constant value="5"/> - </uInt32> - <uInt32 name="MDPriceLevel" id="1023"> - <constant value="1"/> - </uInt32> - <string name="MDEntryType" id="269"> - <copy value="1"/> - </string> - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - <uInt32 name="SecurityID" id="48"> - <delta/> - </uInt32> - <uInt32 name="RptSeq" id="83"> - <delta/> - </uInt32> - <decimal name="MDEntryPx" id="270" presence="optional"> - <exponent> - <default value="0"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <int32 name="MDEntrySize" id="271"> - <delta/> - </int32> - <uInt32 name="MDEntryTime" id="273"> - <delta/> - </uInt32> - <string name="TradingSessionID" id="336"> - <default value="2"/> - </string> - <uInt32 name="NumberOfOrders" id="346"> - <copy value="1"/> - </uInt32> - </sequence> - </template> - - <template name="MDIncRefresh_42" id="42" dictionary="42" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="X"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="TradeDate" id="75"/> - <sequence name="MDEntries"> - <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> - <default value="5"/> - </uInt32> - <uInt32 name="NumberOfOrders" id="346" presence="optional"> - <copy value="1"/> - </uInt32> - <string name="MDEntryType" id="269"> - <copy value="1"/> - </string> - <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> - </uInt32> - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - <uInt32 name="SecurityID" id="48"> - <copy/> - </uInt32> - <uInt32 name="RptSeq" id="83"> - <increment/> - </uInt32> - <string name="TradingSessionID" id="336" presence="optional"> - <default value="2"/> - </string> - <int32 name="MDEntrySize" id="271" presence="optional"> - <delta/> - </int32> - <uInt32 name="MDEntryTime" id="273"> - <copy/> - </uInt32> - <uInt32 name="MDPriceLevel" id="1023" presence="optional"> - <default value="1"/> - </uInt32> - <decimal name="MDEntryPx" id="270" presence="optional"> - <exponent> - <default value="0"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <decimal name="NetChgPrevDay" id="451" presence="optional"> - <exponent> - <default/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <uInt32 name="TradeVolume" id="1020" presence="optional"> - <default/> - </uInt32> - <string name="TickDirection" id="274" presence="optional"> - <default/> - </string> - <string name="QuoteCondition" id="276" presence="optional"> - <default/> - </string> - <string name="TradeCondition" id="277" presence="optional"> - <default/> - </string> - </sequence> - </template> - - <template name="MDIncRefresh_43" id="43" dictionary="43" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="X"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="TradeDate" id="75"/> - <sequence name="MDEntries"> - <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> - <constant value="5"/> - </uInt32> - <uInt32 name="MDPriceLevel" id="1023"> - <constant value="1"/> - </uInt32> - <string name="MDEntryType" id="269"> - <copy value="1"/> - </string> - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - <uInt32 name="SecurityID" id="48"> - <delta/> - </uInt32> - <uInt32 name="RptSeq" id="83"> - <delta/> - </uInt32> - <decimal name="MDEntryPx" id="270" presence="optional"> - <exponent> - <default value="0"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <int32 name="MDEntrySize" id="271"> - <delta/> - </int32> - <uInt32 name="MDEntryTime" id="273"> - <copy/> - </uInt32> - <string name="TradingSessionID" id="336" presence="optional"> - <default value="2"/> - </string> - <uInt32 name="NumberOfOrders" id="346"> - <copy/> - </uInt32> - <uInt32 name="MDQuoteType" id="1070" presence="optional"> - <default/> - </uInt32> - </sequence> - </template> - - <template name="MDIncRefresh_44" id="44" dictionary="44" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="X"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="TradeDate" id="75"/> - <sequence name="MDEntries"> - <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> - <constant value="5"/> - </uInt32> - <uInt32 name="MDPriceLevel" id="1023"> - <constant value="1"/> - </uInt32> - <string name="MDEntryType" id="269"> - <copy value="1"/> - </string> - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - <uInt32 name="SecurityID" id="48"> - <copy/> - </uInt32> - <uInt32 name="RptSeq" id="83"> - <increment/> - </uInt32> - <decimal name="MDEntryPx" id="270" presence="optional"> - <exponent> - <default value="0"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <int32 name="MDEntrySize" id="271" presence="optional"> - <delta/> - </int32> - <uInt32 name="MDEntryTime" id="273"> - <copy/> - </uInt32> - <string name="TradingSessionID" id="336" presence="optional"> - <default value="2"/> - </string> - <uInt32 name="NumberOfOrders" id="346"> - <copy/> - </uInt32> - <uInt32 name="MDQuoteType" id="1070" presence="optional"> - <constant value="0"/> - </uInt32> - </sequence> - </template> - - <template name="MDIncRefresh_45" id="45" dictionary="45" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="X"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="TradeDate" id="75"/> - <sequence name="MDEntries"> - <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> - <copy value="5"/> - </uInt32> - <uInt32 name="MDPriceLevel" id="1023" presence="optional"> - <copy value="1"/> - </uInt32> - <string name="MDEntryType" id="269"> - <copy value="1"/> - </string> - <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> - </uInt32> - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - <uInt32 name="SecurityID" id="48"> - <copy/> - </uInt32> - <uInt32 name="RptSeq" id="83"> - <increment/> - </uInt32> - <decimal name="MDEntryPx" id="270" presence="optional"> - <exponent> - <default value="-2"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <int32 name="MDEntrySize" id="271" presence="optional"> - <delta/> - </int32> - <uInt32 name="MDEntryTime" id="273"> - <copy/> - </uInt32> - <string name="TradingSessionID" id="336" presence="optional"> - <default value="2"/> - </string> - <uInt32 name="NumberOfOrders" id="346" presence="optional"> - <copy value="1"/> - </uInt32> - <decimal name="NetChgPrevDay" id="451" presence="optional"> - <exponent> - <default/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <uInt32 name="TradeVolume" id="1020" presence="optional"> - <default/> - </uInt32> - <string name="TickDirection" id="274" presence="optional"> - <default/> - </string> - <string name="QuoteCondition" id="276" presence="optional"> - <default/> - </string> - <uInt32 name="MDQuoteType" id="1070" presence="optional"> - <default/> - </uInt32> - <string name="TradeCondition" id="277" presence="optional"> - <default/> - </string> - </sequence> - </template> - - <template name="MDSecurityDefinition" id="46" dictionary="46" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - - <string name="MessageType" id="35"> - <constant value="d"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="MDTotalNum" id="911" presence="optional"/> - <sequence name="Events" presence="optional"> - <length name="NoEvents" id="864"/> - <uInt32 name="EventType" id="865" presence="optional"> - <delta/> - </uInt32> - <uInt64 name="EventDate" id="866" presence="optional"> - <delta/> - </uInt64> - <uInt64 name="EventTime" id="1145" presence="optional"> - <delta/> - </uInt64> - </sequence> - - <decimal name="TradingReferencePrice" id="1150" presence="optional"> - <exponent> - <default value="-2"/> - </exponent> - <mantissa/> - </decimal> - <decimal name="HighLimitPx" id="1149" presence="optional"> - <exponent> - <default value="-2"/> - </exponent> - <mantissa/> - </decimal> - <decimal name="LowLimitPx" id="1148" presence="optional"> - <exponent> - <default value="-2"/> - </exponent> - <mantissa/> - </decimal> - <string name="SecurityGroup" id="1151" presence="optional"/> - <string name="Symbol" id="55" presence="optional"/> - <string name="SecurityDesc" id="107" presence="optional"/> - <uInt32 name="SecurityID" id="48" presence="optional"/> - <uInt32 name="SecurityIDSource" id="22" presence="optional"> - <constant value="8"/> - </uInt32> - <string name="CFICode" id="461" presence="optional"/> - <string name="UnderlyingProduct" id="462" presence="optional"/> - <string name="SecurityExchange" id="207" presence="optional"/> - <string name="PricingModel" id="9853" presence="optional"/> - <decimal name="MinCabPrice" id="9850" presence="optional"> - <exponent> - <default value="-2"/> - </exponent> - <mantissa/> - </decimal> - <uInt32 name="ExpirationCycle" id="827" presence="optional"/> - <string name="UnitOfMeasureQty" id="1147" presence="optional"/> - <decimal name="StrikePrice" id="202" presence="optional"> - <exponent> - <default value="-2"/> - </exponent> - <mantissa/> - </decimal> - <string name="StrikeCurrency" id="947" presence="optional"/> - <uInt64 name="MinTradeVol" id="562" presence="optional"/> - <uInt64 name="MaxTradeVol" id="1140" presence="optional"/> - <string name="Currency" id="15" presence="optional"/> - <string name="SettlCurrency" id="120" presence="optional"/> - <sequence name="MDFeedTypes" presence="optional"> - <length name="NoMDFeedTypes" id="1141"/> - <string name="MDFeedType" id="1022"> - <constant value="GBX"/> - </string> - <uInt32 name="MarketDepth" id="264"/> - </sequence> - <string name="MatchAlgo" id="1142" presence="optional"/> - <string name="SecuritySubType" id="762" presence="optional"/> - - <sequence name="Underlyings" presence="optional"> - <length name="NoUnderlyings" id="711"/> - <string name="UnderlyingSymbol" id="311"> - <constant value="[N/A]"/> - </string> - <uInt32 name="UnderlyingSecurityID" id="309"> - <delta/> - </uInt32> - <uInt32 name="UnderlyingSecurityIDSource" id="305"> - <constant value="8"/> - </uInt32> - </sequence> - <string name="MaxPriceVariation" id="1143" presence="optional"/> - <string name="ImpliedMarketIndicator" id="1144" presence="optional"/> - - <sequence name="InstrAttrib" presence="optional"> - <length name="NoInstrAttrib" id="870"/> - <uInt64 name="InstrAttribType" id="871"> - <delta/> - </uInt64> - <string name="InstrAttribValue" id="872" presence="optional"> - <copy/> - </string> - </sequence> - <uInt64 name="MaturityDate" id="200" presence="optional"/> - <decimal name="MinPriceIncrement" id="969" presence="optional"> - <exponent> - <copy value="-2"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <decimal name="MinPriceIncrementAmount" id="1146" presence="optional"> - <exponent> - <default value="-2"/> - </exponent> - <mantissa/> - </decimal> - <decimal name="DisplayFactor" id="9787" presence="optional"> - <exponent> - <default value="-2"/> - </exponent> - <mantissa/> - </decimal> - - <sequence name="Legs" presence="optional"> - <length name="NoLegs" id="555"/> - <string name="LegSymbol" id="600"> - <default value="[N/A]"/> - </string> - <uInt32 name="LegRatioQty" id="623"> - <copy/> - </uInt32> - <uInt64 name="LegSecurityID" id="602"> - <delta/> - </uInt64> - <uInt32 name="LegSecurityIDSource" id="603"> - <constant value="8"/> - </uInt32> - <string name="LegSide" id="624" presence="optional"> - <default value="1"/> - </string> - <string name="LegCFICode" id="608" presence="optional"> - <copy/> - </string> - <string name="LegSecuritySubType" id="764" presence="optional"> - <copy/> - </string> - <string name="LegCurrency" id="556" presence="optional"> - <copy/> - </string> - <uInt64 name="LegMaturityMonthYear" id="610" presence="optional"> - <delta/> - </uInt64> - <decimal name="LegStrikePrice" id="612" presence="optional"> - <exponent> - <copy value="-2"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <string name="LegStrikeCurrency" id="942" presence="optional"> - <copy/> - </string> - <decimal name="LegPrice" id="566" presence="optional"> - <exponent> - <copy value="-2"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <decimal name="LegOptionDelta" id="1017" presence="optional"> - <exponent> - <copy value="-2"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - </sequence> - </template> - - <template name="MDQuoteRequest" id="47" dictionary="47" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="R"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <sequence name="RelatedSym"> - <length name="NoRelatedSym" id="146"/> - <string name="Symbol" id="55"> - <constant value="[N/A]"/> - </string> - <uInt64 name="OrderQty" id="38" presence="optional"/> - - <uInt32 name="Side" id="54" presence="optional"> - <default value="1"/> - </uInt32> - - <uInt64 name="TransactTime" id="60"/> - - <uInt32 name="QuoteType" id="537"> - <default value="1"/> - </uInt32> - - <string name="QuoteReqID" id="131" presence="optional"/> - - <uInt32 name="SecurityID" id="48"/> - - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - </sequence> - </template> - - <template name="MDSecurityStatus" id="48" dictionary="48" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="f"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt32 name="SecurityID" id="48" presence="optional"/> - <uInt32 name="SecurityIDSource" id="22" presence="optional"> - <constant value="8"/> - </uInt32> - <decimal name="HighPx" id="332" presence="optional"> - <exponent> - <default value="-2"/> - </exponent> - <mantissa/> - </decimal> - <decimal name="LowPx" id="333" presence="optional"> - <exponent> - <default value="-2"/> - </exponent> - <mantissa/> - </decimal> - <string name="Symbol" id="55" presence="optional"/> - <uInt32 name="SecurityTradingStatus" id="326" presence="optional"/> - </template> - - <template name="MDNewsMessage" id="49" dictionary="49" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="B"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="Headline" id="147"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <sequence name="LinesOfText"> - <length name="NoLinesOfText" id="33"/> - <string name="text" id="58"> - <copy/> - </string> - </sequence> - </template> - - - <template name="MDHeartbeat" id="50" dictionary="50" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="0"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - </template> - - <template name="MDSnapshotFullRefresh_51" id="51" dictionary="51" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="MessageType" id="35"> - <constant value="W"/> - </string> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <string name="PosDupFlag" id="43" presence="optional"> - <default/> - </string> - <uInt64 name="SendingTime" id="52"/> - - - <uInt32 name="LastMsgSeqNumProcessed" id="369"/> - <uInt32 name="TotalNumReports" id="911"/> - <uInt32 name="MDBookType" id="1021"/> - <uInt32 name="SecurityID" id="48"> - <delta/> - </uInt32> - <uInt32 name="SecurityIDSource" id="22"> - <constant value="8"/> - </uInt32> - - - - <sequence name="MDEntries"> - <length name="NoMDEntries" id="268"/> - <string name="MDEntryType" id="269"> - <default value="2"/> - </string> - <decimal name="MDEntryPx" id="270" presence="optional"> - <exponent> - <default value="-2"/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - <int32 name="MDEntrySize" id="271" presence="optional"> - <delta/> - </int32> - <string name="QuoteCondition" id="276" presence="optional"> - <default value="K"/> - </string> - <string name="TradeCondition" id="277" presence="optional"> - <constant value="U"/> - </string> - <uInt32 name="MDPriceLevel" id="1023" presence="optional"> - <copy value="1"/> - </uInt32> - <uInt32 name="NumberOfOrders" id="346" presence="optional"> - <copy/> - </uInt32> - <string name="TradingSessionID" id="336" presence="optional"> - <default value="2"/> - </string> - <uInt32 name="TradeVolume" id="1020" presence="optional"> - <delta/> - </uInt32> - <string name="TickDirection" id="274" presence="optional"> - <default/> - </string> - <decimal name="NetChgPrevDay" id="451" presence="optional"> - <exponent> - <default/> - </exponent> - <mantissa> - <delta/> - </mantissa> - </decimal> - </sequence> - </template> - - <template name="MDLogon" id="1" dictionary="1" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="A"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="applFeedId" id="1180"> - <constant value="REPLAY"/> - </string> - <uInt32 name="encryptMethod" id="98"> - <constant value="0"/> - </uInt32> - <uInt32 name="heartbeatInt" id="108"/> - <string name="DefaultApplVerID" id="1137"> - <constant value="8"/> - </string> - </template> - - <template name="MDLogout" id="2" dictionary="2" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> - <string name="ApplVerID" id="1128"> - <constant value="8"/> - </string> - <string name="MessageType" id="35"> - <constant value="5"/> - </string> - <string name="SenderCompID" id="49"> - <constant value="CME"/> - </string> - <uInt32 name="MsgSeqNum" id="34"/> - <uInt64 name="SendingTime" id="52"/> - <string name="applFeedId" id="1180"> - <constant value="REPLAY"/> - </string> - <string name="text" id="58" presence="optional"/> - </template> - -</templates> \ No newline at end of file Deleted: trunk/src/test/java/org/openfast/session.xml =================================================================== --- trunk/src/test/java/org/openfast/session.xml 2007-12-06 17:11:51 UTC (rev 99) +++ trunk/src/test/java/org/openfast/session.xml 2007-12-06 17:26:54 UTC (rev 100) @@ -1,11 +0,0 @@ -<templates - templateNs="http://www.openfast.org/fix44/session" - ns="http://www.openfast.org/fix44" - xmlns="http://www.fixprotocol.org/ns/fast/td/1.1" - xmlns:scp="http://www.fixprotocol.org/ns/fast/scp/1.1"> - <template name="Logon" scp:reset="yes"> - <ascii name="MsgType" id="35"><constant value="A"/></ascii> - <int32 name="EncryptMethod" id="98"><constant value="0"/></int32> - <int32 name="HeartBtInt" id="108"/> - </template> -</templates> \ No newline at end of file Modified: trunk/src/test/java/org/openfast/submitted/ComposedDecimalNullPointerTest.java =================================================================== --- trunk/src/test/java/org/openfast/submitted/ComposedDecimalNullPointerTest.java 2007-12-06 17:11:51 UTC (rev 99) +++ trunk/src/test/java/org/openfast/submitted/ComposedDecimalNullPointerTest.java 2007-12-06 17:26:54 UTC (rev 100) @@ -3,21 +3,20 @@ import java.io.FileNotFoundException; import java.io.InputStream; -import junit.framework.TestCase; - import org.openfast.Message; import org.openfast.MessageInputStream; import org.openfast.template.MessageTemplate; import org.openfast.template.loader.MessageTemplateLoader; import org.openfast.template.loader.XMLMessageTemplateLoader; +import org.openfast.test.OpenFastTestCase; -public class ComposedDecimalNullPointerTest extends TestCase { +public class ComposedDecimalNullPointerTest extends OpenFastTestCase { public void testNullPointerOnTwinValue() throws FileNotFoundException { - InputStream templateSource = this.getClass().getResourceAsStream("FASTTestTemplate.xml"); + InputStream templateSource = resource("FASTTestTemplate.xml"); MessageTemplateLoader templateLoader = new XMLMessageTemplateLoader(); MessageTemplate[] templates = templateLoader.load(templateSource); - InputStream is = this.getClass().getResourceAsStream("messages.fast"); + InputStream is = resource("messages.fast"); MessageInputStream mis = new MessageInputStream(is); mis.registerTemplate(35, templates[0]); Message msg = mis.readMessage(); Deleted: trunk/src/test/java/org/openfast/submitted/FASTTestTemplate.xml =================================================================== --- trunk/src/test/java/org/openfast/submitted/FASTTestTemplate.xml 2007-12-06 17:11:51 UTC (rev 99) +++ trunk/src/test/java/org/openfast/submitted/FASTTestTemplate.xml 2007-12-06 17:26:54 UTC (rev 100) @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<template name="MDIncRefresh" id="35" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.fixprotocol.org/ns/fast/td/1.1 T:\dev05\MDS\MDST\source\mdst\config\FAST\FASTTemplate.xsd"> - <typeRef name="MDIncRefresh"/> - <string name="ApplVerID" id="1128"> <constant value="FIX.5.0"/> </string> - <string name="MessageType" id="35"> <constant value="X"/> </string> - <string name="SenderCompID" id="49"> <constant value="CME"/> </string> - <int32 name="MsgSeqNum" id="34"> <increment/> </int32> - <int64 name="SendingTime" id="52"> <delta/> </int64> - <sequence name="MDEntries"> <length name="NoMDEntries" id="268"/> - <uInt32 name="MDUpdateAction" id="279"> <default value="0"/> </uInt32> - <string name="MDEntryType" id="269"> <copy/> </string> - <uInt32 name="MDPriceLevel" id="1023" presence="optional"> <increment value="1"/> - </uInt32> - <string name="SecurityDesc" id="107"> <copy/> </string> - <decimal name="MDEntryPx" id="270"> - <exponent><default value="-3"/></exponent> - <mantissa><delta/></mantissa></decimal> - <uInt32 name="MDEntrySize" id="271"> <delta/> </uInt32> - <uInt32 name="NumberOfOrders" id="346" presence="optional"> <delta/> </uInt32> - <string name="QuoteCondition" id="276" presence="optional"> <default/> </string> - <string name="TradeCondition" id="277" presence="optional"> <default/> </string> - </sequence> - </template> \ No newline at end of file Deleted: trunk/src/test/java/org/openfast/submitted/messages.fast =================================================================== (Binary files differ) Modified: trunk/src/test/java/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java =================================================================== --- trunk/src/test/java/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java 2007-12-06 17:11:51 UTC (rev 99) +++ trunk/src/test/java/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java 2007-12-06 17:26:54 UTC (rev 100) @@ -133,8 +133,7 @@ } public void testLoadMdIncrementalRefreshTemplate() { - InputStream templateStream = this.getClass() - .getResourceAsStream("mdIncrementalRefreshTemplate.xml"); + InputStream templateStream = resource("mdIncrementalRefreshTemplate.xml"); MessageTemplateLoader loader = new XMLMessageTemplateLoader(); MessageTemplate messageTemplate = loader.load(templateStream)[0]; Deleted: trunk/src/test/java/org/openfast/template/loader/mdIncrementalRefreshTemplate.xml =================================================================== --- trunk/src/test/java/org/openfast/template/loader/mdIncrementalRefreshTemplate.xml 2007-12-06 17:11:51 UTC (rev 99) +++ trunk/src/test/java/org/openfast/template/loader/mdIncrementalRefreshTemplate.xml 2007-12-06 17:26:54 UTC (rev 100) @@ -1,35 +0,0 @@ -<templates xmlns="http://www.fixprotocol.org/ns/template-definition" - ns="http://www.fixprotocol.org/ns/templates/sample"> - <template name="MDRefreshSample"> - <typeRef name="MDIncrementalRefresh"/> - <string name="8"><constant value="FIX4.4"/></string> - <uInt32 name="9"><constant value="1"/></uInt32> - <string name="35"><constant value="X"/></string> - <string name="49"><constant value="CME"/></string> - <uInt32 name="34"><increment value="1"/></uInt32> - <string name="52"><delta/></string> - <uInt32 name="75"><copy/></uInt32> - <sequence name="MDEntries"> - <typeRef name="MDEntries"/> - <length name="268"/> - <decimal name="270"><delta/></decimal> - <int32 name="271"><delta/></int32> - <uInt32 name="273"><delta/></uInt32> - <uInt32 name="346" presence="optional"/> - <uInt32 name="1023"><increment value="1"/></uInt32> - <string name="279"><copy/></string> - <string name="269"><copy/></string> - <string name="107"><copy/></string> - <string name="48"><delta/></string> - <string name="276"><copy/></string> - <string name="274"><copy/></string> - <decimal name="451"><copy/></decimal> - <string name="277"><default value="F"/></string> - <uInt32 name="1020" presence="optional"/> - <int32 name="537"><default value="1"/></int32> - <string name="1024"><default value="0"/></string> - <string name="336"><default value="2"/></string> - </sequence> - <string name="10"/> - </template> -</templates> \ No newline at end of file Deleted: trunk/src/test/java/org/openfast/template.xml =================================================================== --- trunk/src/test/java/org/openfast/template.xml 2007-12-06 17:11:51 UTC (rev 99) +++ trunk/src/test/java/org/openfast/template.xml 2007-12-06 17:26:54 UTC (rev 100) @@ -1,12 +0,0 @@ -<templates xmlns="http://www.fixprotocol.org/ns/template-definition" - ns="http://www.fixprotocol.org/ns/templates/sample"> - <template name="person"> - <u32 name="id"><increment/></u32> - <string name="name"><copy/></string> - <string name="phoneNumber"><delta/></string> - <sequence name="contacts"> - <length name="numContacts"/> - <u32 name="id"><delta/></u32> - </sequence> - </template> -</templates> \ No newline at end of file Modified: trunk/src/test/java/org/openfast/test/OpenFastTestCase.java =================================================================== --- trunk/src/test/java/org/openfast/test/OpenFastTestCase.java 2007-12-06 17:11:51 UTC (rev 99) +++ trunk/src/test/java/org/openfast/test/OpenFastTestCase.java 2007-12-06 17:26:54 UTC (rev 100) @@ -242,4 +242,8 @@ assertEquals(defaultVal, scalar.getDefaultValue()); assertEquals(optional, scalar.isOptional()); } + + protected InputStream resource(String url) { + return this.getClass().getClassLoader().getResourceAsStream(url); + } } Copied: trunk/src/test/resources/1.fast (from rev 96, trunk/src/test/java/org/openfast/scenario/1.fast) =================================================================== --- trunk/src/test/resources/1.fast (rev 0) +++ trunk/src/test/resources/1.fast 2007-12-06 17:26:54 UTC (rev 100) @@ -0,0 +1,2 @@ +\xC0\xA1;\xEB#SR M\x83 I\xA0$\xA9\xF6 +8\xC1\x90X\xDFK\xA3[Hi\xD0 \ No newline at end of file Copied: trunk/src/test/resources/FASTTestTemplate.xml (from rev 96, trunk/src/test/java/org/openfast/submitted/FASTTestTemplate.xml) =================================================================== --- trunk/src/test/resources/FASTTestTemplate.xml (rev 0) +++ trunk/src/test/resources/FASTTestTemplate.xml 2007-12-06 17:26:54 UTC (rev 100) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<template name="MDIncRefresh" id="35" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.fixprotocol.org/ns/fast/td/1.1 T:\dev05\MDS\MDST\source\mdst\config\FAST\FASTTemplate.xsd"> + <typeRef name="MDIncRefresh"/> + <string name="ApplVerID" id="1128"> <constant value="FIX.5.0"/> </string> + <string name="MessageType" id="35"> <constant value="X"/> </string> + <string name="SenderCompID" id="49"> <constant value="CME"/> </string> + <int32 name="MsgSeqNum" id="34"> <increment/> </int32> + <int64 name="SendingTime" id="52"> <delta/> </int64> + <sequence name="MDEntries"> <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> <default value="0"/> </uInt32> + <string name="MDEntryType" id="269"> <copy/> </string> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> <increment value="1"/> + </uInt32> + <string name="SecurityDesc" id="107"> <copy/> </string> + <decimal name="MDEntryPx" id="270"> + <exponent><default value="-3"/></exponent> + <mantissa><delta/></mantissa></decimal> + <uInt32 name="MDEntrySize" id="271"> <delta/> </uInt32> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> <delta/> </uInt32> + <string name="QuoteCondition" id="276" presence="optional"> <default/> </string> + <string name="TradeCondition" id="277" presence="optional"> <default/> </string> + </sequence> + </template> \ No newline at end of file Copied: trunk/src/test/resources/components.xml (from rev 99, trunk/src/test/java/org/openfast/components.xml) =================================================================== --- trunk/src/test/resources/components.xml (rev 0) +++ trunk/src/test/resources/components.xml 2007-12-06 17:26:54 UTC (rev 100) @@ -0,0 +1,11 @@ +<templates templateNs="http://www.openfast.org/fix44/components" ns="http://www.openfast.org/fix44/fields"> + <template name="Instrument"> + <ascii name="Symbol" id="55"><copy dictionary="named" /></ascii> + <ascii name="SecurityID" id="48"><copy dictionary="named" /></ascii> + </template> + <template name="Batch"> + <sequence name="Mess... [truncated message content] |
From: <ope...@li...> - 2007-12-06 17:11:50
|
Revision: 99 http://openfast.svn.sourceforge.net/openfast/?rev=99&view=rev Author: jacob_northey Date: 2007-12-06 09:11:51 -0800 (Thu, 06 Dec 2007) Log Message: ----------- Completed move over to Maven Modified Paths: -------------- trunk/.settings/org.eclipse.jdt.core.prefs trunk/pom.xml Added Paths: ----------- trunk/src/assembly/ trunk/src/assembly/source.xml trunk/src/main/resources/ trunk/src/main/resources/fastTemplateSchema-1.0.xsd trunk/src/main/resources/fastTemplateSchema-1.1.xsd trunk/src/test/java/org/openfast/Consumer.java trunk/src/test/java/org/openfast/DictionaryTest.java trunk/src/test/java/org/openfast/EncodeDecodeTest.java trunk/src/test/java/org/openfast/ExhaustiveOperatorTest.java trunk/src/test/java/org/openfast/TemplateTest.java trunk/src/test/java/org/openfast/TypeConversionTest.java trunk/src/test/java/org/openfast/components.xml trunk/src/test/java/org/openfast/preTrade.xml trunk/src/test/java/org/openfast/session.xml trunk/src/test/java/org/openfast/template.xml trunk/src/test/resources/ Removed Paths: ------------- trunk/.classpath trunk/.project trunk/build.xml trunk/lib/ trunk/src/main/java/org/openfast/fastTemplateSchema-1.0.xsd trunk/src/main/java/org/openfast/fastTemplateSchema-1.1.xsd trunk/src/main/java/org/openfast/template/fastTemplate.xsd trunk/test/acceptance/org/openfast/Consumer.java trunk/test/acceptance/org/openfast/DictionaryTest.java trunk/test/acceptance/org/openfast/EncodeDecodeTest.java trunk/test/acceptance/org/openfast/ExhaustiveOperatorTest.java trunk/test/acceptance/org/openfast/TemplateTest.java trunk/test/acceptance/org/openfast/TypeConversionTest.java trunk/test/acceptance/org/openfast/components.xml trunk/test/acceptance/org/openfast/preTrade.xml trunk/test/acceptance/org/openfast/session.xml trunk/test/acceptance/org/openfast/template.xml Deleted: trunk/.classpath =================================================================== --- trunk/.classpath 2007-12-05 18:49:23 UTC (rev 98) +++ trunk/.classpath 2007-12-06 17:11:51 UTC (rev 99) @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry excluding="**/.svn/*" kind="src" path="src/main/java"/> - <classpathentry excluding="**/.svn/*" kind="src" path="src/test/java"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry exported="true" kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"> - <attributes> - <attribute name="org.eclipse.jst.component.dependency" value="../"/> - </attributes> - </classpathentry> - <classpathentry kind="output" path="bin"/> -</classpath> Deleted: trunk/.project =================================================================== --- trunk/.project 2007-12-05 18:49:23 UTC (rev 98) +++ trunk/.project 2007-12-06 17:11:51 UTC (rev 99) @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>openfast4j</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.wst.common.project.facet.core.builder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.wst.validation.validationbuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>org.eclipse.wst.common.project.facet.core.nature</nature> - <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> - <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> - </natures> -</projectDescription> Modified: trunk/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/.settings/org.eclipse.jdt.core.prefs 2007-12-05 18:49:23 UTC (rev 98) +++ trunk/.settings/org.eclipse.jdt.core.prefs 2007-12-06 17:11:51 UTC (rev 99) @@ -1,62 +1,62 @@ -#Fri Jul 27 16:34:54 EDT 2007 -eclipse.preferences.version=1 +#Thu Dec 06 11:48:05 EST 2007 +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.problem.nullReference=ignore +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.source=1.4 +org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.compliance=1.4 org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4 +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=ignore org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 Deleted: trunk/build.xml =================================================================== --- trunk/build.xml 2007-12-05 18:49:23 UTC (rev 98) +++ trunk/build.xml 2007-12-06 17:11:51 UTC (rev 99) @@ -1,192 +0,0 @@ - -<project name="openfast4j" default="all"> - - <property name="src.dir" value="src/main/java" /> - <property name="lib" value="${basedir}/lib" /> - <property name="demo.dir" value="demo" /> - <property name="test.unit.dir" value="src/test/java" /> - - <property name="build.dir" value="build" /> - - <property name="work.dir" value="${build.dir}/work" /> - <property name="build.classes.dir" value="${work.dir}/classes" /> - <property name="build.test.classes.dir" value="${work.dir}/test-classes" /> - <property name="instr.dir" value="${work.dir}/instr" /> - - <property name="docs.dir" value="${build.dir}/docs" /> - <property name="dist.dir" value="${build.dir}/dist" /> - <property name="reports.dir" value="${build.dir}/reports" /> - - <property name="javadoc.dir" value="${docs.dir}/api" /> - <property name="reports.unit" value="${reports.dir}/unit" /> - <property name="reports.coverage" value="${reports.dir}/coverage" /> - <property name="reports.dependency" value="${reports.dir}/dependency" /> - <property name="reports.complexity" value="${reports.dir}/complexity" /> - - <path id="lib.emma.path"> - <pathelement location="${lib}/emma-2.0.5312/emma_ant.jar"/> - <pathelement location="${lib}/emma-2.0.5312/emma.jar"/> - </path> - - <path id="lib.pmd.path"> - <pathelement location="${lib}/pmd-3.9/pmd-3.9.jar"/> - <pathelement location="${lib}/pmd-3.9/asm-3.0.jar"/> - <pathelement location="${lib}/pmd-3.9/jaxen-1.1.jar"/> - <pathelement location="${lib}/pmd-3.9/backport-util-concurrent.jar"/> - </path> - - <path id="lib.junit.path"> - <pathelement location="${lib}/junit-3.8.1/junit.jar"/> - </path> - - <path id="test.path"> - <pathelement location="${build.classes.dir}" /> - <pathelement location="${build.test.classes.dir}" /> - <path refid="lib.junit.path" /> - <path refid="lib.emma.path" /> - </path> - - <path id="emma.test.path"> - <pathelement location="${instr.dir}" /> - <path refid="test.path" /> - </path> - - <path id="build.classpath"> - <pathelement location="${build.classes.dir}" /> - </path> - - <target name="compile"> - <mkdir dir="${build.classes.dir}" /> - <javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="yes" debuglevel="lines,source,vars" target="1.4" source="1.4"> - <compilerarg line="-Xlint:deprecation -Xlint:unchecked"/> - </javac> - <copy todir="${build.classes.dir}"> - <fileset dir="${src.dir}" excludes="**/*.java" includes="**/*" /> - </copy> - </target> - - <target name="compile-test" depends="compile"> - <mkdir dir="${build.test.classes.dir}" /> - <javac srcdir="${test.unit.dir}" destdir="${build.test.classes.dir}" classpathref="test.path" debug="yes" debuglevel="lines,source,vars" target="1.4" source="1.4"> - <compilerarg line="-Xlint:deprecation -Xlint:unchecked"/> - </javac> - <copy todir="${build.test.classes.dir}"> - <fileset dir="${test.unit.dir}" excludes="**/*.java" includes="**/*" /> - </copy> - </target> - - <target name="jar" depends="compile, compile-test"> - <mkdir dir="${dist.dir}" /> - <jar destfile="${dist.dir}/${ant.project.name}.jar" basedir="${build.classes.dir}" includes="**/*.class" /> - </target> - - <target name="instr" depends="jar"> - <mkdir dir="${reports.coverage}" /> - <taskdef resource="emma_ant.properties" classpathref="lib.emma.path"/> - <emma> - <instr instrpathref="build.classpath" destdir="${instr.dir}" metadatafile="${work.dir}/metadata.emma" merge="true" /> - </emma> - </target> - - <target name="unit-test" depends="instr"> - <mkdir dir="${reports.unit}" /> - <junit showoutput="yes" printsummary="yes" haltonerror="yes" haltonfailure="yes" fork="true"> - <classpath refid="emma.test.path" /> - <sysproperty key="emma.coverage.out.file" value="${work.dir}/coverage.emma" /> - <sysproperty key="emma.coverage.out.merge" value="true" /> - <jvmarg line="-ea" /> - <batchtest todir="${reports.unit}"> - <fileset includes="**/*Test.java" dir="${test.unit.dir}" /> - <formatter type="xml" usefile="true" /> - </batchtest> - <formatter type="xml" /> - </junit> - </target> - - <target name="coverage-report" depends="unit-test"> - <emma> - <report sourcepath="${src.dir}"> - <fileset dir="${work.dir}"> - <include name="*.emma" /> - </fileset> - <html outfile="${reports.coverage}/coverage.html" /> - </report> - </emma> - </target> - - <condition property="jdepend.not.installed"> - <not> - <available file="${ant.home}/lib/jdepend-2.9.jar"/> - </not> - </condition> - - <target name="install-jdepend" if="jdepend.not.installed"> - <copy todir="${ant.home}/lib" file="${lib}/jdepend-2.9/jdepend-2.9.jar"/> - <fail message="The jdepend library was not present in your Ant distribution prior to running. It has now been successfully installed. Please rerun the ant build."/> - </target> - - <target name="jdepend" depends="install-jdepend, jar"> - <mkdir dir="${reports.dependency}"/> - <jdepend outputfile="${reports.dependency}/jdepend-report.xml" format="xml"> - <exclude name="java.*" /> - <exclude name="javax.*" /> - <classespath> - <pathelement location="${build.classes.dir}" /> - </classespath> - <classpath location="${build.classes.dir}" /> - </jdepend> - - <xslt basedir="${reports.dependency}" destdir="${reports.dependency}" includes="jdepend-report.xml" style="${ant.home}/etc/jdepend.xsl" /> - </target> - - <target name="complexity"> - <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="lib.pmd.path" /> - <mkdir dir="${reports.complexity}"/> - <pmd rulesetfiles="basic,design"> - <formatter type="xml" toFile="${reports.complexity}/pmd.xml" /> - <fileset dir="${src.dir}"/> - </pmd> - <xslt in="${reports.complexity}/pmd.xml" out="${reports.complexity}/pmd.html" style="${lib}/pmd-3.9/pmd-report-per-class.xslt"/> - <copy file="${lib}/pmd-3.9/sorttable.js" todir="${reports.complexity}"/> - <copy file="${lib}/pmd-3.9/arrow_up.gif" todir="${reports.complexity}"/> - <copy file="${lib}/pmd-3.9/arrow_down.gif" todir="${reports.complexity}"/> - </target> - - <target name="javadoc"> - <javadoc destdir="${javadoc.dir}" author="true" version="true" windowtitle="OpenFAST Documentation"> - <packageset dir="${src.dir}"> - </packageset> - </javadoc> - </target> - - <target name="dist" depends="jar,javadoc"> - <mkdir dir="${work.dir}/dist"/> - <copy todir="${work.dir}/dist/src"> - <fileset dir="${src.dir}"/> - </copy> - <copy todir="${work.dir}/dist/doc"> - <fileset dir="${docs.dir}"/> - </copy> - <copy todir="${work.dir}/dist/lib"> - <fileset dir="${lib}"/> - </copy> - <mkdir dir="${work.dir}/dist/dist"/> - <copy todir="${work.dir}/dist/dist" file="${dist.dir}/${ant.project.name}.jar"/> - <copy todir="${work.dir}/dist" file="license.txt"/> - <copy todir="${work.dir}/dist" file="build.xml"/> - <zip destfile="${dist.dir}/${ant.project.name}.zip" basedir="${work.dir}/dist"/> - <zip destfile="${dist.dir}/${ant.project.name}.zip" basedir="${work.dir}/dist"/> - <tar destfile="${dist.dir}/${ant.project.name}.tar.gz" basedir="${work.dir}/dist" compression="gzip"/> - </target> - - <target name="all" depends="clean, jdepend, complexity, coverage-report, javadoc, dist, post-clean" description="builds and tests everything" /> - - <target name="clean"> - <delete dir="${build.dir}" /> - </target> - - <target name="post-clean"> - <delete dir="${work.dir}" /> - </target> -</project> - Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-12-05 18:49:23 UTC (rev 98) +++ trunk/pom.xml 2007-12-06 17:11:51 UTC (rev 99) @@ -62,21 +62,6 @@ </mailingLists> <build> - <resources> - <resource> - <directory>src/main/java</directory> - <excludes> - <exclude>**/*.java</exclude> - </excludes> - </resource> - <resource> - <directory>src/test/java</directory> - <excludes> - <exclude>**/*.java</exclude> - </excludes> - </resource> - </resources> - <extensions> <extension> <groupId>org.apache.maven.wagon</groupId> @@ -99,6 +84,36 @@ <tagBase>https://openfast.svn.sourceforge.net/svnroot/openfast/tags</tagBase> </configuration> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <executions> + <execution> + <id>javadoc</id> + <phase>process-classes</phase> + <goals> + <goal>javadoc</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptors> + <descriptor>src/assembly/source.xml</descriptor> + </descriptors> + </configuration> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>attached</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </build> Added: trunk/src/assembly/source.xml =================================================================== --- trunk/src/assembly/source.xml (rev 0) +++ trunk/src/assembly/source.xml 2007-12-06 17:11:51 UTC (rev 99) @@ -0,0 +1,50 @@ +<assembly> + <id>src</id> + <formats> + <format>zip</format> + <format>tar.gz</format> + </formats> + <includeBaseDirectory>true</includeBaseDirectory> + <dependencySets> + <dependencySet> + <outputDirectory>/lib</outputDirectory> + </dependencySet> + </dependencySets> + <fileSets> + <fileSet> + <directory>src/main/java</directory> + <outputDirectory>/src</outputDirectory> + </fileSet> + <fileSet> + <directory>/</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>license.txt</include> + </includes> + </fileSet> + <fileSet> + <directory>src/test/java</directory> + <outputDirectory>/test</outputDirectory> + </fileSet> + <fileSet> + <directory>target</directory> + <outputDirectory>/dist</outputDirectory> + <includes> + <include>*.jar</include> + </includes> + </fileSet> + <fileSet> + <directory>target/site/apidocs</directory> + <outputDirectory>/docs/api</outputDirectory> + </fileSet> + </fileSets> + <moduleSets> + <moduleSet> + <binaries> + <includeDependencies>false</includeDependencies> + <unpack>false</unpack> + <outputDirectory>dist</outputDirectory> + </binaries> + </moduleSet> + </moduleSets> +</assembly> \ No newline at end of file Deleted: trunk/src/main/java/org/openfast/fastTemplateSchema-1.0.xsd =================================================================== --- trunk/src/main/java/org/openfast/fastTemplateSchema-1.0.xsd 2007-12-05 18:49:23 UTC (rev 98) +++ trunk/src/main/java/org/openfast/fastTemplateSchema-1.0.xsd 2007-12-06 17:11:51 UTC (rev 99) @@ -1,390 +0,0 @@ -<xs:schema xmlns:td="http://www.fixprotocol.org/ns/template-definition" - xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" - targetNamespace="http://www.fixprotocol.org/ns/template-definition"> - <xs:element name="templates"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:element ref="td:template"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attribute name="ns"/> - <xs:attribute name="templateNs"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="template"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:element ref="td:messageRef"/> - <xs:group ref="td:instruction"/> - </xs:choice> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:templateNsName"/> - <xs:attribute name="ns"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="messageRef"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attributeGroup ref="td:nsName"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:group name="instruction"> - <xs:choice> - <xs:group ref="td:field"/> - <xs:element ref="td:presenceMap"/> - <xs:element ref="td:templateRef"/> - </xs:choice> - </xs:group> - <xs:complexType name="fieldInstrContent"> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:nsName"/> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory"/> - <xs:enumeration value="optional"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - <xs:group name="field"> - <xs:choice> - <xs:group ref="td:integerField"/> - <xs:element ref="td:decimal"/> - <xs:element ref="td:boolean"/> - <xs:element ref="td:string"/> - <xs:element ref="td:byteVector"/> - <xs:element ref="td:any"/> - <xs:element ref="td:sequence"/> - <xs:element ref="td:group"/> - </xs:choice> - </xs:group> - <xs:group name="integerField"> - <xs:choice> - <xs:element ref="td:int8"/> - <xs:element ref="td:uInt8"/> - <xs:element ref="td:int16"/> - <xs:element ref="td:uInt16"/> - <xs:element ref="td:int32"/> - <xs:element ref="td:uInt32"/> - <xs:element ref="td:int64"/> - <xs:element ref="td:uInt64"/> - </xs:choice> - </xs:group> - <xs:element name="int8" type="td:fieldInstrContent"/> - <xs:element name="uInt8" type="td:fieldInstrContent"/> - <xs:element name="int16" type="td:fieldInstrContent"/> - <xs:element name="uInt16" type="td:fieldInstrContent"/> - <xs:element name="int32" type="td:fieldInstrContent"/> - <xs:element name="uInt32" type="td:fieldInstrContent"/> - <xs:element name="int64" type="td:fieldInstrContent"/> - <xs:element name="uInt64" type="td:fieldInstrContent"/> - <xs:element name="decimal"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:group ref="td:singleFieldDecimal"/> - <xs:choice> - <xs:element ref="td:exponent"/> - <xs:element ref="td:mantissa"/> - </xs:choice> - </xs:choice> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:nsName"/> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory"/> - <xs:enumeration value="optional"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="exponent"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="mantissa"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:group name="singleFieldDecimal"> - <xs:sequence> - <xs:group minOccurs="0" ref="td:fieldOp"/> - </xs:sequence> - </xs:group> - <xs:group name="twinFieldDecimal"> - <xs:sequence> - <xs:element minOccurs="0" ref="td:exponent"/> - <xs:element minOccurs="0" ref="td:mantissa"/> - </xs:sequence> - </xs:group> - <xs:element name="boolean" type="td:fieldInstrContent"/> - <xs:element name="string"> - <xs:complexType> - <xs:complexContent> - <xs:extension base="td:fieldInstrContent"> - <xs:attribute name="charset"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="ascii"/> - <xs:enumeration value="unicode"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:extension> - </xs:complexContent> - </xs:complexType> - </xs:element> - <xs:element name="byteVector" type="td:fieldInstrContent"/> - <xs:element name="any" type="td:fieldInstrContent"/> - <xs:element name="sequence"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:element ref="td:length"/> - <xs:group ref="td:instruction"/> - </xs:choice> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:nsName"/> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory"/> - <xs:enumeration value="optional"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="length"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attribute name="name" type="xs:token"/> - <xs:attribute name="ns"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="group"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:instruction"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:nsName"/> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory"/> - <xs:enumeration value="optional"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:group name="fieldOp"> - <xs:choice> - <xs:element ref="td:constant"/> - <xs:element ref="td:implicit"/> - <xs:element ref="td:default"/> - <xs:element ref="td:copy"/> - <xs:element ref="td:increment"/> - <xs:element ref="td:delta"/> - </xs:choice> - </xs:group> - <xs:element name="constant"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attributeGroup ref="td:initialValueAttr"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="implicit"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="default"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attribute name="value"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="copy" type="td:opContext"/> - <xs:element name="increment" type="td:opContext"/> - <xs:element name="delta" type="td:opContext"/> - <xs:attributeGroup name="initialValueAttr"> - <xs:attribute name="value" use="required"/> - </xs:attributeGroup> - <xs:complexType name="opContext"> - <xs:group ref="td:other"/> - <xs:attribute name="dictionary"> - <xs:simpleType> - <xs:union memberTypes="xs:string"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="template"/> - </xs:restriction> - </xs:simpleType> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="message"/> - </xs:restriction> - </xs:simpleType> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="global"/> - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="scope"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="group"/> - <xs:enumeration value="message"/> - <xs:enumeration value="explicit"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="value"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - <xs:attributeGroup name="scopeAttr"> - <xs:attribute name="scope" use="required"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="group"/> - <xs:enumeration value="message"/> - <xs:enumeration value="explicit"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:attributeGroup> - <xs:attributeGroup name="dictionaryAttr"> - <xs:attribute name="dictionary" use="required"> - <xs:simpleType> - <xs:union memberTypes="xs:string"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="template"/> - </xs:restriction> - </xs:simpleType> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="message"/> - </xs:restriction> - </xs:simpleType> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="global"/> - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - </xs:attributeGroup> - <xs:attributeGroup name="lengthAttr"> - <xs:attribute name="length" use="required" type="xs:unsignedInt"/> - </xs:attributeGroup> - <xs:attributeGroup name="charsetAttr"> - <xs:attribute name="charset" use="required"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="ascii"/> - <xs:enumeration value="unicode"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:attributeGroup> - <xs:element name="presenceMap"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attribute name="length" type="xs:unsignedInt"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="templateRef"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attribute name="name" type="xs:token"/> - <xs:attribute name="templateNs"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:attributeGroup name="presenceAttr"> - <xs:attribute name="presence" use="required"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory"/> - <xs:enumeration value="optional"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:attributeGroup> - <xs:attributeGroup name="nsName"> - <xs:attributeGroup ref="td:nameAttr"/> - <xs:attribute name="ns"/> - </xs:attributeGroup> - <xs:attributeGroup name="templateNsName"> - <xs:attributeGroup ref="td:nameAttr"/> - <xs:attribute name="templateNs"/> - </xs:attributeGroup> - <xs:attributeGroup name="nameAttr"> - <xs:attribute name="name" use="required" type="xs:token"/> - </xs:attributeGroup> - <xs:attributeGroup name="nsAttr"> - <xs:attribute name="ns" use="required"/> - </xs:attributeGroup> - <xs:attributeGroup name="templateNsAttr"> - <xs:attribute name="templateNs" use="required"/> - </xs:attributeGroup> - <xs:group name="other"> - <xs:sequence> - <xs:group minOccurs="0" maxOccurs="unbounded" ref="td:foreignElm"/> - </xs:sequence> - </xs:group> - <xs:attributeGroup name="other"> - <xs:attributeGroup ref="td:foreignAttr"/> - </xs:attributeGroup> - <xs:group name="foreignElm"> - <xs:choice> - <xs:any namespace="##other" processContents="skip"/> - <xs:any namespace="##local" processContents="skip"/> - </xs:choice> - </xs:group> - <xs:attributeGroup name="foreignAttr"> - <xs:anyAttribute namespace="##other" processContents="skip"/> - </xs:attributeGroup> -</xs:schema> \ No newline at end of file Deleted: trunk/src/main/java/org/openfast/fastTemplateSchema-1.1.xsd =================================================================== --- trunk/src/main/java/org/openfast/fastTemplateSchema-1.1.xsd 2007-12-05 18:49:23 UTC (rev 98) +++ trunk/src/main/java/org/openfast/fastTemplateSchema-1.1.xsd 2007-12-06 17:11:51 UTC (rev 99) @@ -1,371 +0,0 @@ -<xs:schema xmlns:td="http://www.fixprotocol.org/ns/fast/td/1.1" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - elementFormDefault="qualified" - targetNamespace="http://www.fixprotocol.org/ns/fast/td/1.1"> - <xs:element name="templates"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:element ref="td:template" /> - <xs:group ref="td:other" /> - </xs:choice> - <xs:attribute name="ns" /> - <xs:attribute name="templateNs" /> - <xs:attribute name="dictionary"> - <xs:simpleType> - <xs:union memberTypes="xs:string"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="template" /> - <xs:enumeration value="type" /> - <xs:enumeration value="global" /> - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:element name="template"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:element ref="td:typeRef" /> - <xs:group ref="td:instruction" /> - </xs:choice> - <xs:group ref="td:other" /> - </xs:choice> - <xs:attributeGroup ref="td:templateNsName" /> - <xs:attribute name="ns" /> - <xs:attribute name="dictionary"> - <xs:simpleType> - <xs:union memberTypes="xs:string"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="template" /> - <xs:enumeration value="type" /> - <xs:enumeration value="global" /> - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:element name="typeRef"> - <xs:complexType> - <xs:group ref="td:other" /> - <xs:attributeGroup ref="td:nameAttr" /> - <xs:attribute name="ns" /> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:group name="instruction"> - <xs:choice> - <xs:group ref="td:field" /> - <xs:element ref="td:templateRef" /> - </xs:choice> - </xs:group> - <xs:group name="fieldInstrContent"> - <xs:sequence> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp" /> - <xs:group ref="td:other" /> - </xs:choice> - </xs:sequence> - </xs:group> - <xs:attributeGroup name="fieldInstrContent"> - <xs:attributeGroup ref="td:nsName" /> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory" /> - <xs:enumeration value="optional" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other" /> - </xs:attributeGroup> - <xs:group name="field"> - <xs:choice> - <xs:group ref="td:integerField" /> - <xs:element ref="td:decimal" /> - <xs:group ref="td:stringField" /> - <xs:element ref="td:byteVector" /> - <xs:element ref="td:sequence" /> - <xs:element ref="td:group" /> - </xs:choice> - </xs:group> - <xs:complexType name="integerField"> - <xs:group ref="td:fieldInstrContent" /> - <xs:attributeGroup ref="td:fieldInstrContent" /> - </xs:complexType> - <xs:group name="integerField"> - <xs:choice> - <xs:element ref="td:int32" /> - <xs:element ref="td:uInt32" /> - <xs:element ref="td:int64" /> - <xs:element ref="td:uInt64" /> - </xs:choice> - </xs:group> - <xs:element name="int32" type="td:integerField" /> - <xs:element name="uInt32" type="td:integerField" /> - <xs:element name="int64" type="td:integerField" /> - <xs:element name="uInt64" type="td:integerField" /> - <xs:element name="decimal"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:group ref="td:fieldOp" /> - <xs:choice> - <xs:element ref="td:exponent" /> - <xs:element ref="td:mantissa" /> - </xs:choice> - </xs:choice> - <xs:group ref="td:other" /> - </xs:choice> - <xs:attributeGroup ref="td:nsName" /> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory" /> - <xs:enumeration value="optional" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:element name="exponent"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp" /> - <xs:group ref="td:other" /> - </xs:choice> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:element name="mantissa"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp" /> - <xs:group ref="td:other" /> - </xs:choice> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:group name="stringField"> - <xs:sequence> - <xs:element name="string"> - <xs:complexType> - <xs:sequence> - <xs:group minOccurs="0" ref="td:byteVectorLength" /> - <xs:group ref="td:fieldInstrContent" /> - </xs:sequence> - <xs:attributeGroup ref="td:fieldInstrContent" /> - <xs:attribute name="charset"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="ascii" /> - <xs:enumeration value="unicode" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:group> - <xs:element name="byteVector"> - <xs:complexType> - <xs:sequence> - <xs:group minOccurs="0" ref="td:byteVectorLength" /> - <xs:group ref="td:fieldInstrContent" /> - </xs:sequence> - <xs:attributeGroup ref="td:fieldInstrContent" /> - </xs:complexType> - </xs:element> - <xs:group name="byteVectorLength"> - <xs:sequence> - <xs:element name="length"> - <xs:complexType> - <xs:attributeGroup ref="td:nsName" /> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:group> - <xs:element name="sequence"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:element ref="td:typeRef" /> - <xs:group ref="td:length" /> - <xs:group ref="td:instruction" /> - </xs:choice> - <xs:group ref="td:other" /> - </xs:choice> - <xs:attributeGroup ref="td:nsName" /> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory" /> - <xs:enumeration value="optional" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="dictionary"> - <xs:simpleType> - <xs:union memberTypes="xs:string"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="template" /> - <xs:enumeration value="type" /> - <xs:enumeration value="global" /> - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:group name="length"> - <xs:sequence> - <xs:element name="length"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp" /> - <xs:group ref="td:other" /> - </xs:choice> - <xs:attribute name="name" type="xs:token" /> - <xs:attribute name="ns" /> - <xs:attribute name="id" type="xs:token" /> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:group> - <xs:element name="group"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:element ref="td:typeRef" /> - <xs:group ref="td:instruction" /> - </xs:choice> - <xs:group ref="td:other" /> - </xs:choice> - <xs:attributeGroup ref="td:nsName" /> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory" /> - <xs:enumeration value="optional" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="dictionary"> - <xs:simpleType> - <xs:union memberTypes="xs:string"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="template" /> - <xs:enumeration value="type" /> - <xs:enumeration value="global" /> - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:group name="fieldOp"> - <xs:choice> - <xs:element ref="td:constant" /> - <xs:element ref="td:default" /> - <xs:element ref="td:copy" /> - <xs:element ref="td:increment" /> - <xs:element ref="td:delta" /> - <xs:element ref="td:tail" /> - </xs:choice> - </xs:group> - <xs:element name="constant"> - <xs:complexType> - <xs:group ref="td:other" /> - <xs:attributeGroup ref="td:initialValueAttr" /> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:element name="default"> - <xs:complexType> - <xs:group ref="td:other" /> - <xs:attribute name="value" /> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:element name="copy" type="td:opContext" /> - <xs:element name="increment" type="td:opContext" /> - <xs:element name="delta" type="td:opContext" /> - <xs:element name="tail" type="td:opContext" /> - <xs:attributeGroup name="initialValueAttr"> - <xs:attribute use="required" name="value" /> - </xs:attributeGroup> - <xs:complexType name="opContext"> - <xs:group ref="td:other" /> - <xs:attribute name="dictionary"> - <xs:simpleType> - <xs:union memberTypes="xs:string"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="template" /> - <xs:enumeration value="type" /> - <xs:enumeration value="global" /> - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="key" type="xs:token" /> - <xs:attribute name="ns" /> - <xs:attribute name="value" /> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - <xs:element name="templateRef"> - <xs:complexType> - <xs:group ref="td:other" /> - <xs:attribute name="name" type="xs:token" /> - <xs:attribute name="templateNs" /> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:attributeGroup name="nsName"> - <xs:attributeGroup ref="td:nameAttr" /> - <xs:attribute name="ns" /> - <xs:attribute name="id" type="xs:token" /> - </xs:attributeGroup> - <xs:attributeGroup name="templateNsName"> - <xs:attributeGroup ref="td:nameAttr" /> - <xs:attribute name="templateNs" /> - <xs:attribute name="id" type="xs:token" /> - </xs:attributeGroup> - <xs:attributeGroup name="nameAttr"> - <xs:attribute use="required" name="name" type="xs:token" /> - </xs:attributeGroup> - <xs:group name="other"> - <xs:sequence> - <xs:group minOccurs="0" ref="td:foreignElm" maxOccurs="unbounded" /> - </xs:sequence> - </xs:group> - <xs:attributeGroup name="other"> - <xs:attributeGroup ref="td:foreignAttr" /> - </xs:attributeGroup> - <xs:group name="foreignElm"> - <xs:choice> - <xs:any namespace="##other" processContents="skip" /> - <xs:any namespace="##local" processContents="skip" /> - </xs:choice> - </xs:group> - <xs:attributeGroup name="foreignAttr"> - <xs:anyAttribute namespace="##other" processContents="skip" /> - </xs:attributeGroup> -</xs:schema> \ No newline at end of file Deleted: trunk/src/main/java/org/openfast/template/fastTemplate.xsd =================================================================== --- trunk/src/main/java/org/openfast/template/fastTemplate.xsd 2007-12-05 18:49:23 UTC (rev 98) +++ trunk/src/main/java/org/openfast/template/fastTemplate.xsd 2007-12-06 17:11:51 UTC (rev 99) @@ -1,390 +0,0 @@ -<xs:schema xmlns:td="http://www.fixprotocol.org/ns/template-definition" - xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" - targetNamespace="http://www.fixprotocol.org/ns/template-definition"> - <xs:element name="templates"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:element ref="td:template"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attribute name="ns"/> - <xs:attribute name="templateNs"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="template"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:element ref="td:messageRef"/> - <xs:group ref="td:instruction"/> - </xs:choice> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:templateNsName"/> - <xs:attribute name="ns"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="messageRef"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attributeGroup ref="td:nsName"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:group name="instruction"> - <xs:choice> - <xs:group ref="td:field"/> - <xs:element ref="td:presenceMap"/> - <xs:element ref="td:templateRef"/> - </xs:choice> - </xs:group> - <xs:complexType name="fieldInstrContent"> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:nsName"/> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory"/> - <xs:enumeration value="optional"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - <xs:group name="field"> - <xs:choice> - <xs:group ref="td:integerField"/> - <xs:element ref="td:decimal"/> - <xs:element ref="td:boolean"/> - <xs:element ref="td:string"/> - <xs:element ref="td:byteVector"/> - <xs:element ref="td:any"/> - <xs:element ref="td:sequence"/> - <xs:element ref="td:group"/> - </xs:choice> - </xs:group> - <xs:group name="integerField"> - <xs:choice> - <xs:element ref="td:int8"/> - <xs:element ref="td:uInt8"/> - <xs:element ref="td:int16"/> - <xs:element ref="td:uInt16"/> - <xs:element ref="td:int32"/> - <xs:element ref="td:uInt32"/> - <xs:element ref="td:int64"/> - <xs:element ref="td:uInt64"/> - </xs:choice> - </xs:group> - <xs:element name="int8" type="td:fieldInstrContent"/> - <xs:element name="uInt8" type="td:fieldInstrContent"/> - <xs:element name="int16" type="td:fieldInstrContent"/> - <xs:element name="uInt16" type="td:fieldInstrContent"/> - <xs:element name="int32" type="td:fieldInstrContent"/> - <xs:element name="uInt32" type="td:fieldInstrContent"/> - <xs:element name="int64" type="td:fieldInstrContent"/> - <xs:element name="uInt64" type="td:fieldInstrContent"/> - <xs:element name="decimal"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:group ref="td:singleFieldDecimal"/> - <xs:choice> - <xs:element ref="td:exponent"/> - <xs:element ref="td:mantissa"/> - </xs:choice> - </xs:choice> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:nsName"/> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory"/> - <xs:enumeration value="optional"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="exponent"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="mantissa"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:group name="singleFieldDecimal"> - <xs:sequence> - <xs:group minOccurs="0" ref="td:fieldOp"/> - </xs:sequence> - </xs:group> - <xs:group name="twinFieldDecimal"> - <xs:sequence> - <xs:element minOccurs="0" ref="td:exponent"/> - <xs:element minOccurs="0" ref="td:mantissa"/> - </xs:sequence> - </xs:group> - <xs:element name="boolean" type="td:fieldInstrContent"/> - <xs:element name="string"> - <xs:complexType> - <xs:complexContent> - <xs:extension base="td:fieldInstrContent"> - <xs:attribute name="charset"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="ascii"/> - <xs:enumeration value="unicode"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:extension> - </xs:complexContent> - </xs:complexType> - </xs:element> - <xs:element name="byteVector" type="td:fieldInstrContent"/> - <xs:element name="any" type="td:fieldInstrContent"/> - <xs:element name="sequence"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:element ref="td:length"/> - <xs:group ref="td:instruction"/> - </xs:choice> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:nsName"/> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory"/> - <xs:enumeration value="optional"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="length"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attribute name="name" type="xs:token"/> - <xs:attribute name="ns"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="group"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:instruction"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:nsName"/> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory"/> - <xs:enumeration value="optional"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:group name="fieldOp"> - <xs:choice> - <xs:element ref="td:constant"/> - <xs:element ref="td:implicit"/> - <xs:element ref="td:default"/> - <xs:element ref="td:copy"/> - <xs:element ref="td:increment"/> - <xs:element ref="td:delta"/> - </xs:choice> - </xs:group> - <xs:element name="constant"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attributeGroup ref="td:initialValueAttr"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="implicit"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="default"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attribute name="value"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="copy" type="td:opContext"/> - <xs:element name="increment" type="td:opContext"/> - <xs:element name="delta" type="td:opContext"/> - <xs:attributeGroup name="initialValueAttr"> - <xs:attribute name="value" use="required"/> - </xs:attributeGroup> - <xs:complexType name="opContext"> - <xs:group ref="td:other"/> - <xs:attribute name="dictionary"> - <xs:simpleType> - <xs:union memberTypes="xs:string"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="template"/> - </xs:restriction> - </xs:simpleType> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="message"/> - </xs:restriction> - </xs:simpleType> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="global"/> - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="scope"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="group"/> - <xs:enumeration value="message"/> - <xs:enumeration value="explicit"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="value"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - <xs:attributeGroup name="scopeAttr"> - <xs:attribute name="scope" use="required"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="group"/> - <xs:enumeration value="message"/> - <xs:enumeration value="explicit"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:attributeGroup> - <xs:attributeGroup name="dictionaryAttr"> - <xs:attribute name="dictionary" use="required"> - <xs:simpleType> - <xs:union memberTypes="xs:string"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="template"/> - </xs:restriction> - </xs:simpleType> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="message"/> - </xs:restriction> - </xs:simpleType> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="global"/> - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - </xs:attributeGroup> - <xs:attributeGroup name="lengthAttr"> - <xs:attribute name="length" use="required" type="xs:unsignedInt"/> - </xs:attributeGroup> - <xs:attributeGroup name="charsetAttr"> - <xs:attribute name="charset" use="required"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="ascii"/> - <xs:enumeration value="unicode"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:attributeGroup> - <xs:element name="presenceMap"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attribute name="length" type="xs:unsignedInt"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="templateRef"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attribute name="name" type="xs:token"/> - <xs:attribute name="templateNs"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:attributeGroup name="presenceAttr"> - <xs:attribute name="presence" use="required"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory"/> - <xs:enumeration value="optional"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:attributeGroup> - <xs:attributeGroup name="nsName"> - <xs:attributeGroup ref="td:nameAttr"/> - <xs:attribute name="ns"/> - </xs:attributeGroup> - <xs:attributeGroup name="templateNsName"> - <xs:attributeGroup ref="td:nameAttr"/> - <xs:attribute name="templateNs"/> - </xs:attributeGroup> - <xs:attributeGroup name="nameAttr"> - <xs:attribute name="name" use="required" type="xs:token"/> - </xs:attributeGroup> - <xs:attributeGroup name="nsAttr"> - <xs:attribute name="ns" use="required"/> - </xs:attributeGroup> - <xs:attributeGroup name="templateNsAttr"> - <xs:attribute name="templateNs" use="required"/> - </xs:attributeGroup> - <xs:group name="other"> - <xs:sequence> - <xs:group minOccurs="0" maxOccurs="unbounded" ref="td:foreignElm"/> - </xs:sequence> - </xs:group> - <xs:attributeGroup name="other"> - <xs:attributeGroup ref="td:foreignAttr"/> - </xs:attributeGroup> - <xs:group name="foreignElm"> - <xs:choice> - <xs:any namespace="##other" processContents="skip"/> - <xs:any namespace="##local" processContents="skip"/> - </xs:choice> - </xs:group> - <xs:attributeGroup name="foreignAttr"> - <xs:anyAttribute namespace="##other" processContents="skip"/> - </xs:attributeGroup> -</xs:schema> \ No newline at end of file Copied: trunk/src/main/resources/fastTemplateSchema-1.0.xsd (from rev 96, trunk/src/main/java/org/openfast/fastTemplateSchema-1.0.xsd) =================================================================== --- trunk/src/main/resources/fastTemplateSchema-1.0.xsd (rev 0) +++ trunk/src/main/resources/fastTemplateSchema-1.0.xsd 2007-12-06 17:11:51 UTC (rev 99) @@ -0,0 +1,390 @@ +<xs:schema xmlns:td="http://www.fixprotocol.org/ns/template-definition" + xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" + targetNamespace="http://www.fixprotocol.org/ns/template-definition"> + <xs:element name="templates"> + <xs:complexType> + <xs:choice minOccurs="... [truncated message content] |
From: <ope...@li...> - 2007-12-05 18:49:19
|
Revision: 98 http://openfast.svn.sourceforge.net/openfast/?rev=98&view=rev Author: jacob_northey Date: 2007-12-05 10:49:23 -0800 (Wed, 05 Dec 2007) Log Message: ----------- [maven-release-plugin] prepare for next development iteration Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-12-05 18:49:19 UTC (rev 97) +++ trunk/pom.xml 2007-12-05 18:49:23 UTC (rev 98) @@ -4,7 +4,7 @@ <groupId>org.openfast</groupId> <artifactId>openfast</artifactId> <packaging>jar</packaging> - <version>0.9.4</version> + <version>0.9.5-SNAPSHOT</version> <organization> <name>The LaSalle Technology Group, LLC</name> @@ -32,9 +32,9 @@ </issueManagement> <scm> - <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.4</connection> - <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.4</developerConnection> - <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.4</url> + <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk</connection> + <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk/</developerConnection> + <url>http://openfast.svn.sourceforge.net/viewvc/openfast/trunk</url> </scm> <mailingLists> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2007-12-05 18:49:14
|
Revision: 97 http://openfast.svn.sourceforge.net/openfast/?rev=97&view=rev Author: jacob_northey Date: 2007-12-05 10:49:19 -0800 (Wed, 05 Dec 2007) Log Message: ----------- [maven-release-plugin] copy for tag openfast-0.9.4 Added Paths: ----------- tags/openfast-0.9.4/ tags/openfast-0.9.4/src/test/java/org/openfast/Consumer.java tags/openfast-0.9.4/src/test/java/org/openfast/DictionaryTest.java tags/openfast-0.9.4/src/test/java/org/openfast/EncodeDecodeTest.java tags/openfast-0.9.4/src/test/java/org/openfast/ExhaustiveOperatorTest.java tags/openfast-0.9.4/src/test/java/org/openfast/TemplateTest.java tags/openfast-0.9.4/src/test/java/org/openfast/TypeConversionTest.java tags/openfast-0.9.4/src/test/java/org/openfast/components.xml tags/openfast-0.9.4/src/test/java/org/openfast/preTrade.xml tags/openfast-0.9.4/src/test/java/org/openfast/session.xml tags/openfast-0.9.4/src/test/java/org/openfast/template.xml Removed Paths: ------------- tags/openfast-0.9.4/test/acceptance/org/openfast/Consumer.java tags/openfast-0.9.4/test/acceptance/org/openfast/DictionaryTest.java tags/openfast-0.9.4/test/acceptance/org/openfast/EncodeDecodeTest.java tags/openfast-0.9.4/test/acceptance/org/openfast/ExhaustiveOperatorTest.java tags/openfast-0.9.4/test/acceptance/org/openfast/TemplateTest.java tags/openfast-0.9.4/test/acceptance/org/openfast/TypeConversionTest.java tags/openfast-0.9.4/test/acceptance/org/openfast/components.xml tags/openfast-0.9.4/test/acceptance/org/openfast/preTrade.xml tags/openfast-0.9.4/test/acceptance/org/openfast/session.xml tags/openfast-0.9.4/test/acceptance/org/openfast/template.xml Copied: tags/openfast-0.9.4 (from rev 96, trunk) Copied: tags/openfast-0.9.4/src/test/java/org/openfast/Consumer.java (from rev 96, trunk/test/acceptance/org/openfast/Consumer.java) =================================================================== --- tags/openfast-0.9.4/src/test/java/org/openfast/Consumer.java (rev 0) +++ tags/openfast-0.9.4/src/test/java/org/openfast/Consumer.java 2007-12-05 18:49:19 UTC (rev 97) @@ -0,0 +1,26 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is OpenFAST. + +The Initial Developer of the Original Code is The LaSalle Technology +Group, LLC. Portions created by The LaSalle Technology Group, LLC +are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. + +Contributor(s): Jacob Northey <ja...@la...> + Craig Otis <co...@la...> +*/ + + +package org.openfast; + +public class Consumer { +} Copied: tags/openfast-0.9.4/src/test/java/org/openfast/DictionaryTest.java (from rev 96, trunk/test/acceptance/org/openfast/DictionaryTest.java) =================================================================== --- tags/openfast-0.9.4/src/test/java/org/openfast/DictionaryTest.java (rev 0) +++ tags/openfast-0.9.4/src/test/java/org/openfast/DictionaryTest.java 2007-12-05 18:49:19 UTC (rev 97) @@ -0,0 +1,103 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is OpenFAST. + +The Initial Developer of the Original Code is The LaSalle Technology +Group, LLC. Portions created by The LaSalle Technology Group, LLC +are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. + +Contributor(s): Jacob Northey <ja...@la...> + Craig Otis <co...@la...> +*/ + + +package org.openfast; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import junit.framework.TestCase; + +import org.openfast.session.Connection; +import org.openfast.session.Session; +import org.openfast.session.SessionConstants; +import org.openfast.template.Field; +import org.openfast.template.MessageTemplate; +import org.openfast.template.Scalar; +import org.openfast.template.operator.Operator; +import org.openfast.template.type.Type; +import org.openfast.test.TestUtil; + + +public class DictionaryTest extends TestCase { + private Session session; + private ByteArrayOutputStream out; + + protected void setUp() throws Exception { + out = new ByteArrayOutputStream(); + session = new Session(new Connection() { + public InputStream getInputStream() throws IOException { + return null; + } + + public OutputStream getOutputStream() throws IOException { + return out; + } + + public void close() { + try { + out.close(); + } catch (IOException e) { + } + } + + }, SessionConstants.SCP_1_0); + } + + public void testMultipleDictionaryTypes() throws Exception { + Scalar bid = new Scalar("bid", Type.DECIMAL, Operator.COPY, ScalarValue.UNDEFINED, false); + bid.setDictionary(Dictionary.TEMPLATE); + + MessageTemplate quote = new MessageTemplate("quote", new Field[] { bid }); + + Scalar bidR = new Scalar("bid", Type.DECIMAL, Operator.COPY, ScalarValue.UNDEFINED, false); + MessageTemplate request = new MessageTemplate("request", + new Field[] { bidR }); + + Message quote1 = new Message(quote); + quote1.setFieldValue(1, new DecimalValue(10.2)); + + Message request1 = new Message(request); + request1.setFieldValue(1, new DecimalValue(10.3)); + + Message quote2 = new Message(quote); + quote2.setFieldValue(1, new DecimalValue(10.2)); + + Message request2 = new Message(request); + request2.setFieldValue(1, new DecimalValue(10.2)); + + session.out.registerTemplate(1, request); + session.out.registerTemplate(2, quote); + session.out.writeMessage(quote1); + session.out.writeMessage(request1); + session.out.writeMessage(quote2); + session.out.writeMessage(request2); + + String expected = "11100000 10000010 11111111 00000000 11100110 " + + "11100000 10000001 11111111 00000000 11100111 " + + "11000000 10000010 " + + "11100000 10000001 11111111 00000000 11100110"; + TestUtil.assertBitVectorEquals(expected, out.toByteArray()); + } +} Copied: tags/openfast-0.9.4/src/test/java/org/openfast/EncodeDecodeTest.java (from rev 96, trunk/test/acceptance/org/openfast/EncodeDecodeTest.java) =================================================================== --- tags/openfast-0.9.4/src/test/java/org/openfast/EncodeDecodeTest.java (rev 0) +++ tags/openfast-0.9.4/src/test/java/org/openfast/EncodeDecodeTest.java 2007-12-05 18:49:19 UTC (rev 97) @@ -0,0 +1,157 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is OpenFAST. + +The Initial Developer of the Original Code is The LaSalle Technology +Group, LLC. Portions created by The LaSalle Technology Group, LLC +are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. + +Contributor(s): Jacob Northey <ja...@la...> + Craig Otis <co...@la...> +*/ + + +package org.openfast; + +import junit.framework.TestCase; + +import org.openfast.template.Field; +import org.openfast.template.Group; +import org.openfast.template.MessageTemplate; +import org.openfast.template.Scalar; +import org.openfast.template.Sequence; +import org.openfast.template.operator.Operator; +import org.openfast.template.type.Type; + +import org.openfast.test.ObjectMother; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; + + +public class EncodeDecodeTest extends TestCase { + public void testComplexMessage() throws Exception { + MessageTemplate template = new MessageTemplate("Company", + new Field[] { + new Scalar("Name", Type.STRING, Operator.NONE, ScalarValue.UNDEFINED, false), + new Scalar("Id", Type.U32, Operator.INCREMENT, ScalarValue.UNDEFINED, false), + new Sequence("Employees", + new Field[] { + new Scalar("First Name", Type.STRING, Operator.COPY, ScalarValue.UNDEFINED, false), + new Scalar("Last Name", Type.STRING, Operator.COPY, ScalarValue.UNDEFINED, false), + new Scalar("Age", Type.U32, Operator.DELTA, ScalarValue.UNDEFINED, false) + }, false), + new Group("Tax Information", + new Field[] { + new Scalar("EIN", Type.STRING, Operator.NONE, ScalarValue.UNDEFINED, false) + }, false) + }); + Message aaaInsurance = new Message(template); + aaaInsurance.setFieldValue(1, new StringValue("AAA Insurance")); + aaaInsurance.setFieldValue(2, new IntegerValue(5)); + + SequenceValue employees = new SequenceValue(template.getSequence( + "Employees")); + employees.add(new FieldValue[] { + new StringValue("John"), new StringValue("Doe"), + new IntegerValue(45) + }); + employees.add(new FieldValue[] { + new StringValue("Jane"), new StringValue("Doe"), + new IntegerValue(48) + }); + aaaInsurance.setFieldValue(3, employees); + aaaInsurance.setFieldValue(4, + new GroupValue(template.getGroup("Tax Information"), + new FieldValue[] { new StringValue("99-99999999") })); + + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + MessageOutputStream out = new MessageOutputStream(outStream); + out.registerTemplate(1, template); + out.writeMessage(aaaInsurance); + + Message abcBuilding = new Message(template); + abcBuilding.setFieldValue(1, new StringValue("ABC Building")); + abcBuilding.setFieldValue(2, new IntegerValue(6)); + employees = new SequenceValue(template.getSequence("Employees")); + employees.add(new FieldValue[] { + new StringValue("Bob"), new StringValue("Builder"), + new IntegerValue(3) + }); + employees.add(new FieldValue[] { + new StringValue("Joe"), new StringValue("Rock"), + new IntegerValue(59) + }); + abcBuilding.setFieldValue(3, employees); + abcBuilding.setFieldValue(4, + new GroupValue(template.getGroup("Tax Information"), + new FieldValue[] { new StringValue("99-99999999") })); + out.writeMessage(abcBuilding); + + MessageInputStream in = new MessageInputStream(new ByteArrayInputStream( + outStream.toByteArray())); + in.registerTemplate(1, template); + + GroupValue message = in.readMessage(); + assertEquals(aaaInsurance, message); + + message = in.readMessage(); + assertEquals(abcBuilding, message); + } + + public void testMultipleMessages() { + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + MessageOutputStream out = new MessageOutputStream(outStream); + out.registerTemplate(ObjectMother.ALLOC_INSTRCTN_TEMPLATE_ID, + ObjectMother.allocationInstruction()); + + SequenceValue allocations = new SequenceValue(ObjectMother.allocationInstruction() + .getSequence("Allocations")); + allocations.add(ObjectMother.newAllocation("fortyFiveFund", 22.5, 75.0)); + allocations.add(ObjectMother.newAllocation("fortyFund", 24.6, 25.0)); + + Message ai1 = ObjectMother.newAllocInstrctn("ltg0001", 1, 100.0, 23.4, + ObjectMother.newInstrument("CTYA", "200910"), allocations); + + allocations = new SequenceValue(ObjectMother.allocationInstruction() + .getSequence("Allocations")); + allocations.add(ObjectMother.newAllocation("fortyFiveFund", 22.5, 75.0)); + allocations.add(ObjectMother.newAllocation("fortyFund", 24.6, 25.0)); + + Message ai2 = ObjectMother.newAllocInstrctn("ltg0001", 1, 100.0, 23.4, + ObjectMother.newInstrument("CTYA", "200910"), allocations); + + allocations = new SequenceValue(ObjectMother.allocationInstruction() + .getSequence("Allocations")); + allocations.add(ObjectMother.newAllocation("fortyFiveFund", 22.5, 75.0)); + allocations.add(ObjectMother.newAllocation("fortyFund", 24.6, 25.0)); + + Message ai3 = ObjectMother.newAllocInstrctn("ltg0001", 1, 100.0, 23.4, + ObjectMother.newInstrument("CTYA", "200910"), allocations); + + out.writeMessage(ai1); + out.writeMessage(ai2); + out.writeMessage(ai3); + + byte[] bytes = outStream.toByteArray(); + MessageInputStream in = new MessageInputStream(new ByteArrayInputStream( + bytes)); + in.registerTemplate(ObjectMother.ALLOC_INSTRCTN_TEMPLATE_ID, + ObjectMother.allocationInstruction()); + + Message message = in.readMessage(); + assertEquals(ai1, message); + message = in.readMessage(); + assertEquals(ai2, message); + assertEquals(ai3, in.readMessage()); + } +} Copied: tags/openfast-0.9.4/src/test/java/org/openfast/ExhaustiveOperatorTest.java (from rev 96, trunk/test/acceptance/org/openfast/ExhaustiveOperatorTest.java) =================================================================== --- tags/openfast-0.9.4/src/test/java/org/openfast/ExhaustiveOperatorTest.java (rev 0) +++ tags/openfast-0.9.4/src/test/java/org/openfast/ExhaustiveOperatorTest.java 2007-12-05 18:49:19 UTC (rev 97) @@ -0,0 +1,542 @@ +/* +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is OpenFAST. + +The Initial Developer of the Original Code is The LaSalle Technology +Group, LLC. Portions created by The LaSalle Technology Group, LLC +are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. + +Contributor(s): Jacob Northey <ja...@la...> + Craig Otis <co...@la...> +*/ + + +package org.openfast; + +import java.io.IOException; +import java.io.PipedInputStream; +import java.io.PipedOutputStream; + +import junit.framework.TestCase; + +import org.openfast.codec.FastDecoder; +import org.openfast.codec.FastEncoder; +import org.openfast.template.Field; +import org.openfast.template.MessageTemplate; +import org.openfast.template.Scalar; +import org.openfast.template.operator.Operator; +import org.openfast.template.type.Type; +import org.openfast.test.TestUtil; + + +/** + * The goal of this test is to make sure all cases of all operators are covered + * + * @author Jacob Northey + */ +public class ExhaustiveOperatorTest extends TestCase { + private Context decodingContext; + private Context encodingContext; + private FastEncoder encoder; + private PipedInputStream in; + private PipedOutputStream out; + private FastDecoder decoder; + + public void setUp() throws Exception { + out = new PipedOutputStream(); + in = new PipedInputStream(out); + encodingContext = new Context(); + decodingContext = new Context(); + encoder = new FastEncoder(encodingContext); + decoder = new FastDecoder(decodingContext, in); + } + + public void testEmptyOperatorWithOptionalField() throws Exception { + Scalar field = new Scalar("", Type.U32, Operator.NONE, + ScalarValue.UNDEFINED, true); + MessageTemplate template = registerTemplate(field); + + Message message = new Message(template); + message.setInteger(1, 126); + + // --PMAP-- --TID--- ---#1--- + String encoding = "11000000 11110001 11111111"; + + encodeAndAssertEquals(encoding, message); + + GroupValue readMessage = decoder.readMessage(); + + assertEquals(message, readMessage); + } + + public void testEmptyOperatorWithOptionalFieldOnNullValue() + throws Exception { + Scalar field = new Scalar("", Type.U32, Operator.NONE, + ScalarValue.UNDEFINED, true); + MessageTemplate template = registerTemplate(field); + + // NOTE: The field is not set. + Message message = new Message(template); + + // --PMAP-- --TID--- ---#1--- + String encoding = "11000000 11110001 10000000"; + + encodeAndAssertEquals(encoding, message); + + GroupValue readMessage = decoder.readMessage(); + + assertEquals(message, readMessage); + } + + public void testEmptyOperatorWithSequenceOfMessages() + throws IOException { + Scalar field = new Scalar("", Type.U32, Operator.NONE, + ScalarValue.UNDEFINED, true); + MessageTemplate template = registerTemplate(field); + + // NOTE: The field is not set. + Message msg1 = new Message(template); + + Message msg2 = new Message(template); + msg2.setInteger(1, 15); + + // --PMAP-- --TID--- ---#1--- + String encoding = "11000000 11110001 10000000"; + byte[] encodedMessage; + encodeAndAssertEquals(encoding, msg1); + + // --PMAP-- ---#1--- + encoding = "10000000 10010000"; + encodedMessage = encoder.encode(msg2); + TestUtil.assertBitVectorEquals(encoding, encodedMessage); + out.write(encodedMessage); + + GroupValue readMessage = decoder.readMessage(); + assertEquals(msg1, readMessage); + readMessage = decoder.readMessage(); + assertEquals(msg2, readMessage); + } + + public void testEmptyOperatorWithMandatoryField() throws IOException { + Scalar field = new Scalar("", Type.U32, Operator.NONE, + ScalarValue.UNDEFINED, false); + MessageTemplate template = registerTemplate(field); + + // NOTE: The field is not set. + Message msg1 = new Message(template); + msg1.setInteger(1, 0); + + Message msg2 = new Message(template); + msg2.setInteger(1, 16); + + // --PMAP-- --TID--- ---#1--- + String encoding = "11000000 11110001 10000000"; + byte[] encodedMessage; + encodeAndAssertEquals(encoding, msg1); + + // --PMAP-- ---#1--- + encoding = "10000000 10010000"; + encodedMessage = encoder.encode(msg2); + TestUtil.assertBitVectorEquals(encoding, encodedMessage); + out.write(encodedMessage); + + GroupValue readMessage = decoder.readMessage(); + assertEquals(msg1, readMessage); + readMessage = decoder.readMessage(); + assertEquals(msg2, readMessage); + } + + public void testConstantOperatorWithOptionalField() + throws IOException { + Scalar field = new Scalar("", Type.U32, Operator.CONSTANT, + new IntegerValue(16), true); + MessageTemplate template = registerTemplate(field); + + Message msg1 = new Message(template); + // NOTE: Constant fields are set by default, so set to null to clear; + msg1.setFieldValue(1, null); + + Message msg2 = new Message(template); + msg2.setInteger(1, 16); + + // --PMAP-- --TID--- + encodeAndAssertEquals("11000000 11110001", msg1); + + // --PMAP-- + encodeAndAssertEquals("10100000", msg2); + + readMessageAndAssertEquals(msg1); + readMessageAndAssertEquals(msg2); + } + + public void testConstantOperatorWithMandatoryField() + throws IOException { + Scalar field = new Scalar("", Type.U32, Operator.CONSTANT, + new IntegerValue(16), false); + MessageTemplate template = registerTemplate(field); + + // NOTE: The field is not set. + Message msg1 = new Message(template); + msg1.setInteger(1, 16); + + Message msg2 = new Message(template); + msg2.setInteger(1, 16); + + // --PMAP-- --TID--- + encodeAndAssertEquals("11000000 11110001", msg1); + + // --PMAP-- + encodeAndAssertEquals("10000000", msg2); + + GroupValue readMessage = decoder.readMessage(); + assertEquals(msg1, readMessage); + readMessage = decoder.readMessage(); + assertEquals(msg2, readMessage); + } + + public void testDefaultOperatorWithOptionalField() { + Scalar field = new Scalar("", Type.U32, Operator.DEFAULT, + new IntegerValue(16), true); + MessageTemplate template = registerTemplate(field); + + // NOTE: The field is not set. + Message msg1 = new Message(template); + + Message msg2 = new Message(template); + msg2.setInteger(1, 16); + + Message msg3 = new Message(template); + msg3.setInteger(1, 20); + + // --PMAP-- --TID--- ---#1--- + encodeAndAssertEquals("11100000 11110001 10000000", msg1); + + // --PMAP-- + encodeAndAssertEquals("10000000", msg2); + + // --PMAP-- ---#1--- + encodeAndAssertEquals("10100000 10010101", msg3); + + readMessageAndAssertEquals(msg1); + readMessageAndAssertEquals(msg2); + readMessageAndAssertEquals(msg3); + } + + public void testDefaultOperatorWithMandatoryField() { + Scalar field = new Scalar("", Type.U32, Operator.DEFAULT, + new IntegerValue(16), false); + MessageTemplate template = registerTemplate(field); + + Message msg1 = new Message(template); + msg1.setInteger(1, 16); + + Message msg2 = new Message(template); + msg2.setInteger(1, 20); + + // --PMAP-- --TID--- + encodeAndAssertEquals("11000000 11110001", msg1); + + // --PMAP-- ---#1--- + encodeAndAssertEquals("10100000 10010100", msg2); + + readMessageAndAssertEquals(msg1); + readMessageAndAssertEquals(msg2); + } + + public void testCopyOperatorWithOptionalField() { + Scalar field = new Scalar("", Type.U32, Operator.COPY, + new IntegerValue(16), true); + MessageTemplate template = registerTemplate(field); + + Message msg1 = new Message(template); + msg1.setInteger(1, 16); + + // NOTE: The field is not set. + Message msg2 = new Message(template); + + Message msg3 = new Message(template); + msg3.setInteger(1, 20); + + Message msg4 = new Message(template); + msg4.setInteger(1, 20); + + // --PMAP-- --TID--- + encodeAndAssertEquals("11000000 11110001", msg1); + + // --PMAP-- ---#1--- + encodeAndAssertEquals("10100000 10000000", msg2); + + // --PMAP-- ---#1--- + encodeAndAssertEquals("10100000 10010101", msg3); + + // --PMAP-- + encodeAndAssertEquals("10000000", msg4); + + readMessageAndAssertEquals(msg1); + readMessageAndAssertEquals(msg2); + readMessageAndAssertEquals(msg3); + readMessageAndAssertEquals(msg4); + } + + public void testCopyOperatorWithMandatoryField() { + Scalar field = new Scalar("", Type.U32, Operator.COPY, + new IntegerValue(16), false); + MessageTemplate template = registerTemplate(field); + + Message msg1 = new Message(template); + msg1.setInteger(1, 16); + + Message msg2 = new Message(template); + msg2.setInteger(1, 20); + + Message msg3 = new Message(template); + msg3.setInteger(1, 20); + + // --PMAP-- --TID--- + encodeAndAssertEquals("11000000 11110001", msg1); + + // --PMAP-- ---#1--- + encodeAndAssertEquals("10100000 10010100", msg2); + + // --PMAP-- + encodeAndAssertEquals("10000000", msg3); + + readMessageAndAssertEquals(msg1); + readMessageAndAssertEquals(msg2); + readMessageAndAssertEquals(msg3); + } + + public void testIncrementOperatorWithOptionalField() { + Scalar field = new Scalar("", Type.U32, + Operator.INCREMENT, new IntegerValue(16), true); + MessageTemplate template = registerTemplate(field); + + Message msg1 = new Message(template); + msg1.setInteger(1, 16); + + Message msg2 = new Message(template); + msg2.setInteger(1, 17); + + // NOTE: The field is not set. + Message msg3 = new Message(template); + + Message msg4 = new Message(template); + msg4.setInteger(1, 20); + + // --PMAP-- --TID--- + encodeAndAssertEquals("11000000 11110001", msg1); + + // --PMAP-- + encodeAndAssertEquals("10000000", msg2); + + // --PMAP-- ---#1--- + encodeAndAssertEquals("10100000 10000000", msg3); + + // --PMAP-- ---#1--- + encodeAndAssertEquals("10100000 10010101", msg4); + + readMessageAndAssertEquals(msg1); + readMessageAndAssertEquals(msg2); + readMessageAndAssertEquals(msg3); + readMessageAndAssertEquals(msg4); + } + + public void testIncrementOperatorWithMandatoryField() { + Scalar field = new Scalar("", Type.U32, + Operator.INCREMENT, new IntegerValue(16), false); + MessageTemplate template = registerTemplate(field); + + Message msg1 = new Message(template); + msg1.setInteger(1, 16); + + Message msg2 = new Message(template); + msg2.setInteger(1, 17); + + // NOTE: The field is not set. + Message msg3 = new Message(template); + msg3.setInteger(1, 20); + + // --PMAP-- --TID--- + encodeAndAssertEquals("11000000 11110001", msg1); + + // --PMAP-- ---#1--- + encodeAndAssertEquals("10000000", msg2); + + // --PMAP-- + encodeAndAssertEquals("10100000 10010100", msg3); + + readMessageAndAssertEquals(msg1); + readMessageAndAssertEquals(msg2); + readMessageAndAssertEquals(msg3); + } + + public void testDeltaOperatorWithOptionalField() { + Scalar field = new Scalar("", Type.U32, Operator.DELTA, + new IntegerValue(16), true); + MessageTemplate template = registerTemplate(field); + + Message msg1 = new Message(template); + msg1.setInteger(1, 16); + + Message msg2 = new Message(template); + msg2.setInteger(1, 17); + + // NOTE: The field is not set. + Message msg3 = new Message(template); + + Message msg4 = new Message(template); + msg4.setInteger(1, 20); + + // --PMAP-- --TID--- ---#1--- + encodeAndAssertEquals("11000000 11110001 10000001", msg1); + + // --PMAP-- ---#1--- + encodeAndAssertEquals("10000000 10000010", msg2); + + // --PMAP-- ---#1--- + encodeAndAssertEquals("10000000 10000000", msg3); + + // --PMAP-- ---#1--- + encodeAndAssertEquals("10000000 10000100", msg4); + + readMessageAndAssertEquals(msg1); + readMessageAndAssertEquals(msg2); + readMessageAndAssertEquals(msg3); + readMessageAndAssertEquals(msg4); + } + + public void testDeltaOperatorWithMandatoryField() { + Scalar field = new Scalar("", Type.U32, + Operator.INCREMENT, new IntegerValue(16), false); + MessageTemplate template = registerTemplate(field); + + Message msg1 = new Message(template); + msg1.setInteger(1, 16); + + Message msg2 = new Message(template); + msg2.setInteger(1, 17); + + // NOTE: The field is not set. + Message msg3 = new Message(template); + msg3.setInteger(1, 20); + + // --PMAP-- --TID--- + encodeAndAssertEquals("11000000 11110001", msg1); + + // --PMAP-- ---#1--- + encodeAndAssertEquals("10000000", msg2); + + // --PMAP-- + encodeAndAssertEquals("10100000 10010100", msg3); + + readMessageAndAssertEquals(msg1); + readMessageAndAssertEquals(msg2); + readMessageAndAssertEquals(msg3); + } + + public void testTailOperatorWithOptionalField() { + Scalar field = new Scalar("", Type.STRING, Operator.TAIL, + new StringValue("abc"), true); + MessageTemplate template = registerTemplate(field); + + Message msg1 = new Message(template); + msg1.setString(1, "abc"); + + Message msg2 = new Message(template); + msg2.setString(1, "abd"); + + // NOTE: The field is not set. + Message msg3 = new Message(template); + + Message msg4 = new Message(template); + msg4.setString(1, "dbef"); + + // --PMAP-- --TID--- + encodeAndAssertEquals("11000000 11110001", msg1); + + // --PMAP-- ---#1--- + encodeAndAssertEquals("10100000 11100100", msg2); + + // --PMAP-- ---#1--- + encodeAndAssertEquals("10100000 10000000", msg3); + + // --PMAP-- -----------------#1---------------- + encodeAndAssertEquals("10100000 01100100 01100010 01100101 11100110", + msg4); + + readMessageAndAssertEquals(msg1); + readMessageAndAssertEquals(msg2); + readMessageAndAssertEquals(msg3); + readMessageAndAssertEquals(msg4); + } + + public void testTailOperatorWithMandatoryField() { + Scalar field = new Scalar("", Type.STRING, Operator.TAIL, + new StringValue("abc"), false); + MessageTemplate template = registerTemplate(field); + + Message msg1 = new Message(template); + msg1.setString(1, "abc"); + + Message msg2 = new Message(template); + msg2.setString(1, "abd"); + + // NOTE: The field is not set. + Message msg3 = new Message(template); + msg3.setString(1, "abc"); + + Message msg4 = new Message(template); + msg4.setString(1, "dbef"); + + // --PMAP-- --TID--- + encodeAndAssertEquals("11000000 11110001", msg1); + + // --PMAP-- ---#1--- + encodeAndAssertEquals("10100000 11100100", msg2); + + // --PMAP-- ---#1--- + encodeAndAssertEquals("10100000 11100011", msg3); + + // --PMAP-- -----------------#1---------------- + encodeAndAssertEquals("10100000 01100100 01100010 01100101 11100110", + msg4); + + readMessageAndAssertEquals(msg1); + readMessageAndAssertEquals(msg2); + readMessageAndAssertEquals(msg3); + readMessageAndAssertEquals(msg4); + } + + private MessageTemplate registerTemplate(Scalar field) { + MessageTemplate messageTemplate = new MessageTemplate("", new Field[] { field }); + encodingContext.registerTemplate(113, messageTemplate); + decodingContext.registerTemplate(113, messageTemplate); + + return messageTemplate; + } + + private void readMessageAndAssertEquals(GroupValue msg1) { + GroupValue readMessage = decoder.readMessage(); + assertEquals(msg1, readMessage); + } + + private void encodeAndAssertEquals(String encoding, Message msg1) { + byte[] encodedMessage = encoder.encode(msg1); + TestUtil.assertBitVectorEquals(encoding, encodedMessage); + + try { + out.write(encodedMessage); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} Copied: tags/openfast-0.9.4/src/test/java/org/openfast/TemplateTest.java (from rev 96, trunk/test/acceptance/org/openfast/TemplateTest.java) =================================================================== --- tags/openfast-0.9.4/src/test/java/org/openfast/TemplateTest.java (rev 0) +++ tags/openfast-0.9.4/src/test/java/org/openfast/TemplateTest.java 2007-12-05 18:49:19 UTC (rev 97) @@ -0,0 +1,39 @@ +package org.openfast; + +import junit.framework.TestCase; + +import org.openfast.template.MessageTemplate; +import org.openfast.template.loader.MessageTemplateLoader; +import org.openfast.template.loader.XMLMessageTemplateLoader; + +public class TemplateTest extends TestCase { + private static final String SCP_1_1_NS = "http://www.fixprotocol.org/ns/fast/scp/1.1"; + private static final String PRE_TRADE_NS = "http://www.openfast.org/fix44/preTrade"; + private static final String SESSION_NS = "http://www.openfast.org/fix44/session"; + private static final String COMPONENTS_NS = "http://www.openfast.org/fix44/components"; + private static final String FIX_44_NS = "http://www.openfast.org/fix44"; + private static final String EXT_NS = "http://www.openfast.org/ext"; + private MessageTemplateLoader loader; + + protected void setUp() throws Exception { + loader = new XMLMessageTemplateLoader(true); + loader.load(this.getClass().getResourceAsStream("components.xml")); + loader.load(this.getClass().getResourceAsStream("preTrade.xml")); + loader.load(this.getClass().getResourceAsStream("session.xml")); + } + + public void testTemplates() { + MessageTemplate quote = loader.getTemplateRegistry().get(new QName("Quote", PRE_TRADE_NS)); + + assertEquals(FIX_44_NS, quote.getField("QuoteID").getQName().getNamespace()); + assertNotNull(quote.getField(new QName("Group", EXT_NS))); + + assertEquals(1, quote.getStaticTemplateReferences().length); + assertNotNull(quote.getStaticTemplateReference(new QName("Instrument", COMPONENTS_NS))); + } + + public void testTemplateExtension() { + MessageTemplate logon = loader.getTemplateRegistry().get(new QName("Logon", SESSION_NS)); + assertTrue(logon.hasAttribute(new QName("reset", SCP_1_1_NS))); + } +} Copied: tags/openfast-0.9.4/src/test/java/org/openfast/TypeConversionTest.java (from rev 96, trunk/test/acceptance/org/openfast/TypeConversionTest.java) =================================================================== --- tags/openfast-0.9.4/src/test/java/org/openfast/TypeConversionTest.java (rev 0) +++ tags/openfast-0.9.4/src/test/java/org/openfast/TypeConversionTest.java 2007-12-05 18:49:19 UTC (rev 97) @@ -0,0 +1,46 @@ +package org.openfast; + +import org.openfast.codec.FastDecoder; +import org.openfast.codec.FastEncoder; +import org.openfast.template.MessageTemplate; +import org.openfast.test.OpenFastTestCase; + +public class TypeConversionTest extends OpenFastTestCase { + + public void testConversions() { + MessageTemplate template = template( + "<template>" + + " <string name=\"string\"/>" + + " <uInt32 name=\"uint\"/>" + + " <int8 name=\"byte\"/>" + + " <int16 name=\"short\"/>" + + " <int64 name=\"long\"/>" + + " <byteVector name=\"bytevector\"/>" + + " <decimal name=\"decimal\"/>" + + "</template>"); + + Message message = new Message(template); + message.setByteVector("string", byt("7f001a")); + message.setDecimal("uint", 150.0); + message.setString("byte", "4"); + message.setString("short", "-5"); + message.setString("long", "1000000000000000000"); + message.setString("bytevector", "abcd"); + message.setString("decimal", "2.3"); + + FastEncoder encoder = encoder(template); + + byte[] encoding = encoder.encode(message); + + FastDecoder decoder = decoder(template, encoding); + Message decodedMessage = decoder.readMessage(); + + assertEquals("7f001a", decodedMessage.getString("string")); + assertEquals(150, decodedMessage.getInt("uint")); + assertEquals(150, decodedMessage.getShort("uint")); + assertEquals(4, decodedMessage.getByte("byte")); + assertEquals(-5, decodedMessage.getShort("short")); + assertEquals(1000000000000000000L, decodedMessage.getLong("long")); + assertEquals("61626364", decodedMessage.getString("bytevector")); + } +} Copied: tags/openfast-0.9.4/src/test/java/org/openfast/components.xml (from rev 96, trunk/test/acceptance/org/openfast/components.xml) =================================================================== --- tags/openfast-0.9.4/src/test/java/org/openfast/components.xml (rev 0) +++ tags/openfast-0.9.4/src/test/java/org/openfast/components.xml 2007-12-05 18:49:19 UTC (rev 97) @@ -0,0 +1,11 @@ +<templates templateNs="http://www.openfast.org/fix44/components" ns="http://www.openfast.org/fix44/fields"> + <template name="Instrument"> + <ascii name="Symbol" id="55"><copy dictionary="named" /></ascii> + <ascii name="SecurityID" id="48"><copy dictionary="named" /></ascii> + </template> + <template name="Batch"> + <sequence name="Messages"> + <templateRef/> + </sequence> + </template> +</templates> \ No newline at end of file Copied: tags/openfast-0.9.4/src/test/java/org/openfast/preTrade.xml (from rev 96, trunk/test/acceptance/org/openfast/preTrade.xml) =================================================================== --- tags/openfast-0.9.4/src/test/java/org/openfast/preTrade.xml (rev 0) +++ tags/openfast-0.9.4/src/test/java/org/openfast/preTrade.xml 2007-12-05 18:49:19 UTC (rev 97) @@ -0,0 +1,11 @@ +<templates templateNs="http://www.openfast.org/fix44/preTrade" ns="http://www.openfast.org/fix44"> + <template name="Quote" id="S"> + <ascii name="QuoteID" id="117"><delta/></ascii> + <templateRef name="Instrument" templateNs="http://www.openfast.org/fix44/components"/> + <decimal name="BidPx" id="132"><delta/></decimal> + <int32 name="BidSize" id="134"><delta/></int32> + <decimal name="OfferPx" id="133"><delta/></decimal> + <int32 name="OfferSize" id="135"><delta/></int32> + <ascii name="Group" ns="http://www.openfast.org/ext"><copy/></ascii> + </template> +</templates> \ No newline at end of file Copied: tags/openfast-0.9.4/src/test/java/org/openfast/session.xml (from rev 96, trunk/test/acceptance/org/openfast/session.xml) =================================================================== --- tags/openfast-0.9.4/src/test/java/org/openfast/session.xml (rev 0) +++ tags/openfast-0.9.4/src/test/java/org/openfast/session.xml 2007-12-05 18:49:19 UTC (rev 97) @@ -0,0 +1,11 @@ +<templates + templateNs="http://www.openfast.org/fix44/session" + ns="http://www.openfast.org/fix44" + xmlns="http://www.fixprotocol.org/ns/fast/td/1.1" + xmlns:scp="http://www.fixprotocol.org/ns/fast/scp/1.1"> + <template name="Logon" scp:reset="yes"> + <ascii name="MsgType" id="35"><constant value="A"/></ascii> + <int32 name="EncryptMethod" id="98"><constant value="0"/></int32> + <int32 name="HeartBtInt" id="108"/> + </template> +</templates> \ No newline at end of file Copied: tags/openfast-0.9.4/src/test/java/org/openfast/template.xml (from rev 96, trunk/test/acceptance/org/openfast/template.xml) =================================================================== --- tags/openfast-0.9.4/src/test/java/org/openfast/template.xml (rev 0) +++ tags/openfast-0.9.4/src/test/java/org/openfast/template.xml 2007-12-05 18:49:19 UTC (rev 97) @@ -0,0 +1,12 @@ +<templates xmlns="http://www.fixprotocol.org/ns/template-definition" + ns="http://www.fixprotocol.org/ns/templates/sample"> + <template name="person"> + <u32 name="id"><increment/></u32> + <string name="name"><copy/></string> + <string name="phoneNumber"><delta/></string> + <sequence name="contacts"> + <length name="numContacts"/> + <u32 name="id"><delta/></u32> + </sequence> + </template> +</templates> \ No newline at end of file Deleted: tags/openfast-0.9.4/test/acceptance/org/openfast/Consumer.java =================================================================== --- trunk/test/acceptance/org/openfast/Consumer.java 2007-12-05 18:41:07 UTC (rev 96) +++ tags/openfast-0.9.4/test/acceptance/org/openfast/Consumer.java 2007-12-05 18:49:19 UTC (rev 97) @@ -1,26 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> -*/ - - -package org.openfast; - -public class Consumer { -} Deleted: tags/openfast-0.9.4/test/acceptance/org/openfast/DictionaryTest.java =================================================================== --- trunk/test/acceptance/org/openfast/DictionaryTest.java 2007-12-05 18:41:07 UTC (rev 96) +++ tags/openfast-0.9.4/test/acceptance/org/openfast/DictionaryTest.java 2007-12-05 18:49:19 UTC (rev 97) @@ -1,103 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> -*/ - - -package org.openfast; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import junit.framework.TestCase; - -import org.openfast.session.Connection; -import org.openfast.session.Session; -import org.openfast.session.SessionConstants; -import org.openfast.template.Field; -import org.openfast.template.MessageTemplate; -import org.openfast.template.Scalar; -import org.openfast.template.operator.Operator; -import org.openfast.template.type.Type; -import org.openfast.test.TestUtil; - - -public class DictionaryTest extends TestCase { - private Session session; - private ByteArrayOutputStream out; - - protected void setUp() throws Exception { - out = new ByteArrayOutputStream(); - session = new Session(new Connection() { - public InputStream getInputStream() throws IOException { - return null; - } - - public OutputStream getOutputStream() throws IOException { - return out; - } - - public void close() { - try { - out.close(); - } catch (IOException e) { - } - } - - }, SessionConstants.SCP_1_0); - } - - public void testMultipleDictionaryTypes() throws Exception { - Scalar bid = new Scalar("bid", Type.DECIMAL, Operator.COPY, ScalarValue.UNDEFINED, false); - bid.setDictionary(Dictionary.TEMPLATE); - - MessageTemplate quote = new MessageTemplate("quote", new Field[] { bid }); - - Scalar bidR = new Scalar("bid", Type.DECIMAL, Operator.COPY, ScalarValue.UNDEFINED, false); - MessageTemplate request = new MessageTemplate("request", - new Field[] { bidR }); - - Message quote1 = new Message(quote); - quote1.setFieldValue(1, new DecimalValue(10.2)); - - Message request1 = new Message(request); - request1.setFieldValue(1, new DecimalValue(10.3)); - - Message quote2 = new Message(quote); - quote2.setFieldValue(1, new DecimalValue(10.2)); - - Message request2 = new Message(request); - request2.setFieldValue(1, new DecimalValue(10.2)); - - session.out.registerTemplate(1, request); - session.out.registerTemplate(2, quote); - session.out.writeMessage(quote1); - session.out.writeMessage(request1); - session.out.writeMessage(quote2); - session.out.writeMessage(request2); - - String expected = "11100000 10000010 11111111 00000000 11100110 " + - "11100000 10000001 11111111 00000000 11100111 " + - "11000000 10000010 " + - "11100000 10000001 11111111 00000000 11100110"; - TestUtil.assertBitVectorEquals(expected, out.toByteArray()); - } -} Deleted: tags/openfast-0.9.4/test/acceptance/org/openfast/EncodeDecodeTest.java =================================================================== --- trunk/test/acceptance/org/openfast/EncodeDecodeTest.java 2007-12-05 18:41:07 UTC (rev 96) +++ tags/openfast-0.9.4/test/acceptance/org/openfast/EncodeDecodeTest.java 2007-12-05 18:49:19 UTC (rev 97) @@ -1,157 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> -*/ - - -package org.openfast; - -import junit.framework.TestCase; - -import org.openfast.template.Field; -import org.openfast.template.Group; -import org.openfast.template.MessageTemplate; -import org.openfast.template.Scalar; -import org.openfast.template.Sequence; -import org.openfast.template.operator.Operator; -import org.openfast.template.type.Type; - -import org.openfast.test.ObjectMother; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; - - -public class EncodeDecodeTest extends TestCase { - public void testComplexMessage() throws Exception { - MessageTemplate template = new MessageTemplate("Company", - new Field[] { - new Scalar("Name", Type.STRING, Operator.NONE, ScalarValue.UNDEFINED, false), - new Scalar("Id", Type.U32, Operator.INCREMENT, ScalarValue.UNDEFINED, false), - new Sequence("Employees", - new Field[] { - new Scalar("First Name", Type.STRING, Operator.COPY, ScalarValue.UNDEFINED, false), - new Scalar("Last Name", Type.STRING, Operator.COPY, ScalarValue.UNDEFINED, false), - new Scalar("Age", Type.U32, Operator.DELTA, ScalarValue.UNDEFINED, false) - }, false), - new Group("Tax Information", - new Field[] { - new Scalar("EIN", Type.STRING, Operator.NONE, ScalarValue.UNDEFINED, false) - }, false) - }); - Message aaaInsurance = new Message(template); - aaaInsurance.setFieldValue(1, new StringValue("AAA Insurance")); - aaaInsurance.setFieldValue(2, new IntegerValue(5)); - - SequenceValue employees = new SequenceValue(template.getSequence( - "Employees")); - employees.add(new FieldValue[] { - new StringValue("John"), new StringValue("Doe"), - new IntegerValue(45) - }); - employees.add(new FieldValue[] { - new StringValue("Jane"), new StringValue("Doe"), - new IntegerValue(48) - }); - aaaInsurance.setFieldValue(3, employees); - aaaInsurance.setFieldValue(4, - new GroupValue(template.getGroup("Tax Information"), - new FieldValue[] { new StringValue("99-99999999") })); - - ByteArrayOutputStream outStream = new ByteArrayOutputStream(); - MessageOutputStream out = new MessageOutputStream(outStream); - out.registerTemplate(1, template); - out.writeMessage(aaaInsurance); - - Message abcBuilding = new Message(template); - abcBuilding.setFieldValue(1, new StringValue("ABC Building")); - abcBuilding.setFieldValue(2, new IntegerValue(6)); - employees = new SequenceValue(template.getSequence("Employees")); - employees.add(new FieldValue[] { - new StringValue("Bob"), new StringValue("Builder"), - new IntegerValue(3) - }); - employees.add(new FieldValue[] { - new StringValue("Joe"), new StringValue("Rock"), - new IntegerValue(59) - }); - abcBuilding.setFieldValue(3, employees); - abcBuilding.setFieldValue(4, - new GroupValue(template.getGroup("Tax Information"), - new FieldValue[] { new StringValue("99-99999999") })); - out.writeMessage(abcBuilding); - - MessageInputStream in = new MessageInputStream(new ByteArrayInputStream( - outStream.toByteArray())); - in.registerTemplate(1, template); - - GroupValue message = in.readMessage(); - assertEquals(aaaInsurance, message); - - message = in.readMessage(); - assertEquals(abcBuilding, message); - } - - public void testMultipleMessages() { - ByteArrayOutputStream outStream = new ByteArrayOutputStream(); - MessageOutputStream out = new MessageOutputStream(outStream); - out.registerTemplate(ObjectMother.ALLOC_INSTRCTN_TEMPLATE_ID, - ObjectMother.allocationInstruction()); - - SequenceValue allocations = new SequenceValue(ObjectMother.allocationInstruction() - .getSequence("Allocations")); - allocations.add(ObjectMother.newAllocation("fortyFiveFund", 22.5, 75.0)); - allocations.add(ObjectMother.newAllocation("fortyFund", 24.6, 25.0)); - - Message ai1 = ObjectMother.newAllocInstrctn("ltg0001", 1, 100.0, 23.4, - ObjectMother.newInstrument("CTYA", "200910"), allocations); - - allocations = new SequenceValue(ObjectMother.allocationInstruction() - .getSequence("Allocations")); - allocations.add(ObjectMother.newAllocation("fortyFiveFund", 22.5, 75.0)); - allocations.add(ObjectMother.newAllocation("fortyFund", 24.6, 25.0)); - - Message ai2 = ObjectMother.newAllocInstrctn("ltg0001", 1, 100.0, 23.4, - ObjectMother.newInstrument("CTYA", "200910"), allocations); - - allocations = new SequenceValue(ObjectMother.allocationInstruction() - .getSequence("Allocations")); - allocations.add(ObjectMother.newAllocation("fortyFiveFund", 22.5, 75.0)); - allocations.add(ObjectMother.newAllocation("fortyFund", 24.6, 25.0)); - - Message ai3 = ObjectMother.newAllocInstrctn("ltg0001", 1, 100.0, 23.4, - ObjectMother.newInstrument("CTYA", "200910"), allocations); - - out.writeMessage(ai1); - out.writeMessage(ai2); - out.writeMessage(ai3); - - byte[] bytes = outStream.toByteArray(); - MessageInputStream in = new MessageInputStream(new ByteArrayInputStream( - bytes)); - in.registerTemplate(ObjectMother.ALLOC_INSTRCTN_TEMPLATE_ID, - ObjectMother.allocationInstruction()); - - Message message = in.readMessage(); - assertEquals(ai1, message); - message = in.readMessage(); - assertEquals(ai2, message); - assertEquals(ai3, in.readMessage()); - } -} Deleted: tags/openfast-0.9.4/test/acceptance/org/openfast/ExhaustiveOperatorTest.java =================================================================== --- trunk/test/acceptance/org/openfast/ExhaustiveOperatorTest.java 2007-12-05 18:41:07 UTC (rev 96) +++ tags/openfast-0.9.4/test/acceptance/org/openfast/ExhaustiveOperatorTest.java 2007-12-05 18:49:19 UTC (rev 97) @@ -1,542 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is OpenFAST. - -The Initial Developer of the Original Code is The LaSalle Technology -Group, LLC. Portions created by The LaSalle Technology Group, LLC -are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. - -Contributor(s): Jacob Northey <ja...@la...> - Craig Otis <co...@la...> -*/ - - -package org.openfast; - -import java.io.IOException; -import java.io.PipedInputStream; -import java.io.PipedOutputStream; - -import junit.framework.TestCase; - -import org.openfast.codec.FastDecoder; -import org.openfast.codec.FastEncoder; -import org.openfast.template.Field; -import org.openfast.template.MessageTemplate; -import org.openfast.template.Scalar; -import org.openfast.template.operator.Operator; -import org.openfast.template.type.Type; -import org.openfast.test.TestUtil; - - -/** - * The goal of this test is to make sure all cases of all operators are covered - * - * @author Jacob Northey - */ -public class ExhaustiveOperatorTest extends TestCase { - private Context decodingContext; - private Context encodingContext; - private FastEncoder encoder; - private PipedInputStream in; - private PipedOutputStream out; - private FastDecoder decoder; - - public void setUp() throws Exception { - out = new PipedOutputStream(); - in = new PipedInputStream(out); - encodingContext = new Context(); - decodingContext = new Context(); - encoder = new FastEncoder(encodingContext); - decoder = new FastDecoder(decodingContext, in); - } - - public void testEmptyOperatorWithOptionalField() throws Exception { - Scalar field = new Scalar("", Type.U32, Operator.NONE, - ScalarValue.UNDEFINED, true); - MessageTemplate template = registerTemplate(field); - - Message message = new Message(template); - message.setInteger(1, 126); - - // --PMAP-- --TID--- ---#1--- - String encoding = "11000000 11110001 11111111"; - - encodeAndAssertEquals(encoding, message); - - GroupValue readMessage = decoder.readMessage(); - - assertEquals(message, readMessage); - } - - public void testEmptyOperatorWithOptionalFieldOnNullValue() - throws Exception { - Scalar field = new Scalar("", Type.U32, Operator.NONE, - ScalarValue.UNDEFINED, true); - MessageTemplate template = registerTemplate(field); - - // NOTE: The field is not set. - Message message = new Message(template); - - // --PMAP-- --TID--- ---#1--- - String encoding = "11000000 11110001 10000000"; - - encodeAndAssertEquals(encoding, message); - - GroupValue readMessage = decoder.readMessage(); - - assertEquals(message, readMessage); - } - - public void testEmptyOperatorWithSequenceOfMessages() - throws IOException { - Scalar field = new Scalar("", Type.U32, Operator.NONE, - ScalarValue.UNDEFINED, true); - MessageTemplate template = registerTemplate(field); - - // NOTE: The field is not set. - Message msg1 = new Message(template); - - Message msg2 = new Message(template); - msg2.setInteger(1, 15); - - // --PMAP-- --TID--- ---#1--- - String encoding = "11000000 11110001 10000000"; - byte[] encodedMessage; - encodeAndAssertEquals(encoding, msg1); - - // --PMAP-- ---#1--- - encoding = "10000000 10010000"; - encodedMessage = encoder.encode(msg2); - TestUtil.assertBitVectorEquals(encoding, encodedMessage); - out.write(encodedMessage); - - GroupValue readMessage = decoder.readMessage(); - assertEquals(msg1, readMessage); - readMessage = decoder.readMessage(); - assertEquals(msg2, readMessage); - } - - public void testEmptyOperatorWithMandatoryField() throws IOException { - Scalar field = new Scalar("", Type.U32, Operator.NONE, - ScalarValue.UNDEFINED, false); - MessageTemplate template = registerTemplate(field); - - // NOTE: The field is not set. - Message msg1 = new Message(template); - msg1.setInteger(1, 0); - - Message msg2 = new Message(template); - msg2.setInteger(1, 16); - - // --PMAP-- --TID--- ---#1--- - String encoding = "11000000 11110001 10000000"; - byte[] encodedMessage; - encodeAndAssertEquals(encoding, msg1); - - // --PMAP-- ---#1--- - encoding = "10000000 10010000"; - encodedMessage = encoder.encode(msg2); - TestUtil.assertBitVectorEquals(encoding, encodedMessage); - out.write(encodedMessage); - - GroupValue readMessage = decoder.readMessage(); - assertEquals(msg1, readMessage); - readMessage = decoder.readMessage(); - assertEquals(msg2, readMessage); - } - - public void testConstantOperatorWithOptionalField() - throws IOException { - Scalar field = new Scalar("", Type.U32, Operator.CONSTANT, - new IntegerValue(16), true); - MessageTemplate template = registerTemplate(field); - - Message msg1 = new Message(template); - // NOTE: Constant fields are set by default, so set to null to clear; - msg1.setFieldValue(1, null); - - Message msg2 = new Message(template); - msg2.setInteger(1, 16); - - // --PMAP-- --TID--- - encodeAndAssertEquals("11000000 11110001", msg1); - - // --PMAP-- - encodeAndAssertEquals("10100000", msg2); - - readMessageAndAssertEquals(msg1); - readMessag... [truncated message content] |
From: <ope...@li...> - 2007-12-05 18:41:05
|
Revision: 96 http://openfast.svn.sourceforge.net/openfast/?rev=96&view=rev Author: jacob_northey Date: 2007-12-05 10:41:07 -0800 (Wed, 05 Dec 2007) Log Message: ----------- [maven-release-plugin] prepare release openfast-0.9.4 Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-12-05 18:40:12 UTC (rev 95) +++ trunk/pom.xml 2007-12-05 18:41:07 UTC (rev 96) @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.openfast</groupId> <artifactId>openfast</artifactId> <packaging>jar</packaging> - <version>0.9.4-SNAPSHOT</version> + <version>0.9.4</version> <organization> <name>The LaSalle Technology Group, LLC</name> @@ -32,9 +32,9 @@ </issueManagement> <scm> - <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk</connection> - <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk/</developerConnection> - <url>http://openfast.svn.sourceforge.net/viewvc/openfast/trunk</url> + <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.4</connection> + <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/tags/openfast-0.9.4</developerConnection> + <url>http://openfast.svn.sourceforge.net/viewvc/openfast/tags/openfast-0.9.4</url> </scm> <mailingLists> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2007-12-05 18:40:12
|
Revision: 95 http://openfast.svn.sourceforge.net/openfast/?rev=95&view=rev Author: jacob_northey Date: 2007-12-05 10:40:12 -0800 (Wed, 05 Dec 2007) Log Message: ----------- Added release parameters Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2007-12-05 18:36:44 UTC (rev 94) +++ trunk/pom.xml 2007-12-05 18:40:12 UTC (rev 95) @@ -93,6 +93,12 @@ <target>1.4</target> </configuration> </plugin> + <plugin> + <artifactId>maven-release-plugin</artifactId> + <configuration> + <tagBase>https://openfast.svn.sourceforge.net/svnroot/openfast/tags</tagBase> + </configuration> + </plugin> </plugins> </build> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2007-12-05 18:36:39
|
Revision: 94 http://openfast.svn.sourceforge.net/openfast/?rev=94&view=rev Author: jacob_northey Date: 2007-12-05 10:36:44 -0800 (Wed, 05 Dec 2007) Log Message: ----------- Added tags Added Paths: ----------- tags/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ope...@li...> - 2007-12-05 18:32:28
|
Revision: 93 http://openfast.svn.sourceforge.net/openfast/?rev=93&view=rev Author: jacob_northey Date: 2007-12-05 10:32:33 -0800 (Wed, 05 Dec 2007) Log Message: ----------- Created Maven POM, restructured project to work with Maven. Ant build still works. Modified Paths: -------------- trunk/.classpath trunk/.settings/org.eclipse.wst.common.component trunk/build.xml Added Paths: ----------- trunk/pom.xml trunk/src/main/ trunk/src/main/java/ trunk/src/main/java/org/ trunk/src/main/java/org/openfast/ trunk/src/test/ trunk/src/test/java/ trunk/src/test/java/org/ trunk/src/test/java/org/openfast/ trunk/src/test/java/org/openfast/scenario/ trunk/src/test/java/org/openfast/scenario/1.fast trunk/src/test/java/org/openfast/scenario/CmeTemplateTest.java trunk/src/test/java/org/openfast/scenario/ErrorCasesTest.java trunk/src/test/java/org/openfast/scenario/templates.xml trunk/src/test/java/org/openfast/session/SCP_1_1_Test.java Removed Paths: ------------- trunk/src/main/java/org/openfast/ trunk/src/org/ trunk/src/test/java/org/openfast/ trunk/src/test/java/org/openfast/scenario/ErrorCasesTest.java trunk/test/acceptance/org/openfast/scenario/ trunk/test/acceptance/org/openfast/session/SCP_1_1_Test.java trunk/test/unit/org/ Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - bin build doc build_sf + bin build doc build_sf target Modified: trunk/.classpath =================================================================== --- trunk/.classpath 2007-12-05 16:18:23 UTC (rev 92) +++ trunk/.classpath 2007-12-05 18:32:33 UTC (rev 93) @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry excluding="**/.svn/*" kind="src" path="src"/> - <classpathentry excluding="**/.svn/*" kind="src" path="test/unit"/> - <classpathentry excluding="**/.svn/*" kind="src" path="test/acceptance"/> + <classpathentry excluding="**/.svn/*" kind="src" path="src/main/java"/> + <classpathentry excluding="**/.svn/*" kind="src" path="src/test/java"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry exported="true" kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"> <attributes> Modified: trunk/.settings/org.eclipse.wst.common.component =================================================================== --- trunk/.settings/org.eclipse.wst.common.component 2007-12-05 16:18:23 UTC (rev 92) +++ trunk/.settings/org.eclipse.wst.common.component 2007-12-05 18:32:33 UTC (rev 93) @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project-modules id="moduleCoreId" project-version="1.5.0"> <wb-module deploy-name="openfast4j"> - <wb-resource deploy-path="/" source-path="/src"/> - <wb-resource deploy-path="/" source-path="/test/unit"/> - <wb-resource deploy-path="/" source-path="/test/acceptance"/> + <wb-resource deploy-path="/" source-path="/src/main/java"/> + <wb-resource deploy-path="/" source-path="/src/test/java"/> </wb-module> </project-modules> Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2007-12-05 16:18:23 UTC (rev 92) +++ trunk/build.xml 2007-12-05 18:32:33 UTC (rev 93) @@ -1,12 +1,10 @@ <project name="openfast4j" default="all"> - <property name="src.dir" value="src" /> + <property name="src.dir" value="src/main/java" /> <property name="lib" value="${basedir}/lib" /> <property name="demo.dir" value="demo" /> - <property name="test.dir" value="test" /> - <property name="test.unit.dir" value="${test.dir}/unit" /> - <property name="test.acceptance.dir" value="${test.dir}/acceptance" /> + <property name="test.unit.dir" value="src/test/java" /> <property name="build.dir" value="build" /> @@ -72,12 +70,8 @@ <javac srcdir="${test.unit.dir}" destdir="${build.test.classes.dir}" classpathref="test.path" debug="yes" debuglevel="lines,source,vars" target="1.4" source="1.4"> <compilerarg line="-Xlint:deprecation -Xlint:unchecked"/> </javac> - <javac srcdir="${test.acceptance.dir}" destdir="${build.test.classes.dir}" classpathref="test.path" debug="yes" debuglevel="lines,source,vars" target="1.4" source="1.4"> - <compilerarg line="-Xlint:deprecation -Xlint:unchecked"/> - </javac> <copy todir="${build.test.classes.dir}"> <fileset dir="${test.unit.dir}" excludes="**/*.java" includes="**/*" /> - <fileset dir="${test.acceptance.dir}" excludes="**/*.java" includes="**/*" /> </copy> </target> @@ -103,7 +97,6 @@ <jvmarg line="-ea" /> <batchtest todir="${reports.unit}"> <fileset includes="**/*Test.java" dir="${test.unit.dir}" /> - <fileset includes="**/*Test.java" dir="${test.acceptance.dir}" /> <formatter type="xml" usefile="true" /> </batchtest> <formatter type="xml" /> @@ -174,9 +167,6 @@ <copy todir="${work.dir}/dist/doc"> <fileset dir="${docs.dir}"/> </copy> - <copy todir="${work.dir}/dist/test"> - <fileset dir="${test.dir}"/> - </copy> <copy todir="${work.dir}/dist/lib"> <fileset dir="${lib}"/> </copy> Added: trunk/pom.xml =================================================================== --- trunk/pom.xml (rev 0) +++ trunk/pom.xml 2007-12-05 18:32:33 UTC (rev 93) @@ -0,0 +1,119 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>org.openfast</groupId> + <artifactId>openfast</artifactId> + <packaging>jar</packaging> + <version>0.9.4-SNAPSHOT</version> + + <organization> + <name>The LaSalle Technology Group, LLC</name> + <url>http://www.lasalletech.com</url> + </organization> + + <name>OpenFAST</name> + + <description>OpenFAST is a 100% Java implementation of the FAST Protocol.</description> + + <licenses> + <license> + <name>Mozilla Public License Version 1.1</name> + <url>http://www.mozilla.org/MPL/MPL-1.1.html</url> + <distribution>repo</distribution> + </license> + </licenses> + + <url>http://www.openfast.org</url> + <inceptionYear>2006</inceptionYear> + + <issueManagement> + <system>sourceforge</system> + <url>http://sourceforge.net/tracker/?group_id=198357</url> + </issueManagement> + + <scm> + <connection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk</connection> + <developerConnection>scm:svn:https://openfast.svn.sourceforge.net/svnroot/openfast/trunk/</developerConnection> + <url>http://openfast.svn.sourceforge.net/viewvc/openfast/trunk</url> + </scm> + + <mailingLists> + <mailingList> + <name>OpenFAST Users Mailing List</name> + <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-user</subscribe> + <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-user</unsubscribe> + <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-user</archive> + <post>ope...@li...</post> + </mailingList> + <mailingList> + <name>OpenFAST Commits Mailing List</name> + <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-commit</subscribe> + <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-commit</unsubscribe> + <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-commit</archive> + <post>ope...@li...</post> + </mailingList> + <mailingList> + <name>OpenFAST Announcements Mailing List</name> + <subscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-announce</subscribe> + <unsubscribe>http://lists.sourceforge.net/mailman/listinfo/openfast-announce</unsubscribe> + <archive>https://sourceforge.net/mailarchive/forum.php?forum_name=openfast-announce</archive> + <post>ope...@li...</post> + </mailingList> + </mailingLists> + + <build> + <resources> + <resource> + <directory>src/main/java</directory> + <excludes> + <exclude>**/*.java</exclude> + </excludes> + </resource> + <resource> + <directory>src/test/java</directory> + <excludes> + <exclude>**/*.java</exclude> + </excludes> + </resource> + </resources> + + <extensions> + <extension> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-ssh</artifactId> + <version>1.0-beta-2</version> + </extension> + </extensions> + + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.4</source> + <target>1.4</target> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.2</version> + </dependency> + </dependencies> + + <distributionManagement> + <repository> + <id>sourceforge.net</id> + <name>Sourceforge.net Repository</name> + <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/maven/release</url> + </repository> + <snapshotRepository> + <id>sourceforge.net</id> + <name>Sourceforge.net Snapshot Repository</name> + <url>scp://shell.sourceforge.net/home/groups/o/op/openfast/maven/snapshot</url> + </snapshotRepository> + </distributionManagement> +</project> \ No newline at end of file Copied: trunk/src/main/java/org (from rev 66, trunk/src/org) Copied: trunk/src/main/java/org/openfast (from rev 92, trunk/src/org/openfast) Copied: trunk/src/test/java/org (from rev 66, trunk/test/unit/org) Copied: trunk/src/test/java/org/openfast (from rev 92, trunk/test/unit/org/openfast) Copied: trunk/src/test/java/org/openfast/scenario (from rev 66, trunk/test/acceptance/org/openfast/scenario) Copied: trunk/src/test/java/org/openfast/scenario/1.fast (from rev 92, trunk/test/acceptance/org/openfast/scenario/1.fast) =================================================================== --- trunk/src/test/java/org/openfast/scenario/1.fast (rev 0) +++ trunk/src/test/java/org/openfast/scenario/1.fast 2007-12-05 18:32:33 UTC (rev 93) @@ -0,0 +1,2 @@ +\xC0\xA1;\xEB#SR M\x83 I\xA0$\xA9\xF6 +8\xC1\x90X\xDFK\xA3[Hi\xD0 \ No newline at end of file Copied: trunk/src/test/java/org/openfast/scenario/CmeTemplateTest.java (from rev 92, trunk/test/acceptance/org/openfast/scenario/CmeTemplateTest.java) =================================================================== --- trunk/src/test/java/org/openfast/scenario/CmeTemplateTest.java (rev 0) +++ trunk/src/test/java/org/openfast/scenario/CmeTemplateTest.java 2007-12-05 18:32:33 UTC (rev 93) @@ -0,0 +1,24 @@ +package org.openfast.scenario; + +import java.io.InputStream; + +import org.openfast.Message; +import org.openfast.MessageInputStream; +import org.openfast.template.loader.XMLMessageTemplateLoader; +import org.openfast.test.OpenFastTestCase; + +public class CmeTemplateTest extends OpenFastTestCase { + + public void testDeltas() throws Exception { + InputStream templateSource = this.getClass().getResourceAsStream("templates.xml"); + XMLMessageTemplateLoader templateLoader = new XMLMessageTemplateLoader(); + templateLoader.setLoadTemplateIdFromAuxId(true); + templateLoader.load(templateSource); + + InputStream is = this.getClass().getResourceAsStream("1.fast"); + MessageInputStream mis = new MessageInputStream(is); + mis.setTemplateRegistry(templateLoader.getTemplateRegistry()); + Message md = mis.readMessage(); + assertEquals(-5025.0, md.getSequence("MDEntries").get(0).getDouble("NetChgPrevDay"), .1); + } +} Deleted: trunk/src/test/java/org/openfast/scenario/ErrorCasesTest.java =================================================================== --- trunk/test/acceptance/org/openfast/scenario/ErrorCasesTest.java 2007-09-07 20:07:11 UTC (rev 66) +++ trunk/src/test/java/org/openfast/scenario/ErrorCasesTest.java 2007-12-05 18:32:33 UTC (rev 93) @@ -1,50 +0,0 @@ -package org.openfast.scenario; - - -import org.openfast.Message; -import org.openfast.ScalarValue; -import org.openfast.codec.FastDecoder; -import org.openfast.codec.FastEncoder; -import org.openfast.template.Field; -import org.openfast.template.Group; -import org.openfast.template.MessageTemplate; -import org.openfast.template.Scalar; -import org.openfast.template.Sequence; -import org.openfast.template.operator.Operator; -import org.openfast.template.type.Type; -import org.openfast.test.OpenFastTestCase; - -public class ErrorCasesTest extends OpenFastTestCase { - - public void testMantissaIsntPresentWhenExponentIsNull() throws Exception { - String templateXml = - "<template name=\"SampleTemplate\">" + - " <decimal name=\"bid\" presence=\"optional\">" + - " <mantissa><copy /></mantissa>" + - " <exponent><copy value=\"-2\" /></exponent>" + - " </decimal>" + - "</template>"; - MessageTemplate template = template(templateXml); - FastEncoder encoder = encoder(template); - - Message message = new Message(template); - message.setDecimal(1, 0.63); - assertEquals("11010000 10000001 10111111", encoder.encode(message)); - - message = new Message(template); - assertEquals("10100000 10000000", encoder.encode(message)); - } - - public void testEncodeDecodeNestedSequence() { - Sequence nestedSequence = new Sequence("nested", new Field[] { new Scalar("string", Type.ASCII, Operator.COPY, ScalarValue.UNDEFINED, false) }, true); - Group group = new Group("group", new Field[] { nestedSequence }, true); - MessageTemplate t = new MessageTemplate("template", new Field[] { group }); - Message message = new Message(t); - - FastEncoder encoder = encoder(t); - assertEquals("11000000 10000001", encoder.encode(message)); - - FastDecoder decoder = decoder("11000000 10000001", t); - assertEquals(message, decoder.readMessage()); - } -} Copied: trunk/src/test/java/org/openfast/scenario/ErrorCasesTest.java (from rev 92, trunk/test/acceptance/org/openfast/scenario/ErrorCasesTest.java) =================================================================== --- trunk/src/test/java/org/openfast/scenario/ErrorCasesTest.java (rev 0) +++ trunk/src/test/java/org/openfast/scenario/ErrorCasesTest.java 2007-12-05 18:32:33 UTC (rev 93) @@ -0,0 +1,81 @@ +package org.openfast.scenario; + + +import org.openfast.Message; +import org.openfast.ScalarValue; +import org.openfast.codec.FastDecoder; +import org.openfast.codec.FastEncoder; +import org.openfast.template.Field; +import org.openfast.template.Group; +import org.openfast.template.MessageTemplate; +import org.openfast.template.Scalar; +import org.openfast.template.Sequence; +import org.openfast.template.operator.Operator; +import org.openfast.template.type.Type; +import org.openfast.test.OpenFastTestCase; + +public class ErrorCasesTest extends OpenFastTestCase { + + public void testMantissaIsntPresentWhenExponentIsNull() throws Exception { + String templateXml = + "<template name=\"SampleTemplate\">" + + " <decimal name=\"bid\" presence=\"optional\">" + + " <mantissa><copy /></mantissa>" + + " <exponent><copy value=\"-2\" /></exponent>" + + " </decimal>" + + "</template>"; + MessageTemplate template = template(templateXml); + FastEncoder encoder = encoder(template); + + Message message = new Message(template); + message.setDecimal(1, 0.63); + assertEquals("11010000 10000001 10111111", encoder.encode(message)); + + message = new Message(template); + assertEquals("10100000 10000000", encoder.encode(message)); + } + + public void testEncodeDecodeNestedSequence() { + Sequence nestedSequence = new Sequence("nested", new Field[] { new Scalar("string", Type.ASCII, Operator.COPY, ScalarValue.UNDEFINED, false) }, true); + Group group = new Group("group", new Field[] { nestedSequence }, true); + MessageTemplate t = new MessageTemplate("template", new Field[] { group }); + Message message = new Message(t); + + FastEncoder encoder = encoder(t); + assertEquals("11000000 10000001", encoder.encode(message)); + + FastDecoder decoder = decoder("11000000 10000001", t); + assertEquals(message, decoder.readMessage()); + } + + public void testDictionaryNotInherited() { + String templateDef = "<template name=\"OptDeltaDec\" id=\"58\" dictionary=\"template\">" + + " <string name=\"desc\"/>" + + " <decimal id=\"1\" presence=\"optional\" name=\"Line1\">" + + " <exponent><copy/></exponent>" + + " <mantissa><copy/></mantissa>" + + " </decimal>" + + " <decimal id=\"1\" presence=\"optional\" name=\"Line2\">" + + " <exponent><copy/></exponent>" + + " <mantissa><copy/></mantissa>" + + " </decimal> " + + " <decimal id=\"1\" presence=\"optional\" name=\"Line3\">" + + " <exponent><copy/></exponent> " + + " <mantissa><copy/></mantissa>" + + " </decimal>" + + "</template>"; + + MessageTemplate template = template(templateDef); + + Message m = new Message(template); + + m.setString("desc", "prev"); + m.setDecimal("Line2", 9427.61 ); + m.setDecimal("Line3", 9427.6 ); + + byte[] bytes = encoder(template).encode(m); + Message m2 = decoder(template, bytes).readMessage(); + + assertEquals(m, m2); + } +} Copied: trunk/src/test/java/org/openfast/scenario/templates.xml (from rev 92, trunk/test/acceptance/org/openfast/scenario/templates.xml) =================================================================== --- trunk/src/test/java/org/openfast/scenario/templates.xml (rev 0) +++ trunk/src/test/java/org/openfast/scenario/templates.xml 2007-12-05 18:32:33 UTC (rev 93) @@ -0,0 +1,1465 @@ +<?xml version="1.0" encoding="UTF-8"?> +<templates> + <template name="MDIncRefresh_30" id="30" dictionary="30" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <default value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <delta/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <default/> + </uInt32> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="QuoteCondition" id="276" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_32" id="32" dictionary="32" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <increment/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <uInt32 name="NumberOfOrders" id="346"> + <delta/> + </uInt32> + <string name="TradingSessionID" id="336"> + <default value="2"/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_33" id="33" dictionary="33" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <default value="0"/> + </uInt32> + <string name="MDEntryType" id="269"> + <default value="2"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <delta/> + </uInt32> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_34" id="34" dictionary="34" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <copy value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <string name="QuoteCondition" id="276" presence="optional"> + <copy value="K"/> + </string> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <default/> + </uInt32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <default/> + </uInt32> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_35" id="35" dictionary="35" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <copy value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <delta/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <string name="QuoteCondition" id="276" presence="optional"> + <copy value="K"/> + </string> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <copy/> + </uInt32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <string name="TradingSessionID" id="336"> + <default value="2"/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_36" id="36" dictionary="36" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <copy value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <string name="QuoteCondition" id="276"> + <copy value="K"/> + </string> + <string name="TradingSessionID" id="336"> + <default value="2"/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_37" id="37" dictionary="37" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <default value="0"/> + </uInt32> + <string name="MDEntryType" id="269"> + <default value="2"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <delta/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <delta/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="-1"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default value="-1"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <delta/> + </uInt32> + <string name="TradeCondition" id="277" presence="optional"> + <copy value="1"/> + </string> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_38" id="38" dictionary="38" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <increment/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <default/> + </uInt32> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <default/> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="QuoteCondition" id="276" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_39" id="39" dictionary="39" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <increment/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <string name="TradingSessionID" id="336"> + <default value="2"/> + </string> + <uInt32 name="NumberOfOrders" id="346"> + <delta/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_40" id="40" dictionary="40" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <default value="0"/> + </uInt32> + <string name="MDEntryType" id="269"> + <default value="2"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <delta/> + </uInt32> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_41" id="41" dictionary="41" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <constant value="5"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <constant value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="1"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <delta/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <delta/> + </uInt32> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <uInt32 name="MDEntryTime" id="273"> + <delta/> + </uInt32> + <string name="TradingSessionID" id="336"> + <default value="2"/> + </string> + <uInt32 name="NumberOfOrders" id="346"> + <copy value="1"/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_42" id="42" dictionary="42" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <default value="5"/> + </uInt32> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <copy value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="1"/> + </string> + <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <default value="1"/> + </uInt32> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <default/> + </uInt32> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="QuoteCondition" id="276" presence="optional"> + <default/> + </string> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_43" id="43" dictionary="43" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <constant value="5"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <constant value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="1"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <delta/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <delta/> + </uInt32> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <uInt32 name="NumberOfOrders" id="346"> + <copy/> + </uInt32> + <uInt32 name="MDQuoteType" id="1070" presence="optional"> + <default/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_44" id="44" dictionary="44" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <constant value="5"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <constant value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="1"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <uInt32 name="NumberOfOrders" id="346"> + <copy/> + </uInt32> + <uInt32 name="MDQuoteType" id="1070" presence="optional"> + <constant value="0"/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_45" id="45" dictionary="45" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="5"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <copy value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="1"/> + </string> + <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <copy value="1"/> + </uInt32> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <default/> + </uInt32> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="QuoteCondition" id="276" presence="optional"> + <default/> + </string> + <uInt32 name="MDQuoteType" id="1070" presence="optional"> + <default/> + </uInt32> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDSecurityDefinition" id="46" dictionary="46" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + + <string name="MessageType" id="35"> + <constant value="d"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="MDTotalNum" id="911" presence="optional"/> + <sequence name="Events" presence="optional"> + <length name="NoEvents" id="864"/> + <uInt32 name="EventType" id="865" presence="optional"> + <delta/> + </uInt32> + <uInt64 name="EventDate" id="866" presence="optional"> + <delta/> + </uInt64> + <uInt64 name="EventTime" id="1145" presence="optional"> + <delta/> + </uInt64> + </sequence> + + <decimal name="TradingReferencePrice" id="1150" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <decimal name="HighLimitPx" id="1149" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <decimal name="LowLimitPx" id="1148" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <string name="SecurityGroup" id="1151" presence="optional"/> + <string name="Symbol" id="55" presence="optional"/> + <string name="SecurityDesc" id="107" presence="optional"/> + <uInt32 name="SecurityID" id="48" presence="optional"/> + <uInt32 name="SecurityIDSource" id="22" presence="optional"> + <constant value="8"/> + </uInt32> + <string name="CFICode" id="461" presence="optional"/> + <string name="UnderlyingProduct" id="462" presence="optional"/> + <string name="SecurityExchange" id="207" presence="optional"/> + <string name="PricingModel" id="9853" presence="optional"/> + <decimal name="MinCabPrice" id="9850" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <uInt32 name="ExpirationCycle" id="827" presence="optional"/> + <string name="UnitOfMeasureQty" id="1147" presence="optional"/> + <decimal name="StrikePrice" id="202" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <string name="StrikeCurrency" id="947" presence="optional"/> + <uInt64 name="MinTradeVol" id="562" presence="optional"/> + <uInt64 name="MaxTradeVol" id="1140" presence="optional"/> + <string name="Currency" id="15" presence="optional"/> + <string name="SettlCurrency" id="120" presence="optional"/> + <sequence name="MDFeedTypes" presence="optional"> + <length name="NoMDFeedTypes" id="1141"/> + <string name="MDFeedType" id="1022"> + <constant value="GBX"/> + </string> + <uInt32 name="MarketDepth" id="264"/> + </sequence> + <string name="MatchAlgo" id="1142" presence="optional"/> + <string name="SecuritySubType" id="762" presence="optional"/> + + <sequence name="Underlyings" presence="optional"> + <length name="NoUnderlyings" id="711"/> + <string name="UnderlyingSymbol" id="311"> + <constant value="[N/A]"/> + </string> + <uInt32 name="UnderlyingSecurityID" id="309"> + <delta/> + </uInt32> + <uInt32 name="UnderlyingSecurityIDSource" id="305"> + <constant value="8"/> + </uInt32> + </sequence> + <string name="MaxPriceVariation" id="1143" presence="optional"/> + <string name="ImpliedMarketIndicator" id="1144" presence="optional"/> + + <sequence name="InstrAttrib" presence="optional"> + <length name="NoInstrAttrib" id="870"/> + <uInt64 name="InstrAttribType" id="871"> + <delta/> + </uInt64> + <string name="InstrAttribValue" id="872" presence="optional"> + <copy/> + </string> + </sequence> + <uInt64 name="MaturityDate" id="200" presence="optional"/> + <decimal name="MinPriceIncrement" id="969" presence="optional"> + <exponent> + <copy value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <decimal name="MinPriceIncrementAmount" id="1146" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <decimal name="DisplayFactor" id="9787" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + + <sequence name="Legs" presence="optional"> + <length name="NoLegs" id="555"/> + <string name="LegSymbol" id="600"> + <default value="[N/A]"/> + </string> + <uInt32 name="LegRatioQty" id="623"> + <copy/> + </uInt32> + <uInt64 name="LegSecurityID" id="602"> + <delta/> + </uInt64> + <uInt32 name="LegSecurityIDSource" id="603"> + <constant value="8"/> + </uInt32> + <string name="LegSide" id="624" presence="optional"> + <default value="1"/> + </string> + <string name="LegCFICode" id="608" presence="optional"> + <copy/> + </string> + <string name="LegSecuritySubType" id="764" presence="optional"> + <copy/> + </string> + <string name="LegCurrency" id="556" presence="optional"> + <copy/> + </string> + <uInt64 name="LegMaturityMonthYear" id="610" presence="optional"> + <delta/> + </uInt64> + <decimal name="LegStrikePrice" id="612" presence="optional"> + <exponent> + <copy value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <string name="LegStrikeCurrency" id="942" presence="optional"> + <copy/> + </string> + <decimal name="LegPrice" id="566" presence="optional"> + <exponent> + <copy value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <decimal name="LegOptionDelta" id="1017" presence="optional"> + <exponent> + <copy value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + </sequence> + </template> + + <template name="MDQuoteRequest" id="47" dictionary="47" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="R"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <sequence name="RelatedSym"> + <length name="NoRelatedSym" id="146"/> + <string name="Symbol" id="55"> + <constant value="[N/A]"/> + </string> + <uInt64 name="OrderQty" id="38" presence="optional"/> + + <uInt32 name="Side" id="54" presence="optional"> + <default value="1"/> + </uInt32> + + <uInt64 name="TransactTime" id="60"/> + + <uInt32 name="QuoteType" id="537"> + <default value="1"/> + </uInt32> + + <string name="QuoteReqID" id="131" presence="optional"/> + + <uInt32 name="SecurityID" id="48"/> + + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + </sequence> + </template> + + <template name="MDSecurityStatus" id="48" dictionary="48" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="f"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="SecurityID" id="48" presence="optional"/> + <uInt32 name="SecurityIDSource" id="22" presence="optional"> + <constant value="8"/> + </uInt32> + <decimal name="HighPx" id="332" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <decimal name="LowPx" id="333" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <string name="Symbol" id="55" presence="optional"/> + <uInt32 name="SecurityTradingStatus" id="326" presence="optional"/> + </template> + + <template name="MDNewsMessage" id="49" dictionary="49" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="B"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="Headline" id="147"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <sequence name="LinesOfText"> + <length name="NoLinesOfText" id="33"/> + <string name="text" id="58"> + <copy/> + </string> + </sequence> + </template> + + + <template name="MDHeartbeat" id="50" dictionary="50" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="0"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + </template> + + <template name="MDSnapshotFullRefresh_51" id="51" dictionary="51" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="MessageType" id="35"> + <constant value="W"/> + </string> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt64 name="SendingTime" id="52"/> + + + <uInt32 name="LastMsgSeqNumProcessed" id="369"/> + <uInt32 name="TotalNumReports" id="911"/> + <uInt32 name="MDBookType" id="1021"/> + <uInt32 name="SecurityID" id="48"> + <delta/> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + + + + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <string name="MDEntryType" id="269"> + <default value="2"/> + </string> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <string name="QuoteCondition" id="276" presence="optional"> + <default value="K"/> + </string> + <string name="TradeCondition" id="277" presence="optional"> + <constant value="U"/> + </string> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <copy value="1"/> + </uInt32> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <copy/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <delta/> + </uInt32> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + </sequence> + </template> + + <template name="MDLogon" id="1" dictionary="1" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="A"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="applFeedId" id="1180"> + <constant value="REPLAY"/> + </string> + <uInt32 name="encryptMethod" id="98"> + <constant value="0"/> + </uInt32> + <uInt32 name="heartbeatInt" id="108"/> + <string name="DefaultApplVerID" id="1137"> + <constant value="8"/> + </string> + </template> + + <template name="MDLogout" id="2" dictionary="2" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="5"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="applFeedId" id="1180"> + <constant value="REPLAY"/> + </string> + <string name="text" id="58" presence="optional"/> + </template> + +</templates> \ No newline at end of file Copied: trunk/src/test/java/org/openfast/session/SCP_1_1_Test.java (from rev 83, trunk/test/acceptance/org/openfast/session/SCP_1_1_Test.java) =================================================================== --- trunk/src/test/java/org/openfast/session/SCP_1_1_Test.java (rev 0) +++ trunk/src/test/java/org/openfast/session/SCP_1_1_Test.java 2007-12-05 18:32:33 UTC (rev 93) @@ -0,0 +1,224 @@ +package org.openfast.session; + +import java.io.IOException; + +import junit.framework.TestCase; + +import org.openfast.Message; +import org.openfast.error.ErrorCode; +import org.openfast.error.ErrorHandler; +import org.openfast.template.BasicTemplateRegistry; +import org.openfast.template.TemplateRegistry; +import org.openfast.test.ObjectMother; +import org.openfast.util.RecordingOutputStream; + +public class SCP_1_1_Test extends TestCase { + private static final int MAX_TIMEOUT = 15000; + private LocalEndpoint serverEndpoint; ... [truncated message content] |
From: <ope...@li...> - 2007-12-05 16:18:19
|
Revision: 92 http://openfast.svn.sourceforge.net/openfast/?rev=92&view=rev Author: jacob_northey Date: 2007-12-05 08:18:23 -0800 (Wed, 05 Dec 2007) Log Message: ----------- FIXED: Bug in tail operator occurs when initial values are specified for field. Modified Paths: -------------- trunk/src/org/openfast/template/operator/TailOperatorCodec.java trunk/test/unit/org/openfast/template/operator/TailOperatorCodecTest.java Added Paths: ----------- trunk/test/unit/org/openfast/submitted/TailOperatorTest.java Modified: trunk/src/org/openfast/template/operator/TailOperatorCodec.java =================================================================== --- trunk/src/org/openfast/template/operator/TailOperatorCodec.java 2007-11-26 17:00:20 UTC (rev 91) +++ trunk/src/org/openfast/template/operator/TailOperatorCodec.java 2007-12-05 16:18:23 UTC (rev 92) @@ -27,11 +27,7 @@ } if (priorValue.isUndefined()) { - if (value.equals(field.getDefaultValue())) { - return null; - } else { - return value; - } + priorValue = field.getBaseValue(); } int index = 0; @@ -44,7 +40,8 @@ while (index < val.length && val[index] == prior[index]) index++; - + if (val.length == index) + return null; return (ScalarValue) field.createValue(new String(val, index, val.length-index)); } Added: trunk/test/unit/org/openfast/submitted/TailOperatorTest.java =================================================================== --- trunk/test/unit/org/openfast/submitted/TailOperatorTest.java (rev 0) +++ trunk/test/unit/org/openfast/submitted/TailOperatorTest.java 2007-12-05 16:18:23 UTC (rev 92) @@ -0,0 +1,50 @@ +package org.openfast.submitted; + +import org.openfast.Message; +import org.openfast.StringValue; +import org.openfast.codec.FastEncoder; +import org.openfast.template.Field; +import org.openfast.template.MessageTemplate; +import org.openfast.template.Scalar; +import org.openfast.template.operator.Operator; +import org.openfast.template.type.Type; +import org.openfast.test.OpenFastTestCase; + +public class TailOperatorTest extends OpenFastTestCase { + + public void testSameValue() { + MessageTemplate template = new MessageTemplate("", new Field[] { + new Scalar("mandInit1", Type.ASCII, Operator.TAIL, new StringValue("abcXXX"), false), + new Scalar("mandInit2", Type.ASCII, Operator.TAIL, new StringValue("defXXX"), false) + }); + FastEncoder encoder = encoder(template); + + Message message = new Message(template); + message.setString("mandInit1", "abcXXX"); + message.setString("mandInit2", "defYYY"); + + byte[] encoding = encoder.encode(message); + assertEquals("11010000 10000001 01011001 01011001 11011001", encoding); + + encoding = encoder.encode(message); + assertEquals("10000000", encoding); + } + + public void testOptionalFields() { + MessageTemplate template = new MessageTemplate("", new Field[] { + new Scalar("mandInit1", Type.ASCII, Operator.TAIL, new StringValue("abcXXX"), false), + new Scalar("mandInit2", Type.ASCII, Operator.TAIL, new StringValue("defXXX"), false) + }); + FastEncoder encoder = encoder(template); + + Message message = new Message(template); + message.setString("mandInit1", "abcXXX"); + message.setString("mandInit2", "defYYY"); + + byte[] encoding = encoder.encode(message); + assertEquals("11010000 10000001 01011001 01011001 11011001", encoding); + + encoding = encoder.encode(message); + assertEquals("10000000", encoding); + } +} Modified: trunk/test/unit/org/openfast/template/operator/TailOperatorCodecTest.java =================================================================== --- trunk/test/unit/org/openfast/template/operator/TailOperatorCodecTest.java 2007-11-26 17:00:20 UTC (rev 91) +++ trunk/test/unit/org/openfast/template/operator/TailOperatorCodecTest.java 2007-12-05 16:18:23 UTC (rev 92) @@ -64,6 +64,6 @@ ScalarValue priorValue = new StringValue("abcde"); ScalarValue value = new StringValue("abcde"); - assertEquals(new StringValue(""), OperatorCodec.TAIL.getValueToEncode(value, priorValue, byteVectorField)); + assertEquals(null, OperatorCodec.TAIL.getValueToEncode(value, priorValue, byteVectorField)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jac...@us...> - 2007-11-26 17:00:16
|
Revision: 91 http://openfast.svn.sourceforge.net/openfast/?rev=91&view=rev Author: jacob_northey Date: 2007-11-26 09:00:20 -0800 (Mon, 26 Nov 2007) Log Message: ----------- Added test for tail operator Modified Paths: -------------- trunk/src/org/openfast/template/loader/XMLMessageTemplateLoader.java trunk/test/acceptance/org/openfast/scenario/CmeTemplateTest.java trunk/test/unit/org/openfast/submitted/TailOperatorWithRepeatedValuesTest.java trunk/test/unit/org/openfast/util/UtilTest.java Added Paths: ----------- trunk/src/org/openfast/fastTemplateSchema-1.0.xsd trunk/src/org/openfast/fastTemplateSchema-1.1.xsd Removed Paths: ------------- trunk/src/org/openfast/fastTemplateSchema.v10.xsd trunk/src/org/openfast/fastTemplateSchema.v11.xsd trunk/test/unit/org/openfast/submitted/SchemaValidationTest.java trunk/test/unit/org/openfast/submitted/fastapi.xml Copied: trunk/src/org/openfast/fastTemplateSchema-1.0.xsd (from rev 66, trunk/src/org/openfast/fastTemplateSchema.v10.xsd) =================================================================== --- trunk/src/org/openfast/fastTemplateSchema-1.0.xsd (rev 0) +++ trunk/src/org/openfast/fastTemplateSchema-1.0.xsd 2007-11-26 17:00:20 UTC (rev 91) @@ -0,0 +1,390 @@ +<xs:schema xmlns:td="http://www.fixprotocol.org/ns/template-definition" + xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" + targetNamespace="http://www.fixprotocol.org/ns/template-definition"> + <xs:element name="templates"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element ref="td:template"/> + <xs:group ref="td:other"/> + </xs:choice> + <xs:attribute name="ns"/> + <xs:attribute name="templateNs"/> + <xs:attributeGroup ref="td:other"/> + </xs:complexType> + </xs:element> + <xs:element name="template"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:choice> + <xs:element ref="td:messageRef"/> + <xs:group ref="td:instruction"/> + </xs:choice> + <xs:group ref="td:other"/> + </xs:choice> + <xs:attributeGroup ref="td:templateNsName"/> + <xs:attribute name="ns"/> + <xs:attributeGroup ref="td:other"/> + </xs:complexType> + </xs:element> + <xs:element name="messageRef"> + <xs:complexType> + <xs:group ref="td:other"/> + <xs:attributeGroup ref="td:nsName"/> + <xs:attributeGroup ref="td:other"/> + </xs:complexType> + </xs:element> + <xs:group name="instruction"> + <xs:choice> + <xs:group ref="td:field"/> + <xs:element ref="td:presenceMap"/> + <xs:element ref="td:templateRef"/> + </xs:choice> + </xs:group> + <xs:complexType name="fieldInstrContent"> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:group ref="td:fieldOp"/> + <xs:group ref="td:other"/> + </xs:choice> + <xs:attributeGroup ref="td:nsName"/> + <xs:attribute name="presence"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="mandatory"/> + <xs:enumeration value="optional"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attributeGroup ref="td:other"/> + </xs:complexType> + <xs:group name="field"> + <xs:choice> + <xs:group ref="td:integerField"/> + <xs:element ref="td:decimal"/> + <xs:element ref="td:boolean"/> + <xs:element ref="td:string"/> + <xs:element ref="td:byteVector"/> + <xs:element ref="td:any"/> + <xs:element ref="td:sequence"/> + <xs:element ref="td:group"/> + </xs:choice> + </xs:group> + <xs:group name="integerField"> + <xs:choice> + <xs:element ref="td:int8"/> + <xs:element ref="td:uInt8"/> + <xs:element ref="td:int16"/> + <xs:element ref="td:uInt16"/> + <xs:element ref="td:int32"/> + <xs:element ref="td:uInt32"/> + <xs:element ref="td:int64"/> + <xs:element ref="td:uInt64"/> + </xs:choice> + </xs:group> + <xs:element name="int8" type="td:fieldInstrContent"/> + <xs:element name="uInt8" type="td:fieldInstrContent"/> + <xs:element name="int16" type="td:fieldInstrContent"/> + <xs:element name="uInt16" type="td:fieldInstrContent"/> + <xs:element name="int32" type="td:fieldInstrContent"/> + <xs:element name="uInt32" type="td:fieldInstrContent"/> + <xs:element name="int64" type="td:fieldInstrContent"/> + <xs:element name="uInt64" type="td:fieldInstrContent"/> + <xs:element name="decimal"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:choice> + <xs:group ref="td:singleFieldDecimal"/> + <xs:choice> + <xs:element ref="td:exponent"/> + <xs:element ref="td:mantissa"/> + </xs:choice> + </xs:choice> + <xs:group ref="td:other"/> + </xs:choice> + <xs:attributeGroup ref="td:nsName"/> + <xs:attribute name="presence"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="mandatory"/> + <xs:enumeration value="optional"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attributeGroup ref="td:other"/> + </xs:complexType> + </xs:element> + <xs:element name="exponent"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:group ref="td:fieldOp"/> + <xs:group ref="td:other"/> + </xs:choice> + <xs:attributeGroup ref="td:other"/> + </xs:complexType> + </xs:element> + <xs:element name="mantissa"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:group ref="td:fieldOp"/> + <xs:group ref="td:other"/> + </xs:choice> + <xs:attributeGroup ref="td:other"/> + </xs:complexType> + </xs:element> + <xs:group name="singleFieldDecimal"> + <xs:sequence> + <xs:group minOccurs="0" ref="td:fieldOp"/> + </xs:sequence> + </xs:group> + <xs:group name="twinFieldDecimal"> + <xs:sequence> + <xs:element minOccurs="0" ref="td:exponent"/> + <xs:element minOccurs="0" ref="td:mantissa"/> + </xs:sequence> + </xs:group> + <xs:element name="boolean" type="td:fieldInstrContent"/> + <xs:element name="string"> + <xs:complexType> + <xs:complexContent> + <xs:extension base="td:fieldInstrContent"> + <xs:attribute name="charset"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="ascii"/> + <xs:enumeration value="unicode"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + <xs:element name="byteVector" type="td:fieldInstrContent"/> + <xs:element name="any" type="td:fieldInstrContent"/> + <xs:element name="sequence"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:choice> + <xs:element ref="td:length"/> + <xs:group ref="td:instruction"/> + </xs:choice> + <xs:group ref="td:other"/> + </xs:choice> + <xs:attributeGroup ref="td:nsName"/> + <xs:attribute name="presence"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="mandatory"/> + <xs:enumeration value="optional"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attributeGroup ref="td:other"/> + </xs:complexType> + </xs:element> + <xs:element name="length"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:group ref="td:fieldOp"/> + <xs:group ref="td:other"/> + </xs:choice> + <xs:attribute name="name" type="xs:token"/> + <xs:attribute name="ns"/> + <xs:attributeGroup ref="td:other"/> + </xs:complexType> + </xs:element> + <xs:element name="group"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:group ref="td:instruction"/> + <xs:group ref="td:other"/> + </xs:choice> + <xs:attributeGroup ref="td:nsName"/> + <xs:attribute name="presence"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="mandatory"/> + <xs:enumeration value="optional"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attributeGroup ref="td:other"/> + </xs:complexType> + </xs:element> + <xs:group name="fieldOp"> + <xs:choice> + <xs:element ref="td:constant"/> + <xs:element ref="td:implicit"/> + <xs:element ref="td:default"/> + <xs:element ref="td:copy"/> + <xs:element ref="td:increment"/> + <xs:element ref="td:delta"/> + </xs:choice> + </xs:group> + <xs:element name="constant"> + <xs:complexType> + <xs:group ref="td:other"/> + <xs:attributeGroup ref="td:initialValueAttr"/> + <xs:attributeGroup ref="td:other"/> + </xs:complexType> + </xs:element> + <xs:element name="implicit"> + <xs:complexType> + <xs:group ref="td:other"/> + <xs:attributeGroup ref="td:other"/> + </xs:complexType> + </xs:element> + <xs:element name="default"> + <xs:complexType> + <xs:group ref="td:other"/> + <xs:attribute name="value"/> + <xs:attributeGroup ref="td:other"/> + </xs:complexType> + </xs:element> + <xs:element name="copy" type="td:opContext"/> + <xs:element name="increment" type="td:opContext"/> + <xs:element name="delta" type="td:opContext"/> + <xs:attributeGroup name="initialValueAttr"> + <xs:attribute name="value" use="required"/> + </xs:attributeGroup> + <xs:complexType name="opContext"> + <xs:group ref="td:other"/> + <xs:attribute name="dictionary"> + <xs:simpleType> + <xs:union memberTypes="xs:string"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="template"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="message"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="global"/> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="scope"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="group"/> + <xs:enumeration value="message"/> + <xs:enumeration value="explicit"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="value"/> + <xs:attributeGroup ref="td:other"/> + </xs:complexType> + <xs:attributeGroup name="scopeAttr"> + <xs:attribute name="scope" use="required"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="group"/> + <xs:enumeration value="message"/> + <xs:enumeration value="explicit"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:attributeGroup> + <xs:attributeGroup name="dictionaryAttr"> + <xs:attribute name="dictionary" use="required"> + <xs:simpleType> + <xs:union memberTypes="xs:string"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="template"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="message"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="global"/> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> + </xs:attribute> + </xs:attributeGroup> + <xs:attributeGroup name="lengthAttr"> + <xs:attribute name="length" use="required" type="xs:unsignedInt"/> + </xs:attributeGroup> + <xs:attributeGroup name="charsetAttr"> + <xs:attribute name="charset" use="required"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="ascii"/> + <xs:enumeration value="unicode"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:attributeGroup> + <xs:element name="presenceMap"> + <xs:complexType> + <xs:group ref="td:other"/> + <xs:attribute name="length" type="xs:unsignedInt"/> + <xs:attributeGroup ref="td:other"/> + </xs:complexType> + </xs:element> + <xs:element name="templateRef"> + <xs:complexType> + <xs:group ref="td:other"/> + <xs:attribute name="name" type="xs:token"/> + <xs:attribute name="templateNs"/> + <xs:attributeGroup ref="td:other"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="presenceAttr"> + <xs:attribute name="presence" use="required"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="mandatory"/> + <xs:enumeration value="optional"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:attributeGroup> + <xs:attributeGroup name="nsName"> + <xs:attributeGroup ref="td:nameAttr"/> + <xs:attribute name="ns"/> + </xs:attributeGroup> + <xs:attributeGroup name="templateNsName"> + <xs:attributeGroup ref="td:nameAttr"/> + <xs:attribute name="templateNs"/> + </xs:attributeGroup> + <xs:attributeGroup name="nameAttr"> + <xs:attribute name="name" use="required" type="xs:token"/> + </xs:attributeGroup> + <xs:attributeGroup name="nsAttr"> + <xs:attribute name="ns" use="required"/> + </xs:attributeGroup> + <xs:attributeGroup name="templateNsAttr"> + <xs:attribute name="templateNs" use="required"/> + </xs:attributeGroup> + <xs:group name="other"> + <xs:sequence> + <xs:group minOccurs="0" maxOccurs="unbounded" ref="td:foreignElm"/> + </xs:sequence> + </xs:group> + <xs:attributeGroup name="other"> + <xs:attributeGroup ref="td:foreignAttr"/> + </xs:attributeGroup> + <xs:group name="foreignElm"> + <xs:choice> + <xs:any namespace="##other" processContents="skip"/> + <xs:any namespace="##local" processContents="skip"/> + </xs:choice> + </xs:group> + <xs:attributeGroup name="foreignAttr"> + <xs:anyAttribute namespace="##other" processContents="skip"/> + </xs:attributeGroup> +</xs:schema> \ No newline at end of file Copied: trunk/src/org/openfast/fastTemplateSchema-1.1.xsd (from rev 89, trunk/src/org/openfast/fastTemplateSchema.v11.xsd) =================================================================== --- trunk/src/org/openfast/fastTemplateSchema-1.1.xsd (rev 0) +++ trunk/src/org/openfast/fastTemplateSchema-1.1.xsd 2007-11-26 17:00:20 UTC (rev 91) @@ -0,0 +1,371 @@ +<xs:schema xmlns:td="http://www.fixprotocol.org/ns/fast/td/1.1" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified" + targetNamespace="http://www.fixprotocol.org/ns/fast/td/1.1"> + <xs:element name="templates"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element ref="td:template" /> + <xs:group ref="td:other" /> + </xs:choice> + <xs:attribute name="ns" /> + <xs:attribute name="templateNs" /> + <xs:attribute name="dictionary"> + <xs:simpleType> + <xs:union memberTypes="xs:string"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="template" /> + <xs:enumeration value="type" /> + <xs:enumeration value="global" /> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> + </xs:attribute> + <xs:attributeGroup ref="td:other" /> + </xs:complexType> + </xs:element> + <xs:element name="template"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:choice> + <xs:element ref="td:typeRef" /> + <xs:group ref="td:instruction" /> + </xs:choice> + <xs:group ref="td:other" /> + </xs:choice> + <xs:attributeGroup ref="td:templateNsName" /> + <xs:attribute name="ns" /> + <xs:attribute name="dictionary"> + <xs:simpleType> + <xs:union memberTypes="xs:string"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="template" /> + <xs:enumeration value="type" /> + <xs:enumeration value="global" /> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> + </xs:attribute> + <xs:attributeGroup ref="td:other" /> + </xs:complexType> + </xs:element> + <xs:element name="typeRef"> + <xs:complexType> + <xs:group ref="td:other" /> + <xs:attributeGroup ref="td:nameAttr" /> + <xs:attribute name="ns" /> + <xs:attributeGroup ref="td:other" /> + </xs:complexType> + </xs:element> + <xs:group name="instruction"> + <xs:choice> + <xs:group ref="td:field" /> + <xs:element ref="td:templateRef" /> + </xs:choice> + </xs:group> + <xs:group name="fieldInstrContent"> + <xs:sequence> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:group ref="td:fieldOp" /> + <xs:group ref="td:other" /> + </xs:choice> + </xs:sequence> + </xs:group> + <xs:attributeGroup name="fieldInstrContent"> + <xs:attributeGroup ref="td:nsName" /> + <xs:attribute name="presence"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="mandatory" /> + <xs:enumeration value="optional" /> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attributeGroup ref="td:other" /> + </xs:attributeGroup> + <xs:group name="field"> + <xs:choice> + <xs:group ref="td:integerField" /> + <xs:element ref="td:decimal" /> + <xs:group ref="td:stringField" /> + <xs:element ref="td:byteVector" /> + <xs:element ref="td:sequence" /> + <xs:element ref="td:group" /> + </xs:choice> + </xs:group> + <xs:complexType name="integerField"> + <xs:group ref="td:fieldInstrContent" /> + <xs:attributeGroup ref="td:fieldInstrContent" /> + </xs:complexType> + <xs:group name="integerField"> + <xs:choice> + <xs:element ref="td:int32" /> + <xs:element ref="td:uInt32" /> + <xs:element ref="td:int64" /> + <xs:element ref="td:uInt64" /> + </xs:choice> + </xs:group> + <xs:element name="int32" type="td:integerField" /> + <xs:element name="uInt32" type="td:integerField" /> + <xs:element name="int64" type="td:integerField" /> + <xs:element name="uInt64" type="td:integerField" /> + <xs:element name="decimal"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:choice> + <xs:group ref="td:fieldOp" /> + <xs:choice> + <xs:element ref="td:exponent" /> + <xs:element ref="td:mantissa" /> + </xs:choice> + </xs:choice> + <xs:group ref="td:other" /> + </xs:choice> + <xs:attributeGroup ref="td:nsName" /> + <xs:attribute name="presence"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="mandatory" /> + <xs:enumeration value="optional" /> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attributeGroup ref="td:other" /> + </xs:complexType> + </xs:element> + <xs:element name="exponent"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:group ref="td:fieldOp" /> + <xs:group ref="td:other" /> + </xs:choice> + <xs:attributeGroup ref="td:other" /> + </xs:complexType> + </xs:element> + <xs:element name="mantissa"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:group ref="td:fieldOp" /> + <xs:group ref="td:other" /> + </xs:choice> + <xs:attributeGroup ref="td:other" /> + </xs:complexType> + </xs:element> + <xs:group name="stringField"> + <xs:sequence> + <xs:element name="string"> + <xs:complexType> + <xs:sequence> + <xs:group minOccurs="0" ref="td:byteVectorLength" /> + <xs:group ref="td:fieldInstrContent" /> + </xs:sequence> + <xs:attributeGroup ref="td:fieldInstrContent" /> + <xs:attribute name="charset"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="ascii" /> + <xs:enumeration value="unicode" /> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:group> + <xs:element name="byteVector"> + <xs:complexType> + <xs:sequence> + <xs:group minOccurs="0" ref="td:byteVectorLength" /> + <xs:group ref="td:fieldInstrContent" /> + </xs:sequence> + <xs:attributeGroup ref="td:fieldInstrContent" /> + </xs:complexType> + </xs:element> + <xs:group name="byteVectorLength"> + <xs:sequence> + <xs:element name="length"> + <xs:complexType> + <xs:attributeGroup ref="td:nsName" /> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:group> + <xs:element name="sequence"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:choice> + <xs:element ref="td:typeRef" /> + <xs:group ref="td:length" /> + <xs:group ref="td:instruction" /> + </xs:choice> + <xs:group ref="td:other" /> + </xs:choice> + <xs:attributeGroup ref="td:nsName" /> + <xs:attribute name="presence"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="mandatory" /> + <xs:enumeration value="optional" /> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="dictionary"> + <xs:simpleType> + <xs:union memberTypes="xs:string"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="template" /> + <xs:enumeration value="type" /> + <xs:enumeration value="global" /> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> + </xs:attribute> + <xs:attributeGroup ref="td:other" /> + </xs:complexType> + </xs:element> + <xs:group name="length"> + <xs:sequence> + <xs:element name="length"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:group ref="td:fieldOp" /> + <xs:group ref="td:other" /> + </xs:choice> + <xs:attribute name="name" type="xs:token" /> + <xs:attribute name="ns" /> + <xs:attribute name="id" type="xs:token" /> + <xs:attributeGroup ref="td:other" /> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:group> + <xs:element name="group"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:choice> + <xs:element ref="td:typeRef" /> + <xs:group ref="td:instruction" /> + </xs:choice> + <xs:group ref="td:other" /> + </xs:choice> + <xs:attributeGroup ref="td:nsName" /> + <xs:attribute name="presence"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="mandatory" /> + <xs:enumeration value="optional" /> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="dictionary"> + <xs:simpleType> + <xs:union memberTypes="xs:string"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="template" /> + <xs:enumeration value="type" /> + <xs:enumeration value="global" /> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> + </xs:attribute> + <xs:attributeGroup ref="td:other" /> + </xs:complexType> + </xs:element> + <xs:group name="fieldOp"> + <xs:choice> + <xs:element ref="td:constant" /> + <xs:element ref="td:default" /> + <xs:element ref="td:copy" /> + <xs:element ref="td:increment" /> + <xs:element ref="td:delta" /> + <xs:element ref="td:tail" /> + </xs:choice> + </xs:group> + <xs:element name="constant"> + <xs:complexType> + <xs:group ref="td:other" /> + <xs:attributeGroup ref="td:initialValueAttr" /> + <xs:attributeGroup ref="td:other" /> + </xs:complexType> + </xs:element> + <xs:element name="default"> + <xs:complexType> + <xs:group ref="td:other" /> + <xs:attribute name="value" /> + <xs:attributeGroup ref="td:other" /> + </xs:complexType> + </xs:element> + <xs:element name="copy" type="td:opContext" /> + <xs:element name="increment" type="td:opContext" /> + <xs:element name="delta" type="td:opContext" /> + <xs:element name="tail" type="td:opContext" /> + <xs:attributeGroup name="initialValueAttr"> + <xs:attribute use="required" name="value" /> + </xs:attributeGroup> + <xs:complexType name="opContext"> + <xs:group ref="td:other" /> + <xs:attribute name="dictionary"> + <xs:simpleType> + <xs:union memberTypes="xs:string"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="template" /> + <xs:enumeration value="type" /> + <xs:enumeration value="global" /> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="key" type="xs:token" /> + <xs:attribute name="ns" /> + <xs:attribute name="value" /> + <xs:attributeGroup ref="td:other" /> + </xs:complexType> + <xs:element name="templateRef"> + <xs:complexType> + <xs:group ref="td:other" /> + <xs:attribute name="name" type="xs:token" /> + <xs:attribute name="templateNs" /> + <xs:attributeGroup ref="td:other" /> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="nsName"> + <xs:attributeGroup ref="td:nameAttr" /> + <xs:attribute name="ns" /> + <xs:attribute name="id" type="xs:token" /> + </xs:attributeGroup> + <xs:attributeGroup name="templateNsName"> + <xs:attributeGroup ref="td:nameAttr" /> + <xs:attribute name="templateNs" /> + <xs:attribute name="id" type="xs:token" /> + </xs:attributeGroup> + <xs:attributeGroup name="nameAttr"> + <xs:attribute use="required" name="name" type="xs:token" /> + </xs:attributeGroup> + <xs:group name="other"> + <xs:sequence> + <xs:group minOccurs="0" ref="td:foreignElm" maxOccurs="unbounded" /> + </xs:sequence> + </xs:group> + <xs:attributeGroup name="other"> + <xs:attributeGroup ref="td:foreignAttr" /> + </xs:attributeGroup> + <xs:group name="foreignElm"> + <xs:choice> + <xs:any namespace="##other" processContents="skip" /> + <xs:any namespace="##local" processContents="skip" /> + </xs:choice> + </xs:group> + <xs:attributeGroup name="foreignAttr"> + <xs:anyAttribute namespace="##other" processContents="skip" /> + </xs:attributeGroup> +</xs:schema> \ No newline at end of file Deleted: trunk/src/org/openfast/fastTemplateSchema.v10.xsd =================================================================== --- trunk/src/org/openfast/fastTemplateSchema.v10.xsd 2007-11-16 17:11:20 UTC (rev 90) +++ trunk/src/org/openfast/fastTemplateSchema.v10.xsd 2007-11-26 17:00:20 UTC (rev 91) @@ -1,390 +0,0 @@ -<xs:schema xmlns:td="http://www.fixprotocol.org/ns/template-definition" - xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" - targetNamespace="http://www.fixprotocol.org/ns/template-definition"> - <xs:element name="templates"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:element ref="td:template"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attribute name="ns"/> - <xs:attribute name="templateNs"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="template"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:element ref="td:messageRef"/> - <xs:group ref="td:instruction"/> - </xs:choice> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:templateNsName"/> - <xs:attribute name="ns"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="messageRef"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attributeGroup ref="td:nsName"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:group name="instruction"> - <xs:choice> - <xs:group ref="td:field"/> - <xs:element ref="td:presenceMap"/> - <xs:element ref="td:templateRef"/> - </xs:choice> - </xs:group> - <xs:complexType name="fieldInstrContent"> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:nsName"/> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory"/> - <xs:enumeration value="optional"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - <xs:group name="field"> - <xs:choice> - <xs:group ref="td:integerField"/> - <xs:element ref="td:decimal"/> - <xs:element ref="td:boolean"/> - <xs:element ref="td:string"/> - <xs:element ref="td:byteVector"/> - <xs:element ref="td:any"/> - <xs:element ref="td:sequence"/> - <xs:element ref="td:group"/> - </xs:choice> - </xs:group> - <xs:group name="integerField"> - <xs:choice> - <xs:element ref="td:int8"/> - <xs:element ref="td:uInt8"/> - <xs:element ref="td:int16"/> - <xs:element ref="td:uInt16"/> - <xs:element ref="td:int32"/> - <xs:element ref="td:uInt32"/> - <xs:element ref="td:int64"/> - <xs:element ref="td:uInt64"/> - </xs:choice> - </xs:group> - <xs:element name="int8" type="td:fieldInstrContent"/> - <xs:element name="uInt8" type="td:fieldInstrContent"/> - <xs:element name="int16" type="td:fieldInstrContent"/> - <xs:element name="uInt16" type="td:fieldInstrContent"/> - <xs:element name="int32" type="td:fieldInstrContent"/> - <xs:element name="uInt32" type="td:fieldInstrContent"/> - <xs:element name="int64" type="td:fieldInstrContent"/> - <xs:element name="uInt64" type="td:fieldInstrContent"/> - <xs:element name="decimal"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:group ref="td:singleFieldDecimal"/> - <xs:choice> - <xs:element ref="td:exponent"/> - <xs:element ref="td:mantissa"/> - </xs:choice> - </xs:choice> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:nsName"/> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory"/> - <xs:enumeration value="optional"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="exponent"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="mantissa"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:group name="singleFieldDecimal"> - <xs:sequence> - <xs:group minOccurs="0" ref="td:fieldOp"/> - </xs:sequence> - </xs:group> - <xs:group name="twinFieldDecimal"> - <xs:sequence> - <xs:element minOccurs="0" ref="td:exponent"/> - <xs:element minOccurs="0" ref="td:mantissa"/> - </xs:sequence> - </xs:group> - <xs:element name="boolean" type="td:fieldInstrContent"/> - <xs:element name="string"> - <xs:complexType> - <xs:complexContent> - <xs:extension base="td:fieldInstrContent"> - <xs:attribute name="charset"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="ascii"/> - <xs:enumeration value="unicode"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:extension> - </xs:complexContent> - </xs:complexType> - </xs:element> - <xs:element name="byteVector" type="td:fieldInstrContent"/> - <xs:element name="any" type="td:fieldInstrContent"/> - <xs:element name="sequence"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:element ref="td:length"/> - <xs:group ref="td:instruction"/> - </xs:choice> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:nsName"/> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory"/> - <xs:enumeration value="optional"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="length"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attribute name="name" type="xs:token"/> - <xs:attribute name="ns"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="group"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:instruction"/> - <xs:group ref="td:other"/> - </xs:choice> - <xs:attributeGroup ref="td:nsName"/> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory"/> - <xs:enumeration value="optional"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:group name="fieldOp"> - <xs:choice> - <xs:element ref="td:constant"/> - <xs:element ref="td:implicit"/> - <xs:element ref="td:default"/> - <xs:element ref="td:copy"/> - <xs:element ref="td:increment"/> - <xs:element ref="td:delta"/> - </xs:choice> - </xs:group> - <xs:element name="constant"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attributeGroup ref="td:initialValueAttr"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="implicit"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="default"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attribute name="value"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="copy" type="td:opContext"/> - <xs:element name="increment" type="td:opContext"/> - <xs:element name="delta" type="td:opContext"/> - <xs:attributeGroup name="initialValueAttr"> - <xs:attribute name="value" use="required"/> - </xs:attributeGroup> - <xs:complexType name="opContext"> - <xs:group ref="td:other"/> - <xs:attribute name="dictionary"> - <xs:simpleType> - <xs:union memberTypes="xs:string"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="template"/> - </xs:restriction> - </xs:simpleType> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="message"/> - </xs:restriction> - </xs:simpleType> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="global"/> - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="scope"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="group"/> - <xs:enumeration value="message"/> - <xs:enumeration value="explicit"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="value"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - <xs:attributeGroup name="scopeAttr"> - <xs:attribute name="scope" use="required"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="group"/> - <xs:enumeration value="message"/> - <xs:enumeration value="explicit"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:attributeGroup> - <xs:attributeGroup name="dictionaryAttr"> - <xs:attribute name="dictionary" use="required"> - <xs:simpleType> - <xs:union memberTypes="xs:string"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="template"/> - </xs:restriction> - </xs:simpleType> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="message"/> - </xs:restriction> - </xs:simpleType> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="global"/> - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - </xs:attributeGroup> - <xs:attributeGroup name="lengthAttr"> - <xs:attribute name="length" use="required" type="xs:unsignedInt"/> - </xs:attributeGroup> - <xs:attributeGroup name="charsetAttr"> - <xs:attribute name="charset" use="required"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="ascii"/> - <xs:enumeration value="unicode"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:attributeGroup> - <xs:element name="presenceMap"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attribute name="length" type="xs:unsignedInt"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:element name="templateRef"> - <xs:complexType> - <xs:group ref="td:other"/> - <xs:attribute name="name" type="xs:token"/> - <xs:attribute name="templateNs"/> - <xs:attributeGroup ref="td:other"/> - </xs:complexType> - </xs:element> - <xs:attributeGroup name="presenceAttr"> - <xs:attribute name="presence" use="required"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory"/> - <xs:enumeration value="optional"/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:attributeGroup> - <xs:attributeGroup name="nsName"> - <xs:attributeGroup ref="td:nameAttr"/> - <xs:attribute name="ns"/> - </xs:attributeGroup> - <xs:attributeGroup name="templateNsName"> - <xs:attributeGroup ref="td:nameAttr"/> - <xs:attribute name="templateNs"/> - </xs:attributeGroup> - <xs:attributeGroup name="nameAttr"> - <xs:attribute name="name" use="required" type="xs:token"/> - </xs:attributeGroup> - <xs:attributeGroup name="nsAttr"> - <xs:attribute name="ns" use="required"/> - </xs:attributeGroup> - <xs:attributeGroup name="templateNsAttr"> - <xs:attribute name="templateNs" use="required"/> - </xs:attributeGroup> - <xs:group name="other"> - <xs:sequence> - <xs:group minOccurs="0" maxOccurs="unbounded" ref="td:foreignElm"/> - </xs:sequence> - </xs:group> - <xs:attributeGroup name="other"> - <xs:attributeGroup ref="td:foreignAttr"/> - </xs:attributeGroup> - <xs:group name="foreignElm"> - <xs:choice> - <xs:any namespace="##other" processContents="skip"/> - <xs:any namespace="##local" processContents="skip"/> - </xs:choice> - </xs:group> - <xs:attributeGroup name="foreignAttr"> - <xs:anyAttribute namespace="##other" processContents="skip"/> - </xs:attributeGroup> -</xs:schema> \ No newline at end of file Deleted: trunk/src/org/openfast/fastTemplateSchema.v11.xsd =================================================================== --- trunk/src/org/openfast/fastTemplateSchema.v11.xsd 2007-11-16 17:11:20 UTC (rev 90) +++ trunk/src/org/openfast/fastTemplateSchema.v11.xsd 2007-11-26 17:00:20 UTC (rev 91) @@ -1,371 +0,0 @@ -<xs:schema xmlns:td="http://www.fixprotocol.org/ns/fast/td/1.1" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - elementFormDefault="qualified" - targetNamespace="http://www.fixprotocol.org/ns/fast/td/1.1"> - <xs:element name="templates"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:element ref="td:template" /> - <xs:group ref="td:other" /> - </xs:choice> - <xs:attribute name="ns" /> - <xs:attribute name="templateNs" /> - <xs:attribute name="dictionary"> - <xs:simpleType> - <xs:union memberTypes="xs:string"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="template" /> - <xs:enumeration value="type" /> - <xs:enumeration value="global" /> - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:element name="template"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:element ref="td:typeRef" /> - <xs:group ref="td:instruction" /> - </xs:choice> - <xs:group ref="td:other" /> - </xs:choice> - <xs:attributeGroup ref="td:templateNsName" /> - <xs:attribute name="ns" /> - <xs:attribute name="dictionary"> - <xs:simpleType> - <xs:union memberTypes="xs:string"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="template" /> - <xs:enumeration value="type" /> - <xs:enumeration value="global" /> - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:element name="typeRef"> - <xs:complexType> - <xs:group ref="td:other" /> - <xs:attributeGroup ref="td:nameAttr" /> - <xs:attribute name="ns" /> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:group name="instruction"> - <xs:choice> - <xs:group ref="td:field" /> - <xs:element ref="td:templateRef" /> - </xs:choice> - </xs:group> - <xs:group name="fieldInstrContent"> - <xs:sequence> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp" /> - <xs:group ref="td:other" /> - </xs:choice> - </xs:sequence> - </xs:group> - <xs:attributeGroup name="fieldInstrContent"> - <xs:attributeGroup ref="td:nsName" /> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory" /> - <xs:enumeration value="optional" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other" /> - </xs:attributeGroup> - <xs:group name="field"> - <xs:choice> - <xs:group ref="td:integerField" /> - <xs:element ref="td:decimal" /> - <xs:group ref="td:stringField" /> - <xs:element ref="td:byteVector" /> - <xs:element ref="td:sequence" /> - <xs:element ref="td:group" /> - </xs:choice> - </xs:group> - <xs:complexType name="integerField"> - <xs:group ref="td:fieldInstrContent" /> - <xs:attributeGroup ref="td:fieldInstrContent" /> - </xs:complexType> - <xs:group name="integerField"> - <xs:choice> - <xs:element ref="td:int32" /> - <xs:element ref="td:uInt32" /> - <xs:element ref="td:int64" /> - <xs:element ref="td:uInt64" /> - </xs:choice> - </xs:group> - <xs:element name="int32" type="td:integerField" /> - <xs:element name="uInt32" type="td:integerField" /> - <xs:element name="int64" type="td:integerField" /> - <xs:element name="uInt64" type="td:integerField" /> - <xs:element name="decimal"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:group ref="td:fieldOp" /> - <xs:choice> - <xs:element ref="td:exponent" /> - <xs:element ref="td:mantissa" /> - </xs:choice> - </xs:choice> - <xs:group ref="td:other" /> - </xs:choice> - <xs:attributeGroup ref="td:nsName" /> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory" /> - <xs:enumeration value="optional" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:element name="exponent"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp" /> - <xs:group ref="td:other" /> - </xs:choice> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:element name="mantissa"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp" /> - <xs:group ref="td:other" /> - </xs:choice> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:group name="stringField"> - <xs:sequence> - <xs:element name="string"> - <xs:complexType> - <xs:sequence> - <xs:group minOccurs="0" ref="td:byteVectorLength" /> - <xs:group ref="td:fieldInstrContent" /> - </xs:sequence> - <xs:attributeGroup ref="td:fieldInstrContent" /> - <xs:attribute name="charset"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="ascii" /> - <xs:enumeration value="unicode" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:group> - <xs:element name="byteVector"> - <xs:complexType> - <xs:sequence> - <xs:group minOccurs="0" ref="td:byteVectorLength" /> - <xs:group ref="td:fieldInstrContent" /> - </xs:sequence> - <xs:attributeGroup ref="td:fieldInstrContent" /> - </xs:complexType> - </xs:element> - <xs:group name="byteVectorLength"> - <xs:sequence> - <xs:element name="length"> - <xs:complexType> - <xs:attributeGroup ref="td:nsName" /> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:group> - <xs:element name="sequence"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:element ref="td:typeRef" /> - <xs:group ref="td:length" /> - <xs:group ref="td:instruction" /> - </xs:choice> - <xs:group ref="td:other" /> - </xs:choice> - <xs:attributeGroup ref="td:nsName" /> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory" /> - <xs:enumeration value="optional" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="dictionary"> - <xs:simpleType> - <xs:union memberTypes="xs:string"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="template" /> - <xs:enumeration value="type" /> - <xs:enumeration value="global" /> - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:group name="length"> - <xs:sequence> - <xs:element name="length"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:group ref="td:fieldOp" /> - <xs:group ref="td:other" /> - </xs:choice> - <xs:attribute name="name" type="xs:token" /> - <xs:attribute name="ns" /> - <xs:attribute name="id" type="xs:token" /> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:group> - <xs:element name="group"> - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:choice> - <xs:element ref="td:typeRef" /> - <xs:group ref="td:instruction" /> - </xs:choice> - <xs:group ref="td:other" /> - </xs:choice> - <xs:attributeGroup ref="td:nsName" /> - <xs:attribute name="presence"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="mandatory" /> - <xs:enumeration value="optional" /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="dictionary"> - <xs:simpleType> - <xs:union memberTypes="xs:string"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="template" /> - <xs:enumeration value="type" /> - <xs:enumeration value="global" /> - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:group name="fieldOp"> - <xs:choice> - <xs:element ref="td:constant" /> - <xs:element ref="td:default" /> - <xs:element ref="td:copy" /> - <xs:element ref="td:increment" /> - <xs:element ref="td:delta" /> - <xs:element ref="td:tail" /> - </xs:choice> - </xs:group> - <xs:element name="constant"> - <xs:complexType> - <xs:group ref="td:other" /> - <xs:attributeGroup ref="td:initialValueAttr" /> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:element name="default"> - <xs:complexType> - <xs:group ref="td:other" /> - <xs:attribute name="value" /> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:element name="copy" type="td:opContext" /> - <xs:element name="increment" type="td:opContext" /> - <xs:element name="delta" type="td:opContext" /> - <xs:element name="tail" type="td:opContext" /> - <xs:attributeGroup name="initialValueAttr"> - <xs:attribute use="required" name="value" /> - </xs:attributeGroup> - <xs:complexType name="opContext"> - <xs:group ref="td:other" /> - <xs:attribute name="dictionary"> - <xs:simpleType> - <xs:union memberTypes="xs:string"> - <xs:simpleType> - <xs:restriction base="xs:token"> - <xs:enumeration value="template" /> - <xs:enumeration value="type" /> - <xs:enumeration value="global" /> - </xs:restriction> - </xs:simpleType> - </xs:union> - </xs:simpleType> - </xs:attribute> - <xs:attribute name="key" type="xs:token" /> - <xs:attribute name="ns" /> - <xs:attribute name="value" /> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - <xs:element name="templateRef"> - <xs:complexType> - <xs:group ref="td:other" /> - <xs:attribute name="name" type="xs:token" /> - <xs:attribute name="templateNs" /> - <xs:attributeGroup ref="td:other" /> - </xs:complexType> - </xs:element> - <xs:attributeGroup name="nsName"> - <xs:attributeGroup ref="td:nameAttr" /> - <xs:attribute name="ns" /> - <xs:attribute name="id" type="xs:token" /> - </xs:attributeGroup> - <xs:attributeGroup name="templateNsName"> - <xs:attributeGroup ref="td:nameAttr" /> - <xs:attribute name="templateNs" /> - <xs:attribute name="id" type="xs:token" /> - </xs:attributeGroup> - <xs:attributeGroup name="nameAttr"> - <xs:attribute use="required" name="name" type="xs:token" /> - </xs:attributeGroup> - <xs:group name="other"> - <xs:sequence> - <xs:group minOccurs="0" ref="td:foreignElm" maxOccurs="unbounded" /> - </xs:sequence> - </xs:group> - <xs:attributeGroup name="other"> - <xs:attributeGroup ref="td:foreignAttr" /> - </xs:attributeGroup> - <xs:group name="foreignElm"> - <xs:choice> - <xs:any namespace="##other" processContents="skip" /> - <xs:any namespace="##local" processContents="skip" /> - </xs:choice> - </xs:group> - <xs:attributeGroup name="foreignAttr"> - <xs:anyAttribute namespace="##other" processContents="skip" /> - </xs:attributeGroup> -</xs:schema> \ No newline at end of file Modified: trunk/src/org/openfast/template/loader/XMLMessageTemplateLoader.java =================================================================== --- trunk/src/org/openfast/template/loader/XMLMessageTemplateLoader.java 2007-11-16 17:11:20 UTC (rev 90) +++ trunk/src/org/openfast/template/loader/XMLMessageTemplateLoader.java 2007-11-26 17:00:20 UTC (rev 91) @@ -27,15 +27,8 @@ import java.util.ArrayList; import java.util.Map; -import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamSource; -import javax.xml.validation.Schema; -import javax.xml.validation.SchemaFactory; -import javax.xml.validation.Validator; import org.openfast.error.ErrorCode; import org.openfast.error.ErrorHandler; @@ -48,6 +41,7 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; @@ -63,13 +57,8 @@ private final boolean namespaceAwareness; private final ParsingContext initialContext; - private boolean validate; private boolean loadTemplateIdFromAuxId; - private Schema templateDefinitionSchema; - - - public XMLMessageTemplateLoader() { this(false); } @@ -99,28 +88,6 @@ initialContext.getFieldParsers().add(fieldParser); } - public boolean isValid(InputStream source) { - try { - Schema schema = loadFastTemplateDefinitionSchema(); - schema.newValidator().validate(new StreamSource(source), null); - return true; - } catch (SAXException e) { - initialContext.getErrorHandler().error(FastConstants.S1_INVALID_XML, e.getMessage(), e); - return false; - } catch (IOException e) { - initialContext.getErrorHandler().error(FastConstants.IO_ERROR, e.getMessage(), e); - return false; - } - } - - private Schema loadFastTemplateDefinitionSchema() throws SAXException { - if (templateDefinitionSchema == null) { - SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); - templateDefinitionSchema = schemaFactory.newSchema(new StreamSource(this.getClass().getClassLoader().getResourceAsStream("org/openfast/fastTemplateSchema.v11.xsd"))); - } - return templateDefinitionSchema; - } - /** * Parses the XML stream and creates an array of the elements * @param source The inputStream object to load @@ -174,16 +141,11 @@ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setIgnoringElementContentWhitespace(true); dbf.setNamespaceAware(namespaceAwareness); - DocumentBuilder builder = dbf.newDocumentBuilder(); + builder.setErrorHandler(errorHandler); - Document document = builder.parse(templateStream); - if (validate) { - Validator validator = loadFastTemplateDefinitionSchema().newValidator(); - DOMResult result = new DOMResult(); - validator.validate(new DOMSource(document), result); - return (Document) result.getNode(); - } + InputSource inputSource = new InputSource(templateStream); + Document document = builder.parse(inputSource); return document; } catch (IOException e) { initialContext.getErrorHandler().error(IO_ERROR, @@ -218,8 +180,4 @@ public void setLoadTemplateIdFromAuxId(boolean loadTempalteIdFromAuxId) { this.loadTemplateIdFromAuxId = loadTempalteIdFromAuxId; } - - public void setValidate(boolean validate) { - this.validate = validate; - } } Modified: trunk/test/acceptance/org/openfast/scenario/CmeTemplateTest.java =================================================================== --- trunk/test/acceptance/org/openfast/scenario/CmeTemplateTest.java 2007-11-16 17:11:20 UTC (rev 90) +++ trunk/test/acceptance/org/openfast/scenario/CmeTemplateTest.java 2007-11-26 17:00:20 UTC (rev 91) @@ -18,7 +18,6 @@ InputStream is = this.getClass().getResourceAsStream("1.fast"); MessageInputStream mis = new MessageInputStream(is); mis.setTemplateRegistry(templateLoader.getTemplateRegistry()); - mis.getContext().setTraceEnabled(true); Message md = mis.readMessage(); assertEquals(-5025.0, md.getSequence("MDEntries").get(0).getDouble("NetChgPrevDay"), .1); } Deleted: trunk/test/unit/org/openfast/submitted/SchemaValidationTest.java =================================================================== --- trunk/test/unit/org/openfast/submitted/SchemaValidationTest.java 2007-11-16 17:11:20 UTC (rev 90) +++ trunk/test/unit/org/openfast/submitted/SchemaValidationTest.java 2007-11-26 17:00:20 UTC (rev 91) @@ -1,20 +0,0 @@ -package org.openfast.submitted; - -import java.io.InputStream; - -import junit.framework.TestCase; - -import org.openfast.template.MessageTemplate; -import org.openfast.template.loader.XMLMessageTemplateLoader; - -public class SchemaValidationTest extends TestCase { - - public void testValidateSchema() throws Exception { - InputStream templateSource = this.getClass().getResourceAsStream("fastapi.xml"); - XMLMessageTemplateLoader templateLoader = new XMLMessageTemplateLoader(); - templateLoader.setLoadTemplateIdFromAuxId(true); - templateLoader.setValidate(true); - MessageTemplate[] templates = templateLoader.load(templateSource); - assertEquals(1, templates.length); - } -} Modified: trunk/test/unit/org/openfast/submitted/TailOperatorWithRepeatedValuesTest.java =================================================================== --- trunk/test/unit/org/openfast/submitted/TailOperatorWithRepeatedValuesTest.java 2007-11-16 17:11:20 UTC (rev 90) +++ trunk/test/unit/org/openfast/submitted/TailOperatorWithRepeatedValuesTest.java 2007-11-26 17:00:20 UTC (rev 91) @@ -2,13 +2,11 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.OutputStream; import org.openfast.Message; import org.openfast.MessageInputStream; import org.openfast.MessageOutputStream; import org.openfast.ScalarValue; -import org.openfast.codec.FastEncoder; import org.openfast.template.Field; import org.openfast.template.MessageTemplate; import org.openfast.template.Scalar; Deleted: trunk/test/unit/org/openfast/submitted/fastapi.xml =================================================================== --- trunk/test/unit/org/openfast/submitted/fastapi.xml 2007-11-16 17:11:20 UTC (rev 90) +++ trunk/test/unit/org/openfast/submitted/fastapi.xml 2007-11-26 17:00:20 UTC (rev 91) @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<templates xmlns="http://www.fixprotocol.org/ns/fast/td/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.fixprotocol.org/ns/fast/td/1.1 fast.xsd"> - <template name="MDIncRefresh" id="123"> - <typeRef name="MDIncRefresh"/> - <uInt32 name="field1" id="1"> <copy/> </uInt32> - <uInt32 name="field2" id="2"> </uInt32> - <uInt32 name="field3" id="3"> <default value="300000000"/> </uInt32> - <uInt32 name="field4" id="4"> <constant value="260000000"/> </uInt32> - <uInt32 name="field5" id="5"> <delta/> </uInt32> - <uInt32 name="field6" id="6"> <increment/> </uInt32> - <uInt32 name="field7" id="7"> <copy/> </uInt32> - <uInt32 name="field8" id="8"> <copy/> </uInt32> - <uInt32 name="field9" id="9"> <copy/> </uInt32> - <uInt32 name="field10" id="10"> <copy/> </uInt32> - <uInt32 name="field11" id="11"> <copy/> </uInt32> - <uInt32 name="field12" id="12"> <copy/> </uInt32> - </template> -</templates> \ No newline at end of file Modified: trunk/test/unit/org/openfast/util/UtilTest.java =================================================================== --- trunk/test/unit/org/openfast/util/UtilTest.java 2007-11-16 17:11:20 UTC (rev 90) +++ trunk/test/unit/org/openfast/util/UtilTest.java 2007-11-26 17:00:20 UTC (rev 91) @@ -86,8 +86,4 @@ private ScalarValue diff(String base, String value) { return Util.getDifference(new StringValue(value), new StringValue(base)); } - - public void testIt() throws Exception { - System.out.println(this.getClass().getResource("/org/openfast/fastTemplateSchema.v11.xsd").toString()); - } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jac...@us...> - 2007-11-16 17:11:17
|
Revision: 90 http://openfast.svn.sourceforge.net/openfast/?rev=90&view=rev Author: jacob_northey Date: 2007-11-16 09:11:20 -0800 (Fri, 16 Nov 2007) Log Message: ----------- FIXED: Tail operator causes index out of bounds exception when encoding the same value twice in a row. Modified Paths: -------------- trunk/src/org/openfast/template/operator/TailOperatorCodec.java trunk/test/unit/org/openfast/template/operator/TailOperatorCodecTest.java Added Paths: ----------- trunk/test/unit/org/openfast/submitted/TailOperatorWithRepeatedValuesTest.java Modified: trunk/src/org/openfast/template/operator/TailOperatorCodec.java =================================================================== --- trunk/src/org/openfast/template/operator/TailOperatorCodec.java 2007-11-13 20:57:52 UTC (rev 89) +++ trunk/src/org/openfast/template/operator/TailOperatorCodec.java 2007-11-16 17:11:20 UTC (rev 90) @@ -39,7 +39,10 @@ byte[] val = value.getBytes(); byte[] prior = priorValue.getBytes(); - while (val[index] == prior[index]) + if (val.length > prior.length) + return value; + + while (index < val.length && val[index] == prior[index]) index++; return (ScalarValue) field.createValue(new String(val, index, val.length-index)); Added: trunk/test/unit/org/openfast/submitted/TailOperatorWithRepeatedValuesTest.java =================================================================== --- trunk/test/unit/org/openfast/submitted/TailOperatorWithRepeatedValuesTest.java (rev 0) +++ trunk/test/unit/org/openfast/submitted/TailOperatorWithRepeatedValuesTest.java 2007-11-16 17:11:20 UTC (rev 90) @@ -0,0 +1,41 @@ +package org.openfast.submitted; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; + +import org.openfast.Message; +import org.openfast.MessageInputStream; +import org.openfast.MessageOutputStream; +import org.openfast.ScalarValue; +import org.openfast.codec.FastEncoder; +import org.openfast.template.Field; +import org.openfast.template.MessageTemplate; +import org.openfast.template.Scalar; +import org.openfast.template.operator.Operator; +import org.openfast.template.type.Type; +import org.openfast.test.OpenFastTestCase; + +public class TailOperatorWithRepeatedValuesTest extends OpenFastTestCase { + + public void testTailOperatorWithRepeatedValues() { + MessageTemplate t = new MessageTemplate("temp", new Field[] { + new Scalar("main", Type.ASCII, Operator.TAIL, ScalarValue.UNDEFINED, false) + }); + Message m = new Message(t); + m.setString(1, "abcde"); + + ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); + MessageOutputStream messageOut = new MessageOutputStream(byteOut); + messageOut.registerTemplate(1, t); + + messageOut.writeMessage(m); + messageOut.writeMessage(m); + + MessageInputStream messageIn = new MessageInputStream(new ByteArrayInputStream(byteOut.toByteArray())); + messageIn.registerTemplate(1, t); + + assertEquals(m, messageIn.readMessage()); + assertEquals(m, messageIn.readMessage()); + } +} Modified: trunk/test/unit/org/openfast/template/operator/TailOperatorCodecTest.java =================================================================== --- trunk/test/unit/org/openfast/template/operator/TailOperatorCodecTest.java 2007-11-13 20:57:52 UTC (rev 89) +++ trunk/test/unit/org/openfast/template/operator/TailOperatorCodecTest.java 2007-11-16 17:11:20 UTC (rev 90) @@ -39,4 +39,31 @@ ScalarValue expected = new StringValue("ce"); assertEquals(expected, OperatorCodec.TAIL.getValueToEncode(value, priorValue, byteVectorField)); } + + public void testGetValueToEncodeAsciiStringTooLong() { + Scalar byteVectorField = new Scalar("str", Type.ASCII, Operator.TAIL, ScalarValue.UNDEFINED, true); + + ScalarValue priorValue = new StringValue("abcde"); + ScalarValue value = new StringValue("dbcdef"); + + assertEquals(value, OperatorCodec.TAIL.getValueToEncode(value, priorValue, byteVectorField)); + } + + public void testGetValueToEncodeAsciiStringLengthMismatch() { + Scalar byteVectorField = new Scalar("str", Type.ASCII, Operator.TAIL, ScalarValue.UNDEFINED, true); + + ScalarValue priorValue = new StringValue("abcde"); + ScalarValue value = new StringValue("abcdef"); + + assertEquals(value, OperatorCodec.TAIL.getValueToEncode(value, priorValue, byteVectorField)); + } + + public void testGetValueToEncodeAsciiStringSameValue() { + Scalar byteVectorField = new Scalar("str", Type.ASCII, Operator.TAIL, ScalarValue.UNDEFINED, true); + + ScalarValue priorValue = new StringValue("abcde"); + ScalarValue value = new StringValue("abcde"); + + assertEquals(new StringValue(""), OperatorCodec.TAIL.getValueToEncode(value, priorValue, byteVectorField)); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jac...@us...> - 2007-11-13 20:57:49
|
Revision: 89 http://openfast.svn.sourceforge.net/openfast/?rev=89&view=rev Author: jacob_northey Date: 2007-11-13 12:57:52 -0800 (Tue, 13 Nov 2007) Log Message: ----------- Added xml schema validation; Fixed bug in GroupValue equals method. Modified Paths: -------------- trunk/build.xml trunk/src/org/openfast/GroupValue.java trunk/src/org/openfast/StringValue.java trunk/src/org/openfast/fastTemplateSchema.v11.xsd trunk/src/org/openfast/template/loader/XMLMessageTemplateLoader.java trunk/src/org/openfast/template/operator/OptionallyPresentOperatorCodec.java trunk/test/unit/org/openfast/submitted/OptionalInitialValueTest.java trunk/test/unit/org/openfast/template/type/codec/NullableUnsignedIntegerTest.java trunk/test/unit/org/openfast/test/ObjectMother.java trunk/test/unit/org/openfast/util/UtilTest.java Added Paths: ----------- trunk/test/unit/org/openfast/GroupValueTest.java trunk/test/unit/org/openfast/submitted/SchemaValidationTest.java trunk/test/unit/org/openfast/submitted/fastapi.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2007-11-09 17:07:33 UTC (rev 88) +++ trunk/build.xml 2007-11-13 20:57:52 UTC (rev 89) @@ -62,6 +62,9 @@ <javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="yes" debuglevel="lines,source,vars" target="1.4" source="1.4"> <compilerarg line="-Xlint:deprecation -Xlint:unchecked"/> </javac> + <copy todir="${build.classes.dir}"> + <fileset dir="${src.dir}" excludes="**/*.java" includes="**/*" /> + </copy> </target> <target name="compile-test" depends="compile"> Modified: trunk/src/org/openfast/GroupValue.java =================================================================== --- trunk/src/org/openfast/GroupValue.java 2007-11-09 17:07:33 UTC (rev 88) +++ trunk/src/org/openfast/GroupValue.java 2007-11-13 20:57:52 UTC (rev 89) @@ -257,7 +257,11 @@ } for (int i = 0; i < values.length; i++) { - if (!values[i].equals(other.values[i])) { + if (values[i] == null) { + if (other.values[i] != null) + return false; + } + else if (!values[i].equals(other.values[i])) { return false; } } Modified: trunk/src/org/openfast/StringValue.java =================================================================== --- trunk/src/org/openfast/StringValue.java 2007-11-09 17:07:33 UTC (rev 88) +++ trunk/src/org/openfast/StringValue.java 2007-11-13 20:57:52 UTC (rev 89) @@ -31,6 +31,7 @@ public final String value; public StringValue(String value) { + if (value == null) throw new NullPointerException(); this.value = value; } Modified: trunk/src/org/openfast/fastTemplateSchema.v11.xsd =================================================================== --- trunk/src/org/openfast/fastTemplateSchema.v11.xsd 2007-11-09 17:07:33 UTC (rev 88) +++ trunk/src/org/openfast/fastTemplateSchema.v11.xsd 2007-11-13 20:57:52 UTC (rev 89) @@ -353,8 +353,7 @@ </xs:attributeGroup> <xs:group name="other"> <xs:sequence> - <xs:group minOccurs="0" ref="td:foreignElm" - maxOccurs="unbounded" /> + <xs:group minOccurs="0" ref="td:foreignElm" maxOccurs="unbounded" /> </xs:sequence> </xs:group> <xs:attributeGroup name="other"> Modified: trunk/src/org/openfast/template/loader/XMLMessageTemplateLoader.java =================================================================== --- trunk/src/org/openfast/template/loader/XMLMessageTemplateLoader.java 2007-11-09 17:07:33 UTC (rev 88) +++ trunk/src/org/openfast/template/loader/XMLMessageTemplateLoader.java 2007-11-13 20:57:52 UTC (rev 89) @@ -27,8 +27,15 @@ import java.util.ArrayList; import java.util.Map; +import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; +import javax.xml.validation.Validator; import org.openfast.error.ErrorCode; import org.openfast.error.ErrorHandler; @@ -56,8 +63,12 @@ private final boolean namespaceAwareness; private final ParsingContext initialContext; + private boolean validate; private boolean loadTemplateIdFromAuxId; + private Schema templateDefinitionSchema; + + public XMLMessageTemplateLoader() { this(false); @@ -87,7 +98,29 @@ public void addFieldParser(FieldParser fieldParser) { initialContext.getFieldParsers().add(fieldParser); } + + public boolean isValid(InputStream source) { + try { + Schema schema = loadFastTemplateDefinitionSchema(); + schema.newValidator().validate(new StreamSource(source), null); + return true; + } catch (SAXException e) { + initialContext.getErrorHandler().error(FastConstants.S1_INVALID_XML, e.getMessage(), e); + return false; + } catch (IOException e) { + initialContext.getErrorHandler().error(FastConstants.IO_ERROR, e.getMessage(), e); + return false; + } + } + private Schema loadFastTemplateDefinitionSchema() throws SAXException { + if (templateDefinitionSchema == null) { + SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + templateDefinitionSchema = schemaFactory.newSchema(new StreamSource(this.getClass().getClassLoader().getResourceAsStream("org/openfast/fastTemplateSchema.v11.xsd"))); + } + return templateDefinitionSchema; + } + /** * Parses the XML stream and creates an array of the elements * @param source The inputStream object to load @@ -127,24 +160,31 @@ * @return Returns a DOM org.w3c.dom.Document object, returns null if there are exceptions caught */ private Document parseXml(InputStream templateStream) { + org.xml.sax.ErrorHandler errorHandler = new org.xml.sax.ErrorHandler() { + public void error(SAXParseException exception) throws SAXException { + initialContext.getErrorHandler().error(XML_PARSING_ERROR, "ERROR: " + exception.getMessage(), exception); + } + public void fatalError(SAXParseException exception) throws SAXException { + initialContext.getErrorHandler().error(XML_PARSING_ERROR, "FATAL: " + exception.getMessage(), exception); + } + public void warning(SAXParseException exception) throws SAXException { + initialContext.getErrorHandler().error(XML_PARSING_ERROR, "WARNING: " + exception.getMessage(), exception); + }}; try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setIgnoringElementContentWhitespace(true); dbf.setNamespaceAware(namespaceAwareness); DocumentBuilder builder = dbf.newDocumentBuilder(); - builder.setErrorHandler(new org.xml.sax.ErrorHandler() { - public void error(SAXParseException exception) throws SAXException { - initialContext.getErrorHandler().error(XML_PARSING_ERROR, "ERROR: " + exception.getMessage(), exception); - } - public void fatalError(SAXParseException exception) throws SAXException { - initialContext.getErrorHandler().error(XML_PARSING_ERROR, "FATAL: " + exception.getMessage(), exception); - } - public void warning(SAXParseException exception) throws SAXException { - initialContext.getErrorHandler().error(XML_PARSING_ERROR, "WARNING: " + exception.getMessage(), exception); - }}); - - return builder.parse(templateStream); + builder.setErrorHandler(errorHandler); + Document document = builder.parse(templateStream); + if (validate) { + Validator validator = loadFastTemplateDefinitionSchema().newValidator(); + DOMResult result = new DOMResult(); + validator.validate(new DOMSource(document), result); + return (Document) result.getNode(); + } + return document; } catch (IOException e) { initialContext.getErrorHandler().error(IO_ERROR, "Error occurred while trying to read xml template: " + e.getMessage(), e); @@ -178,4 +218,8 @@ public void setLoadTemplateIdFromAuxId(boolean loadTempalteIdFromAuxId) { this.loadTemplateIdFromAuxId = loadTempalteIdFromAuxId; } + + public void setValidate(boolean validate) { + this.validate = validate; + } } Modified: trunk/src/org/openfast/template/operator/OptionallyPresentOperatorCodec.java =================================================================== --- trunk/src/org/openfast/template/operator/OptionallyPresentOperatorCodec.java 2007-11-09 17:07:33 UTC (rev 88) +++ trunk/src/org/openfast/template/operator/OptionallyPresentOperatorCodec.java 2007-11-13 20:57:52 UTC (rev 89) @@ -62,7 +62,7 @@ } if (field.isOptional()) { - if (!field.getDefaultValue().isUndefined() || ((priorValue != ScalarValue.UNDEFINED) && (priorValue != null))) { + if (((priorValue == ScalarValue.UNDEFINED) && !field.getDefaultValue().isUndefined()) || ((priorValue != ScalarValue.UNDEFINED) && (priorValue != null))) { return ScalarValue.NULL; } } else { Added: trunk/test/unit/org/openfast/GroupValueTest.java =================================================================== --- trunk/test/unit/org/openfast/GroupValueTest.java (rev 0) +++ trunk/test/unit/org/openfast/GroupValueTest.java 2007-11-13 20:57:52 UTC (rev 89) @@ -0,0 +1,14 @@ +package org.openfast; + +import junit.framework.TestCase; + +import org.openfast.test.ObjectMother; + +public class GroupValueTest extends TestCase { + + public void testEquals() { + GroupValue v = ObjectMother.newAllocation(null, 10.0, 11.0); + GroupValue v2 = ObjectMother.newAllocation(null, 10.0, 11.0); + assertEquals(v, v2); + } +} Modified: trunk/test/unit/org/openfast/submitted/OptionalInitialValueTest.java =================================================================== --- trunk/test/unit/org/openfast/submitted/OptionalInitialValueTest.java 2007-11-09 17:07:33 UTC (rev 88) +++ trunk/test/unit/org/openfast/submitted/OptionalInitialValueTest.java 2007-11-13 20:57:52 UTC (rev 89) @@ -9,9 +9,9 @@ public void testOptionalInitialValue() throws Exception { MessageTemplate template = template("<template name=\"OptCopyInit\" id=\"520\" dictionary=\"template\">" + - "<string id=\"1\" presence=\"optional\" name=\"Line1\"><copy value=\"abc\"/></string>" + - "<string id=\"1\" presence=\"optional\" name=\"Line2\"><copy value=\"abc\"/></string>" + - "<string id=\"1\" presence=\"optional\" name=\"Line3\"><copy value=\"abc\"/></string>" + + "<string id=\"1\" presence=\"optional\" name=\"Line1\"><copy value=\"abc\"/></string>" + + "<string id=\"1\" presence=\"optional\" name=\"Line2\"><copy value=\"abc\"/></string>" + + "<string id=\"1\" presence=\"optional\" name=\"Line3\"><copy value=\"abc\"/></string>" + "</template>"); FastEncoder encoder = encoder(template); Message m = new Message(template); @@ -22,5 +22,27 @@ Message decoded = decoder(template, encoding).readMessage(); assertEquals(m, decoded); + + encoding = encoder.encode(m); + assertEquals("10000000", encoding); } + + public void testOptionalNoInitialValue() throws Exception { + MessageTemplate template = template("<template name=\"OptCopyInit\" id=\"520\" dictionary=\"template\">" + + "<string id=\"1\" presence=\"optional\" name=\"Line1\"><copy/></string>" + + "<string id=\"1\" presence=\"optional\" name=\"Line2\"><copy value=\"abc\"/></string>" + + "<string id=\"1\" presence=\"optional\" name=\"Line3\"><copy value=\"abc\"/></string>" + + "</template>"); + FastEncoder encoder = encoder(template); + Message m = new Message(template); + m.setString("Line1", null); // absent + m.setString("Line2", "abc"); // as initial + m.setString("Line3", "xyz"); // sth else + byte[] encoding = encoder.encode(m); + + assertEquals("11001000 10000001 01111000 01111001 11111010", encoding); + + Message decoded = decoder(template, encoding).readMessage(); + assertEquals(m, decoded); + } } Added: trunk/test/unit/org/openfast/submitted/SchemaValidationTest.java =================================================================== --- trunk/test/unit/org/openfast/submitted/SchemaValidationTest.java (rev 0) +++ trunk/test/unit/org/openfast/submitted/SchemaValidationTest.java 2007-11-13 20:57:52 UTC (rev 89) @@ -0,0 +1,20 @@ +package org.openfast.submitted; + +import java.io.InputStream; + +import junit.framework.TestCase; + +import org.openfast.template.MessageTemplate; +import org.openfast.template.loader.XMLMessageTemplateLoader; + +public class SchemaValidationTest extends TestCase { + + public void testValidateSchema() throws Exception { + InputStream templateSource = this.getClass().getResourceAsStream("fastapi.xml"); + XMLMessageTemplateLoader templateLoader = new XMLMessageTemplateLoader(); + templateLoader.setLoadTemplateIdFromAuxId(true); + templateLoader.setValidate(true); + MessageTemplate[] templates = templateLoader.load(templateSource); + assertEquals(1, templates.length); + } +} Added: trunk/test/unit/org/openfast/submitted/fastapi.xml =================================================================== --- trunk/test/unit/org/openfast/submitted/fastapi.xml (rev 0) +++ trunk/test/unit/org/openfast/submitted/fastapi.xml 2007-11-13 20:57:52 UTC (rev 89) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<templates xmlns="http://www.fixprotocol.org/ns/fast/td/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.fixprotocol.org/ns/fast/td/1.1 fast.xsd"> + <template name="MDIncRefresh" id="123"> + <typeRef name="MDIncRefresh"/> + <uInt32 name="field1" id="1"> <copy/> </uInt32> + <uInt32 name="field2" id="2"> </uInt32> + <uInt32 name="field3" id="3"> <default value="300000000"/> </uInt32> + <uInt32 name="field4" id="4"> <constant value="260000000"/> </uInt32> + <uInt32 name="field5" id="5"> <delta/> </uInt32> + <uInt32 name="field6" id="6"> <increment/> </uInt32> + <uInt32 name="field7" id="7"> <copy/> </uInt32> + <uInt32 name="field8" id="8"> <copy/> </uInt32> + <uInt32 name="field9" id="9"> <copy/> </uInt32> + <uInt32 name="field10" id="10"> <copy/> </uInt32> + <uInt32 name="field11" id="11"> <copy/> </uInt32> + <uInt32 name="field12" id="12"> <copy/> </uInt32> + </template> +</templates> \ No newline at end of file Modified: trunk/test/unit/org/openfast/template/type/codec/NullableUnsignedIntegerTest.java =================================================================== --- trunk/test/unit/org/openfast/template/type/codec/NullableUnsignedIntegerTest.java 2007-11-09 17:07:33 UTC (rev 88) +++ trunk/test/unit/org/openfast/template/type/codec/NullableUnsignedIntegerTest.java 2007-11-13 20:57:52 UTC (rev 89) @@ -1,6 +1,5 @@ package org.openfast.template.type.codec; -import org.openfast.ScalarValue; import org.openfast.test.OpenFastTestCase; public class NullableUnsignedIntegerTest extends OpenFastTestCase { Modified: trunk/test/unit/org/openfast/test/ObjectMother.java =================================================================== --- trunk/test/unit/org/openfast/test/ObjectMother.java 2007-11-09 17:07:33 UTC (rev 88) +++ trunk/test/unit/org/openfast/test/ObjectMother.java 2007-11-13 20:57:52 UTC (rev 89) @@ -159,9 +159,10 @@ public static GroupValue newAllocation(String account, double price, double quantity) { - return new GroupValue(allocations().getGroup(), + StringValue acct = account != null ? new StringValue(account) : null; + return new GroupValue(allocations().getGroup(), new FieldValue[] { - new StringValue(account), new DecimalValue(price), + acct, new DecimalValue(price), new DecimalValue(quantity), new DecimalValue(0.0) }); } Modified: trunk/test/unit/org/openfast/util/UtilTest.java =================================================================== --- trunk/test/unit/org/openfast/util/UtilTest.java 2007-11-09 17:07:33 UTC (rev 88) +++ trunk/test/unit/org/openfast/util/UtilTest.java 2007-11-13 20:57:52 UTC (rev 89) @@ -86,4 +86,8 @@ private ScalarValue diff(String base, String value) { return Util.getDifference(new StringValue(value), new StringValue(base)); } + + public void testIt() throws Exception { + System.out.println(this.getClass().getResource("/org/openfast/fastTemplateSchema.v11.xsd").toString()); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jac...@us...> - 2007-11-09 17:07:29
|
Revision: 88 http://openfast.svn.sourceforge.net/openfast/?rev=88&view=rev Author: jacob_northey Date: 2007-11-09 09:07:33 -0800 (Fri, 09 Nov 2007) Log Message: ----------- FIXED: optional copy scalar with default value encodes null value as empty encoding when it should encode a null value in the fast stream; FEATURE: Added ability to parse auxiliary ids as template ids in XMLMessageTemplateLoader; Modified Paths: -------------- trunk/src/org/openfast/template/loader/MessageTemplateLoader.java trunk/src/org/openfast/template/loader/TemplateParser.java trunk/src/org/openfast/template/loader/XMLMessageTemplateLoader.java trunk/src/org/openfast/template/operator/CopyOperatorCodec.java trunk/src/org/openfast/template/operator/OptionallyPresentOperatorCodec.java trunk/test/unit/org/openfast/template/type/codec/NullableSignedIntegerTest.java trunk/test/unit/org/openfast/template/type/codec/NullableUnsignedIntegerTest.java Added Paths: ----------- trunk/test/acceptance/org/openfast/scenario/1.fast trunk/test/acceptance/org/openfast/scenario/CmeTemplateTest.java trunk/test/acceptance/org/openfast/scenario/templates.xml trunk/test/unit/org/openfast/submitted/OptionalInitialValueTest.java Modified: trunk/src/org/openfast/template/loader/MessageTemplateLoader.java =================================================================== --- trunk/src/org/openfast/template/loader/MessageTemplateLoader.java 2007-11-08 18:34:53 UTC (rev 87) +++ trunk/src/org/openfast/template/loader/MessageTemplateLoader.java 2007-11-09 17:07:33 UTC (rev 88) @@ -32,7 +32,6 @@ */ public interface MessageTemplateLoader { MessageTemplate[] load(InputStream source); - void setTemplateRegistry(TemplateRegistry templateRegistry); TemplateRegistry getTemplateRegistry(); } Modified: trunk/src/org/openfast/template/loader/TemplateParser.java =================================================================== --- trunk/src/org/openfast/template/loader/TemplateParser.java 2007-11-08 18:34:53 UTC (rev 87) +++ trunk/src/org/openfast/template/loader/TemplateParser.java 2007-11-09 17:07:33 UTC (rev 88) @@ -7,6 +7,12 @@ public class TemplateParser extends GroupParser { + private boolean loadTemplateIdFromAuxId; + + public TemplateParser(boolean loadTemplateIdFromAuxId) { + this.loadTemplateIdFromAuxId = loadTemplateIdFromAuxId; + } + /** * Creates a MessageTemplate object from the dom template element * @param context @@ -16,7 +22,15 @@ protected Field parse(Element templateElement, boolean optional, ParsingContext context) { MessageTemplate messageTemplate = new MessageTemplate(getTemplateName(templateElement, context), parseFields(templateElement, context)); parseMore(templateElement, messageTemplate, context); - context.getTemplateRegistry().define(messageTemplate); + if (loadTemplateIdFromAuxId && templateElement.hasAttribute("id")) { + try { + int templateId = Integer.parseInt(templateElement.getAttribute("id")); + context.getTemplateRegistry().register(templateId, messageTemplate); + } catch (NumberFormatException e) { + context.getTemplateRegistry().define(messageTemplate); + } + } else + context.getTemplateRegistry().define(messageTemplate); return messageTemplate; } Modified: trunk/src/org/openfast/template/loader/XMLMessageTemplateLoader.java =================================================================== --- trunk/src/org/openfast/template/loader/XMLMessageTemplateLoader.java 2007-11-08 18:34:53 UTC (rev 87) +++ trunk/src/org/openfast/template/loader/XMLMessageTemplateLoader.java 2007-11-09 17:07:33 UTC (rev 88) @@ -56,6 +56,8 @@ private final boolean namespaceAwareness; private final ParsingContext initialContext; + private boolean loadTemplateIdFromAuxId; + public XMLMessageTemplateLoader() { this(false); @@ -99,7 +101,7 @@ Element root = document.getDocumentElement(); - TemplateParser templateParser = new TemplateParser(); + TemplateParser templateParser = new TemplateParser(loadTemplateIdFromAuxId); if (root.getNodeName().equals("template")) { return new MessageTemplate[] { (MessageTemplate) templateParser.parse(root, initialContext) }; @@ -172,4 +174,8 @@ public void setTypeMap(Map typeMap) { initialContext.setTypeMap(typeMap); } + + public void setLoadTemplateIdFromAuxId(boolean loadTempalteIdFromAuxId) { + this.loadTemplateIdFromAuxId = loadTempalteIdFromAuxId; + } } Modified: trunk/src/org/openfast/template/operator/CopyOperatorCodec.java =================================================================== --- trunk/src/org/openfast/template/operator/CopyOperatorCodec.java 2007-11-08 18:34:53 UTC (rev 87) +++ trunk/src/org/openfast/template/operator/CopyOperatorCodec.java 2007-11-09 17:07:33 UTC (rev 88) @@ -44,8 +44,7 @@ * @return Returns null if the priorValue is undefined and if the ScalarValue object equals the defaultValue object or priorValue object, otherwise * returns the ScalarValue object */ - protected ScalarValue getValueToEncode(ScalarValue value, - ScalarValue priorValue, ScalarValue defaultValue) { + protected ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, ScalarValue defaultValue) { if ((priorValue == ScalarValue.UNDEFINED) && value.equals(defaultValue)) { return null; } Modified: trunk/src/org/openfast/template/operator/OptionallyPresentOperatorCodec.java =================================================================== --- trunk/src/org/openfast/template/operator/OptionallyPresentOperatorCodec.java 2007-11-08 18:34:53 UTC (rev 87) +++ trunk/src/org/openfast/template/operator/OptionallyPresentOperatorCodec.java 2007-11-09 17:07:33 UTC (rev 88) @@ -62,7 +62,7 @@ } if (field.isOptional()) { - if ((priorValue != ScalarValue.UNDEFINED) && (priorValue != null)) { + if (!field.getDefaultValue().isUndefined() || ((priorValue != ScalarValue.UNDEFINED) && (priorValue != null))) { return ScalarValue.NULL; } } else { Added: trunk/test/acceptance/org/openfast/scenario/1.fast =================================================================== --- trunk/test/acceptance/org/openfast/scenario/1.fast (rev 0) +++ trunk/test/acceptance/org/openfast/scenario/1.fast 2007-11-09 17:07:33 UTC (rev 88) @@ -0,0 +1,2 @@ +\xC0\xA1;\xEB#SR M\x83 I\xA0$\xA9\xF6 +8\xC1\x90X\xDFK\xA3[Hi\xD0 \ No newline at end of file Added: trunk/test/acceptance/org/openfast/scenario/CmeTemplateTest.java =================================================================== --- trunk/test/acceptance/org/openfast/scenario/CmeTemplateTest.java (rev 0) +++ trunk/test/acceptance/org/openfast/scenario/CmeTemplateTest.java 2007-11-09 17:07:33 UTC (rev 88) @@ -0,0 +1,25 @@ +package org.openfast.scenario; + +import java.io.InputStream; + +import org.openfast.Message; +import org.openfast.MessageInputStream; +import org.openfast.template.loader.XMLMessageTemplateLoader; +import org.openfast.test.OpenFastTestCase; + +public class CmeTemplateTest extends OpenFastTestCase { + + public void testDeltas() throws Exception { + InputStream templateSource = this.getClass().getResourceAsStream("templates.xml"); + XMLMessageTemplateLoader templateLoader = new XMLMessageTemplateLoader(); + templateLoader.setLoadTemplateIdFromAuxId(true); + templateLoader.load(templateSource); + + InputStream is = this.getClass().getResourceAsStream("1.fast"); + MessageInputStream mis = new MessageInputStream(is); + mis.setTemplateRegistry(templateLoader.getTemplateRegistry()); + mis.getContext().setTraceEnabled(true); + Message md = mis.readMessage(); + assertEquals(-5025.0, md.getSequence("MDEntries").get(0).getDouble("NetChgPrevDay"), .1); + } +} Added: trunk/test/acceptance/org/openfast/scenario/templates.xml =================================================================== --- trunk/test/acceptance/org/openfast/scenario/templates.xml (rev 0) +++ trunk/test/acceptance/org/openfast/scenario/templates.xml 2007-11-09 17:07:33 UTC (rev 88) @@ -0,0 +1,1465 @@ +<?xml version="1.0" encoding="UTF-8"?> +<templates> + <template name="MDIncRefresh_30" id="30" dictionary="30" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <default value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <delta/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <default/> + </uInt32> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="QuoteCondition" id="276" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_32" id="32" dictionary="32" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <increment/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <uInt32 name="NumberOfOrders" id="346"> + <delta/> + </uInt32> + <string name="TradingSessionID" id="336"> + <default value="2"/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_33" id="33" dictionary="33" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <default value="0"/> + </uInt32> + <string name="MDEntryType" id="269"> + <default value="2"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <delta/> + </uInt32> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_34" id="34" dictionary="34" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <copy value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <string name="QuoteCondition" id="276" presence="optional"> + <copy value="K"/> + </string> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <default/> + </uInt32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <default/> + </uInt32> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_35" id="35" dictionary="35" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <copy value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <delta/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <string name="QuoteCondition" id="276" presence="optional"> + <copy value="K"/> + </string> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <copy/> + </uInt32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <string name="TradingSessionID" id="336"> + <default value="2"/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_36" id="36" dictionary="36" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <copy value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <string name="QuoteCondition" id="276"> + <copy value="K"/> + </string> + <string name="TradingSessionID" id="336"> + <default value="2"/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_37" id="37" dictionary="37" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <default value="0"/> + </uInt32> + <string name="MDEntryType" id="269"> + <default value="2"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <delta/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <delta/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="-1"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default value="-1"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <delta/> + </uInt32> + <string name="TradeCondition" id="277" presence="optional"> + <copy value="1"/> + </string> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_38" id="38" dictionary="38" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <increment/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <default/> + </uInt32> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <default/> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="QuoteCondition" id="276" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_39" id="39" dictionary="39" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="1"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <increment/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="0"/> + </string> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <string name="TradingSessionID" id="336"> + <default value="2"/> + </string> + <uInt32 name="NumberOfOrders" id="346"> + <delta/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_40" id="40" dictionary="40" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <default value="0"/> + </uInt32> + <string name="MDEntryType" id="269"> + <default value="2"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <delta/> + </uInt32> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_41" id="41" dictionary="41" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <constant value="5"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <constant value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="1"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <delta/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <delta/> + </uInt32> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <uInt32 name="MDEntryTime" id="273"> + <delta/> + </uInt32> + <string name="TradingSessionID" id="336"> + <default value="2"/> + </string> + <uInt32 name="NumberOfOrders" id="346"> + <copy value="1"/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_42" id="42" dictionary="42" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <default value="5"/> + </uInt32> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <copy value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="1"/> + </string> + <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <default value="1"/> + </uInt32> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <default/> + </uInt32> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="QuoteCondition" id="276" presence="optional"> + <default/> + </string> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDIncRefresh_43" id="43" dictionary="43" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <constant value="5"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <constant value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="1"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <delta/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <delta/> + </uInt32> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271"> + <delta/> + </int32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <uInt32 name="NumberOfOrders" id="346"> + <copy/> + </uInt32> + <uInt32 name="MDQuoteType" id="1070" presence="optional"> + <default/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_44" id="44" dictionary="44" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <constant value="5"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023"> + <constant value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="1"/> + </string> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="0"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <uInt32 name="NumberOfOrders" id="346"> + <copy/> + </uInt32> + <uInt32 name="MDQuoteType" id="1070" presence="optional"> + <constant value="0"/> + </uInt32> + </sequence> + </template> + + <template name="MDIncRefresh_45" id="45" dictionary="45" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="X"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="TradeDate" id="75"/> + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <uInt32 name="MDUpdateAction" id="279"> + <copy value="5"/> + </uInt32> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <copy value="1"/> + </uInt32> + <string name="MDEntryType" id="269"> + <copy value="1"/> + </string> + <uInt32 name="OpenCloseSettleFlag" id="286" presence="optional"> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + <uInt32 name="SecurityID" id="48"> + <copy/> + </uInt32> + <uInt32 name="RptSeq" id="83"> + <increment/> + </uInt32> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <uInt32 name="MDEntryTime" id="273"> + <copy/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <copy value="1"/> + </uInt32> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <default/> + </uInt32> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <string name="QuoteCondition" id="276" presence="optional"> + <default/> + </string> + <uInt32 name="MDQuoteType" id="1070" presence="optional"> + <default/> + </uInt32> + <string name="TradeCondition" id="277" presence="optional"> + <default/> + </string> + </sequence> + </template> + + <template name="MDSecurityDefinition" id="46" dictionary="46" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + + <string name="MessageType" id="35"> + <constant value="d"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="MDTotalNum" id="911" presence="optional"/> + <sequence name="Events" presence="optional"> + <length name="NoEvents" id="864"/> + <uInt32 name="EventType" id="865" presence="optional"> + <delta/> + </uInt32> + <uInt64 name="EventDate" id="866" presence="optional"> + <delta/> + </uInt64> + <uInt64 name="EventTime" id="1145" presence="optional"> + <delta/> + </uInt64> + </sequence> + + <decimal name="TradingReferencePrice" id="1150" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <decimal name="HighLimitPx" id="1149" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <decimal name="LowLimitPx" id="1148" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <string name="SecurityGroup" id="1151" presence="optional"/> + <string name="Symbol" id="55" presence="optional"/> + <string name="SecurityDesc" id="107" presence="optional"/> + <uInt32 name="SecurityID" id="48" presence="optional"/> + <uInt32 name="SecurityIDSource" id="22" presence="optional"> + <constant value="8"/> + </uInt32> + <string name="CFICode" id="461" presence="optional"/> + <string name="UnderlyingProduct" id="462" presence="optional"/> + <string name="SecurityExchange" id="207" presence="optional"/> + <string name="PricingModel" id="9853" presence="optional"/> + <decimal name="MinCabPrice" id="9850" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <uInt32 name="ExpirationCycle" id="827" presence="optional"/> + <string name="UnitOfMeasureQty" id="1147" presence="optional"/> + <decimal name="StrikePrice" id="202" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <string name="StrikeCurrency" id="947" presence="optional"/> + <uInt64 name="MinTradeVol" id="562" presence="optional"/> + <uInt64 name="MaxTradeVol" id="1140" presence="optional"/> + <string name="Currency" id="15" presence="optional"/> + <string name="SettlCurrency" id="120" presence="optional"/> + <sequence name="MDFeedTypes" presence="optional"> + <length name="NoMDFeedTypes" id="1141"/> + <string name="MDFeedType" id="1022"> + <constant value="GBX"/> + </string> + <uInt32 name="MarketDepth" id="264"/> + </sequence> + <string name="MatchAlgo" id="1142" presence="optional"/> + <string name="SecuritySubType" id="762" presence="optional"/> + + <sequence name="Underlyings" presence="optional"> + <length name="NoUnderlyings" id="711"/> + <string name="UnderlyingSymbol" id="311"> + <constant value="[N/A]"/> + </string> + <uInt32 name="UnderlyingSecurityID" id="309"> + <delta/> + </uInt32> + <uInt32 name="UnderlyingSecurityIDSource" id="305"> + <constant value="8"/> + </uInt32> + </sequence> + <string name="MaxPriceVariation" id="1143" presence="optional"/> + <string name="ImpliedMarketIndicator" id="1144" presence="optional"/> + + <sequence name="InstrAttrib" presence="optional"> + <length name="NoInstrAttrib" id="870"/> + <uInt64 name="InstrAttribType" id="871"> + <delta/> + </uInt64> + <string name="InstrAttribValue" id="872" presence="optional"> + <copy/> + </string> + </sequence> + <uInt64 name="MaturityDate" id="200" presence="optional"/> + <decimal name="MinPriceIncrement" id="969" presence="optional"> + <exponent> + <copy value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <decimal name="MinPriceIncrementAmount" id="1146" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <decimal name="DisplayFactor" id="9787" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + + <sequence name="Legs" presence="optional"> + <length name="NoLegs" id="555"/> + <string name="LegSymbol" id="600"> + <default value="[N/A]"/> + </string> + <uInt32 name="LegRatioQty" id="623"> + <copy/> + </uInt32> + <uInt64 name="LegSecurityID" id="602"> + <delta/> + </uInt64> + <uInt32 name="LegSecurityIDSource" id="603"> + <constant value="8"/> + </uInt32> + <string name="LegSide" id="624" presence="optional"> + <default value="1"/> + </string> + <string name="LegCFICode" id="608" presence="optional"> + <copy/> + </string> + <string name="LegSecuritySubType" id="764" presence="optional"> + <copy/> + </string> + <string name="LegCurrency" id="556" presence="optional"> + <copy/> + </string> + <uInt64 name="LegMaturityMonthYear" id="610" presence="optional"> + <delta/> + </uInt64> + <decimal name="LegStrikePrice" id="612" presence="optional"> + <exponent> + <copy value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <string name="LegStrikeCurrency" id="942" presence="optional"> + <copy/> + </string> + <decimal name="LegPrice" id="566" presence="optional"> + <exponent> + <copy value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <decimal name="LegOptionDelta" id="1017" presence="optional"> + <exponent> + <copy value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + </sequence> + </template> + + <template name="MDQuoteRequest" id="47" dictionary="47" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="R"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <sequence name="RelatedSym"> + <length name="NoRelatedSym" id="146"/> + <string name="Symbol" id="55"> + <constant value="[N/A]"/> + </string> + <uInt64 name="OrderQty" id="38" presence="optional"/> + + <uInt32 name="Side" id="54" presence="optional"> + <default value="1"/> + </uInt32> + + <uInt64 name="TransactTime" id="60"/> + + <uInt32 name="QuoteType" id="537"> + <default value="1"/> + </uInt32> + + <string name="QuoteReqID" id="131" presence="optional"/> + + <uInt32 name="SecurityID" id="48"/> + + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + </sequence> + </template> + + <template name="MDSecurityStatus" id="48" dictionary="48" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="f"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt32 name="SecurityID" id="48" presence="optional"/> + <uInt32 name="SecurityIDSource" id="22" presence="optional"> + <constant value="8"/> + </uInt32> + <decimal name="HighPx" id="332" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <decimal name="LowPx" id="333" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa/> + </decimal> + <string name="Symbol" id="55" presence="optional"/> + <uInt32 name="SecurityTradingStatus" id="326" presence="optional"/> + </template> + + <template name="MDNewsMessage" id="49" dictionary="49" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="B"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="Headline" id="147"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <sequence name="LinesOfText"> + <length name="NoLinesOfText" id="33"/> + <string name="text" id="58"> + <copy/> + </string> + </sequence> + </template> + + + <template name="MDHeartbeat" id="50" dictionary="50" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="0"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + </template> + + <template name="MDSnapshotFullRefresh_51" id="51" dictionary="51" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="MessageType" id="35"> + <constant value="W"/> + </string> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <string name="PosDupFlag" id="43" presence="optional"> + <default/> + </string> + <uInt64 name="SendingTime" id="52"/> + + + <uInt32 name="LastMsgSeqNumProcessed" id="369"/> + <uInt32 name="TotalNumReports" id="911"/> + <uInt32 name="MDBookType" id="1021"/> + <uInt32 name="SecurityID" id="48"> + <delta/> + </uInt32> + <uInt32 name="SecurityIDSource" id="22"> + <constant value="8"/> + </uInt32> + + + + <sequence name="MDEntries"> + <length name="NoMDEntries" id="268"/> + <string name="MDEntryType" id="269"> + <default value="2"/> + </string> + <decimal name="MDEntryPx" id="270" presence="optional"> + <exponent> + <default value="-2"/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + <int32 name="MDEntrySize" id="271" presence="optional"> + <delta/> + </int32> + <string name="QuoteCondition" id="276" presence="optional"> + <default value="K"/> + </string> + <string name="TradeCondition" id="277" presence="optional"> + <constant value="U"/> + </string> + <uInt32 name="MDPriceLevel" id="1023" presence="optional"> + <copy value="1"/> + </uInt32> + <uInt32 name="NumberOfOrders" id="346" presence="optional"> + <copy/> + </uInt32> + <string name="TradingSessionID" id="336" presence="optional"> + <default value="2"/> + </string> + <uInt32 name="TradeVolume" id="1020" presence="optional"> + <delta/> + </uInt32> + <string name="TickDirection" id="274" presence="optional"> + <default/> + </string> + <decimal name="NetChgPrevDay" id="451" presence="optional"> + <exponent> + <default/> + </exponent> + <mantissa> + <delta/> + </mantissa> + </decimal> + </sequence> + </template> + + <template name="MDLogon" id="1" dictionary="1" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="A"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="applFeedId" id="1180"> + <constant value="REPLAY"/> + </string> + <uInt32 name="encryptMethod" id="98"> + <constant value="0"/> + </uInt32> + <uInt32 name="heartbeatInt" id="108"/> + <string name="DefaultApplVerID" id="1137"> + <constant value="8"/> + </string> + </template> + + <template name="MDLogout" id="2" dictionary="2" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1"> + <string name="ApplVerID" id="1128"> + <constant value="8"/> + </string> + <string name="MessageType" id="35"> + <constant value="5"/> + </string> + <string name="SenderCompID" id="49"> + <constant value="CME"/> + </string> + <uInt32 name="MsgSeqNum" id="34"/> + <uInt64 name="SendingTime" id="52"/> + <string name="applFeedId" id="1180"> + <constant value="REPLAY"/> + </string> + <string name="text" id="58" presence="optional"/> + </template> + +</templates> \ No newline at end of file Added: trunk/test/unit/org/openfast/submitted/OptionalInitialValueTest.java =================================================================== --- trunk/test/unit/org/openfast/submitted/OptionalInitialValueTest.java (rev 0) +++ trunk/test/unit/org/openfast/submitted/OptionalInitialValueTest.java 2007-11-09 17:07:33 UTC (rev 88) @@ -0,0 +1,26 @@ +package org.openfast.submitted; + +import org.openfast.Message; +import org.openfast.codec.FastEncoder; +import org.openfast.template.MessageTemplate; +import org.openfast.test.OpenFastTestCase; + +public class OptionalInitialValueTest extends OpenFastTestCase { + + public void testOptionalInitialValue() throws Exception { + MessageTemplate template = template("<template name=\"OptCopyInit\" id=\"520\" dictionary=\"template\">" + + "<string id=\"1\" presence=\"optional\" name=\"Line1\"><copy value=\"abc\"/></string>" + + "<string id=\"1\" presence=\"optional\" name=\"Line2\"><copy value=\"abc\"/></string>" + + "<string id=\"1\" presence=\"optional\" name=\"Line3\"><copy value=\"abc\"/></string>" + + "</template>"); + FastEncoder encoder = encoder(template); + Message m = new Message(template); + m.setString("Line1", null); // absent + m.setString("Line2", "abc"); // as initial + m.setString("Line3", "xyz"); // sth else + byte[] encoding = encoder.encode(m); + + Message decoded = decoder(template, encoding).readMessage(); + assertEquals(m, decoded); + } +} Modified: trunk/test/unit/org/openfast/template/type/codec/NullableSignedIntegerTest.java =================================================================== --- trunk/test/unit/org/openfast/template/type/codec/NullableSignedIntegerTest.java 2007-11-08 18:34:53 UTC (rev 87) +++ trunk/test/unit/org/openfast/template/type/codec/NullableSignedIntegerTest.java 2007-11-09 17:07:33 UTC (rev 88) @@ -12,6 +12,7 @@ assertEncodeDecode(i(-17), "11101111", TypeCodec.NULLABLE_INTEGER); assertEncodeDecode(i(547), "00000100 10100100", TypeCodec.NULLABLE_INTEGER); assertEncodeDecode(i(-5), "11111011", TypeCodec.NULLABLE_INTEGER); + assertEncodeDecode(i(124322), "00000111 01001011 10100011", TypeCodec.NULLABLE_INTEGER); } } Modified: trunk/test/unit/org/openfast/template/type/codec/NullableUnsignedIntegerTest.java =================================================================== --- trunk/test/unit/org/openfast/template/type/codec/NullableUnsignedIntegerTest.java 2007-11-08 18:34:53 UTC (rev 87) +++ trunk/test/unit/org/openfast/template/type/codec/NullableUnsignedIntegerTest.java 2007-11-09 17:07:33 UTC (rev 88) @@ -1,5 +1,6 @@ package org.openfast.template.type.codec; +import org.openfast.ScalarValue; import org.openfast.test.OpenFastTestCase; public class NullableUnsignedIntegerTest extends OpenFastTestCase { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jac...@us...> - 2007-11-08 18:34:50
|
Revision: 87 http://openfast.svn.sourceforge.net/openfast/?rev=87&view=rev Author: jacob_northey Date: 2007-11-08 10:34:53 -0800 (Thu, 08 Nov 2007) Log Message: ----------- Added support for user-defined dictionaries Modified Paths: -------------- trunk/src/org/openfast/Context.java trunk/src/org/openfast/session/Endpoint.java trunk/src/org/openfast/session/FastServer.java trunk/src/org/openfast/session/LocalEndpoint.java trunk/src/org/openfast/session/RecordingEndpoint.java trunk/src/org/openfast/session/tcp/TcpEndpoint.java trunk/src/org/openfast/template/operator/CopyOperatorCodec.java trunk/src/org/openfast/template/type/codec/AsciiString.java trunk/src/org/openfast/template/type/codec/UnsignedInteger.java Modified: trunk/src/org/openfast/Context.java =================================================================== --- trunk/src/org/openfast/Context.java 2007-11-06 04:46:19 UTC (rev 86) +++ trunk/src/org/openfast/Context.java 2007-11-08 18:34:53 UTC (rev 87) @@ -98,6 +98,8 @@ } private Dictionary getDictionary(String dictionary) { + if (!dictionaries.containsKey(dictionary)) + dictionaries.put(dictionary, new GlobalDictionary()); return (Dictionary) dictionaries.get(dictionary); } Modified: trunk/src/org/openfast/session/Endpoint.java =================================================================== --- trunk/src/org/openfast/session/Endpoint.java 2007-11-06 04:46:19 UTC (rev 86) +++ trunk/src/org/openfast/session/Endpoint.java 2007-11-08 18:34:53 UTC (rev 87) @@ -4,4 +4,5 @@ Connection connect() throws FastConnectionException; void setConnectionListener(ConnectionListener listener); void accept() throws FastConnectionException; + void close(); } Modified: trunk/src/org/openfast/session/FastServer.java =================================================================== --- trunk/src/org/openfast/session/FastServer.java 2007-11-06 04:46:19 UTC (rev 86) +++ trunk/src/org/openfast/session/FastServer.java 2007-11-08 18:34:53 UTC (rev 87) @@ -69,6 +69,7 @@ public void close() throws FastConnectionException { listening = false; + endpoint.close(); } // ************* OPTIONAL DEPENDENCY SETTERS ************** Modified: trunk/src/org/openfast/session/LocalEndpoint.java =================================================================== --- trunk/src/org/openfast/session/LocalEndpoint.java 2007-11-06 04:46:19 UTC (rev 86) +++ trunk/src/org/openfast/session/LocalEndpoint.java 2007-11-08 18:34:53 UTC (rev 87) @@ -39,4 +39,7 @@ this.listener = listener; } + public void close() { + } + } Modified: trunk/src/org/openfast/session/RecordingEndpoint.java =================================================================== --- trunk/src/org/openfast/session/RecordingEndpoint.java 2007-11-06 04:46:19 UTC (rev 86) +++ trunk/src/org/openfast/session/RecordingEndpoint.java 2007-11-08 18:34:53 UTC (rev 87) @@ -53,4 +53,8 @@ return recordingOutputStream; } } + + public void close() { + underlyingEndpoint.close(); + } } Modified: trunk/src/org/openfast/session/tcp/TcpEndpoint.java =================================================================== --- trunk/src/org/openfast/session/tcp/TcpEndpoint.java 2007-11-06 04:46:19 UTC (rev 86) +++ trunk/src/org/openfast/session/tcp/TcpEndpoint.java 2007-11-08 18:34:53 UTC (rev 87) @@ -37,6 +37,8 @@ private final int port; private String host; private ConnectionListener connectionListener = ConnectionListener.NULL; + private ServerSocket serverSocket; + private boolean closed = true; public TcpEndpoint(int port) { this.port = port; @@ -61,18 +63,29 @@ } public void accept() throws FastConnectionException { + closed = false; try { - ServerSocket serverSocket = new ServerSocket(port); + serverSocket = new ServerSocket(port); while (true) { Socket socket = serverSocket.accept(); connectionListener.onConnect(new TcpConnection(socket)); } } catch (IOException e) { - throw new FastConnectionException(e); + if (!closed) + throw new FastConnectionException(e); } } public void setConnectionListener(ConnectionListener listener) { this.connectionListener = listener; } + + public void close() { + closed = true; + if (serverSocket != null) + try { + serverSocket.close(); + } catch (IOException e) { + } + } } Modified: trunk/src/org/openfast/template/operator/CopyOperatorCodec.java =================================================================== --- trunk/src/org/openfast/template/operator/CopyOperatorCodec.java 2007-11-06 04:46:19 UTC (rev 86) +++ trunk/src/org/openfast/template/operator/CopyOperatorCodec.java 2007-11-08 18:34:53 UTC (rev 87) @@ -46,8 +46,7 @@ */ protected ScalarValue getValueToEncode(ScalarValue value, ScalarValue priorValue, ScalarValue defaultValue) { - if ((priorValue == ScalarValue.UNDEFINED) && - value.equals(defaultValue)) { + if ((priorValue == ScalarValue.UNDEFINED) && value.equals(defaultValue)) { return null; } Modified: trunk/src/org/openfast/template/type/codec/AsciiString.java =================================================================== --- trunk/src/org/openfast/template/type/codec/AsciiString.java 2007-11-06 04:46:19 UTC (rev 86) +++ trunk/src/org/openfast/template/type/codec/AsciiString.java 2007-11-08 18:34:53 UTC (rev 87) @@ -48,8 +48,7 @@ */ public byte[] encodeValue(ScalarValue value) { if ((value == null) || value.isNull()) { - throw new IllegalStateException( - "Only nullable strings can represent null values."); + throw new IllegalStateException("Only nullable strings can represent null values."); } String string = value.toString(); Modified: trunk/src/org/openfast/template/type/codec/UnsignedInteger.java =================================================================== --- trunk/src/org/openfast/template/type/codec/UnsignedInteger.java 2007-11-06 04:46:19 UTC (rev 86) +++ trunk/src/org/openfast/template/type/codec/UnsignedInteger.java 2007-11-08 18:34:53 UTC (rev 87) @@ -55,8 +55,7 @@ byte[] encoded = new byte[size]; for (int factor = 0; factor < size; factor++) { - encoded[size - factor - 1] = (byte) ((value >> (factor * 7)) & - 0x7f); + encoded[size - factor - 1] = (byte) ((value >> (factor * 7)) & 0x7f); } return encoded; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jac...@us...> - 2007-11-06 04:46:21
|
Revision: 86 http://openfast.svn.sourceforge.net/openfast/?rev=86&view=rev Author: jacob_northey Date: 2007-11-05 20:46:19 -0800 (Mon, 05 Nov 2007) Log Message: ----------- Made TypeReference namespace aware; FIXED: dictionary and keys in composed decimal operators; FIXED: dictionary and namespace inheritance in Sequence Modified Paths: -------------- trunk/src/org/openfast/ApplicationTypeDictionary.java trunk/src/org/openfast/Context.java trunk/src/org/openfast/Dictionary.java trunk/src/org/openfast/GlobalDictionary.java trunk/src/org/openfast/TemplateDictionary.java trunk/src/org/openfast/error/FastConstants.java trunk/src/org/openfast/fastTemplateSchema.v11.xsd trunk/src/org/openfast/template/Group.java trunk/src/org/openfast/template/Sequence.java trunk/src/org/openfast/template/loader/ComposedDecimalParser.java trunk/src/org/openfast/template/loader/GroupParser.java trunk/src/org/openfast/template/loader/SequenceParser.java trunk/test/unit/org/openfast/ApplicationTypeDictionaryTest.java trunk/test/unit/org/openfast/TemplateDictionaryTest.java trunk/test/unit/org/openfast/template/loader/ComposedDecimalParserTest.java trunk/test/unit/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java Added Paths: ----------- trunk/test/unit/org/openfast/template/loader/SequenceParserTest.java Modified: trunk/src/org/openfast/ApplicationTypeDictionary.java =================================================================== --- trunk/src/org/openfast/ApplicationTypeDictionary.java 2007-11-01 19:52:07 UTC (rev 85) +++ trunk/src/org/openfast/ApplicationTypeDictionary.java 2007-11-06 04:46:19 UTC (rev 86) @@ -9,7 +9,7 @@ private Map dictionary = new HashMap(); - public ScalarValue lookup(Group template, QName key, String applicationType) { + public ScalarValue lookup(Group template, QName key, QName applicationType) { if (dictionary.containsKey(template.getTypeReference())) { Map applicationTypeMap = (Map) dictionary.get(template.getTypeReference()); if (applicationTypeMap.containsKey(key)) @@ -22,7 +22,7 @@ dictionary = new HashMap(); } - public void store(Group group, String applicationType, QName key, ScalarValue value) { + public void store(Group group, QName applicationType, QName key, ScalarValue value) { if (!dictionary.containsKey(group.getTypeReference())) { dictionary.put(group.getTypeReference(), new HashMap()); } Modified: trunk/src/org/openfast/Context.java =================================================================== --- trunk/src/org/openfast/Context.java 2007-11-01 19:52:07 UTC (rev 85) +++ trunk/src/org/openfast/Context.java 2007-11-06 04:46:19 UTC (rev 86) @@ -45,7 +45,7 @@ private int lastTemplateId; private Map dictionaries = new HashMap(); private ErrorHandler errorHandler = ErrorHandler.DEFAULT; - private String currentApplicationType; + private QName currentApplicationType; private List listeners = Collections.EMPTY_LIST; private boolean traceEnabled; private Trace encodeTrace; @@ -119,11 +119,11 @@ } public void newMessage(MessageTemplate template) { - currentApplicationType = (template.hasTypeReference()) ? template.getTypeReference() : FastConstants.ANY; + currentApplicationType = (template.hasTypeReference()) ? template.getTypeReference() : FastConstants.ANY_TYPE; } - public void setCurrentApplicationType(String typeReference) { - currentApplicationType = typeReference; + public void setCurrentApplicationType(QName name) { + currentApplicationType = name; } public TemplateRegistry getTemplateRegistry() { Modified: trunk/src/org/openfast/Dictionary.java =================================================================== --- trunk/src/org/openfast/Dictionary.java 2007-11-01 19:52:07 UTC (rev 85) +++ trunk/src/org/openfast/Dictionary.java 2007-11-06 04:46:19 UTC (rev 86) @@ -29,9 +29,9 @@ public static final String TEMPLATE = "template"; public static final String GLOBAL = "global"; - ScalarValue lookup(Group template, QName key, String applicationType); + ScalarValue lookup(Group template, QName key, QName currentApplicationType); - void store(Group group, String applicationType, QName key, ScalarValue valueToEncode); + void store(Group group, QName applicationType, QName key, ScalarValue valueToEncode); void reset(); } Modified: trunk/src/org/openfast/GlobalDictionary.java =================================================================== --- trunk/src/org/openfast/GlobalDictionary.java 2007-11-01 19:52:07 UTC (rev 85) +++ trunk/src/org/openfast/GlobalDictionary.java 2007-11-06 04:46:19 UTC (rev 86) @@ -31,7 +31,7 @@ public class GlobalDictionary implements Dictionary { protected Map table = new HashMap(); - public ScalarValue lookup(Group template, QName key, String applicationType) { + public ScalarValue lookup(Group template, QName key, QName applicationType) { if (!table.containsKey(key)) { return ScalarValue.UNDEFINED; } @@ -39,7 +39,7 @@ return (ScalarValue) table.get(key); } - public void store(Group group, String applicationType, QName key, ScalarValue value) { + public void store(Group group, QName applicationType, QName key, ScalarValue value) { table.put(key, value); } Modified: trunk/src/org/openfast/TemplateDictionary.java =================================================================== --- trunk/src/org/openfast/TemplateDictionary.java 2007-11-01 19:52:07 UTC (rev 85) +++ trunk/src/org/openfast/TemplateDictionary.java 2007-11-06 04:46:19 UTC (rev 86) @@ -31,7 +31,7 @@ public class TemplateDictionary implements Dictionary { protected Map table = new HashMap(); - public ScalarValue lookup(Group template, QName key, String applicationType) { + public ScalarValue lookup(Group template, QName key, QName applicationType) { if (!table.containsKey(template)) { return ScalarValue.UNDEFINED; } @@ -47,7 +47,7 @@ table.clear(); } - public void store(Group group, String applicationType, QName key, ScalarValue valueToEncode) { + public void store(Group group, QName applicationType, QName key, ScalarValue valueToEncode) { if (!table.containsKey(group)) { table.put(group, new HashMap()); } Modified: trunk/src/org/openfast/error/FastConstants.java =================================================================== --- trunk/src/org/openfast/error/FastConstants.java 2007-11-01 19:52:07 UTC (rev 85) +++ trunk/src/org/openfast/error/FastConstants.java 2007-11-06 04:46:19 UTC (rev 86) @@ -24,7 +24,7 @@ import org.openfast.QName; public interface FastConstants { - String ANY = "any"; + QName ANY_TYPE = new QName("any"); FastAlertSeverity ERROR = FastAlertSeverity.ERROR; FastAlertSeverity WARN = FastAlertSeverity.WARN; Modified: trunk/src/org/openfast/fastTemplateSchema.v11.xsd =================================================================== --- trunk/src/org/openfast/fastTemplateSchema.v11.xsd 2007-11-01 19:52:07 UTC (rev 85) +++ trunk/src/org/openfast/fastTemplateSchema.v11.xsd 2007-11-06 04:46:19 UTC (rev 86) @@ -160,8 +160,7 @@ <xs:element name="string"> <xs:complexType> <xs:sequence> - <xs:group minOccurs="0" - ref="td:byteVectorLength" /> + <xs:group minOccurs="0" ref="td:byteVectorLength" /> <xs:group ref="td:fieldInstrContent" /> </xs:sequence> <xs:attributeGroup ref="td:fieldInstrContent" /> Modified: trunk/src/org/openfast/template/Group.java =================================================================== --- trunk/src/org/openfast/template/Group.java 2007-11-01 19:52:07 UTC (rev 85) +++ trunk/src/org/openfast/template/Group.java 2007-11-06 04:46:19 UTC (rev 86) @@ -49,7 +49,7 @@ private static final long serialVersionUID = 1L; - private String typeReference = null; + private QName typeReference = null; protected String childNamespace = ""; protected final Field[] fields; protected final Map fieldIndexMap; @@ -440,7 +440,7 @@ * Set the name of the type referenced by this group * @param typeReference The name of the application type referenced by this goup */ - public void setTypeReference(String typeReference) { + public void setTypeReference(QName typeReference) { this.typeReference = typeReference; } @@ -448,7 +448,7 @@ * * @return Returns the application type referenced by this group */ - public String getTypeReference() { + public QName getTypeReference() { return typeReference; } Modified: trunk/src/org/openfast/template/Sequence.java =================================================================== --- trunk/src/org/openfast/template/Sequence.java 2007-11-01 19:52:07 UTC (rev 85) +++ trunk/src/org/openfast/template/Sequence.java 2007-11-06 04:46:19 UTC (rev 86) @@ -247,7 +247,7 @@ * Set the type reference * @param typeReference The type reference name as a string */ - public void setTypeReference(String typeReference) { + public void setTypeReference(QName typeReference) { this.group.setTypeReference(typeReference); } @@ -255,7 +255,7 @@ * * @return Returns the typeReference as a string */ - public String getTypeReference() { + public QName getTypeReference() { return group.getTypeReference(); } Modified: trunk/src/org/openfast/template/loader/ComposedDecimalParser.java =================================================================== --- trunk/src/org/openfast/template/loader/ComposedDecimalParser.java 2007-11-01 19:52:07 UTC (rev 85) +++ trunk/src/org/openfast/template/loader/ComposedDecimalParser.java 2007-11-06 04:46:19 UTC (rev 86) @@ -4,6 +4,7 @@ import org.openfast.ScalarValue; import org.openfast.template.ComposedScalar; import org.openfast.template.Field; +import org.openfast.template.Scalar; import org.openfast.template.operator.Operator; import org.openfast.template.type.Type; import org.openfast.util.Util; @@ -57,32 +58,52 @@ String exponentOperator = "none"; ScalarValue mantissaDefaultValue = ScalarValue.UNDEFINED; ScalarValue exponentDefaultValue = ScalarValue.UNDEFINED; + QName mantissaKey = null; + QName exponentKey = null; + String mantissaDictionary = context.getDictionary(); + String exponentDictionary = context.getDictionary(); + String mantissaNamespace = context.getNamespace(); + String exponentNamespace = context.getNamespace(); if ((mantissaNode != null) && mantissaNode.hasChildNodes()) { - Node operatorNode = getElement((Element) mantissaNode, 1); - mantissaOperator = operatorNode.getNodeName(); + Element operatorElement = getElement((Element) mantissaNode, 1); + mantissaOperator = operatorElement.getNodeName(); - String value = ((Element) operatorNode).getAttribute("value"); - - if ((value != null) && !value.equals("")) { - mantissaDefaultValue = Type.U32.getValue(value); - } + if (operatorElement.hasAttribute("value")) + mantissaDefaultValue = Type.I64.getValue(operatorElement.getAttribute("value")); + if (operatorElement.hasAttribute("ns")) + mantissaNamespace = operatorElement.getAttribute("ns"); + if (operatorElement.hasAttribute("key")) + mantissaKey = new QName(operatorElement.getAttribute("key"), mantissaNamespace); + if (operatorElement.hasAttribute("dictionary")) + mantissaDictionary = operatorElement.getAttribute("dictionary"); } if ((exponentNode != null) && exponentNode.hasChildNodes()) { - Node operatorNode = getElement((Element) exponentNode, 1); - exponentOperator = operatorNode.getNodeName(); + Element operatorElement = getElement((Element) exponentNode, 1); + exponentOperator = operatorElement.getNodeName(); - String value = ((Element) operatorNode).getAttribute("value"); - - if ((value != null) && !value.equals("")) { - exponentDefaultValue = Type.U32.getValue(value); - } + if (operatorElement.hasAttribute("value")) + exponentDefaultValue = Type.I32.getValue(operatorElement.getAttribute("value")); + if (operatorElement.hasAttribute("ns")) + exponentNamespace = operatorElement.getAttribute("ns"); + if (operatorElement.hasAttribute("key")) + exponentKey = new QName(operatorElement.getAttribute("key"), exponentNamespace); + if (operatorElement.hasAttribute("dictionary")) + exponentDictionary = operatorElement.getAttribute("dictionary"); } ComposedScalar scalar = Util.composedDecimal(name, Operator.getOperator(exponentOperator), exponentDefaultValue, Operator.getOperator(mantissaOperator), mantissaDefaultValue, optional); - scalar.getFields()[0].setDictionary(context.getDictionary()); - scalar.getFields()[1].setDictionary(context.getDictionary()); + + Scalar exponent = scalar.getFields()[0]; + exponent.setDictionary(exponentDictionary); + if (exponentKey != null) + exponent.setKey(exponentKey); + + Scalar mantissa = scalar.getFields()[1]; + mantissa.setDictionary(mantissaDictionary); + if (mantissaKey != null) + mantissa.setKey(mantissaKey); if (fieldNode.hasAttribute("id")) scalar.setId(fieldNode.getAttribute("id")); Modified: trunk/src/org/openfast/template/loader/GroupParser.java =================================================================== --- trunk/src/org/openfast/template/loader/GroupParser.java 2007-11-01 19:52:07 UTC (rev 85) +++ trunk/src/org/openfast/template/loader/GroupParser.java 2007-11-06 04:46:19 UTC (rev 86) @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.List; +import org.openfast.QName; import org.openfast.error.FastConstants; import org.openfast.template.Field; import org.openfast.template.Group; @@ -67,16 +68,21 @@ * @param templateTag The dom element object * @return Returns a string of the TypeReference from the passed element dom object */ - protected static String getTypeReference(Element templateTag) { + protected static QName getTypeReference(Element templateTag) { String typeReference = null; + String typeRefNs = ""; NodeList typeReferenceTags = templateTag.getElementsByTagName("typeRef"); if (typeReferenceTags.getLength() > 0) { Element messageRef = (Element) typeReferenceTags.item(0); typeReference = messageRef.getAttribute("name"); + if (messageRef.hasAttribute("ns")) + typeRefNs = messageRef.getAttribute("ns"); + return new QName(typeReference, typeRefNs); + } else { + return FastConstants.ANY_TYPE; } - return typeReference; } } Modified: trunk/src/org/openfast/template/loader/SequenceParser.java =================================================================== --- trunk/src/org/openfast/template/loader/SequenceParser.java 2007-11-01 19:52:07 UTC (rev 85) +++ trunk/src/org/openfast/template/loader/SequenceParser.java 2007-11-06 04:46:19 UTC (rev 86) @@ -2,9 +2,11 @@ import org.openfast.Global; import org.openfast.QName; +import org.openfast.ScalarValue; import org.openfast.template.Field; import org.openfast.template.Scalar; import org.openfast.template.Sequence; +import org.openfast.template.operator.Operator; import org.openfast.template.type.Type; import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -29,7 +31,7 @@ protected Field parse(Element sequenceElement, boolean optional, ParsingContext context) { Sequence sequence = new Sequence(context.getName(), - parseSequenceLengthField(sequenceElement, optional, context), + parseSequenceLengthField(context.getName(), sequenceElement, optional, context), GroupParser.parseFields(sequenceElement, context), optional); GroupParser.parseMore(sequenceElement, sequence.getGroup(), context); return sequence; @@ -37,16 +39,19 @@ /** * + * @param name * @param sequence The dom element object * @param sequenceName Name of the sequence to which this lenght field belongs * @param optional Determines if the Scalar is required or not for the data * @return Returns null if there are no elements by the tag length, otherwise */ - private Scalar parseSequenceLengthField(Element sequence, boolean optional, ParsingContext parent) { + private Scalar parseSequenceLengthField(QName name, Element sequence, boolean optional, ParsingContext parent) { NodeList lengthElements = sequence.getElementsByTagName("length"); if (lengthElements.getLength() == 0) { - return null; + Scalar implicitLength = new Scalar(Global.createImplicitName(name), Type.U32, Operator.NONE, ScalarValue.UNDEFINED, optional); + implicitLength.setDictionary(parent.getDictionary()); + return implicitLength; } Element length = (Element) lengthElements.item(0); Modified: trunk/test/unit/org/openfast/ApplicationTypeDictionaryTest.java =================================================================== --- trunk/test/unit/org/openfast/ApplicationTypeDictionaryTest.java 2007-11-01 19:52:07 UTC (rev 85) +++ trunk/test/unit/org/openfast/ApplicationTypeDictionaryTest.java 2007-11-06 04:46:19 UTC (rev 86) @@ -6,8 +6,8 @@ public class ApplicationTypeDictionaryTest extends OpenFastTestCase { public void testLookup() { - ObjectMother.allocationInstruction().setTypeReference("AllocationInstruction"); - ObjectMother.allocations().setTypeReference("Allocation"); + ObjectMother.allocationInstruction().setTypeReference(new QName("AllocationInstruction")); + ObjectMother.allocations().setTypeReference(new QName("Allocation")); Context context = new Context(); Modified: trunk/test/unit/org/openfast/TemplateDictionaryTest.java =================================================================== --- trunk/test/unit/org/openfast/TemplateDictionaryTest.java 2007-11-01 19:52:07 UTC (rev 85) +++ trunk/test/unit/org/openfast/TemplateDictionaryTest.java 2007-11-06 04:46:19 UTC (rev 86) @@ -24,6 +24,7 @@ import junit.framework.TestCase; +import org.openfast.error.FastConstants; import org.openfast.template.Field; import org.openfast.template.Group; import org.openfast.template.MessageTemplate; @@ -40,16 +41,16 @@ new Scalar("exchange", Type.STRING, Operator.COPY, ScalarValue.UNDEFINED, false) }); ScalarValue value = new StringValue("NYSE"); - dictionary.store(template, "any", new QName("exchange"), value); + dictionary.store(template, FastConstants.ANY_TYPE, new QName("exchange"), value); - assertEquals(value, dictionary.lookup(template, new QName("exchange"), "any")); + assertEquals(value, dictionary.lookup(template, new QName("exchange"), FastConstants.ANY_TYPE)); Group quoteTemplate = new MessageTemplate("Quote", new Field[] { new Scalar("bid", Type.DECIMAL, Operator.DELTA, ScalarValue.UNDEFINED, false) }); assertEquals(ScalarValue.UNDEFINED, - dictionary.lookup(quoteTemplate, new QName("exchange"), "any")); + dictionary.lookup(quoteTemplate, new QName("exchange"), FastConstants.ANY_TYPE)); } public void testLookupMultipleValuesForTemplate() throws Exception { @@ -60,12 +61,12 @@ }); ScalarValue value = new StringValue("NYSE"); ScalarValue marketValue = new DecimalValue(100000.00); - dictionary.store(template, "any", new QName("exchange"), value); - dictionary.store(template, "any", new QName("marketValue"), marketValue); + dictionary.store(template, FastConstants.ANY_TYPE, new QName("exchange"), value); + dictionary.store(template, FastConstants.ANY_TYPE, new QName("marketValue"), marketValue); assertFalse(value.equals(ScalarValue.UNDEFINED)); - assertEquals(value, dictionary.lookup(template, new QName("exchange"), "any")); - assertEquals(marketValue, dictionary.lookup(template, new QName("marketValue"), "any")); + assertEquals(value, dictionary.lookup(template, new QName("exchange"), FastConstants.ANY_TYPE)); + assertEquals(marketValue, dictionary.lookup(template, new QName("marketValue"), FastConstants.ANY_TYPE)); } public void testReset() { @@ -75,12 +76,12 @@ new Scalar("exchange", Type.STRING, Operator.COPY, ScalarValue.UNDEFINED, false) }); ScalarValue value = new StringValue("NYSE"); - dictionary.store(template, "any", new QName("exchange"), value); + dictionary.store(template, FastConstants.ANY_TYPE, new QName("exchange"), value); - assertEquals(value, dictionary.lookup(template, new QName("exchange"), "any")); + assertEquals(value, dictionary.lookup(template, new QName("exchange"), FastConstants.ANY_TYPE)); dictionary.reset(); assertEquals(ScalarValue.UNDEFINED, - dictionary.lookup(template, new QName("exchange"), "any")); + dictionary.lookup(template, new QName("exchange"), FastConstants.ANY_TYPE)); } public void testExistingTemplateValueLookup() throws Exception { @@ -90,8 +91,8 @@ new Scalar("exchange", Type.STRING, Operator.COPY, ScalarValue.UNDEFINED, false) }); ScalarValue value = new StringValue("NYSE"); - dictionary.store(template, "any", new QName("exchange"), value); + dictionary.store(template, FastConstants.ANY_TYPE, new QName("exchange"), value); - assertEquals(ScalarValue.UNDEFINED, dictionary.lookup(template, new QName("bid"), "any")); + assertEquals(ScalarValue.UNDEFINED, dictionary.lookup(template, new QName("bid"), FastConstants.ANY_TYPE)); } } Modified: trunk/test/unit/org/openfast/template/loader/ComposedDecimalParserTest.java =================================================================== --- trunk/test/unit/org/openfast/template/loader/ComposedDecimalParserTest.java 2007-11-01 19:52:07 UTC (rev 85) +++ trunk/test/unit/org/openfast/template/loader/ComposedDecimalParserTest.java 2007-11-06 04:46:19 UTC (rev 86) @@ -1,8 +1,10 @@ package org.openfast.template.loader; import org.openfast.IntegerValue; +import org.openfast.QName; import org.openfast.ScalarValue; import org.openfast.template.ComposedScalar; +import org.openfast.template.Scalar; import org.openfast.template.operator.Operator; import org.openfast.template.type.Type; import org.openfast.test.OpenFastTestCase; @@ -33,6 +35,22 @@ assertComposedScalarField(decimal, Type.DECIMAL, "composed", Operator.CONSTANT, new IntegerValue(-2), Operator.DELTA, ScalarValue.UNDEFINED); assertEquals("template", decimal.getFields()[0].getDictionary()); assertEquals("template", decimal.getFields()[1].getDictionary()); + } + + public void testFullyDefinedOperators() throws Exception { + Element decimalDef = document("<decimal name=\"composed\"><mantissa><delta dictionary=\"template\" key=\"variable\" value=\"100\"/></mantissa><exponent><copy dictionary=\"template\" key=\"static\" value=\"-2\"/></exponent></decimal>").getDocumentElement(); + assertTrue(parser.canParse(decimalDef, context)); + ComposedScalar decimal = (ComposedScalar) parser.parse(decimalDef, context); + + assertComposedScalarField(decimal, Type.DECIMAL, "composed", Operator.COPY, new IntegerValue(-2), Operator.DELTA, new IntegerValue(100)); + Scalar exponent = decimal.getFields()[0]; + Scalar mantissa = decimal.getFields()[1]; + + assertEquals("template", exponent.getDictionary()); + assertEquals(new QName("static"), exponent.getKey()); + + assertEquals("template", exponent.getDictionary()); + assertEquals(new QName("variable"), mantissa.getKey()); } } Added: trunk/test/unit/org/openfast/template/loader/SequenceParserTest.java =================================================================== --- trunk/test/unit/org/openfast/template/loader/SequenceParserTest.java (rev 0) +++ trunk/test/unit/org/openfast/template/loader/SequenceParserTest.java 2007-11-06 04:46:19 UTC (rev 86) @@ -0,0 +1,81 @@ +package org.openfast.template.loader; + +import org.openfast.QName; +import org.openfast.template.Sequence; +import org.openfast.test.OpenFastTestCase; +import org.w3c.dom.Element; + +public class SequenceParserTest extends OpenFastTestCase { + + private SequenceParser parser; + private ParsingContext context; + + public void setUp() { + parser = new SequenceParser(); + context = ParsingContext.NULL; + } + + public void testInheritDictionary() throws Exception { + ParsingContext c = new ParsingContext(context); + c.setDictionary("template"); + Element node = document("<sequence name=\"seq\"></sequence>").getDocumentElement(); + + assertTrue(parser.canParse(node, c)); + Sequence sequence = (Sequence) parser.parse(node, c); + assertEquals("template", sequence.getLength().getDictionary()); + + node = document("<sequence name=\"seq\"><length name=\"explicitLength\"/></sequence>").getDocumentElement(); + sequence = (Sequence) parser.parse(node, c); + assertEquals("template", sequence.getLength().getDictionary()); + } + + public void testInheritance() throws Exception { + String ns = "http://openfast.org/test"; + String dictionary = "template"; + ParsingContext c = new ParsingContext(context); + c.setDictionary(dictionary); + c.setNamespace(ns); + + Element node = document("<sequence name=\"seq\"><length name=\"seqLen\"/></sequence>").getDocumentElement(); + + assertTrue(parser.canParse(node, c)); + Sequence sequence = (Sequence) parser.parse(node, c); + assertEquals(dictionary, sequence.getLength().getDictionary()); + assertEquals(ns, sequence.getLength().getQName().getNamespace()); + assertEquals(ns, sequence.getQName().getNamespace()); + } + + public void testOverride() throws Exception { + ParsingContext c = new ParsingContext(context); + c.setDictionary("template"); + c.setNamespace("http://openfast.org/test"); + + Element node = document("<sequence name=\"seq\" ns=\"http://openfast.org/override\" dictionary=\"type\"><length name=\"seqLen\"/></sequence>").getDocumentElement(); + + assertTrue(parser.canParse(node, c)); + Sequence sequence = (Sequence) parser.parse(node, c); + assertEquals("type", sequence.getLength().getDictionary()); + assertEquals("http://openfast.org/override", sequence.getLength().getQName().getNamespace()); + assertEquals("http://openfast.org/override", sequence.getQName().getNamespace()); + } + + public void testSequenceWithFields() throws Exception { + ParsingContext c = new ParsingContext(XMLMessageTemplateLoader.createInitialContext()); + c.setDictionary("template"); + c.setNamespace("http://openfast.org/test"); + + Element node = document("<sequence name=\"seq\" ns=\"http://openfast.org/override\" dictionary=\"type\">" + + "<length name=\"seqLen\"/>" + + "<string name=\"value\"><copy/></string>" + + "<uInt32 name=\"date\"><delta/></uInt32>" + + "<typeRef name=\"Seq\" ns=\"org.openfast.override\"/>" + + "</sequence>").getDocumentElement(); + + assertTrue(parser.canParse(node, c)); + Sequence sequence = (Sequence) parser.parse(node, c); + assertEquals("type", sequence.getLength().getDictionary()); + assertEquals("http://openfast.org/override", sequence.getLength().getQName().getNamespace()); + assertEquals("http://openfast.org/override", sequence.getQName().getNamespace()); + assertEquals(new QName("Seq", "org.openfast.override"), sequence.getTypeReference()); + } +} Modified: trunk/test/unit/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java =================================================================== --- trunk/test/unit/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java 2007-11-01 19:52:07 UTC (rev 85) +++ trunk/test/unit/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java 2007-11-06 04:46:19 UTC (rev 86) @@ -138,7 +138,7 @@ MessageTemplateLoader loader = new XMLMessageTemplateLoader(); MessageTemplate messageTemplate = loader.load(templateStream)[0]; - assertEquals("MDIncrementalRefresh", messageTemplate.getTypeReference()); + assertEquals("MDIncrementalRefresh", messageTemplate.getTypeReference().getName()); assertEquals("MDRefreshSample", messageTemplate.getName()); assertEquals(10, messageTemplate.getFieldCount()); @@ -157,7 +157,7 @@ assertSequence(messageTemplate, index, 17); Sequence sequence = (Sequence) messageTemplate.getField(index++); - assertEquals("MDEntries", sequence.getTypeReference()); + assertEquals("MDEntries", sequence.getTypeReference().getName()); assertSequenceLengthField(sequence, "268", Type.U32, Operator.NONE); /********************************** SEQUENCE FIELDS **********************************/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jac...@us...> - 2007-11-01 19:52:12
|
Revision: 85 http://openfast.svn.sourceforge.net/openfast/?rev=85&view=rev Author: jacob_northey Date: 2007-11-01 12:52:07 -0700 (Thu, 01 Nov 2007) Log Message: ----------- FIXED: Sequence explicit length field name not being parsed. Modified Paths: -------------- trunk/src/org/openfast/session/BasicClient.java trunk/src/org/openfast/session/SessionControlProtocol_1_0.java trunk/src/org/openfast/template/loader/SequenceParser.java trunk/test/acceptance/org/openfast/scenario/ErrorCasesTest.java Modified: trunk/src/org/openfast/session/BasicClient.java =================================================================== --- trunk/src/org/openfast/session/BasicClient.java 2007-10-31 15:07:59 UTC (rev 84) +++ trunk/src/org/openfast/session/BasicClient.java 2007-11-01 19:52:07 UTC (rev 85) @@ -18,4 +18,13 @@ return vendorId; } + public boolean equals(Object obj) { + if (obj == this) return true; + if (obj == null || !(obj instanceof BasicClient)) return false; + return ((BasicClient) obj).name.equals(name); + } + + public int hashCode() { + return name.hashCode(); + } } Modified: trunk/src/org/openfast/session/SessionControlProtocol_1_0.java =================================================================== --- trunk/src/org/openfast/session/SessionControlProtocol_1_0.java 2007-10-31 15:07:59 UTC (rev 84) +++ trunk/src/org/openfast/session/SessionControlProtocol_1_0.java 2007-11-01 19:52:07 UTC (rev 85) @@ -91,7 +91,12 @@ public void handleMessage(Session session, Message message) { if (message.getTemplate().equals(FAST_ALERT_TEMPLATE)) { - session.getErrorHandler().error(ErrorCode.getAlertCode(message), message.getString(4)); + ErrorCode alertCode = ErrorCode.getAlertCode(message); + if (alertCode.equals(SessionConstants.CLOSE)) { + session.close(alertCode); + } else { + session.getErrorHandler().error(alertCode, message.getString(4)); + } } } Modified: trunk/src/org/openfast/template/loader/SequenceParser.java =================================================================== --- trunk/src/org/openfast/template/loader/SequenceParser.java 2007-10-31 15:07:59 UTC (rev 84) +++ trunk/src/org/openfast/template/loader/SequenceParser.java 2007-11-01 19:52:07 UTC (rev 85) @@ -11,7 +11,7 @@ public class SequenceParser extends AbstractFieldParser { - private FieldParser sequenceLengthParser = new ScalarParser("length") { + private ScalarParser sequenceLengthParser = new ScalarParser("length") { protected Type getType(Element fieldNode, ParsingContext context) { return Type.U32; } @@ -50,7 +50,8 @@ } Element length = (Element) lengthElements.item(0); - return (Scalar) sequenceLengthParser.parse(length, parent); + ParsingContext context = new ParsingContext(length, parent); + return (Scalar) sequenceLengthParser.parse(length, optional, context); } } Modified: trunk/test/acceptance/org/openfast/scenario/ErrorCasesTest.java =================================================================== --- trunk/test/acceptance/org/openfast/scenario/ErrorCasesTest.java 2007-10-31 15:07:59 UTC (rev 84) +++ trunk/test/acceptance/org/openfast/scenario/ErrorCasesTest.java 2007-11-01 19:52:07 UTC (rev 85) @@ -70,7 +70,6 @@ Message m = new Message(template); m.setString("desc", "prev"); - // m.setDecimal("Line1", null); m.setDecimal("Line2", 9427.61 ); m.setDecimal("Line3", 9427.6 ); @@ -78,7 +77,5 @@ Message m2 = decoder(template, bytes).readMessage(); assertEquals(m, m2); - - } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jac...@us...> - 2007-10-31 15:07:57
|
Revision: 84 http://openfast.svn.sourceforge.net/openfast/?rev=84&view=rev Author: jacob_northey Date: 2007-10-31 08:07:59 -0700 (Wed, 31 Oct 2007) Log Message: ----------- FIXED: Composed decimal fields do not inherit dictionary from context; FIXED: Composed scalars decode nulls incorrectly Modified Paths: -------------- trunk/src/org/openfast/session/template/exchange/AbstractFieldInstructionConverter.java trunk/src/org/openfast/template/BasicTemplateRegistry.java trunk/src/org/openfast/template/ComposedScalar.java trunk/src/org/openfast/template/TemplateRegistry.java trunk/src/org/openfast/template/loader/ComposedDecimalParser.java trunk/src/org/openfast/template/loader/ScalarParser.java trunk/src/org/openfast/template/operator/CopyOperatorCodec.java trunk/src/org/openfast/template/operator/Operator.java trunk/src/org/openfast/util/Util.java trunk/test/acceptance/org/openfast/scenario/ErrorCasesTest.java trunk/test/unit/org/openfast/session/template/exchange/ComposedDecimalConverterTest.java trunk/test/unit/org/openfast/template/loader/ComposedDecimalParserTest.java trunk/test/unit/org/openfast/template/type/codec/ComposedDecimalTest.java Modified: trunk/src/org/openfast/session/template/exchange/AbstractFieldInstructionConverter.java =================================================================== --- trunk/src/org/openfast/session/template/exchange/AbstractFieldInstructionConverter.java 2007-10-29 01:07:21 UTC (rev 83) +++ trunk/src/org/openfast/session/template/exchange/AbstractFieldInstructionConverter.java 2007-10-31 15:07:59 UTC (rev 84) @@ -47,7 +47,7 @@ } private static final Map/*<Operator, MessageTemplate>*/ OPERATOR_TEMPLATE_MAP = new HashMap(); - private static final Map/*<Operator, MessageTemplate>*/ TEMPLATE_OPERATOR_MAP = new HashMap(); + private static final Map/*<MessageTemplate, Operator>*/ TEMPLATE_OPERATOR_MAP = new HashMap(); static { OPERATOR_TEMPLATE_MAP.put(Operator.CONSTANT, SessionControlProtocol_1_1.CONSTANT_OP); Modified: trunk/src/org/openfast/template/BasicTemplateRegistry.java =================================================================== --- trunk/src/org/openfast/template/BasicTemplateRegistry.java 2007-10-29 01:07:21 UTC (rev 83) +++ trunk/src/org/openfast/template/BasicTemplateRegistry.java 2007-10-31 15:07:59 UTC (rev 84) @@ -33,8 +33,10 @@ } public void define(MessageTemplate template) { - nameMap.put(template.getQName(), template); - templates.add(template); + if (!templates.contains(template)) { + nameMap.put(template.getQName(), template); + templates.add(template); + } } public int getId(QName name) { Modified: trunk/src/org/openfast/template/ComposedScalar.java =================================================================== --- trunk/src/org/openfast/template/ComposedScalar.java 2007-10-29 01:07:21 UTC (rev 83) +++ trunk/src/org/openfast/template/ComposedScalar.java 2007-10-31 15:07:59 UTC (rev 84) @@ -37,6 +37,8 @@ FieldValue[] values = new FieldValue[fields.length]; for (int i=0; i<fields.length; i++) { values[i] = fields[i].decode(in, template, context, presenceMapReader); + if (i == 0 && values[0] == null) + return null; } return valueConverter.compose(values); } Modified: trunk/src/org/openfast/template/TemplateRegistry.java =================================================================== --- trunk/src/org/openfast/template/TemplateRegistry.java 2007-10-29 01:07:21 UTC (rev 83) +++ trunk/src/org/openfast/template/TemplateRegistry.java 2007-10-31 15:07:59 UTC (rev 84) @@ -28,7 +28,7 @@ -public interface TemplateRegistry { +public interface TemplateRegistry extends Iterable { TemplateRegistry NULL = new NullTemplateRegistry(); void registerAll(TemplateRegistry registry); @@ -62,6 +62,18 @@ void addTemplateRegisteredListener(TemplateRegisteredListener templateRegisteredListener); void removeTemplateRegisteredListener(TemplateRegisteredListener templateRegisteredListener); + + /** + * Iterator over the names of each template (defined or registered) in this registry + * + * @return an iterator over the qualified names each item is of type QName + */ Iterator/*<QName>*/ nameIterator(); + + /** + * Iterator over the set of templates (defined or registered) in this registry + * + * @return an iterator over the set of templates each item is an instance of MessageTemplate + */ Iterator/*<MessageTemplate>*/ iterator(); } Modified: trunk/src/org/openfast/template/loader/ComposedDecimalParser.java =================================================================== --- trunk/src/org/openfast/template/loader/ComposedDecimalParser.java 2007-10-29 01:07:21 UTC (rev 83) +++ trunk/src/org/openfast/template/loader/ComposedDecimalParser.java 2007-10-31 15:07:59 UTC (rev 84) @@ -81,6 +81,8 @@ } ComposedScalar scalar = Util.composedDecimal(name, Operator.getOperator(exponentOperator), exponentDefaultValue, Operator.getOperator(mantissaOperator), mantissaDefaultValue, optional); + scalar.getFields()[0].setDictionary(context.getDictionary()); + scalar.getFields()[1].setDictionary(context.getDictionary()); if (fieldNode.hasAttribute("id")) scalar.setId(fieldNode.getAttribute("id")); Modified: trunk/src/org/openfast/template/loader/ScalarParser.java =================================================================== --- trunk/src/org/openfast/template/loader/ScalarParser.java 2007-10-29 01:07:21 UTC (rev 83) +++ trunk/src/org/openfast/template/loader/ScalarParser.java 2007-10-31 15:07:59 UTC (rev 84) @@ -50,6 +50,7 @@ if (key != null) scalar.setKey(new QName(key, ns)); scalar.setDictionary(context.getDictionary()); + parseExternalAttributes(fieldNode, scalar); return scalar; } Modified: trunk/src/org/openfast/template/operator/CopyOperatorCodec.java =================================================================== --- trunk/src/org/openfast/template/operator/CopyOperatorCodec.java 2007-10-29 01:07:21 UTC (rev 83) +++ trunk/src/org/openfast/template/operator/CopyOperatorCodec.java 2007-10-31 15:07:59 UTC (rev 84) @@ -68,7 +68,7 @@ return null; } - Global.handleError(FastConstants.D5_NO_DEFAULT_VALUE, ""); + Global.handleError(FastConstants.D5_NO_DEFAULT_VALUE, "No default value for " + field); return null; } Modified: trunk/src/org/openfast/template/operator/Operator.java =================================================================== --- trunk/src/org/openfast/template/operator/Operator.java 2007-10-29 01:07:21 UTC (rev 83) +++ trunk/src/org/openfast/template/operator/Operator.java 2007-10-31 15:07:59 UTC (rev 84) @@ -31,6 +31,14 @@ if (scalar.getDefaultValue().isUndefined()) Global.handleError(FastConstants.S4_NO_INITIAL_VALUE_FOR_CONST, "The field " + scalar + " must have a default value defined."); } + + public boolean shouldStoreValue(ScalarValue value) { + return false; + } + + public boolean usesDictionary() { + return false; + } }; public static final Operator DEFAULT = new Operator("default") { private static final long serialVersionUID = 1L; Modified: trunk/src/org/openfast/util/Util.java =================================================================== --- trunk/src/org/openfast/util/Util.java 2007-10-29 01:07:21 UTC (rev 83) +++ trunk/src/org/openfast/util/Util.java 2007-10-31 15:07:59 UTC (rev 84) @@ -185,4 +185,12 @@ Scalar mantissaScalar = new Scalar(Global.createImplicitName(name), Type.I64, mantissaOp, mantissaVal, false); return new ComposedScalar(name, Type.DECIMAL, new Scalar[] { exponentScalar, mantissaScalar }, optional, new DecimalConverter()); } + + public static int toInt(String attribute) { + try { + return Integer.parseInt(attribute); + } catch (NumberFormatException e) { + return 0; + } + } } Modified: trunk/test/acceptance/org/openfast/scenario/ErrorCasesTest.java =================================================================== --- trunk/test/acceptance/org/openfast/scenario/ErrorCasesTest.java 2007-10-29 01:07:21 UTC (rev 83) +++ trunk/test/acceptance/org/openfast/scenario/ErrorCasesTest.java 2007-10-31 15:07:59 UTC (rev 84) @@ -47,4 +47,38 @@ FastDecoder decoder = decoder("11000000 10000001", t); assertEquals(message, decoder.readMessage()); } + + public void testDictionaryNotInherited() { + String templateDef = "<template name=\"OptDeltaDec\" id=\"58\" dictionary=\"template\">" + + " <string name=\"desc\"/>" + + " <decimal id=\"1\" presence=\"optional\" name=\"Line1\">" + + " <exponent><copy/></exponent>" + + " <mantissa><copy/></mantissa>" + + " </decimal>" + + " <decimal id=\"1\" presence=\"optional\" name=\"Line2\">" + + " <exponent><copy/></exponent>" + + " <mantissa><copy/></mantissa>" + + " </decimal> " + + " <decimal id=\"1\" presence=\"optional\" name=\"Line3\">" + + " <exponent><copy/></exponent> " + + " <mantissa><copy/></mantissa>" + + " </decimal>" + + "</template>"; + + MessageTemplate template = template(templateDef); + + Message m = new Message(template); + + m.setString("desc", "prev"); + // m.setDecimal("Line1", null); + m.setDecimal("Line2", 9427.61 ); + m.setDecimal("Line3", 9427.6 ); + + byte[] bytes = encoder(template).encode(m); + Message m2 = decoder(template, bytes).readMessage(); + + assertEquals(m, m2); + + + } } Modified: trunk/test/unit/org/openfast/session/template/exchange/ComposedDecimalConverterTest.java =================================================================== --- trunk/test/unit/org/openfast/session/template/exchange/ComposedDecimalConverterTest.java 2007-10-29 01:07:21 UTC (rev 83) +++ trunk/test/unit/org/openfast/session/template/exchange/ComposedDecimalConverterTest.java 2007-10-31 15:07:59 UTC (rev 84) @@ -30,9 +30,4 @@ Field composedDecimal = converter.convert(fieldDef, TemplateRegistry.NULL, context); assertEquals(composedDecimal, decimal); } - - public void testConvertFieldConversionContext() { -// GroupValue fieldDef = converter.convert(decimal, context); - } - } Modified: trunk/test/unit/org/openfast/template/loader/ComposedDecimalParserTest.java =================================================================== --- trunk/test/unit/org/openfast/template/loader/ComposedDecimalParserTest.java 2007-10-29 01:07:21 UTC (rev 83) +++ trunk/test/unit/org/openfast/template/loader/ComposedDecimalParserTest.java 2007-10-31 15:07:59 UTC (rev 84) @@ -25,4 +25,14 @@ assertComposedScalarField(decimal, Type.DECIMAL, "composed", Operator.CONSTANT, new IntegerValue(-2), Operator.DELTA, ScalarValue.UNDEFINED); } + public void testInheritDictionary() throws Exception { + Element decimalDef = document("<decimal name=\"composed\"><mantissa><delta/></mantissa><exponent><constant value=\"-2\"/></exponent></decimal>").getDocumentElement(); + context.setDictionary("template"); + assertTrue(parser.canParse(decimalDef, context)); + ComposedScalar decimal = (ComposedScalar) parser.parse(decimalDef, context); + assertComposedScalarField(decimal, Type.DECIMAL, "composed", Operator.CONSTANT, new IntegerValue(-2), Operator.DELTA, ScalarValue.UNDEFINED); + assertEquals("template", decimal.getFields()[0].getDictionary()); + assertEquals("template", decimal.getFields()[1].getDictionary()); + + } } Modified: trunk/test/unit/org/openfast/template/type/codec/ComposedDecimalTest.java =================================================================== --- trunk/test/unit/org/openfast/template/type/codec/ComposedDecimalTest.java 2007-10-29 01:07:21 UTC (rev 83) +++ trunk/test/unit/org/openfast/template/type/codec/ComposedDecimalTest.java 2007-10-31 15:07:59 UTC (rev 84) @@ -5,6 +5,7 @@ import org.openfast.BitVectorReader; import org.openfast.ByteUtil; import org.openfast.Context; +import org.openfast.IntegerValue; import org.openfast.QName; import org.openfast.ScalarValue; import org.openfast.template.ComposedScalar; @@ -58,5 +59,76 @@ assertEquals(d(94225, -3), scalar.decode(bitStream("11100111"), template, context, pmapReader("10100000"))); assertEquals(d(94350, -3), scalar.decode(bitStream("00000000 11111101"), template, context, pmapReader("10100000"))); } + + public void testCopyExponentDeltaMantissa() { + ComposedScalar decimal = Util.composedDecimal(name, Operator.COPY, ScalarValue.UNDEFINED, Operator.DELTA, new IntegerValue(1), false); + Context context = new Context(); + BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + assertEquals("11111110 00000001 00010110 10101100", decimal.encode(d(19245, -2), template, context , pmapBuilder)); + assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); + pmapBuilder = new BitVectorBuilder(7); + assertEquals("11111100", decimal.encode(d(19241, -2), template, context , pmapBuilder)); + assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); + } + + public void testCopyExponentDefaultMantissa() { + ComposedScalar decimal = Util.composedDecimal(name, Operator.COPY, ScalarValue.UNDEFINED, Operator.DEFAULT, new IntegerValue(1), false); + Context context = new Context(); + BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + assertEquals("11111110 00000001 00010110 10101101", decimal.encode(d(19245, -2), template, context , pmapBuilder)); + assertEquals("11100000", pmapBuilder.getBitVector().getBytes()); + + pmapBuilder = new BitVectorBuilder(7); + assertEquals("00000001 00010110 10101001", decimal.encode(d(19241, -2), template, context , pmapBuilder)); + assertEquals("10100000", pmapBuilder.getBitVector().getBytes()); + pmapBuilder = new BitVectorBuilder(7); + assertEquals("10000000", decimal.encode(d(1, 0), template, context , pmapBuilder)); + assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); + + pmapBuilder = new BitVectorBuilder(7); + assertEquals("", decimal.encode(d(1, 0), template, context , pmapBuilder)); + assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(2, pmapBuilder.getIndex()); + } + + public void testOptionalDefaultNullExponent() { + ComposedScalar decimal = Util.composedDecimal(name, Operator.DEFAULT, ScalarValue.UNDEFINED, Operator.DELTA, new IntegerValue(12200), true); + Context context = new Context(); + BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + + assertEquals("", decimal.encode(null, template, context , pmapBuilder)); + assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(1, pmapBuilder.getIndex()); // ONLY ONE PMAP BIT SHOULD BE WRITTEN + + pmapBuilder = new BitVectorBuilder(7); + assertEquals("11111110 10000001", decimal.encode(d(12201, -2), template, context , pmapBuilder)); + assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(1, pmapBuilder.getIndex()); + } + + public void testOptionalConstantExponent() { + ComposedScalar decimal = Util.composedDecimal(name, Operator.CONSTANT, new IntegerValue(-2), Operator.DEFAULT, new IntegerValue(100), true); + Context context = new Context(); + BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + + assertEquals("", decimal.encode(d(100, -2), template, context , pmapBuilder)); + assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(2, pmapBuilder.getIndex()); + } + + public void testOptionalDeltaExponentCopyMantissa() { + ComposedScalar decimal = Util.composedDecimal(name, Operator.DELTA, ScalarValue.UNDEFINED, Operator.COPY, ScalarValue.UNDEFINED, true); + Context context = new Context(); + BitVectorBuilder pmapBuilder = new BitVectorBuilder(7); + + assertEquals("10000000", decimal.encode(null, template, context , pmapBuilder)); + assertEquals("10000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(0, pmapBuilder.getIndex()); + + pmapBuilder = new BitVectorBuilder(7); + assertEquals("10000001 10000001", decimal.encode(d(1, 0), template, context , pmapBuilder)); + assertEquals("11000000", pmapBuilder.getBitVector().getBytes()); + assertEquals(1, pmapBuilder.getIndex()); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jac...@us...> - 2007-10-29 01:07:28
|
Revision: 83 http://openfast.svn.sourceforge.net/openfast/?rev=83&view=rev Author: jacob_northey Date: 2007-10-28 18:07:21 -0700 (Sun, 28 Oct 2007) Log Message: ----------- FIX: None operator should not use dictionary; FIX: SCP 1.1 Breaks on dynamic exchange of multiple templates Modified Paths: -------------- trunk/src/org/openfast/Context.java trunk/src/org/openfast/FieldValue.java trunk/src/org/openfast/GroupValue.java trunk/src/org/openfast/Message.java trunk/src/org/openfast/ScalarValue.java trunk/src/org/openfast/SequenceValue.java trunk/src/org/openfast/codec/FastDecoder.java trunk/src/org/openfast/error/ErrorCode.java trunk/src/org/openfast/session/Session.java trunk/src/org/openfast/session/SessionConstants.java trunk/src/org/openfast/session/SessionControlProtocol_1_0.java trunk/src/org/openfast/session/SessionControlProtocol_1_1.java trunk/src/org/openfast/session/SessionProtocol.java trunk/src/org/openfast/session/template/exchange/AbstractFieldInstructionConverter.java trunk/src/org/openfast/session/template/exchange/ComposedDecimalConverter.java trunk/src/org/openfast/session/template/exchange/GroupConverter.java trunk/src/org/openfast/session/template/exchange/ScalarConverter.java trunk/src/org/openfast/session/template/exchange/SequenceConverter.java trunk/src/org/openfast/template/ComposedScalar.java trunk/src/org/openfast/template/Group.java trunk/src/org/openfast/template/MessageTemplate.java trunk/src/org/openfast/template/Scalar.java trunk/src/org/openfast/template/operator/DeltaDecimalOperatorCodec.java trunk/src/org/openfast/template/operator/DeltaIntegerOperatorCodec.java trunk/src/org/openfast/template/operator/DeltaStringOperatorCodec.java trunk/src/org/openfast/template/operator/Operator.java trunk/src/org/openfast/template/operator/TailOperatorCodec.java trunk/test/acceptance/org/openfast/TypeConversionTest.java trunk/test/acceptance/org/openfast/session/SCP_1_1_Test.java trunk/test/unit/org/openfast/session/template/exchange/ScalarConverterTest.java trunk/test/unit/org/openfast/template/ScalarTest.java Added Paths: ----------- trunk/src/org/openfast/debug/BasicDecodeTrace.java trunk/src/org/openfast/debug/BasicEncodeTrace.java trunk/src/org/openfast/debug/Trace.java trunk/src/org/openfast/session/SessionListener.java Removed Paths: ------------- trunk/src/org/openfast/debug/BasicTrace.java trunk/src/org/openfast/debug/DecodeTrace.java trunk/src/org/openfast/debug/EncodeTrace.java Modified: trunk/src/org/openfast/Context.java =================================================================== --- trunk/src/org/openfast/Context.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/Context.java 2007-10-29 01:07:21 UTC (rev 83) @@ -28,8 +28,9 @@ import java.util.List; import java.util.Map; -import org.openfast.debug.DecodeTrace; -import org.openfast.debug.EncodeTrace; +import org.openfast.debug.BasicDecodeTrace; +import org.openfast.debug.BasicEncodeTrace; +import org.openfast.debug.Trace; import org.openfast.error.ErrorHandler; import org.openfast.error.FastConstants; import org.openfast.template.BasicTemplateRegistry; @@ -47,8 +48,8 @@ private String currentApplicationType; private List listeners = Collections.EMPTY_LIST; private boolean traceEnabled; - public EncodeTrace encodeTrace; - public DecodeTrace decodeTrace; + private Trace encodeTrace; + private Trace decodeTrace; public Context() { dictionaries.put("global", new GlobalDictionary()); @@ -138,11 +139,27 @@ } public void startTrace() { - encodeTrace = new EncodeTrace(); - decodeTrace = new DecodeTrace(); + setEncodeTrace(new BasicEncodeTrace()); + setDecodeTrace(new BasicDecodeTrace()); } public void setTraceEnabled(boolean enabled) { this.traceEnabled = enabled; } + + public void setEncodeTrace(BasicEncodeTrace encodeTrace) { + this.encodeTrace = encodeTrace; + } + + public Trace getEncodeTrace() { + return encodeTrace; + } + + public void setDecodeTrace(Trace decodeTrace) { + this.decodeTrace = decodeTrace; + } + + public Trace getDecodeTrace() { + return decodeTrace; + } } Modified: trunk/src/org/openfast/FieldValue.java =================================================================== --- trunk/src/org/openfast/FieldValue.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/FieldValue.java 2007-10-29 01:07:21 UTC (rev 83) @@ -25,4 +25,5 @@ import java.io.Serializable; public interface FieldValue extends Serializable { + FieldValue copy(); } Modified: trunk/src/org/openfast/GroupValue.java =================================================================== --- trunk/src/org/openfast/GroupValue.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/GroupValue.java 2007-10-29 01:07:21 UTC (rev 83) @@ -187,8 +187,8 @@ setFieldValue(group.getFieldIndex(field), value); } - public void setFieldValue(int IndexfieldIndex, FieldValue value) { - values[IndexfieldIndex] = value; + public void setFieldValue(int fieldIndex, FieldValue value) { + values[fieldIndex] = value; } public void setBitVector(int fieldIndex, BitVector vector) { @@ -219,6 +219,10 @@ values[fieldIndex] = new IntegerValue(value); } + public void setBool(String fieldName, boolean value) { + setFieldValue(fieldName, new IntegerValue(value ? 1 : 0)); + } + public void setLong(String fieldName, long value) { setFieldValue(fieldName, new LongValue(value)); } @@ -303,4 +307,12 @@ public boolean isDefined(String fieldName) { return getValue(fieldName) != null; } + + public FieldValue copy() { + FieldValue[] copies = new FieldValue[values.length]; + for (int i=0; i<copies.length; i++) { + copies[i] = values[i].copy(); + } + return new GroupValue(group, this.values); + } } Modified: trunk/src/org/openfast/Message.java =================================================================== --- trunk/src/org/openfast/Message.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/Message.java 2007-10-29 01:07:21 UTC (rev 83) @@ -91,4 +91,12 @@ public MessageTemplate getTemplate() { return template; } + + public FieldValue copy() { + FieldValue[] copies = new FieldValue[values.length]; + for (int i=0; i<copies.length; i++) { + copies[i] = values[i].copy(); + } + return new Message(template, this.values); + } } Modified: trunk/src/org/openfast/ScalarValue.java =================================================================== --- trunk/src/org/openfast/ScalarValue.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/ScalarValue.java 2007-10-29 01:07:21 UTC (rev 83) @@ -59,6 +59,10 @@ public boolean equalsValue(String defaultValue) { return false; } + + public FieldValue copy() { + return this; // immutable objects don't need actual copies. + } /** * Modified: trunk/src/org/openfast/SequenceValue.java =================================================================== --- trunk/src/org/openfast/SequenceValue.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/SequenceValue.java 2007-10-29 01:07:21 UTC (rev 83) @@ -123,4 +123,12 @@ public GroupValue[] getValues() { return (GroupValue[]) this.elements.toArray(new GroupValue[elements.size()]); } + + public FieldValue copy() { + SequenceValue value = new SequenceValue(this.sequence); + for (int i=0; i<elements.size(); i++) { + value.add((GroupValue) ((GroupValue)elements.get(i)).copy()); + } + return value; + } } Modified: trunk/src/org/openfast/codec/FastDecoder.java =================================================================== --- trunk/src/org/openfast/codec/FastDecoder.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/codec/FastDecoder.java 2007-10-29 01:07:21 UTC (rev 83) @@ -65,11 +65,6 @@ context.setLastTemplateId(templateId); - if (context.isTraceEnabled()) { - context.encodeTrace.groupStarted(template); - context.encodeTrace.pmap(pmap.getBytes()); - } - return template.decode(in, templateId, presenceMapReader, context); } Copied: trunk/src/org/openfast/debug/BasicDecodeTrace.java (from rev 75, trunk/src/org/openfast/debug/DecodeTrace.java) =================================================================== --- trunk/src/org/openfast/debug/BasicDecodeTrace.java (rev 0) +++ trunk/src/org/openfast/debug/BasicDecodeTrace.java 2007-10-29 01:07:21 UTC (rev 83) @@ -0,0 +1,44 @@ +package org.openfast.debug; + +import org.openfast.ByteUtil; +import org.openfast.FieldValue; +import org.openfast.template.Field; +import org.openfast.template.Group; + +public class BasicDecodeTrace implements Trace { + private String indent = ""; + + public void groupStart(Group group) { + print(group); + moveDown(); + } + + private void moveDown() { + indent += " "; + } + + private void moveUp() { + indent = indent.substring(0, indent.length()-2); + } + + private void print(Object object) { + System.out.print(indent); + System.out.println(object); + } + + public void groupEnd() { + moveUp(); + } + + public void field(Field field, FieldValue value, FieldValue decodedValue, byte[] encoding, int pmapIndex) { + StringBuilder scalarDecode = new StringBuilder(); + scalarDecode.append(field.getName()).append(": "); + scalarDecode.append(ByteUtil.convertByteArrayToBitString(encoding)); + scalarDecode.append(" -> ").append(value).append('(').append(decodedValue).append(')'); + print(scalarDecode); + } + + public void pmap(byte[] bytes) { + print("PMAP: " + ByteUtil.convertByteArrayToBitString(bytes)); + } +} Copied: trunk/src/org/openfast/debug/BasicEncodeTrace.java (from rev 76, trunk/src/org/openfast/debug/EncodeTrace.java) =================================================================== --- trunk/src/org/openfast/debug/BasicEncodeTrace.java (rev 0) +++ trunk/src/org/openfast/debug/BasicEncodeTrace.java 2007-10-29 01:07:21 UTC (rev 83) @@ -0,0 +1,115 @@ +package org.openfast.debug; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + +import org.openfast.ByteUtil; +import org.openfast.FieldValue; +import org.openfast.template.Field; +import org.openfast.template.Group; + +public class BasicEncodeTrace implements Trace { + + private Stack stack = new Stack(); + + public void groupStart(Group group) { + TraceGroup traceGroup = new TraceGroup(group); + if (!stack.isEmpty()) + ((TraceGroup)stack.peek()).addGroup(traceGroup); + stack.push(traceGroup); + } + + public void field(Field field, FieldValue value, FieldValue encoded, byte[] encoding, int pmapIndex) { + ((TraceGroup)stack.peek()).addField(field, value, encoded, pmapIndex, encoding); + } + + public void groupEnd() { + TraceGroup group = (TraceGroup) stack.pop(); + if (stack.isEmpty()) { + System.out.println(group); + } + } + + public void pmap(byte[] pmap) { + ((TraceGroup)stack.peek()).setPmap(pmap); + } + + private class TraceGroup implements TraceNode { + + private List nodes; + private byte[] pmap; + private Group group; + + public TraceGroup(Group group) { + this.group = group; + this.nodes = new ArrayList(group.getFieldCount()); + } + + public void setPmap(byte[] pmap) { + this.pmap = pmap; + } + + public void addField(Field field, FieldValue value, FieldValue encoded, int fieldIndex, byte[] encoding) { + nodes.add(new TraceField(field, value, encoded, fieldIndex, encoding)); + } + + public void addGroup(TraceGroup traceGroup) { + nodes.add(traceGroup); + } + + public StringBuilder serialize(StringBuilder builder, int indent) { + builder.append(indent(indent)).append(group.getName()).append("\n"); + indent +=2; + if (pmap != null) + builder.append(indent(indent)).append("PMAP: ").append(ByteUtil.convertByteArrayToBitString(pmap)).append("\n"); + for (int i=0; i<nodes.size(); i++) { + ((TraceNode) nodes.get(i)).serialize(builder, indent); + } + indent -=2; + return builder; + } + + public String toString() { + return serialize(new StringBuilder(), 0).toString(); + } + } + + private class TraceField implements TraceNode { + private Field field; + private int pmapIndex; + private byte[] encoding; + private FieldValue value; + private FieldValue encoded; + + public TraceField(Field field, FieldValue value, FieldValue encoded, int pmapIndex, byte[] encoding) { + this.field = field; + this.value = value; + this.encoded = encoded; + this.pmapIndex = pmapIndex; + this.encoding = encoding; + } + + public StringBuilder serialize(StringBuilder builder, int indent) { + builder.append(indent(indent)); + builder.append(field.getName()).append("["); + if (field.usesPresenceMapBit()) + builder.append("pmapIndex:").append(pmapIndex); + builder.append("]: ").append(value).append(" = ").append(encoded).append(" -> "); + builder.append(ByteUtil.convertByteArrayToBitString(encoding)); + builder.append("\n"); + return builder; + } + } + + private interface TraceNode { + StringBuilder serialize(StringBuilder builder, int indent); + } + + public String indent(int indent) { + String tab = ""; + for (int i=0; i<indent; i++) + tab += " "; + return tab; + } +} Deleted: trunk/src/org/openfast/debug/BasicTrace.java =================================================================== --- trunk/src/org/openfast/debug/BasicTrace.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/debug/BasicTrace.java 2007-10-29 01:07:21 UTC (rev 83) @@ -1,22 +0,0 @@ -package org.openfast.debug; - -public class BasicTrace { - - protected static final String INDENT_SIZE = " "; - protected String indent = ""; - protected byte[] pmap; - - - protected void moveDown() { - indent += INDENT_SIZE; - } - - protected void moveUp() { - indent = indent.substring(0, indent.length() - INDENT_SIZE.length()); - } - - protected void print(Object object) { - System.out.print(indent); - System.out.println(object); - } -} Deleted: trunk/src/org/openfast/debug/DecodeTrace.java =================================================================== --- trunk/src/org/openfast/debug/DecodeTrace.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/debug/DecodeTrace.java 2007-10-29 01:07:21 UTC (rev 83) @@ -1,49 +0,0 @@ -package org.openfast.debug; - -import java.util.HashMap; -import java.util.Map; - -import org.openfast.GroupValue; -import org.openfast.ScalarValue; -import org.openfast.template.Group; -import org.openfast.template.Scalar; -import org.openfast.template.operator.Operator; - -public class DecodeTrace extends BasicTrace { - - - private static final Map OPERATOR_SYMBOLS = new HashMap(); - static { - OPERATOR_SYMBOLS.put(Operator.DELTA, "+"); - OPERATOR_SYMBOLS.put(Operator.COPY, "="); - OPERATOR_SYMBOLS.put(Operator.DEFAULT, "!"); - OPERATOR_SYMBOLS.put(Operator.INCREMENT, "++"); - OPERATOR_SYMBOLS.put(Operator.TAIL, "---"); - OPERATOR_SYMBOLS.put(Operator.CONSTANT, "@"); - OPERATOR_SYMBOLS.put(Operator.NONE, ","); - } - - public void groupStarted(Group group) { - print(group); - moveDown(); - } - - public void groupEnded(GroupValue groupValue) { - print(groupValue); - moveUp(); - } - - public void field(Scalar scalar, ScalarValue value, ScalarValue previousValue, ScalarValue decodedValue, byte[] buffer) { - StringBuilder scalarDecode = new StringBuilder(); - scalarDecode.append(scalar.getName()).append(": "); - if (previousValue == ScalarValue.UNDEFINED) - scalarDecode.append("_"); - else - scalarDecode.append(previousValue); - scalarDecode.append(' '); - scalarDecode.append(OPERATOR_SYMBOLS.get(scalar.getOperator())); - scalarDecode.append(' '); - scalarDecode.append(decodedValue).append(" -> ").append(value); - print(scalarDecode); - } -} Deleted: trunk/src/org/openfast/debug/EncodeTrace.java =================================================================== --- trunk/src/org/openfast/debug/EncodeTrace.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/debug/EncodeTrace.java 2007-10-29 01:07:21 UTC (rev 83) @@ -1,42 +0,0 @@ -package org.openfast.debug; - -import org.openfast.ByteUtil; -import org.openfast.GroupValue; -import org.openfast.template.Field; -import org.openfast.template.Group; - -public class EncodeTrace extends BasicTrace { - - private StringBuilder fieldEncodings; - - public void groupStart(GroupValue groupValue) { - print(groupValue); - fieldEncodings = new StringBuilder(); - moveDown(); - } - - public void field(Field field, int fieldIndex, int pmapIndex, byte[] encoding) { - fieldEncodings.append(indent); - fieldEncodings.append(field.getName()).append("[fieldIndex:").append(fieldIndex); - if (field.usesPresenceMapBit()) - fieldEncodings.append(", pmapIndex:").append(pmapIndex); - fieldEncodings.append("] = ").append(ByteUtil.convertByteArrayToBitString(encoding)); - fieldEncodings.append("\n"); - } - - public void groupEnd() { - print("PMAP: " + ByteUtil.convertByteArrayToBitString(pmap)); - System.out.println(fieldEncodings); - moveUp(); - } - - public void pmap(byte[] pmap) { - this.pmap = pmap; - } - - public void groupStarted(Group group) { - System.out.print(indent); - System.out.print(group); - } - -} Copied: trunk/src/org/openfast/debug/Trace.java (from rev 76, trunk/src/org/openfast/debug/EncodeTrace.java) =================================================================== --- trunk/src/org/openfast/debug/Trace.java (rev 0) +++ trunk/src/org/openfast/debug/Trace.java 2007-10-29 01:07:21 UTC (rev 83) @@ -0,0 +1,12 @@ +package org.openfast.debug; + +import org.openfast.FieldValue; +import org.openfast.template.Field; +import org.openfast.template.Group; + +public interface Trace { + void groupStart(Group group); + void groupEnd(); + void field(Field field, FieldValue value, FieldValue encoded, byte[] encoding, int pmapIndex); + void pmap(byte[] pmap); +} Modified: trunk/src/org/openfast/error/ErrorCode.java =================================================================== --- trunk/src/org/openfast/error/ErrorCode.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/error/ErrorCode.java 2007-10-29 01:07:21 UTC (rev 83) @@ -77,4 +77,11 @@ public String toString() { return shortName + ": " + description; } + + public boolean equals(Object obj) { + if (obj == this) return true; + if (obj == null || !(obj instanceof ErrorCode)) return false; + ErrorCode other = (ErrorCode) obj; + return other.code == this.code && other.getType().equals(this.getType()); + } } Modified: trunk/src/org/openfast/session/Session.java =================================================================== --- trunk/src/org/openfast/session/Session.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/session/Session.java 2007-10-29 01:07:21 UTC (rev 83) @@ -23,6 +23,7 @@ package org.openfast.session; import java.io.IOException; +import java.net.SocketException; import org.openfast.Context; import org.openfast.Message; @@ -32,12 +33,13 @@ import org.openfast.error.ErrorCode; import org.openfast.error.ErrorHandler; import org.openfast.error.FastConstants; +import org.openfast.error.FastException; import org.openfast.template.MessageTemplate; import org.openfast.template.TemplateRegistry; public class Session implements ErrorHandler { - private ErrorHandler errorHandler = ErrorHandler.NULL; + private ErrorHandler errorHandler = ErrorHandler.DEFAULT; public final MessageInputStream in; public final MessageOutputStream out; @@ -48,6 +50,7 @@ private MessageListener messageListener; private boolean listening; private Thread listeningThread; + private SessionListener sessionListener = SessionListener.NULL; public Session(Connection connection, SessionProtocol protocol) { Context inContext = new Context(); @@ -67,11 +70,22 @@ protocol.configureSession(this); } + // INITIATOR public void close() throws FastConnectionException { + listening = false; + out.writeMessage(protocol.getCloseMessage()); in.close(); out.close(); } + // RESPONDER + public void close(ErrorCode alertCode) { + listening = false; + in.close(); + out.close(); + sessionListener.onClose(); + } + public void setClient(Client client) { this.client = client; } @@ -122,18 +136,33 @@ Runnable messageReader = new Runnable() { public void run() { while (listening) { - Message message = in.readMessage(); - if (message == null) { - listening = false; - break; + try { + Message message = in.readMessage(); + + if (message == null) { + listening = false; + break; + } + if (protocol.isProtocolMessage(message)) { + protocol.handleMessage(Session.this, message); + } else if (messageListener != null) { + messageListener.onMessage(message); + } else { + throw new IllegalStateException("Received non-protocol message without a message listener."); + } + } catch (Exception e) { + Throwable cause = e.getCause(); + + if (cause != null && cause.getClass().equals(SocketException.class) && + cause.getMessage().equals("Socket closed")) { + listening = false; + } else if (e instanceof FastException) { + FastException fastException = ((FastException) e); + errorHandler.error(fastException.getCode(), fastException.getMessage()); + } else { + errorHandler.error(FastConstants.GENERAL_ERROR, e.getMessage(), e); + } } - if (protocol.isProtocolMessage(message)) { - protocol.handleMessage(Session.this, message); - } else if (messageListener != null) { - messageListener.onMessage(message); - } else { - throw new IllegalStateException("Received non-protocol message without a message listener."); - } } }}; listeningThread = new Thread(messageReader, "FAST Session Message Reader"); @@ -168,11 +197,19 @@ public void addDynamicTemplateDefinition(MessageTemplate template) { in.getTemplateRegistry().define(template); + out.getTemplateRegistry().define(template); } public void registerDynamicTemplate(QName templateName, int id) { if (!in.getTemplateRegistry().isDefined(templateName)) throw new IllegalStateException("Template " + templateName + " has not been defined."); in.getTemplateRegistry().register(id, templateName); + if (!out.getTemplateRegistry().isDefined(templateName)) + throw new IllegalStateException("Template " + templateName + " has not been defined."); + out.getTemplateRegistry().register(id, templateName); } + + public void setSessionListener(SessionListener sessionListener) { + this.sessionListener = sessionListener; + } } Modified: trunk/src/org/openfast/session/SessionConstants.java =================================================================== --- trunk/src/org/openfast/session/SessionConstants.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/session/SessionConstants.java 2007-10-29 01:07:21 UTC (rev 83) @@ -36,6 +36,7 @@ ErrorCode TEMPLATE_UNKNOWN = new ErrorCode(SESSION, 12, "TUNKNOWN", "Template unknown", FastAlertSeverity.ERROR); ErrorCode UNAUTHORIZED = new ErrorCode(SESSION, 13, "EAUTH", "Unauthorized", FastAlertSeverity.FATAL); ErrorCode PROTCOL_ERROR = new ErrorCode(SESSION, 14, "EPROTO", "Protocol Error", FastAlertSeverity.ERROR); + ErrorCode CLOSE = new ErrorCode(SESSION, 15, "CLOSE", "Session Closed", FastAlertSeverity.INFO); ErrorCode UNDEFINED = new ErrorCode(SESSION, -1, "UNDEFINED", "Undefined Alert Code", FastAlertSeverity.ERROR); SessionProtocol SCP_1_0 = new SessionControlProtocol_1_0(); Modified: trunk/src/org/openfast/session/SessionControlProtocol_1_0.java =================================================================== --- trunk/src/org/openfast/session/SessionControlProtocol_1_0.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/session/SessionControlProtocol_1_0.java 2007-10-29 01:07:21 UTC (rev 83) @@ -113,4 +113,8 @@ public Message createTemplateDefinitionMessage(MessageTemplate messageTemplate) { return null; } + + public Message getCloseMessage() { + return createFastAlertMessage(SessionConstants.CLOSE); + } } Modified: trunk/src/org/openfast/session/SessionControlProtocol_1_1.java =================================================================== --- trunk/src/org/openfast/session/SessionControlProtocol_1_1.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/session/SessionControlProtocol_1_1.java 2007-10-29 01:07:21 UTC (rev 83) @@ -195,11 +195,9 @@ public final static MessageTemplate FAST_ALERT_TEMPLATE = new MessageTemplate("", new Field[] { - new Scalar("Severity", Type.U32, Operator.NONE, - ScalarValue.UNDEFINED, false), + new Scalar("Severity", Type.U32, Operator.NONE, ScalarValue.UNDEFINED, false), new Scalar("Code", Type.U32, Operator.NONE, ScalarValue.UNDEFINED, false), - new Scalar("Value", Type.U32, Operator.NONE, - ScalarValue.UNDEFINED, true), + new Scalar("Value", Type.U32, Operator.NONE, ScalarValue.UNDEFINED, true), new Scalar("Description", Type.ASCII, Operator.NONE, ScalarValue.UNDEFINED, false), }); public final static MessageTemplate FAST_HELLO_TEMPLATE = new MessageTemplate("", @@ -230,7 +228,12 @@ private static final SessionMessageHandler ALERT_HANDLER = new SessionMessageHandler() { public void handleMessage(Session session, Message message) { - session.getErrorHandler().error(ErrorCode.getAlertCode(message), message.getString(4)); + ErrorCode alertCode = ErrorCode.getAlertCode(message); + if (alertCode.equals(SessionConstants.CLOSE)) { + session.close(alertCode); + } else { + session.getErrorHandler().error(alertCode, message.getString(4)); + } } }; @@ -254,12 +257,13 @@ }); private static final MessageTemplate OTHER = new MessageTemplate(new QName("Other", NAMESPACE), new Field[] { + new Group(qualify("Other"), new Field[] { new Sequence(qualify("ForeignAttributes"), new Field[]{ new StaticTemplateReference(ATTRIBUTE) }, true), new Sequence(qualify("ForeignElements"), new Field[]{ new StaticTemplateReference(ELEMENT) - }, true) + }, true) }, true) }); private static final MessageTemplate TEMPLATE_NAME = new MessageTemplate(new QName("TemplateName", NAMESPACE), new Field[] { @@ -488,7 +492,7 @@ } private static final TemplateRegistry TEMPLATE_REGISTRY = new BasicTemplateRegistry(); - + static { TEMPLATE_REGISTRY.register(FAST_HELLO_TEMPLATE_ID, FAST_HELLO_TEMPLATE); TEMPLATE_REGISTRY.register(FAST_ALERT_TEMPLATE_ID, FAST_ALERT_TEMPLATE); @@ -533,4 +537,10 @@ } } } + + public Message getCloseMessage() { + return CLOSE; + } + + private static final Message CLOSE = createFastAlertMessage(SessionConstants.CLOSE); } Added: trunk/src/org/openfast/session/SessionListener.java =================================================================== --- trunk/src/org/openfast/session/SessionListener.java (rev 0) +++ trunk/src/org/openfast/session/SessionListener.java 2007-10-29 01:07:21 UTC (rev 83) @@ -0,0 +1,9 @@ +package org.openfast.session; + +public interface SessionListener { + SessionListener NULL = new SessionListener() { + public void onClose() { + }}; + + void onClose(); +} Modified: trunk/src/org/openfast/session/SessionProtocol.java =================================================================== --- trunk/src/org/openfast/session/SessionProtocol.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/session/SessionProtocol.java 2007-10-29 01:07:21 UTC (rev 83) @@ -18,4 +18,5 @@ public boolean supportsTemplateExchange(); public Message createTemplateDefinitionMessage(MessageTemplate messageTemplate); public Message createTemplateDeclarationMessage(MessageTemplate messageTemplate, int templateId); + public Message getCloseMessage(); } Modified: trunk/src/org/openfast/session/template/exchange/AbstractFieldInstructionConverter.java =================================================================== --- trunk/src/org/openfast/session/template/exchange/AbstractFieldInstructionConverter.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/session/template/exchange/AbstractFieldInstructionConverter.java 2007-10-29 01:07:21 UTC (rev 83) @@ -32,7 +32,7 @@ GroupValue operatorMessage = new Message(operatorTemplate); if (!scalar.getDictionary().equals(Dictionary.GLOBAL)) operatorMessage.setString("Dictionary", scalar.getDictionary()); - if (!scalar.getKey().equals(scalar.getName())) { + if (!scalar.getKey().equals(scalar.getQName())) { Group key = operatorTemplate.getGroup("Key"); GroupValue keyValue = new GroupValue(key); keyValue.setString("Name", scalar.getKey().getName()); Modified: trunk/src/org/openfast/session/template/exchange/ComposedDecimalConverter.java =================================================================== --- trunk/src/org/openfast/session/template/exchange/ComposedDecimalConverter.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/session/template/exchange/ComposedDecimalConverter.java 2007-10-29 01:07:21 UTC (rev 83) @@ -60,8 +60,8 @@ GroupValue componentOperatorGroup = new GroupValue(componentGroup.getGroup("Operator")); componentDef.setFieldValue("Operator", componentOperatorGroup); componentOperatorGroup.setFieldValue(0, componentOperatorDef); - if (!component.getInitialValue().isUndefined()) - componentDef.setInteger("InitialValue", component.getInitialValue().toInt()); + if (!component.getDefaultValue().isUndefined()) + componentDef.setInteger("InitialValue", component.getDefaultValue().toInt()); return componentDef; } Modified: trunk/src/org/openfast/session/template/exchange/GroupConverter.java =================================================================== --- trunk/src/org/openfast/session/template/exchange/GroupConverter.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/session/template/exchange/GroupConverter.java 2007-10-29 01:07:21 UTC (rev 83) @@ -20,7 +20,10 @@ } public GroupValue convert(Field field, ConversionContext context) { - return convert((Group) field, new Message(SessionControlProtocol_1_1.GROUP_INSTR), context); + Group group = (Group) field; + Message groupMsg = convert(group, new Message(SessionControlProtocol_1_1.GROUP_INSTR), context); + groupMsg.setBool("Optional", field.isOptional()); + return groupMsg; } public boolean shouldConvert(Field field) { Modified: trunk/src/org/openfast/session/template/exchange/ScalarConverter.java =================================================================== --- trunk/src/org/openfast/session/template/exchange/ScalarConverter.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/session/template/exchange/ScalarConverter.java 2007-10-29 01:07:21 UTC (rev 83) @@ -19,6 +19,30 @@ public class ScalarConverter extends AbstractFieldInstructionConverter { + private final Map/*<Type, MessageTemplate>*/ TYPE_TEMPLATE_MAP = new HashMap(); + private final Map/*<Type, MessageTemplate>*/ TEMPLATE_TYPE_MAP = new HashMap(); + + public ScalarConverter() { + TYPE_TEMPLATE_MAP.put(Type.I32, SessionControlProtocol_1_1.INT32_INSTR); + TYPE_TEMPLATE_MAP.put(Type.U32, SessionControlProtocol_1_1.UINT32_INSTR); + TYPE_TEMPLATE_MAP.put(Type.I64, SessionControlProtocol_1_1.INT64_INSTR); + TYPE_TEMPLATE_MAP.put(Type.U64, SessionControlProtocol_1_1.UINT64_INSTR); + TYPE_TEMPLATE_MAP.put(Type.DECIMAL, SessionControlProtocol_1_1.DECIMAL_INSTR); + TYPE_TEMPLATE_MAP.put(Type.UNICODE, SessionControlProtocol_1_1.UNICODE_INSTR); + TYPE_TEMPLATE_MAP.put(Type.ASCII, SessionControlProtocol_1_1.ASCII_INSTR); + TYPE_TEMPLATE_MAP.put(Type.STRING, SessionControlProtocol_1_1.ASCII_INSTR); + TYPE_TEMPLATE_MAP.put(Type.BYTE_VECTOR, SessionControlProtocol_1_1.BYTE_VECTOR_INSTR); + + TEMPLATE_TYPE_MAP.put(SessionControlProtocol_1_1.INT32_INSTR, Type.I32); + TEMPLATE_TYPE_MAP.put(SessionControlProtocol_1_1.UINT32_INSTR, Type.U32); + TEMPLATE_TYPE_MAP.put(SessionControlProtocol_1_1.INT64_INSTR, Type.I64); + TEMPLATE_TYPE_MAP.put(SessionControlProtocol_1_1.UINT64_INSTR, Type.U64); + TEMPLATE_TYPE_MAP.put(SessionControlProtocol_1_1.DECIMAL_INSTR, Type.DECIMAL); + TEMPLATE_TYPE_MAP.put(SessionControlProtocol_1_1.UNICODE_INSTR, Type.UNICODE); + TEMPLATE_TYPE_MAP.put(SessionControlProtocol_1_1.ASCII_INSTR, Type.ASCII); + TEMPLATE_TYPE_MAP.put(SessionControlProtocol_1_1.BYTE_VECTOR_INSTR, Type.BYTE_VECTOR); + } + public Field convert(GroupValue fieldDef, TemplateRegistry templateRegistry, ConversionContext context) { Type type = (Type) TEMPLATE_TYPE_MAP.get(fieldDef.getGroup()); boolean optional = fieldDef.getBool("Optional"); @@ -51,8 +75,8 @@ scalarMsg.setInteger("Optional", scalar.isOptional() ? 1 : 0); if (!scalar.getOperator().equals(Operator.NONE)) scalarMsg.setFieldValue("Operator", new GroupValue(scalarTemplate.getGroup("Operator"), new FieldValue[] { createOperator(scalar) })); - if (!scalar.getInitialValue().isUndefined()) - scalarMsg.setFieldValue("InitialValue", scalar.getInitialValue()); + if (!scalar.getDefaultValue().isUndefined()) + scalarMsg.setFieldValue("InitialValue", scalar.getDefaultValue()); return scalarMsg; } @@ -63,28 +87,4 @@ public boolean shouldConvert(Field field) { return field.getClass().equals(Scalar.class); } - - private static final Map/*<Type, MessageTemplate>*/ TYPE_TEMPLATE_MAP = new HashMap(); - private static final Map/*<Type, MessageTemplate>*/ TEMPLATE_TYPE_MAP = new HashMap(); - - static { - TYPE_TEMPLATE_MAP.put(Type.I32, SessionControlProtocol_1_1.INT32_INSTR); - TYPE_TEMPLATE_MAP.put(Type.U32, SessionControlProtocol_1_1.UINT32_INSTR); - TYPE_TEMPLATE_MAP.put(Type.I64, SessionControlProtocol_1_1.INT64_INSTR); - TYPE_TEMPLATE_MAP.put(Type.U64, SessionControlProtocol_1_1.UINT64_INSTR); - TYPE_TEMPLATE_MAP.put(Type.DECIMAL, SessionControlProtocol_1_1.DECIMAL_INSTR); - TYPE_TEMPLATE_MAP.put(Type.UNICODE, SessionControlProtocol_1_1.UNICODE_INSTR); - TYPE_TEMPLATE_MAP.put(Type.ASCII, SessionControlProtocol_1_1.ASCII_INSTR); - TYPE_TEMPLATE_MAP.put(Type.STRING, SessionControlProtocol_1_1.ASCII_INSTR); - TYPE_TEMPLATE_MAP.put(Type.BYTE_VECTOR, SessionControlProtocol_1_1.BYTE_VECTOR_INSTR); - - TEMPLATE_TYPE_MAP.put(SessionControlProtocol_1_1.INT32_INSTR, Type.I32); - TEMPLATE_TYPE_MAP.put(SessionControlProtocol_1_1.UINT32_INSTR, Type.U32); - TEMPLATE_TYPE_MAP.put(SessionControlProtocol_1_1.INT64_INSTR, Type.I64); - TEMPLATE_TYPE_MAP.put(SessionControlProtocol_1_1.UINT64_INSTR, Type.U64); - TEMPLATE_TYPE_MAP.put(SessionControlProtocol_1_1.DECIMAL_INSTR, Type.DECIMAL); - TEMPLATE_TYPE_MAP.put(SessionControlProtocol_1_1.UNICODE_INSTR, Type.UNICODE); - TEMPLATE_TYPE_MAP.put(SessionControlProtocol_1_1.ASCII_INSTR, Type.ASCII); - TEMPLATE_TYPE_MAP.put(SessionControlProtocol_1_1.BYTE_VECTOR_INSTR, Type.BYTE_VECTOR); - } } Modified: trunk/src/org/openfast/session/template/exchange/SequenceConverter.java =================================================================== --- trunk/src/org/openfast/session/template/exchange/SequenceConverter.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/session/template/exchange/SequenceConverter.java 2007-10-29 01:07:21 UTC (rev 83) @@ -50,6 +50,7 @@ public GroupValue convert(Field field, ConversionContext context) { Sequence sequence = (Sequence) field; Message seqDef = GroupConverter.convert(sequence.getGroup(), new Message(SessionControlProtocol_1_1.SEQUENCE_INSTR), context); + seqDef.setBool("Optional", sequence.isOptional()); if (!sequence.isImplicitLength()) { Group lengthGroup = SessionControlProtocol_1_1.SEQUENCE_INSTR.getGroup("Length"); GroupValue lengthDef = new GroupValue(lengthGroup); @@ -65,8 +66,8 @@ lengthDef.setFieldValue("Operator", operatorDef); } - if (!length.getInitialValue().isUndefined()) { - lengthDef.setFieldValue("InitialValue", length.getInitialValue()); + if (!length.getDefaultValue().isUndefined()) { + lengthDef.setFieldValue("InitialValue", length.getDefaultValue()); } } return seqDef; Modified: trunk/src/org/openfast/template/ComposedScalar.java =================================================================== --- trunk/src/org/openfast/template/ComposedScalar.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/template/ComposedScalar.java 2007-10-29 01:07:21 UTC (rev 83) @@ -94,7 +94,7 @@ if (!other.fields[i].getTypeCodec().equals(fields[i].getTypeCodec())) return false; if (!other.fields[i].getOperator().equals(fields[i].getOperator())) return false; if (!other.fields[i].getOperatorCodec().equals(fields[i].getOperatorCodec())) return false; - if (!other.fields[i].getInitialValue().equals(fields[i].getInitialValue())) return false; + if (!other.fields[i].getDefaultValue().equals(fields[i].getDefaultValue())) return false; if (!other.fields[i].getDictionary().equals(fields[i].getDictionary())) return false; } return true; Modified: trunk/src/org/openfast/template/Group.java =================================================================== --- trunk/src/org/openfast/template/Group.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/template/Group.java 2007-10-29 01:07:21 UTC (rev 83) @@ -152,7 +152,7 @@ GroupValue groupValue = (GroupValue) value; if (context.isTraceEnabled()) { - context.encodeTrace.groupStart(groupValue); + context.getEncodeTrace().groupStart(this); } BitVectorBuilder presenceMapBuilder = new BitVectorBuilder(fields.length); try { @@ -161,10 +161,9 @@ for (int fieldIndex = 0; fieldIndex < fields.length; fieldIndex++) { FieldValue fieldValue = groupValue.getValue(fieldIndex); Field field = getField(fieldIndex); + if (!field.isOptional() && fieldValue == null) + Global.handleError(FastConstants.GENERAL_ERROR, "Mandatory field " + field + " is null"); byte[] encoding = field.encode(fieldValue, template, context, presenceMapBuilder); - if (context.isTraceEnabled() && encoding.length > 0) { - context.encodeTrace.field(field, fieldIndex, presenceMapBuilder.getIndex(), encoding); - } fieldEncodings[fieldIndex] = encoding; } ByteArrayOutputStream buffer = new ByteArrayOutputStream(); @@ -172,7 +171,7 @@ if (usesPresenceMap()) { byte[] pmap = presenceMapBuilder.getBitVector().getTruncatedBytes(); if (context.isTraceEnabled()) - context.encodeTrace.pmap(pmap); + context.getEncodeTrace().pmap(pmap); buffer.write(pmap); } for (int i = 0; i < fieldEncodings.length; i++) { @@ -181,7 +180,7 @@ } } if (context.isTraceEnabled()) - context.encodeTrace.groupEnd(); + context.getEncodeTrace().groupEnd(); return buffer.toByteArray(); } catch (IOException e) { throw new RuntimeException(e); @@ -199,11 +198,12 @@ public FieldValue decode(InputStream in, Group group, Context context, BitVectorReader pmapReader) { try { if (!usesPresenceMapBit() || pmapReader.read()) { - if (context.isTraceEnabled()) - context.decodeTrace.groupStarted(group); + if (context.isTraceEnabled()) { + context.getDecodeTrace().groupStart(this); + } GroupValue groupValue = new GroupValue(this, decodeFieldValues(in, group, context)); if (context.isTraceEnabled()) - context.decodeTrace.groupEnded(groupValue); + context.getDecodeTrace().groupEnd(); return groupValue; } else return null; @@ -224,6 +224,8 @@ protected FieldValue[] decodeFieldValues(InputStream in, Group template, Context context) { if (usesPresenceMap()) { BitVector pmap = ((BitVectorValue) TypeCodec.BIT_VECTOR.decode(in)).value; + if (context.isTraceEnabled()) + context.getDecodeTrace().pmap(pmap.getBytes()); if (pmap.isOverlong()) Global.handleError(FastConstants.R7_PMAP_OVERLONG, "The presence map " + pmap + " for the group " + this + " is overlong."); return decodeFieldValues(in, template, new BitVectorReader(pmap), context); Modified: trunk/src/org/openfast/template/MessageTemplate.java =================================================================== --- trunk/src/org/openfast/template/MessageTemplate.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/template/MessageTemplate.java 2007-10-29 01:07:21 UTC (rev 83) @@ -103,13 +103,13 @@ public Message decode(InputStream in, int templateId, BitVectorReader presenceMapReader, Context context) { try { if (context.isTraceEnabled()) - context.decodeTrace.groupStarted(this); + context.getDecodeTrace().groupStart(this); FieldValue[] fieldValues = super.decodeFieldValues(in, this, presenceMapReader, context); fieldValues[0] = new IntegerValue(templateId); Message message = new Message(this, fieldValues); if (context.isTraceEnabled()) - context.decodeTrace.groupEnded(message); + context.getDecodeTrace().groupEnd(); return message; } catch (FastException e) { throw new FastException("An error occurred while decoding " + this, e.getCode(), e); Modified: trunk/src/org/openfast/template/Scalar.java =================================================================== --- trunk/src/org/openfast/template/Scalar.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/template/Scalar.java 2007-10-29 01:07:21 UTC (rev 83) @@ -148,7 +148,12 @@ return new byte[0]; } - return typeCodec.encode(valueToEncode); + byte[] encoding = typeCodec.encode(valueToEncode); + + if (context.isTraceEnabled() && encoding.length > 0) { + context.getEncodeTrace().field(this, fieldValue, valueToEncode, encoding, presenceMapBuilder.getIndex()); + } + return encoding; } /** @@ -211,10 +216,14 @@ */ public FieldValue decode(InputStream in, Group template, Context context, BitVectorReader presenceMapReader) { try { - ScalarValue previousValue = context.lookup( getDictionary(), template, getKey()); - validateDictionaryTypeAgainstFieldType(previousValue, this.type); + ScalarValue previousValue = null; + if (operator.usesDictionary()) { + previousValue = context.lookup( getDictionary(), template, getKey()); + validateDictionaryTypeAgainstFieldType(previousValue, this.type); + } ScalarValue value; + int pmapIndex = presenceMapReader.getIndex(); if (isPresent(presenceMapReader)) { if (context.isTraceEnabled()) in = new RecordingInputStream(in); @@ -226,7 +235,7 @@ value = decodeValue(decodedValue, previousValue); if (context.isTraceEnabled()) - context.decodeTrace.field(this, value, previousValue, decodedValue, ((RecordingInputStream) in).getBuffer()); + context.getDecodeTrace().field(this, value, decodedValue, ((RecordingInputStream) in).getBuffer(), pmapIndex); } else { value = decode(previousValue); } @@ -308,7 +317,7 @@ * * @return Returns the initialValue of the current ScalarValue object */ - public ScalarValue getInitialValue() { + public ScalarValue getBaseValue() { return initialValue; } Modified: trunk/src/org/openfast/template/operator/DeltaDecimalOperatorCodec.java =================================================================== --- trunk/src/org/openfast/template/operator/DeltaDecimalOperatorCodec.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/template/operator/DeltaDecimalOperatorCodec.java 2007-10-29 01:07:21 UTC (rev 83) @@ -83,7 +83,7 @@ if (priorVal.isUndefined()) { if (field.getDefaultValue().isUndefined()) { - priorValue = (DecimalValue) field.getInitialValue(); + priorValue = (DecimalValue) field.getBaseValue(); } else if (val == null) { if (field.isOptional()) { return ScalarValue.NULL; Modified: trunk/src/org/openfast/template/operator/DeltaIntegerOperatorCodec.java =================================================================== --- trunk/src/org/openfast/template/operator/DeltaIntegerOperatorCodec.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/template/operator/DeltaIntegerOperatorCodec.java 2007-10-29 01:07:21 UTC (rev 83) @@ -34,7 +34,7 @@ } if (priorValue.isUndefined()) { - priorValue = field.getInitialValue(); + priorValue = field.getBaseValue(); } return ((NumericValue) value).subtract((NumericValue) priorValue); @@ -53,7 +53,7 @@ if (previousValue.isUndefined()) { if (field.getDefaultValue().isUndefined()) { - previousValue = field.getInitialValue(); + previousValue = field.getBaseValue(); } else { previousValue = field.getDefaultValue(); } Modified: trunk/src/org/openfast/template/operator/DeltaStringOperatorCodec.java =================================================================== --- trunk/src/org/openfast/template/operator/DeltaStringOperatorCodec.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/template/operator/DeltaStringOperatorCodec.java 2007-10-29 01:07:21 UTC (rev 83) @@ -59,8 +59,7 @@ return null; } - ScalarValue base = (priorValue.isUndefined()) ? field.getInitialValue() - : priorValue; + ScalarValue base = (priorValue.isUndefined()) ? field.getBaseValue() : priorValue; return Util.getDifference((StringValue) value, (StringValue) base); } @@ -79,8 +78,7 @@ } TwinValue diffValue = (TwinValue) newValue; - ScalarValue base = (previousValue.isUndefined()) - ? field.getInitialValue() : previousValue; + ScalarValue base = (previousValue.isUndefined()) ? field.getBaseValue() : previousValue; if (diffValue.first.toInt() > base.toString().length()) { Global.handleError(FastConstants.D7_SUBTRCTN_LEN_LONG, "The string diff <" + diffValue + "> cannot be applied to the base value \"" + base + "\" because the subtraction length is too long."); Modified: trunk/src/org/openfast/template/operator/Operator.java =================================================================== --- trunk/src/org/openfast/template/operator/Operator.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/template/operator/Operator.java 2007-10-29 01:07:21 UTC (rev 83) @@ -15,7 +15,15 @@ private static final Map OPERATOR_NAME_MAP = new HashMap(); private final String name; - public static final Operator NONE = new Operator("none"); + public static final Operator NONE = new Operator("none") { + private static final long serialVersionUID = 2L; + public boolean usesDictionary() { + return false; + } + public boolean shouldStoreValue(ScalarValue value) { + return false; + } + }; public static final Operator CONSTANT = new Operator("constant") { private static final long serialVersionUID = 1L; @@ -92,4 +100,8 @@ public int hashCode() { return name.hashCode(); } + + public boolean usesDictionary() { + return true; + } } Modified: trunk/src/org/openfast/template/operator/TailOperatorCodec.java =================================================================== --- trunk/src/org/openfast/template/operator/TailOperatorCodec.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/src/org/openfast/template/operator/TailOperatorCodec.java 2007-10-29 01:07:21 UTC (rev 83) @@ -56,7 +56,7 @@ return null; } else if ((previousValue == null) || previousValue.isUndefined()) { - base = (StringValue) field.getInitialValue(); + base = (StringValue) field.getBaseValue(); } else { base = (StringValue) previousValue; } @@ -79,7 +79,7 @@ public ScalarValue decodeEmptyValue(ScalarValue previousValue, Scalar field) { if (previousValue.isUndefined()) { - return field.getInitialValue(); + return field.getBaseValue(); } return previousValue; Modified: trunk/test/acceptance/org/openfast/TypeConversionTest.java =================================================================== --- trunk/test/acceptance/org/openfast/TypeConversionTest.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/test/acceptance/org/openfast/TypeConversionTest.java 2007-10-29 01:07:21 UTC (rev 83) @@ -26,6 +26,7 @@ message.setString("short", "-5"); message.setString("long", "1000000000000000000"); message.setString("bytevector", "abcd"); + message.setString("decimal", "2.3"); FastEncoder encoder = encoder(template); Modified: trunk/test/acceptance/org/openfast/session/SCP_1_1_Test.java =================================================================== --- trunk/test/acceptance/org/openfast/session/SCP_1_1_Test.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/test/acceptance/org/openfast/session/SCP_1_1_Test.java 2007-10-29 01:07:21 UTC (rev 83) @@ -13,7 +13,7 @@ import org.openfast.util.RecordingOutputStream; public class SCP_1_1_Test extends TestCase { - private static final int MAX_TIMEOUT = 2000; + private static final int MAX_TIMEOUT = 15000; private LocalEndpoint serverEndpoint; private RecordingEndpoint clientEndpoint; private FastServer server; @@ -107,8 +107,9 @@ public void newSession(Session session) { wait0(MAX_TIMEOUT); session.setListening(true); + session.setErrorHandler(ErrorHandler.NULL); notify0(); - if (successfullThreadsCount == 0) + if (successfullThreadsCount < 0) wait0(MAX_TIMEOUT); }}); server.listen(); @@ -134,7 +135,7 @@ wait0(MAX_TIMEOUT); assertEquals(1, successfullThreadsCount); } - + public void testTemplateExchange() throws Exception { server.setSessionHandler(new SessionHandler() { public void newSession(Session session) { @@ -167,7 +168,6 @@ if (successfullThreadsCount < 1) wait0(MAX_TIMEOUT); - session.close(); assertEquals(1, successfullThreadsCount); } @@ -204,7 +204,6 @@ if (successfullThreadsCount < 1) wait0(MAX_TIMEOUT); - session.close(); assertEquals(1, successfullThreadsCount); } Modified: trunk/test/unit/org/openfast/session/template/exchange/ScalarConverterTest.java =================================================================== --- trunk/test/unit/org/openfast/session/template/exchange/ScalarConverterTest.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/test/unit/org/openfast/session/template/exchange/ScalarConverterTest.java 2007-10-29 01:07:21 UTC (rev 83) @@ -21,12 +21,19 @@ context = SessionControlProtocol_1_1.createInitialContext(); } - public void testConvertDefaultWithInitialValue() { + public void testConvertDefaultWithDefaultValue() { Field scalar = new Scalar("default10", Type.U32, Operator.DEFAULT, new IntegerValue(10), false); GroupValue fieldDef = converter.convert(scalar, context); Field decodedScalar = converter.convert(fieldDef, TemplateRegistry.NULL, context); assertEquals(scalar, decodedScalar); } + + public void testConvertDeltaWithDefaultValue() { + Field scalar = new Scalar("value", Type.U32, Operator.DELTA, new IntegerValue(1), false); + GroupValue fieldDef = converter.convert(scalar, context); + Field decodedScalar = converter.convert(fieldDef, TemplateRegistry.NULL, context); + assertEquals(scalar, decodedScalar); + } } Modified: trunk/test/unit/org/openfast/template/ScalarTest.java =================================================================== --- trunk/test/unit/org/openfast/template/ScalarTest.java 2007-10-22 18:17:57 UTC (rev 82) +++ trunk/test/unit/org/openfast/template/ScalarTest.java 2007-10-29 01:07:21 UTC (rev 83) @@ -24,9 +24,12 @@ import org.openfast.BitVectorBuilder; import org.openfast.Context; +import org.openfast.FieldValue; +import org.openfast.GroupValue; import org.openfast.IntegerValue; import org.openfast.Message; import org.openfast.ScalarValue; +import org.openfast.StringValue; import org.openfast.codec.FastDecoder; import org.openfast.codec.FastEncoder; import org.openfast.error.FastConstants; @@ -107,4 +110,25 @@ assertEquals(FastConstants.D4_INVALID_TYPE, e.getCode()); } } + + public void testUsesPresenceMapBit() throws Exception { + assertFalse(new Scalar("InitialValue", Type.U32, Operator.NONE, null, true).usesPresenceMapBit()); + } + + public void testNoneOperatorDoesNotModifyDictionary() { + MessageTemplate template = new MessageTemplate("tmpl", new Field[] { + new Scalar("Name", Type.STRING, Operator.NONE, ScalarValue.UNDEFINED, false), + new Group("Group", new Field[]{ + new Scalar("Name", Type.STRING, Operator.DELTA, ScalarValue.UNDEFINED, false) + }, false) + }); + Message message = new Message(template); + message.setString("Name", "A"); + message.setFieldValue("Group", new GroupValue(template.getGroup("Group"), new FieldValue[] { + new StringValue("AB") + })); + FastEncoder encoder = encoder(template); + assertEquals("11000000 10000001 11000001 10000000 01000001 11000010", encoder.encode(message)); + assertEquals("10000000 11000001 10000000 10000000", encoder.encode(message)); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jac...@us...> - 2007-10-22 18:26:35
|
Revision: 82 http://openfast.svn.sourceforge.net/openfast/?rev=82&view=rev Author: jacob_northey Date: 2007-10-22 11:17:57 -0700 (Mon, 22 Oct 2007) Log Message: ----------- Retrofitting unit tests to XMLMessageTemplateLoader parsers Modified Paths: -------------- trunk/test/unit/org/openfast/template/loader/ScalarParserTest.java trunk/test/unit/org/openfast/template/loader/TemplateRefParserTest.java trunk/test/unit/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java trunk/test/unit/org/openfast/test/OpenFastTestCase.java Added Paths: ----------- trunk/test/unit/org/openfast/template/loader/Array.java Added: trunk/test/unit/org/openfast/template/loader/Array.java =================================================================== --- trunk/test/unit/org/openfast/template/loader/Array.java (rev 0) +++ trunk/test/unit/org/openfast/template/loader/Array.java 2007-10-22 18:17:57 UTC (rev 82) @@ -0,0 +1,53 @@ +package org.openfast.template.loader; + +import java.io.InputStream; + +import org.openfast.BitVectorBuilder; +import org.openfast.BitVectorReader; +import org.openfast.Context; +import org.openfast.FieldValue; +import org.openfast.QName; +import org.openfast.template.Field; +import org.openfast.template.Group; + +public class Array extends Field { + + public Array(QName name, boolean optional) { + super(name, optional); + } + + private static final long serialVersionUID = 1L; + + public FieldValue createValue(String value) { + return null; + } + + public FieldValue decode(InputStream in, Group template, Context context, BitVectorReader presenceMapReader) { + return null; + } + + public byte[] encode(FieldValue value, Group template, Context context, BitVectorBuilder presenceMapBuilder) { + return null; + } + + public String getTypeName() { + return null; + } + + public Class getValueType() { + return null; + } + + public boolean isPresenceMapBitSet(byte[] encoding, FieldValue fieldValue) { + return false; + } + + public boolean usesPresenceMapBit() { + return false; + } + + public boolean equals(Object obj) { + return name.equals(((Array) obj).name); + } + +} Modified: trunk/test/unit/org/openfast/template/loader/ScalarParserTest.java =================================================================== --- trunk/test/unit/org/openfast/template/loader/ScalarParserTest.java 2007-10-22 17:38:42 UTC (rev 81) +++ trunk/test/unit/org/openfast/template/loader/ScalarParserTest.java 2007-10-22 18:17:57 UTC (rev 82) @@ -3,6 +3,7 @@ import org.openfast.DecimalValue; import org.openfast.Dictionary; import org.openfast.ScalarValue; +import org.openfast.error.FastException; import org.openfast.template.Scalar; import org.openfast.template.operator.Operator; import org.openfast.template.type.Type; @@ -39,4 +40,20 @@ Scalar string = (Scalar) parser.parse(stringDef, context); assertScalarField(string, Type.STRING, "text", null, "http://openfast.org/data/", Dictionary.GLOBAL, "text", Operator.DEFAULT, ScalarValue.UNDEFINED, true); } + + public void testParseWithOperatorNamespace() throws Exception { + Element uintDef = document("<uInt32 name=\"uint\"><copy key=\"values\" ns=\"http://openfast.org/data/\"/></uInt32>").getDocumentElement(); + Scalar uint = (Scalar) parser.parse(uintDef, context); + assertScalarField(uint, Type.U32, "uint", null, "", Dictionary.GLOBAL, "values", "http://openfast.org/data/", Operator.COPY, ScalarValue.UNDEFINED, false); + } + + public void testInvalidType() throws Exception { + Element invalidDef = document("<array name=\"set\"/>").getDocumentElement(); + try { + parser.parse(invalidDef, context); + } catch (FastException e) { + assertEquals(XMLMessageTemplateLoader.INVALID_TYPE, e.getCode()); + assertTrue(e.getMessage().startsWith("The type array is not defined. Possible types: ")); + } + } } Modified: trunk/test/unit/org/openfast/template/loader/TemplateRefParserTest.java =================================================================== --- trunk/test/unit/org/openfast/template/loader/TemplateRefParserTest.java 2007-10-22 17:38:42 UTC (rev 81) +++ trunk/test/unit/org/openfast/template/loader/TemplateRefParserTest.java 2007-10-22 18:17:57 UTC (rev 82) @@ -1,5 +1,7 @@ package org.openfast.template.loader; +import org.openfast.error.FastConstants; +import org.openfast.error.FastException; import org.openfast.template.DynamicTemplateReference; import org.openfast.template.Field; import org.openfast.template.MessageTemplate; @@ -29,4 +31,14 @@ StaticTemplateReference statTempRef = (StaticTemplateReference) parser.parse(statTempRefDef, context); assertEquals(base, statTempRef.getTemplate()); } + + public void testParseStaticWithUndefinedTemplate() throws Exception { + Element statTempRefDef = document("<templateRef name=\"base\"/>").getDocumentElement(); + try { + parser.parse(statTempRefDef, context); + } catch (FastException e) { + assertEquals(FastConstants.D8_TEMPLATE_NOT_EXIST, e.getCode()); + assertEquals("The template \"base\" was not found.", e.getMessage()); + } + } } Modified: trunk/test/unit/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java =================================================================== --- trunk/test/unit/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java 2007-10-22 17:38:42 UTC (rev 81) +++ trunk/test/unit/org/openfast/template/loader/XMLMessageTemplateLoaderTest.java 2007-10-22 18:17:57 UTC (rev 82) @@ -31,6 +31,7 @@ import org.openfast.error.FastConstants; import org.openfast.error.FastException; import org.openfast.template.DynamicTemplateReference; +import org.openfast.template.Field; import org.openfast.template.MessageTemplate; import org.openfast.template.Scalar; import org.openfast.template.Sequence; @@ -38,6 +39,7 @@ import org.openfast.template.type.Type; import org.openfast.template.type.codec.TypeCodec; import org.openfast.test.OpenFastTestCase; +import org.w3c.dom.Element; public class XMLMessageTemplateLoaderTest extends OpenFastTestCase { @@ -53,8 +55,7 @@ " <decimal name=\"close\"><copy /></decimal>" + " </template>" + "</templates>"; MessageTemplateLoader loader = new XMLMessageTemplateLoader(); - MessageTemplate[] templates = loader.load(new ByteArrayInputStream( - templateXml.getBytes())); + MessageTemplate[] templates = loader.load(new ByteArrayInputStream(templateXml.getBytes())); MessageTemplate messageTemplate = templates[0]; assertEquals("SampleTemplate", messageTemplate.getName()); assertEquals(7, messageTemplate.getFieldCount()); @@ -319,4 +320,30 @@ loader.setErrorHandler(ErrorHandler.NULL); assertEquals(0, loader.load(null).length); } + + public void testCustomFieldParser() { + String templateXml = + "<template name=\"custom\">" + + " <array name=\"intArr\" type=\"int\"></array>" + + "</template>"; + XMLMessageTemplateLoader loader = new XMLMessageTemplateLoader(); + try { + loader.load(stream(templateXml)); + } catch (FastException e) { + assertEquals("No parser registered for array", e.getMessage()); + assertEquals(FastConstants.PARSE_ERROR, e.getCode()); + } + loader.addFieldParser(new FieldParser() { + + public boolean canParse(Element element, ParsingContext context) { + return element.getNodeName().equals("array"); + } + + public Field parse(Element fieldNode, ParsingContext context) { + return new Array(new QName(fieldNode.getAttribute("name"), ""), false); + }}); + + MessageTemplate template = loader.load(stream(templateXml))[0]; + assertEquals(new Array(new QName("intArr", ""), false), template.getField(1)); + } } Modified: trunk/test/unit/org/openfast/test/OpenFastTestCase.java =================================================================== --- trunk/test/unit/org/openfast/test/OpenFastTestCase.java 2007-10-22 17:38:42 UTC (rev 81) +++ trunk/test/unit/org/openfast/test/OpenFastTestCase.java 2007-10-22 18:17:57 UTC (rev 82) @@ -227,11 +227,15 @@ } protected void assertScalarField(Scalar scalar, Type type, String name, String id, String namespace, String dictionary, String key, Operator op, ScalarValue defaultVal, boolean optional) { + assertScalarField(scalar, type, name, id, namespace, dictionary, key, namespace, op, defaultVal, optional); + } + + protected void assertScalarField(Scalar scalar, Type type, String name, String id, String namespace, String dictionary, String key, String keyNamespace, Operator op, ScalarValue defaultVal, boolean optional) { QName qname = new QName(name, namespace); assertEquals(type, scalar.getType()); assertEquals(op, scalar.getOperator()); assertEquals(qname, scalar.getQName()); - QName keyName = new QName(key, namespace); + QName keyName = new QName(key, keyNamespace); assertEquals(keyName, scalar.getKey()); assertEquals(id, scalar.getId()); assertEquals(dictionary, scalar.getDictionary()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |