Search in sources :

Example 1 with TargetSubID

use of quickfix.field.TargetSubID in project wso2-synapse by wso2.

the class FIXTransportSenderTest method testIsTargetValid.

@Test
public void testIsTargetValid() throws Exception {
    Map<String, String> fieldValues = new HashMap<>();
    fieldValues.put(FIXConstants.BEGIN_STRING, "FIX.4.1");
    fieldValues.put(FIXConstants.DELIVER_TO_COMP_ID, "SYNAPSE");
    fieldValues.put(FIXConstants.DELIVER_TO_SUB_ID, "sy");
    fieldValues.put(FIXConstants.DELIVER_TO_LOCATION_ID, "randomLoc");
    SessionID id = new SessionID(new BeginString("FIX.4.1"), new SenderCompID("BANZAI"), new SenderSubID("ba"), new SenderLocationID("senderLoc"), new TargetCompID("SYNAPSE"), new TargetSubID("sy"), new TargetLocationID("randomLoc"), "FIX.4.1:SYNAPSE->BANZAI");
    FIXTransportSender sender = new FIXTransportSender();
    Class senderClass = sender.getClass();
    Method isTargetvalid = senderClass.getDeclaredMethod("isTargetValid", Map.class, SessionID.class, boolean.class);
    isTargetvalid.setAccessible(true);
    Object result = isTargetvalid.invoke(senderClass.newInstance(), fieldValues, id, true);
    Assert.assertEquals("Invalid target!", "true", result.toString());
}
Also used : BeginString(quickfix.field.BeginString) SenderCompID(quickfix.field.SenderCompID) SenderSubID(quickfix.field.SenderSubID) HashMap(java.util.HashMap) TargetCompID(quickfix.field.TargetCompID) TargetSubID(quickfix.field.TargetSubID) TargetLocationID(quickfix.field.TargetLocationID) BeginString(quickfix.field.BeginString) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Method(java.lang.reflect.Method) SenderLocationID(quickfix.field.SenderLocationID) SessionID(quickfix.SessionID) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

Method (java.lang.reflect.Method)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 SessionID (quickfix.SessionID)1 BeginString (quickfix.field.BeginString)1 SenderCompID (quickfix.field.SenderCompID)1 SenderLocationID (quickfix.field.SenderLocationID)1 SenderSubID (quickfix.field.SenderSubID)1 TargetCompID (quickfix.field.TargetCompID)1 TargetLocationID (quickfix.field.TargetLocationID)1 TargetSubID (quickfix.field.TargetSubID)1