test_class.declarator: messageHelper
test_class.modifier: private
test_class.original_string: private NTGMessageHelper messageHelper;
test_class.type: NTGMessageHelper
test_class.var_name: messageHelper
test_class.declarator: messageFactory
test_class.modifier: private
test_class.original_string: private IMessageFactory messageFactory;
test_class.type: IMessageFactory
test_class.var_name: messageFactory
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.declarator: namespace
test_class.modifier: private
test_class.original_string: private String namespace;
test_class.type: String
test_class.var_name: namespace
test_class.file: BackEnd/Service/service-ntg/src/test/java/com/exactpro/sf/services/ntg/TestNTGMessageHelper.java
test_class.identifier: TestNTGMessageHelper
test_class.superclass: extends AbstractTest
test_case.body: @Test
      public void testMessageType() throws IOException {
          IFieldStructure typeField = dictionary.getFields().get("MessageType");
          for (String element : typeField.getValues().keySet()) {
              IMessage message = messageFactory.createMessage(element, namespace);
              messageHelper.prepareMessageToEncode(message, null);
              checkValueInMessageHeader(message, "MessageType", typeField.getValues().get(element).getCastValue());
              checkValueInMessageHeader(message, "StartOfMessage", 2);
          }
      }
test_case.class_method_signature: TestNTGMessageHelper.testMessageType()
test_case.full_signature: @Test public void testMessageType()
test_case.identifier: testMessageType
test_case.invocations: get getFields keySet getValues createMessage prepareMessageToEncode checkValueInMessageHeader getCastValue get getValues checkValueInMessageHeader
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testMessageType()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(NTGMessageHelper.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(NTGMessageHelper.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: MESSAGE_HEADER = "MessageHeader"
focal_class.modifier: public static final
focal_class.original_string: public static final String MESSAGE_HEADER = "MessageHeader";
focal_class.type: String
focal_class.var_name: MESSAGE_HEADER
focal_class.declarator: FIELD_DIRTY_MSG_TYPE = "NTGMsgType"
focal_class.modifier: public static
focal_class.original_string: public static String FIELD_DIRTY_MSG_TYPE = "NTGMsgType";
focal_class.type: String
focal_class.var_name: FIELD_DIRTY_MSG_TYPE
focal_class.declarator: FIELD_DIRTY_START = "DirtyStart"
focal_class.modifier: public static
focal_class.original_string: public static String FIELD_DIRTY_START = "DirtyStart";
focal_class.type: String
focal_class.var_name: FIELD_DIRTY_START
focal_class.declarator: FIELD_DIRTY_MSG_LEN = "DirtyMsgLen"
focal_class.modifier: public static
focal_class.original_string: public static String FIELD_DIRTY_MSG_LEN = "DirtyMsgLen";
focal_class.type: String
focal_class.var_name: FIELD_DIRTY_MSG_LEN
focal_class.declarator: FIELD_MESSAGE_LENGTH = "MessageLength"
focal_class.modifier: public static final
focal_class.original_string: public static final String FIELD_MESSAGE_LENGTH = "MessageLength";
focal_class.type: String
focal_class.var_name: FIELD_MESSAGE_LENGTH
focal_class.declarator: FIELD_START_OF_MESSAGE = "StartOfMessage"
focal_class.modifier: public static final
focal_class.original_string: public static final String FIELD_START_OF_MESSAGE = "StartOfMessage";
focal_class.type: String
focal_class.var_name: FIELD_START_OF_MESSAGE
focal_class.declarator: VALUE_START_OF_MESSAGE = 2
focal_class.modifier: public static final
focal_class.original_string: public static final int VALUE_START_OF_MESSAGE = 2;
focal_class.type: int
focal_class.var_name: VALUE_START_OF_MESSAGE
focal_class.declarator: FIELD_TRANSACT_TIME = "TransactTime"
focal_class.modifier: public static final
focal_class.original_string: public static final String FIELD_TRANSACT_TIME = "TransactTime";
focal_class.type: String
focal_class.var_name: FIELD_TRANSACT_TIME
focal_class.declarator: MESSAGE_TYPE = "MessageType"
focal_class.modifier: public static final
focal_class.original_string: public static final String MESSAGE_TYPE = "MessageType";
focal_class.type: String
focal_class.var_name: MESSAGE_TYPE
focal_class.declarator: MESSAGE_LOGON = "Logon"
focal_class.modifier: public static final
focal_class.original_string: public static final String MESSAGE_LOGON = "Logon";
focal_class.type: String
focal_class.var_name: MESSAGE_LOGON
focal_class.declarator: MESSAGE_HEARTBEAT = "Heartbeat"
focal_class.modifier: public static final
focal_class.original_string: public static final String MESSAGE_HEARTBEAT = "Heartbeat";
focal_class.type: String
focal_class.var_name: MESSAGE_HEARTBEAT
focal_class.declarator: MESSAGE_REJECT = "Reject"
focal_class.modifier: public static final
focal_class.original_string: public static final String MESSAGE_REJECT = "Reject";
focal_class.type: String
focal_class.var_name: MESSAGE_REJECT
focal_class.declarator: ATTRIBUTE_MESSAGE_TYPE = "MessageType"
focal_class.modifier: public static final
focal_class.original_string: public static final String ATTRIBUTE_MESSAGE_TYPE = "MessageType";
focal_class.type: String
focal_class.var_name: ATTRIBUTE_MESSAGE_TYPE
focal_class.declarator: codec
focal_class.modifier: private
focal_class.original_string: private AbstractCodec codec;
focal_class.type: AbstractCodec
focal_class.var_name: codec
focal_class.declarator: metadata
focal_class.modifier: private
focal_class.original_string: private Map<String, NTGMessageMetadata> metadata;
focal_class.type: Map<String, NTGMessageMetadata>
focal_class.var_name: metadata
focal_class.file: BackEnd/Service/service-ntg/src/main/java/com/exactpro/sf/services/ntg/NTGMessageHelper.java
focal_class.identifier: NTGMessageHelper
focal_class.class_method_signature: NTGMessageHelper.init(IMessageFactory messageFactory, IDictionaryStructure messageDictionary)
focal_class.full_signature: @Override public void init(IMessageFactory messageFactory, IDictionaryStructure messageDictionary)
focal_class.identifier: init
focal_class.modifiers: @Override public
focal_class.parameters: (IMessageFactory messageFactory, IDictionaryStructure messageDictionary)
focal_class.return: void
focal_class.signature: void init(IMessageFactory messageFactory, IDictionaryStructure messageDictionary)
focal_class.class_method_signature: NTGMessageHelper.getCodec(IServiceContext serviceContext)
focal_class.full_signature: @Override public synchronized AbstractCodec getCodec(IServiceContext serviceContext)
focal_class.identifier: getCodec
focal_class.modifiers: @Override public synchronized
focal_class.parameters: (IServiceContext serviceContext)
focal_class.return: AbstractCodec
focal_class.signature: AbstractCodec getCodec(IServiceContext serviceContext)
focal_class.class_method_signature: NTGMessageHelper.prepareMessageToEncode(IMessage message, Map<String, String> params)
focal_class.full_signature: @Override public IMessage prepareMessageToEncode(IMessage message, Map<String, String> params)
focal_class.identifier: prepareMessageToEncode
focal_class.modifiers: @Override public
focal_class.parameters: (IMessage message, Map<String, String> params)
focal_class.return: IMessage
focal_class.signature: IMessage prepareMessageToEncode(IMessage message, Map<String, String> params)
focal_class.class_method_signature: NTGMessageHelper.getMetadata(String messageName)
focal_class.full_signature: private NTGMessageMetadata getMetadata(String messageName)
focal_class.identifier: getMetadata
focal_class.modifiers: private
focal_class.parameters: (String messageName)
focal_class.return: NTGMessageMetadata
focal_class.signature: NTGMessageMetadata getMetadata(String messageName)
focal_class.class_method_signature: NTGMessageHelper.getSenderTime(IMessage message)
focal_class.full_signature: @Override public long getSenderTime(IMessage message)
focal_class.identifier: getSenderTime
focal_class.modifiers: @Override public
focal_class.parameters: (IMessage message)
focal_class.return: long
focal_class.signature: long getSenderTime(IMessage message)
focal_class.superclass: extends MessageHelper
focal_method.body: @Override
  	public IMessage prepareMessageToEncode(IMessage message, Map<String, String> params) {
  		// AML3 - header can be filled like repeating group.
  		IMessage header = (IMessage) message.getField(MESSAGE_HEADER);
          NTGMessageMetadata m = getMetadata(message.getName());
          if(header == null) {
              header = getMessageFactory().createMessage(MESSAGE_HEADER, getNamespace());
              // add header to message
              message.addField(MESSAGE_HEADER, header);
          }
  
          if (!header.isFieldSet(FIELD_MESSAGE_LENGTH)) {
              // special case: handle AML2 actions that doesn't sets
              // MessageLength field
              header.addField(FIELD_MESSAGE_LENGTH, m.messageSize);
          }
          if (!header.isFieldSet(FIELD_START_OF_MESSAGE)) {
              header.addField(FIELD_START_OF_MESSAGE, VALUE_START_OF_MESSAGE);
          }
          if (!header.isFieldSet(MESSAGE_TYPE)) {
              header.addField(MESSAGE_TYPE, m.messageType);
          }
  
  
  		if (params != null) {
              // AML2 - header filled by actions. Dirty AML2 uses "#nativemsgtype", "#dirtystart", "#dirtymsglen" to override header's fields
  		    String value = params.get(FIELD_DIRTY_MSG_LEN);
  		    if (value != null) {
                  header.addField(FIELD_MESSAGE_LENGTH, Integer.valueOf(value));
  		    }
  		    
  		    value = params.get(FIELD_DIRTY_MSG_TYPE);
              if (value != null) {
                  header.addField(MESSAGE_TYPE, value);
              }
              
              value = params.get(FIELD_DIRTY_START);
              if (value != null) {
                  header.addField(FIELD_START_OF_MESSAGE, Integer.valueOf(value));
              }
  		}
  		return message;
  	}
focal_method.class_method_signature: NTGMessageHelper.prepareMessageToEncode(IMessage message, Map<String, String> params)
focal_method.full_signature: @Override public IMessage prepareMessageToEncode(IMessage message, Map<String, String> params)
focal_method.identifier: prepareMessageToEncode
focal_method.invocations: getField getMetadata getName createMessage getMessageFactory getNamespace addField isFieldSet addField isFieldSet addField isFieldSet addField get addField valueOf get addField get addField valueOf
focal_method.modifiers: @Override public
focal_method.parameters: (IMessage message, Map<String, String> params)
focal_method.return: IMessage
focal_method.signature: IMessage prepareMessageToEncode(IMessage message, Map<String, String> params)