Skip to content

Commit ce5fdc9

Browse files
committed
ESDK-3854: Fix unit test
1 parent 3f80d83 commit ce5fdc9

File tree

1 file changed

+62
-61
lines changed

1 file changed

+62
-61
lines changed

Java/Ema/Core/src/test/java/com/thomsonreuters/ema/access/EmaFileConfigJunitTests.java

+62-61
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package com.thomsonreuters.ema.access;
1+
package com.thomsonreuters.ema.access;
22

33
import junit.framework.TestCase;
4-
import com.thomsonreuters.ema.unittest.TestUtilities;
4+
import com.thomsonreuters.ema.unittest.TestUtilities;
55
import com.thomsonreuters.upa.codec.Qos;
66
import com.thomsonreuters.upa.codec.QosRates;
77
import com.thomsonreuters.upa.codec.QosTimeliness;
@@ -43,7 +43,7 @@ public void testLoadCfgFromFile()
4343
System.out.println("Using Ema Config: " + EmaConfigFileLocation);
4444
}
4545

46-
OmmConsumerConfigImpl testConfig = (OmmConsumerConfigImpl) EmaFactory.createOmmConsumerConfig(EmaConfigFileLocation);
46+
OmmConsumerConfigImpl testConfig = (OmmConsumerConfigImpl) EmaFactory.createOmmConsumerConfig(EmaConfigFileLocation);
4747

4848
// Check default consumer name (Conusmer_2) and associated values
4949
System.out.println("Retrieving DefaultConsumer configuration values: (DefaultConsumer value=Consumer_2) ");
@@ -70,16 +70,16 @@ public void testLoadCfgFromFile()
7070
TestUtilities.checkResult("MaxOutstandingPosts value == 90000", intLongValue == 90000 );
7171
int intValue = JUnitTestConnect.configGetIntValue(testConfig, defaultConsName, JUnitTestConnect.ConfigGroupTypeConsumer, JUnitTestConnect.DispatchTimeoutApiThread);
7272
TestUtilities.checkResult("DispatchTimeoutApiThread value == 90", intValue == 90 );
73-
intValue = testConfig.xmlConfig().getGlobalConfig().getPrimitiveValue(ConfigManager.ReactorMsgEventPoolLimit).intValue();
74-
TestUtilities.checkResult("ReactorMsgEventPoolLimit value == 2000", intValue == 2000);
75-
intValue = testConfig.xmlConfig().getGlobalConfig().getPrimitiveValue(ConfigManager.ReactorChannelEventPoolLimit).intValue();
76-
TestUtilities.checkResult("ReactorChannelEventPoolLimit value == 1500", intValue == 1500);
77-
intValue = testConfig.xmlConfig().getGlobalConfig().getPrimitiveValue(ConfigManager.WorkerEventPoolLimit).intValue();
78-
TestUtilities.checkResult("WorkerEventPoolLimit value == 1000", intValue == 1000);
79-
intValue = testConfig.xmlConfig().getGlobalConfig().getPrimitiveValue(ConfigManager.TunnelStreamMsgEventPoolLimit).intValue();
80-
TestUtilities.checkResult("TunnelStreamMsgEventPoolLimit value == 2500", intValue == 2500);
81-
intValue = testConfig.xmlConfig().getGlobalConfig().getPrimitiveValue(ConfigManager.TunnelStreamStatusEventPoolLimit).intValue();
82-
TestUtilities.checkResult("TunnelStreamStatusEventPoolLimit value == 3000", intValue == 3000);
73+
intValue = testConfig.xmlConfig().getGlobalConfig().getPrimitiveValue(ConfigManager.ReactorMsgEventPoolLimit).intValue();
74+
TestUtilities.checkResult("ReactorMsgEventPoolLimit value == 2000", intValue == 2000);
75+
intValue = testConfig.xmlConfig().getGlobalConfig().getPrimitiveValue(ConfigManager.ReactorChannelEventPoolLimit).intValue();
76+
TestUtilities.checkResult("ReactorChannelEventPoolLimit value == 1500", intValue == 1500);
77+
intValue = testConfig.xmlConfig().getGlobalConfig().getPrimitiveValue(ConfigManager.WorkerEventPoolLimit).intValue();
78+
TestUtilities.checkResult("WorkerEventPoolLimit value == 1000", intValue == 1000);
79+
intValue = testConfig.xmlConfig().getGlobalConfig().getPrimitiveValue(ConfigManager.TunnelStreamMsgEventPoolLimit).intValue();
80+
TestUtilities.checkResult("TunnelStreamMsgEventPoolLimit value == 2500", intValue == 2500);
81+
intValue = testConfig.xmlConfig().getGlobalConfig().getPrimitiveValue(ConfigManager.TunnelStreamStatusEventPoolLimit).intValue();
82+
TestUtilities.checkResult("TunnelStreamStatusEventPoolLimit value == 3000", intValue == 3000);
8383

