DataDictionary { public void validate(Message message) throws IncorrectTagValue, FieldNotFound, IncorrectDataFormat { validate(message, false); } private  DataDictionary();  DataDictionary(String location);  DataDictionary(String location, Supplier<DocumentBuilderFactory> documentBuilderFactorySupplier);  DataDictionary(InputStream in);  DataDictionary(InputStream in, Supplier<DocumentBuilderFactory> documentBuilderFactorySupplier);  DataDictionary(DataDictionary source); String getVersion(); String getFieldName(int field); String getValueName(int field, String value); String getValue(int field, String name); boolean isField(int field); FieldType getFieldType(int field); String getMsgType(String msgName); boolean isMsgType(String msgType); boolean isAdminMessage(String msgType); boolean isAppMessage(String msgType); boolean isMsgField(String msgType, int field); boolean isHeaderField(int field); boolean isTrailerField(int field); int getFieldTag(String name); boolean isRequiredField(String msgType, int field); boolean isRequiredHeaderField(int field); boolean isRequiredTrailerField(int field); boolean hasFieldValue(int field); boolean isFieldValue(int field, String value); boolean isGroup(String msg, int field); boolean isHeaderGroup(int field); GroupInfo getGroup(String msg, int field); boolean isDataField(int field); void setCheckFieldsOutOfOrder(boolean flag); boolean isCheckFieldsOutOfOrder(); boolean isCheckUnorderedGroupFields(); boolean isCheckFieldsHaveValues(); boolean isCheckUserDefinedFields(); boolean isAllowUnknownMessageFields(); void setCheckUnorderedGroupFields(boolean flag); void setCheckFieldsHaveValues(boolean flag); void setCheckUserDefinedFields(boolean flag); void setAllowUnknownMessageFields(boolean allowUnknownFields); void validate(Message message); void validate(Message message, boolean bodyOnly); int getNumMessageCategories(); int[] getOrderedFields(); static final String ANY_VALUE; static final String HEADER_ID; static final String TRAILER_ID; }
@Test public void testMessageValidateBodyOnly() throws Exception { final quickfix.fix44.NewOrderSingle newSingle = new quickfix.fix44.NewOrderSingle( new ClOrdID("123"), new Side(Side.BUY), new TransactTime(), new OrdType( OrdType.LIMIT)); newSingle.setField(new OrderQty(42)); newSingle.setField(new Price(42.37)); newSingle.setField(new HandlInst()); newSingle.setField(new Symbol("QFJ")); newSingle.setField(new HandlInst(HandlInst.MANUAL_ORDER_BEST_EXECUTION)); newSingle.setField(new TimeInForce(TimeInForce.DAY)); newSingle.setField(new Account("testAccount")); final DataDictionary dd = getDictionary(); new ExpectedTestFailure(FieldException.class, "field=") { @Override protected void execute() throws Throwable { dd.validate(newSingle); } }.run(); dd.validate(newSingle, true); }
@Test public void testMessageDataDictionaryMismatch() throws Exception { final quickfix.fix43.NewOrderSingle newSingle = new quickfix.fix43.NewOrderSingle( new ClOrdID("123"), new HandlInst(HandlInst.MANUAL_ORDER_BEST_EXECUTION), new Side(Side.BUY), new TransactTime(), new OrdType( OrdType.LIMIT)); newSingle.setField(new OrderQty(42)); newSingle.setField(new Price(42.37)); newSingle.setField(new Symbol("QFJ")); newSingle.setField(new TimeInForce(TimeInForce.DAY)); newSingle.setField(new Account("testAccount")); final DataDictionary dd = getDictionary(); new ExpectedTestFailure(UnsupportedVersion.class, "Message version 'FIX.4.3' does not match the data dictionary version 'FIX.4.4'") { @Override protected void execute() throws Throwable { dd.validate(newSingle); } }.run(); dd.validate(newSingle, true); }