test_class.declarator: codec
test_class.modifier: private
test_class.original_string: private FIXCodec codec;
test_class.type: FIXCodec
test_class.var_name: codec
test_class.declarator: msgFactory
test_class.modifier: private
test_class.original_string: private IMessageFactory msgFactory;
test_class.type: IMessageFactory
test_class.var_name: msgFactory
test_class.declarator: dictionary
test_class.modifier: private
test_class.original_string: private IDictionaryStructure dictionary;
test_class.type: IDictionaryStructure
test_class.var_name: dictionary
test_class.file: BackEnd/Service/service-fix/src/test/java/com/exactpro/sf/services/fix/FixCodecTest.java
test_class.identifier: FixCodecTest
test_class.superclass: extends AbstractTest
test_case.body: @Test
      public void testMessageFilter() throws Exception {
          StringBuilder builder = new StringBuilder();
          builder.append("8=FIX.4.49=14635=D34=71805=ez_mbp352=20151013-12:32:45.516.56=PARFX11=144473956586638=10000000040=144=0.0154=1.55=USD/MXN59=060=20151013-12:32:45.51310=150");
          builder.append("8=FIX.4.49=14635=D34=72805=ez_mbp352=20151013-12:32:45.516.56=PARFX11=144473956586638=10000000040=144=0.0154=1.55=USD/MXN59=060=20151013-12:32:45.51310=150");
          builder.append("8=FIX.4.49=14735=D34=72 805=ez_mbp352=20151013-12:32:45.516.56=PARFX11=144473956586638=10000000040=144=0.0154=1.55=USD/MXN59=060=20151013-12:32:45.51310=150");
          builder.append("8=FIX.4.49=14635=D34=74805=ez_mbp352=20151013-12:32:45.516.56=PARFX11=144473956586638=10000000040=144=0.0154=1.55=USD/MXN59=060=20151013-12:32:45.51310=150");
  
          TCPIPSettings settings = new TCPIPSettings();
          settings.setDepersonalizationIncomingMessages(true);
          settings.setDecodeByDictionary(false);
          settings.setFilterMessages("35:D; 34:71; 805:ez_mbp3");
  
          FIXCodec codec = new FIXCodec();
          codec.init(serviceContext, settings, msgFactory, dictionary);
  
          IoSession session = new DummySession();
          AbstractProtocolDecoderOutput outputDec = new MockProtocolDecoderOutput();
  
          IoBuffer buffer = IoBuffer.wrap(builder.toString().getBytes());
          codec.decode(session, buffer, outputDec);
  
          Assert.assertEquals(1, outputDec.getMessageQueue().size());
          IMessage message = (IMessage) outputDec.getMessageQueue().poll();
          Assert.assertEquals("D", message.getField("MsgType"));
          Assert.assertEquals("71", message.getField("MsgSeqNum"));
  
          // check without space in value
          settings.setFilterMessages("35:D; 34:71,72");
          codec.init(serviceContext, settings, msgFactory, dictionary);
          session = new DummySession();
          outputDec = new MockProtocolDecoderOutput();
          buffer = IoBuffer.wrap(builder.toString().getBytes());
          codec.decode(session, buffer, outputDec);
  
          Assert.assertEquals(2, outputDec.getMessageQueue().size());
          message = (IMessage) outputDec.getMessageQueue().poll();
          Assert.assertEquals("D", message.getField("MsgType"));
          Assert.assertEquals("71", message.getField("MsgSeqNum"));
  
          message = (IMessage) outputDec.getMessageQueue().poll();
          Assert.assertEquals("D", message.getField("MsgType"));
          Assert.assertEquals("72", message.getField("MsgSeqNum"));
  
          // check with space in value
          settings.setFilterMessages("35:D; 34:71,72 ");
          codec.init(serviceContext, settings, msgFactory, dictionary);
          session = new DummySession();
          outputDec = new MockProtocolDecoderOutput();
          buffer = IoBuffer.wrap(builder.toString().getBytes());
          codec.decode(session, buffer, outputDec);
  
          Assert.assertEquals(2, outputDec.getMessageQueue().size());
          message = (IMessage) outputDec.getMessageQueue().poll();
          Assert.assertEquals("D", message.getField("MsgType"));
          Assert.assertEquals("71", message.getField("MsgSeqNum"));
  
          message = (IMessage) outputDec.getMessageQueue().poll();
          Assert.assertEquals("D", message.getField("MsgType"));
          Assert.assertEquals("72 ", message.getField("MsgSeqNum"));
      }