8484
intLongValue = JUnitTestConnect.configGetIntLongValue(testConfig, defaultConsName, JUnitTestConnect.ConfigGroupTypeConsumer, JUnitTestConnect.MaxDispatchCountApiThread);
8585
TestUtilities.checkResult("MaxDispatchCountApiThread value == 400", intLongValue == 400 );
@@ -569,14 +569,14 @@ public void testLoadCfgFromProgrammaticConfig()
569569

570570
try
571571
{
572-
innerElementList.add(EmaFactory.createElementEntry().intValue("ReactorMsgEventPoolLimit", 100));
573-
innerElementList.add(EmaFactory.createElementEntry().intValue("ReactorChannelEventPoolLimit", 150));
574-
innerElementList.add(EmaFactory.createElementEntry().intValue("WorkerEventPoolLimit", 200));
575-
innerElementList.add(EmaFactory.createElementEntry().intValue("TunnelStreamMsgEventPoolLimit", 250));
576-
innerElementList.add(EmaFactory.createElementEntry().intValue("TunnelStreamStatusEventPoolLimit", 300));
577-
outermostMap.add(EmaFactory.createMapEntry().keyAscii( "GlobalConfig", MapEntry.MapAction.ADD, innerElementList ));
578-
innerElementList.clear();
579-
572+
innerElementList.add(EmaFactory.createElementEntry().intValue("ReactorMsgEventPoolLimit", 100));
573+
innerElementList.add(EmaFactory.createElementEntry().intValue("ReactorChannelEventPoolLimit", 150));
574+
innerElementList.add(EmaFactory.createElementEntry().intValue("WorkerEventPoolLimit", 200));
575+
innerElementList.add(EmaFactory.createElementEntry().intValue("TunnelStreamMsgEventPoolLimit", 250));
576+
innerElementList.add(EmaFactory.createElementEntry().intValue("TunnelStreamStatusEventPoolLimit", 300));
577+
outermostMap.add(EmaFactory.createMapEntry().keyAscii( "GlobalConfig", MapEntry.MapAction.ADD, innerElementList ));
578+
innerElementList.clear();
579+
580580
elementList.add(EmaFactory.createElementEntry().ascii("DefaultConsumer", "Consumer_1"));
581581

582582
innerElementList.add(EmaFactory.createElementEntry().ascii("Channel", "Channel_1"));
@@ -715,18 +715,18 @@ public void testLoadCfgFromProgrammaticConfig()
715715
TestUtilities.checkResult("ReissueTokenAttemptInterval == 9000", intValue == 9000);
716716
double doubleValue = JUnitTestConnect.activeConfigGetDoubleValue(cons, JUnitTestConnect.ConfigGroupTypeConsumer, JUnitTestConnect.TokenReissueRatio, -1);
717717
TestUtilities.checkResult("TokenReissueRatio == 0.9", doubleValue == 0.9);
718-
String enableRtt = JUnitTestConnect.activeConfigGetStringValue(cons, JUnitTestConnect.ConfigGroupTypeConsumer, JUnitTestConnect.EnableRtt, -1);
719-
TestUtilities.checkResult("EnableRtt value == true", enableRtt.contentEquals("true") );
720-
int value = ((OmmConsumerImpl) cons).activeConfig().globalConfig.reactorMsgEventPoolLimit;
721-
TestUtilities.checkResult("ReactorMsgEventPoolLimit == 100", value == 100);
722-
value = ((OmmConsumerImpl) cons).activeConfig().globalConfig.reactorChannelEventPoolLimit;
723-
TestUtilities.checkResult("ReactorChannelEventPoolLimit == 150", value == 150);
724-
value = ((OmmConsumerImpl) cons).activeConfig().globalConfig.workerEventPoolLimit;
725-
TestUtilities.checkResult("WorkerEventPoolLimit == 200", value == 200);
726-
value = ((OmmConsumerImpl) cons).activeConfig().globalConfig.tunnelStreamMsgEventPoolLimit;
727-
TestUtilities.checkResult("TunnelStreamMsgEventPoolLimit == 250", value == 250);
728-
value = ((OmmConsumerImpl) cons).activeConfig().globalConfig.tunnelStreamStatusEventPoolLimit;
729-
TestUtilities.checkResult("TunnelStreamStatusEventPoolLimit == 300", value == 300);
718+
String enableRtt = JUnitTestConnect.activeConfigGetStringValue(cons, JUnitTestConnect.ConfigGroupTypeConsumer, JUnitTestConnect.EnableRtt, -1);
719+
TestUtilities.checkResult("EnableRtt value == true", enableRtt.contentEquals("true") );
720+
int value = ((OmmConsumerImpl) cons).activeConfig().globalConfig.reactorMsgEventPoolLimit;
721+
TestUtilities.checkResult("ReactorMsgEventPoolLimit == 100", value == 100);
722+
value = ((OmmConsumerImpl) cons).activeConfig().globalConfig.reactorChannelEventPoolLimit;
723+
TestUtilities.checkResult("ReactorChannelEventPoolLimit == 150", value == 150);
724+
value = ((OmmConsumerImpl) cons).activeConfig().globalConfig.workerEventPoolLimit;
725+
TestUtilities.checkResult("WorkerEventPoolLimit == 200", value == 200);
726+
value = ((OmmConsumerImpl) cons).activeConfig().globalConfig.tunnelStreamMsgEventPoolLimit;
727+
TestUtilities.checkResult("TunnelStreamMsgEventPoolLimit == 250", value == 250);
728+
value = ((OmmConsumerImpl) cons).activeConfig().globalConfig.tunnelStreamStatusEventPoolLimit;
729+
TestUtilities.checkResult("TunnelStreamStatusEventPoolLimit == 300", value == 300);
730730

731731

732732
// Check values of Consumer_1
@@ -2364,14 +2364,14 @@ public void testLoadCfgFromProgrammaticConfigForIProv()
23642364
ElementList innerElementList = EmaFactory.createElementList();
23652365
try
23662366
{
2367-
innerElementList.add(EmaFactory.createElementEntry().intValue("ReactorMsgEventPoolLimit", 2000));
2368-
innerElementList.add(EmaFactory.createElementEntry().intValue("ReactorChannelEventPoolLimit", 1500));
2369-
innerElementList.add(EmaFactory.createElementEntry().intValue("WorkerEventPoolLimit", 1000));
2370-
innerElementList.add(EmaFactory.createElementEntry().intValue("TunnelStreamMsgEventPoolLimit", 2500));
2371-
innerElementList.add(EmaFactory.createElementEntry().intValue("TunnelStreamStatusEventPoolLimit", 3000));
2372-
outermostMap.add(EmaFactory.createMapEntry().keyAscii( "GlobalConfig", MapEntry.MapAction.ADD, innerElementList ));
2373-
innerElementList.clear();
2374-
2367+
innerElementList.add(EmaFactory.createElementEntry().intValue("ReactorMsgEventPoolLimit", 2000));
2368+
innerElementList.add(EmaFactory.createElementEntry().intValue("ReactorChannelEventPoolLimit", 1500));
2369+
innerElementList.add(EmaFactory.createElementEntry().intValue("WorkerEventPoolLimit", 1000));
2370+
innerElementList.add(EmaFactory.createElementEntry().intValue("TunnelStreamMsgEventPoolLimit", 2500));
2371+
innerElementList.add(EmaFactory.createElementEntry().intValue("TunnelStreamStatusEventPoolLimit", 3000));
2372+
outermostMap.add(EmaFactory.createMapEntry().keyAscii( "GlobalConfig", MapEntry.MapAction.ADD, innerElementList ));
2373+
innerElementList.clear();
2374+
23752375
elementList.add(EmaFactory.createElementEntry().ascii("DefaultIProvider", "Provider_1"));
23762376

23772377
innerElementList.add(EmaFactory.createElementEntry().ascii("Server", "Server_1"));
@@ -2384,7 +2384,7 @@ public void testLoadCfgFromProgrammaticConfigForIProv()
23842384
innerElementList.add(EmaFactory.createElementEntry().intValue("AcceptMessageWithoutAcceptingRequests", 1));
23852385
innerElementList.add(EmaFactory.createElementEntry().intValue("AcceptMessageWithoutBeingLogin", 1));
23862386
innerElementList.add(EmaFactory.createElementEntry().intValue("AcceptMessageWithoutQosInRange", 1));
2387-
innerElementList.add(EmaFactory.createElementEntry().intValue("EnforceAckIDValidation", 1));
2387+
innerElementList.add(EmaFactory.createElementEntry().intValue("EnforceAckIDValidation", 1));
23882388
innerElementList.add(EmaFactory.createElementEntry().intValue("FieldDictionaryFragmentSize", 2000));
23892389
innerElementList.add(EmaFactory.createElementEntry().intValue("EnumTypeFragmentSize", 1000));
23902390
innerElementList.add(EmaFactory.createElementEntry().intValue("RefreshFirstRequired", 0));
@@ -2569,11 +2569,11 @@ public void testLoadCfgFromProgrammaticConfigForIProv()
25692569

25702570
System.out.println("Using Ema Config: " + localConfigPath);
25712571

2572-
OmmIProviderImpl prov = null;
2572+
OmmIProviderImpl prov = null;
25732573
if (testCase == 0)
2574-
prov = (OmmIProviderImpl) JUnitTestConnect.createOmmIProvider(EmaFactory.createOmmIProviderConfig().config(outermostMap));
2574+
prov = (OmmIProviderImpl) JUnitTestConnect.createOmmIProvider(EmaFactory.createOmmIProviderConfig().config(outermostMap));
25752575
else if (testCase == 1)
2576-
prov = (OmmIProviderImpl) JUnitTestConnect.createOmmIProvider(EmaFactory.createOmmIProviderConfig(localConfigPath).config(outermostMap));
2576+
prov = (OmmIProviderImpl) JUnitTestConnect.createOmmIProvider(EmaFactory.createOmmIProviderConfig(localConfigPath).config(outermostMap));
25772577

25782578
String defaultProvName = JUnitTestConnect.activeConfigGetStringValue(prov, JUnitTestConnect.ConfigGroupTypeProvider, JUnitTestConnect.IProviderName);
25792579
TestUtilities.checkResult("DefaultProvider value != null", defaultProvName != null);
@@ -2594,8 +2594,8 @@ else if (testCase == 1)
25942594
TestUtilities.checkResult("AcceptMessageSameKeyButDiffStream == 1", boolValue == true);
25952595
boolValue = JUnitTestConnect.activeConfigGetBooleanValue(prov, JUnitTestConnect.ConfigGroupTypeProvider, JUnitTestConnect.IProviderAcceptMessageThatChangesService);
25962596
TestUtilities.checkResult("AcceptMessageThatChangesService == 1", boolValue == true);
2597-
boolValue = JUnitTestConnect.activeConfigGetBooleanValue(prov, JUnitTestConnect.ConfigGroupTypeProvider, JUnitTestConnect.IProviderEnforceAckIDValidation);
2598-
TestUtilities.checkResult("IProviderEnforceAckIDValidation == 1", boolValue == true);
2597+
boolValue = JUnitTestConnect.activeConfigGetBooleanValue(prov, JUnitTestConnect.ConfigGroupTypeProvider, JUnitTestConnect.IProviderEnforceAckIDValidation);
2598+
TestUtilities.checkResult("IProviderEnforceAckIDValidation == 1", boolValue == true);
25992599
boolValue = JUnitTestConnect.activeConfigGetBooleanValue(prov, JUnitTestConnect.ConfigGroupTypeProvider, JUnitTestConnect.IProviderRefreshFirstRequired);
26002600
TestUtilities.checkResult("RefreshFirstRequired == 0", boolValue == false);
26012601
int intLongValue = JUnitTestConnect.activeConfigGetIntLongValue(prov, JUnitTestConnect.ConfigGroupTypeProvider, JUnitTestConnect.DictionaryFieldDictFragmentSize);
@@ -2619,18 +2619,18 @@ else if (testCase == 1)
26192619

26202620
boolValue = JUnitTestConnect.activeConfigGetBooleanValue(prov, JUnitTestConnect.ConfigGroupTypeProvider, JUnitTestConnect.XmlTraceToStdout);
26212621
TestUtilities.checkResult("XmlTraceToStdout == 1", boolValue == true);
2622-
2623-
// Check Global configuration:
2624-
int value = prov.activeConfig().globalConfig.reactorMsgEventPoolLimit;
2625-
TestUtilities.checkResult("ReactorMsgEventPoolLimit == 2000", value == 2000);
2626-
value = prov.activeConfig().globalConfig.reactorChannelEventPoolLimit;
2627-
TestUtilities.checkResult("ReactorChannelEventPoolLimit == 1500", value == 1500);
2628-
value = prov.activeConfig().globalConfig.workerEventPoolLimit;
2629-
TestUtilities.checkResult("WorkerEventPoolLimit == 1000", value == 1000);
2630-
value = prov.activeConfig().globalConfig.tunnelStreamMsgEventPoolLimit;
2631-
TestUtilities.checkResult("TunnelStreamMsgEventPoolLimit == 2500", value == 2500);
2632-
value = prov.activeConfig().globalConfig.tunnelStreamStatusEventPoolLimit;
2633-
TestUtilities.checkResult("TunnelStreamStatusEventPoolLimit == 3000", value == 3000);
2622+
2623+
// Check Global configuration:
2624+
int value = prov.activeConfig().globalConfig.reactorMsgEventPoolLimit;
2625+
TestUtilities.checkResult("ReactorMsgEventPoolLimit == 2000", value == 2000);
2626+
value = prov.activeConfig().globalConfig.reactorChannelEventPoolLimit;
2627+
TestUtilities.checkResult("ReactorChannelEventPoolLimit == 1500", value == 1500);
2628+
value = prov.activeConfig().globalConfig.workerEventPoolLimit;
2629+
TestUtilities.checkResult("WorkerEventPoolLimit == 1000", value == 1000);
2630+
value = prov.activeConfig().globalConfig.tunnelStreamMsgEventPoolLimit;
2631+
TestUtilities.checkResult("TunnelStreamMsgEventPoolLimit == 2500", value == 2500);
2632+
value = prov.activeConfig().globalConfig.tunnelStreamStatusEventPoolLimit;
2633+
TestUtilities.checkResult("TunnelStreamStatusEventPoolLimit == 3000", value == 3000);
26342634

26352635
// Check Server configuration:
26362636
// Check Server_1 configuration.
@@ -3303,6 +3303,7 @@ public void testMergCfgBetweenFileAndProgrammaticConfigForIProv()
33033303
innerElementList.add(EmaFactory.createElementEntry().intValue("MaxDispatchCountApiThread", 900));
33043304
innerElementList.add(EmaFactory.createElementEntry().intValue("MaxDispatchCountUserThread", 900));
33053305
innerElementList.add(EmaFactory.createElementEntry().intValue("XmlTraceToStdout", 1));
3306+
innerElementList.add(EmaFactory.createElementEntry().intValue("EnforceAckIDValidation", 1));
33063307
innerMap.add(EmaFactory.createMapEntry().keyAscii( "Provider_2", MapEntry.MapAction.ADD, innerElementList));
33073308
innerElementList.clear();
33083309

@@ -3459,8 +3460,8 @@ else if (testCase == 1)
34593460
TestUtilities.checkResult("AcceptMessageSameKeyButDiffStream == 1", boolValue == true);
34603461
boolValue = JUnitTestConnect.activeConfigGetBooleanValue(prov, JUnitTestConnect.ConfigGroupTypeProvider, JUnitTestConnect.IProviderAcceptMessageThatChangesService);
34613462
TestUtilities.checkResult("AcceptMessageThatChangesService == 1", boolValue == true);
3462-
boolValue = JUnitTestConnect.activeConfigGetBooleanValue(prov, JUnitTestConnect.ConfigGroupTypeProvider, JUnitTestConnect.IProviderEnforceAckIDValidation);
3463-
TestUtilities.checkResult("EnforceAckIDValidation == 1", boolValue == true);
3463+
boolValue = JUnitTestConnect.activeConfigGetBooleanValue(prov, JUnitTestConnect.ConfigGroupTypeProvider, JUnitTestConnect.IProviderEnforceAckIDValidation);
3464+
TestUtilities.checkResult("EnforceAckIDValidation == 1", boolValue == true);
34643465
boolValue = JUnitTestConnect.activeConfigGetBooleanValue(prov, JUnitTestConnect.ConfigGroupTypeProvider, JUnitTestConnect.IProviderRefreshFirstRequired);
34653466
TestUtilities.checkResult("RefreshFirstRequired == 0", boolValue == false);
34663467
int intLongValue = JUnitTestConnect.activeConfigGetIntLongValue(prov, JUnitTestConnect.ConfigGroupTypeProvider, JUnitTestConnect.DictionaryFieldDictFragmentSize);

0 commit comments

Comments
 (0)