Skip to content

Commit

Permalink
Merge pull request #908 from gbirchmeier/message-n-test
Browse files Browse the repository at this point in the history
Add 35=n <message> defs to dictionary
  • Loading branch information
gbirchmeier authored Dec 10, 2024
2 parents 568d603 + edf0fcf commit 72facb6
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 4 deletions.
1 change: 1 addition & 0 deletions Messages/FIX43/MessageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public QuickFix.Message Create(string beginString, string msgType)
case QuickFix.FIX43.SequenceReset.MsgType: return new QuickFix.FIX43.SequenceReset();
case QuickFix.FIX43.Logout.MsgType: return new QuickFix.FIX43.Logout();
case QuickFix.FIX43.BusinessMessageReject.MsgType: return new QuickFix.FIX43.BusinessMessageReject();
case QuickFix.FIX43.XMLnonFIX.MsgType: return new QuickFix.FIX43.XMLnonFIX();
case QuickFix.FIX43.Advertisement.MsgType: return new QuickFix.FIX43.Advertisement();
case QuickFix.FIX43.IndicationOfInterest.MsgType: return new QuickFix.FIX43.IndicationOfInterest();
case QuickFix.FIX43.News.MsgType: return new QuickFix.FIX43.News();
Expand Down
20 changes: 20 additions & 0 deletions Messages/FIX43/XMLnonFIX.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This is a generated file. Don't edit it directly!

using QuickFix.Fields;
namespace QuickFix
{
namespace FIX43
{
public class XMLnonFIX : Message
{
public const string MsgType = "n";

public XMLnonFIX() : base()
{
this.Header.SetField(new QuickFix.Fields.MsgType("n"));
}


}
}
}
1 change: 1 addition & 0 deletions Messages/FIX44/MessageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public QuickFix.Message Create(string beginString, string msgType)
case QuickFix.FIX44.Reject.MsgType: return new QuickFix.FIX44.Reject();
case QuickFix.FIX44.SequenceReset.MsgType: return new QuickFix.FIX44.SequenceReset();
case QuickFix.FIX44.Logout.MsgType: return new QuickFix.FIX44.Logout();
case QuickFix.FIX44.XMLnonFIX.MsgType: return new QuickFix.FIX44.XMLnonFIX();
case QuickFix.FIX44.BusinessMessageReject.MsgType: return new QuickFix.FIX44.BusinessMessageReject();
case QuickFix.FIX44.UserRequest.MsgType: return new QuickFix.FIX44.UserRequest();
case QuickFix.FIX44.UserResponse.MsgType: return new QuickFix.FIX44.UserResponse();
Expand Down
20 changes: 20 additions & 0 deletions Messages/FIX44/XMLnonFIX.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This is a generated file. Don't edit it directly!

using QuickFix.Fields;
namespace QuickFix
{
namespace FIX44
{
public class XMLnonFIX : Message
{
public const string MsgType = "n";

public XMLnonFIX() : base()
{
this.Header.SetField(new QuickFix.Fields.MsgType("n"));
}


}
}
}
1 change: 1 addition & 0 deletions Messages/FIXT11/MessageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public QuickFix.Message Create(string beginString, string msgType)
case QuickFix.FIXT11.SequenceReset.MsgType: return new QuickFix.FIXT11.SequenceReset();
case QuickFix.FIXT11.Logout.MsgType: return new QuickFix.FIXT11.Logout();
case QuickFix.FIXT11.Logon.MsgType: return new QuickFix.FIXT11.Logon();
case QuickFix.FIXT11.XMLnonFIX.MsgType: return new QuickFix.FIXT11.XMLnonFIX();
}

return new QuickFix.Message();
Expand Down
20 changes: 20 additions & 0 deletions Messages/FIXT11/XMLnonFIX.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This is a generated file. Don't edit it directly!

using QuickFix.Fields;
namespace QuickFix
{
namespace FIXT11
{
public class XMLnonFIX : Message
{
public const string MsgType = "n";

public XMLnonFIX() : base()
{
this.Header.SetField(new QuickFix.Fields.MsgType("n"));
}


}
}
}
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ What's New
* #900 - correct CompositeLog to use IFactory.CreateNonSessionLog when appropriate (gbirchmeier)
* #891 - make NonSessionLog implement IDisposable and fix the IOException (VAllens)
* #893 - Upgrade the unit testing framework to the latest version and remove obsolete Assert methods (VAllens)
* #900 - A fix to make body-less messages work, specifically 35=n aka XMLnonFIX (gbirchmeier)
* #907 - A fix to make body-less messages work, specifically 35=n aka XMLnonFIX (gbirchmeier)

### v1.12.0

Expand Down
6 changes: 3 additions & 3 deletions UnitTests/DataDictionaryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,16 +376,16 @@ public void ParseThroughComments()
[Test]
public void TestCheckMsgType() {
DataDictionary dd = new DataDictionary();
dd.LoadFIXSpec("FIX44");
dd.LoadTestFIXSpec("msg_type_test");

Assert.Throws(typeof(InvalidMessageType), delegate { dd.CheckMsgType("foo"); });

// True check, case 1: DD has a <message> definition for this one
Assert.DoesNotThrow(delegate { dd.CheckMsgType("B"); });

// True check, case 2: Type is in field 35, but there is no Message type
Assert.That(dd.Messages, Does.Not.ContainKey("n")); // Sanity check; if fails, fix the test.
Assert.DoesNotThrow(delegate { dd.CheckMsgType("n"); });
Assert.That(dd.Messages, Does.Not.ContainKey("bar")); // Sanity check; if fails, fix the test.
Assert.DoesNotThrow(delegate { dd.CheckMsgType("bar"); });
}

private static XmlNode MakeNode(string xmlString)
Expand Down
3 changes: 3 additions & 0 deletions spec/fix/FIX43.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@
<field name="EncodedTextLen" required="N" />
<field name="EncodedText" required="N" />
</message>
<message name="XMLnonFIX" msgtype="n" msgcat="admin">
<!-- this message has no body fields -->
</message>
<message name="Advertisement" msgtype="7" msgcat="app">
<field name="AdvId" required="Y" />
<field name="AdvTransType" required="Y" />
Expand Down
3 changes: 3 additions & 0 deletions spec/fix/FIX44.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
<field name="EncodedTextLen" required="N" />
<field name="EncodedText" required="N" />
</message>
<message name="XMLnonFIX" msgtype="n" msgcat="admin">
<!-- this message has no body fields -->
</message>
<message name="BusinessMessageReject" msgtype="j" msgcat="app">
<field name="RefSeqNum" required="N" />
<field name="RefMsgType" required="Y" />
Expand Down
3 changes: 3 additions & 0 deletions spec/fix/FIXT11.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
<field name='DefaultApplVerID' required='Y'/>
<component name='MsgTypeGrp' required='N'/>
</message>
<message name="XMLnonFIX" msgtype="n" msgcat="admin">
<!-- this message has no body fields -->
</message>
</messages>
<components>
<component name='HopGrp'>
Expand Down
20 changes: 20 additions & 0 deletions spec/test/msg_type_test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- for DataDictionaryTests.TestCheckMsgType -->

<fix minor="9" major="9">
<header/>
<trailer/>
<messages>
<message name="News" msgtype="B" msgcat="admin">
<!-- body not important for test -->
</message>
</messages>

<fields>
<field number="35" name="MsgType" type="STRING">
<value enum="B" description="NEWS" />
<value enum="bar" description="BAR_MESSAGE" />
</field>
</fields>
</fix>

0 comments on commit 72facb6

Please sign in to comment.