test_case.class_method_signature: FixCodecTest.testMessageFilter()
test_case.full_signature: @Test public void testMessageFilter()
test_case.identifier: testMessageFilter
test_case.invocations: append append append append setDepersonalizationIncomingMessages setDecodeByDictionary setFilterMessages init wrap getBytes toString decode assertEquals size getMessageQueue poll getMessageQueue assertEquals getField assertEquals getField setFilterMessages init wrap getBytes toString decode assertEquals size getMessageQueue poll getMessageQueue assertEquals getField assertEquals getField poll getMessageQueue assertEquals getField assertEquals getField setFilterMessages init wrap getBytes toString decode assertEquals size getMessageQueue poll getMessageQueue assertEquals getField assertEquals getField poll getMessageQueue assertEquals getField assertEquals getField
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testMessageFilter()
focal_class.declarator: logger = LoggerFactory.getLogger(FIXCodec.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(FIXCodec.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: SOH = "\001"
focal_class.modifier: public static final
focal_class.original_string: public static final String SOH = "\001";
focal_class.type: String
focal_class.var_name: SOH
focal_class.declarator: SEP = "\\|"
focal_class.modifier: public static final
focal_class.original_string: public static final String SEP = "\\|";
focal_class.type: String
focal_class.var_name: SEP
focal_class.declarator: SUB_CONDITIONS_DELIMETER = ","
focal_class.modifier: public static final
focal_class.original_string: public static final String SUB_CONDITIONS_DELIMETER = ",";
focal_class.type: String
focal_class.var_name: SUB_CONDITIONS_DELIMETER
focal_class.declarator: SOH_REPLACEMENT = SOH + "$1"
focal_class.modifier: private static final
focal_class.original_string: private static final String SOH_REPLACEMENT = SOH + "$1";
focal_class.type: String
focal_class.var_name: SOH_REPLACEMENT
focal_class.declarator: settings
focal_class.modifier: private
focal_class.original_string: private TCPIPSettings settings;
focal_class.type: TCPIPSettings
focal_class.var_name: settings
focal_class.declarator: msgFactory
focal_class.modifier: private
focal_class.original_string: private IMessageFactory msgFactory;
focal_class.type: IMessageFactory
focal_class.var_name: msgFactory
focal_class.declarator: fieldConverter
focal_class.modifier: private
focal_class.original_string: private IFieldConverter fieldConverter;
focal_class.type: IFieldConverter
focal_class.var_name: fieldConverter
focal_class.declarator: dictionary
focal_class.modifier: private
focal_class.original_string: private IDictionaryStructure dictionary;
focal_class.type: IDictionaryStructure
focal_class.var_name: dictionary
focal_class.declarator: qfjConverter
focal_class.modifier: private
focal_class.original_string: private DirtyQFJIMessageConverter qfjConverter;
focal_class.type: DirtyQFJIMessageConverter
focal_class.var_name: qfjConverter
focal_class.declarator: msgStructures
focal_class.modifier: private
focal_class.original_string: private Map<String, IMessageStructure> msgStructures;
focal_class.type: Map<String, IMessageStructure>
focal_class.var_name: msgStructures
focal_class.declarator: dataDict
focal_class.modifier: private
focal_class.original_string: private QFJDictionaryAdapter dataDict;
focal_class.type: QFJDictionaryAdapter
focal_class.var_name: dataDict
focal_class.declarator: messageFilter
focal_class.modifier: private
focal_class.original_string: private IMessageFilter<String> messageFilter;
focal_class.type: IMessageFilter<String>
focal_class.var_name: messageFilter
focal_class.declarator: messagesWithXmlField = new HashSet<>()
focal_class.modifier: private final
focal_class.original_string: private final Set<String> messagesWithXmlField = new HashSet<>();
focal_class.type: Set<String>
focal_class.var_name: messagesWithXmlField
focal_class.declarator: documentFactory = DocumentBuilderFactory.newInstance()
focal_class.modifier: private final
focal_class.original_string: private final DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
focal_class.type: DocumentBuilderFactory
focal_class.var_name: documentFactory
focal_class.declarator: separatorReplacePattern
focal_class.modifier: private
focal_class.original_string: private String separatorReplacePattern;
focal_class.type: String
focal_class.var_name: separatorReplacePattern
focal_class.declarator: fieldSeparator = SOH
focal_class.modifier: private
focal_class.original_string: private String fieldSeparator = SOH;
focal_class.type: String
focal_class.var_name: fieldSeparator
focal_class.file: BackEnd/Service/service-fix/src/main/java/com/exactpro/sf/services/fix/FIXCodec.java
focal_class.identifier: FIXCodec
focal_class.class_method_signature: FIXCodec.init(IServiceContext serviceContext, ICommonSettings settings, IMessageFactory msgFactory, IDictionaryStructure dictionary)
focal_class.full_signature: @Override public void init(IServiceContext serviceContext, ICommonSettings settings, IMessageFactory msgFactory, IDictionaryStructure dictionary)
focal_class.identifier: init
focal_class.modifiers: @Override public
focal_class.parameters: (IServiceContext serviceContext, ICommonSettings settings, IMessageFactory msgFactory, IDictionaryStructure dictionary)
focal_class.return: void
focal_class.signature: void init(IServiceContext serviceContext, ICommonSettings settings, IMessageFactory msgFactory, IDictionaryStructure dictionary)
focal_class.class_method_signature: FIXCodec.getFixString(IoBuffer in)
focal_class.full_signature: public static String getFixString(IoBuffer in)
focal_class.identifier: getFixString
focal_class.modifiers: public static
focal_class.parameters: (IoBuffer in)
focal_class.return: String
focal_class.signature: String getFixString(IoBuffer in)
focal_class.class_method_signature: FIXCodec.getFixString(IoBuffer in, String fieldSeparator)
focal_class.full_signature: public static String getFixString(IoBuffer in, String fieldSeparator)
focal_class.identifier: getFixString
focal_class.modifiers: public static
focal_class.parameters: (IoBuffer in, String fieldSeparator)
focal_class.return: String
focal_class.signature: String getFixString(IoBuffer in, String fieldSeparator)
focal_class.class_method_signature: FIXCodec.doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out)
focal_class.full_signature: @Override protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out)
focal_class.identifier: doDecode
focal_class.modifiers: @Override protected
focal_class.parameters: (IoSession session, IoBuffer in, ProtocolDecoderOutput out)
focal_class.return: boolean
focal_class.signature: boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out)
focal_class.class_method_signature: FIXCodec.encode(IoSession session, Object message, ProtocolEncoderOutput out)
focal_class.full_signature: @Override public void encode(IoSession session, Object message, ProtocolEncoderOutput out)
focal_class.identifier: encode
focal_class.modifiers: @Override public
focal_class.parameters: (IoSession session, Object message, ProtocolEncoderOutput out)
focal_class.return: void
focal_class.signature: void encode(IoSession session, Object message, ProtocolEncoderOutput out)
focal_class.class_method_signature: FIXCodec.convertToIMessageByIDictionaryStructure(String fixMessage)
focal_class.full_signature: protected IMessage convertToIMessageByIDictionaryStructure(String fixMessage)
focal_class.identifier: convertToIMessageByIDictionaryStructure
focal_class.modifiers: protected
focal_class.parameters: (String fixMessage)
focal_class.return: IMessage
focal_class.signature: IMessage convertToIMessageByIDictionaryStructure(String fixMessage)
focal_class.class_method_signature: FIXCodec.convertToIMessage(String fixMessage)
focal_class.full_signature: protected IMessage convertToIMessage(String fixMessage)
focal_class.identifier: convertToIMessage
focal_class.modifiers: protected
focal_class.parameters: (String fixMessage)
focal_class.return: IMessage
focal_class.signature: IMessage convertToIMessage(String fixMessage)
focal_class.class_method_signature: FIXCodec.isUnexpectedMessage(String fixMessage, String unexpectedMessages)
focal_class.full_signature: protected boolean isUnexpectedMessage(String fixMessage, String unexpectedMessages)
focal_class.identifier: isUnexpectedMessage
focal_class.modifiers: protected
focal_class.parameters: (String fixMessage, String unexpectedMessages)
focal_class.return: boolean
focal_class.signature: boolean isUnexpectedMessage(String fixMessage, String unexpectedMessages)
focal_class.class_method_signature: FIXCodec.getMessageName(IMessage message)
focal_class.full_signature: protected String getMessageName(IMessage message)
focal_class.identifier: getMessageName
focal_class.modifiers: protected
focal_class.parameters: (IMessage message)
focal_class.return: String
focal_class.signature: String getMessageName(IMessage message)
focal_class.class_method_signature: FIXCodec.getMessageStructure(String msgTypeValue)
focal_class.full_signature: protected IMessageStructure getMessageStructure(String msgTypeValue)
focal_class.identifier: getMessageStructure
focal_class.modifiers: protected
focal_class.parameters: (String msgTypeValue)
focal_class.return: IMessageStructure
focal_class.signature: IMessageStructure getMessageStructure(String msgTypeValue)
focal_class.class_method_signature: FIXCodec.convertMessageToIMessage(Message message, String namespace)
focal_class.full_signature: private IMessage convertMessageToIMessage(Message message, String namespace)
focal_class.identifier: convertMessageToIMessage
focal_class.modifiers: private
focal_class.parameters: (Message message, String namespace)
focal_class.return: IMessage
focal_class.signature: IMessage convertMessageToIMessage(Message message, String namespace)
focal_class.class_method_signature: FIXCodec.copyFields(FieldMap message, IMessage iMessageTo, IFieldStructure messageStructure)
focal_class.full_signature: private void copyFields(FieldMap message, IMessage iMessageTo, IFieldStructure messageStructure)
focal_class.identifier: copyFields
focal_class.modifiers: private
focal_class.parameters: (FieldMap message, IMessage iMessageTo, IFieldStructure messageStructure)
focal_class.return: void
focal_class.signature: void copyFields(FieldMap message, IMessage iMessageTo, IFieldStructure messageStructure)
focal_class.class_method_signature: FIXCodec.addGroup(List<Group> groups, List<IMessage> groupList, IFieldStructure groupStructure)
focal_class.full_signature: private void addGroup(List<Group> groups, List<IMessage> groupList, IFieldStructure groupStructure)
focal_class.identifier: addGroup
focal_class.modifiers: private
focal_class.parameters: (List<Group> groups, List<IMessage> groupList, IFieldStructure groupStructure)
focal_class.return: void
focal_class.signature: void addGroup(List<Group> groups, List<IMessage> groupList, IFieldStructure groupStructure)
focal_class.class_method_signature: FIXCodec.parseXmlFields(IMessage targetMessage, IFieldExtractor fieldExtractor, String msgType)
focal_class.full_signature: private IMessage parseXmlFields(IMessage targetMessage, IFieldExtractor fieldExtractor, String msgType)
focal_class.identifier: parseXmlFields
focal_class.modifiers: private
focal_class.parameters: (IMessage targetMessage, IFieldExtractor fieldExtractor, String msgType)
focal_class.return: IMessage
focal_class.signature: IMessage parseXmlFields(IMessage targetMessage, IFieldExtractor fieldExtractor, String msgType)
focal_class.superclass: extends AbstractCodec
focal_method.body: @Override
      public void init(IServiceContext serviceContext, ICommonSettings settings, IMessageFactory msgFactory, IDictionaryStructure dictionary) {
          if (!(settings instanceof TCPIPSettings)) {
              throw new IllegalStateException("settings is not TCPIPSettings. settings is " + settings.getClass().getName());
          }
  
          this.settings = (TCPIPSettings)settings;
  
          FixPropertiesReader.loadAndSetCharset(serviceContext);
  
          this.msgFactory = msgFactory;
  
          this.dictionary = Objects.requireNonNull(dictionary, "dictionary cannot be null");
          this.fieldConverter = new FixFieldConverter();
          fieldConverter.init(dictionary, dictionary.getNamespace());
          QFJIMessageConverterSettings qfjiMessageConverterSettings = new QFJIMessageConverterSettings(dictionary, this.msgFactory);
          this.qfjConverter = new DirtyQFJIMessageConverter(qfjiMessageConverterSettings);
  
          this.msgStructures = new HashMap<>();
  
          messagesWithXmlField.clear();
  
          for(IMessageStructure messageStructure : dictionary.getMessages().values()) {
              String msgType = getAttributeValue(messageStructure, FixMessageHelper.MESSAGE_TYPE_ATTR_NAME);
              if(msgType != null) {
                  msgStructures.put(msgType, messageStructure);
  
                  Boolean hasXmlFields = getAttributeValue(messageStructure, FixMessageHelper.HAS_XML_FIELDS_ATTR_NAME);
                  if (Boolean.TRUE.equals(hasXmlFields)) {
                      messagesWithXmlField.add(msgType);
                  }
              }
          }
          this.dataDict = new QFJDictionaryAdapter(dictionary);
          dataDict.setAllowUnknownMessageFields(true);
  
          String filterValues = this.settings.getFilterMessages();
          messageFilter = isNotEmpty(filterValues) ? new TagValueFilter(filterValues) : new FakeFilter();
  
          String fieldSeparator = this.settings.getFieldSeparator();
          if (isNotEmpty(fieldSeparator) ) {
              this.fieldSeparator = fieldSeparator;
              this.separatorReplacePattern = format("\\%s+(\\d+=)|\\%s+$", fieldSeparator, fieldSeparator);
          } else {
              this.fieldSeparator = SOH;
              this.separatorReplacePattern = null;
          }
      }
focal_method.class_method_signature: FIXCodec.init(IServiceContext serviceContext, ICommonSettings settings, IMessageFactory msgFactory, IDictionaryStructure dictionary)
focal_method.full_signature: @Override public void init(IServiceContext serviceContext, ICommonSettings settings, IMessageFactory msgFactory, IDictionaryStructure dictionary)
focal_method.identifier: init
focal_method.invocations: getName getClass loadAndSetCharset requireNonNull init getNamespace clear values getMessages getAttributeValue put getAttributeValue equals add setAllowUnknownMessageFields getFilterMessages isNotEmpty getFieldSeparator isNotEmpty format
focal_method.modifiers: @Override public
focal_method.parameters: (IServiceContext serviceContext, ICommonSettings settings, IMessageFactory msgFactory, IDictionaryStructure dictionary)
focal_method.return: void
focal_method.signature: void init(IServiceContext serviceContext, ICommonSettings settings, IMessageFactory msgFactory, IDictionaryStructure dictionary)