use of com.axway.ats.agent.core.threading.patterns.AllAtOncePattern in project ats-framework by Axway.
the class DisabledTest_MultiThreadedActionHandlerWithParameterizedInputData method paremterizedVariousDataPositive.
@Test
public void paremterizedVariousDataPositive() throws Exception {
LoaderDataConfig loaderDataConfig = new LoaderDataConfig();
loaderDataConfig.addParameterConfig(new RangeDataConfig("fileName", "file{0}.txt", 1, 300));
loaderDataConfig.addParameterConfig(new RangeDataConfig("fileName", "file{0}.txt", 1, 300));
loaderDataConfig.addParameterConfig(new RangeDataConfig("milliseconds", 1, 4));
AllAtOncePattern pattern = new AllAtOncePattern(5, true);
QueueExecutionStatistics.getInstance().initActionExecutionResults("test 1");
actionHandler.executeActions("IP", "test 1", -1, actionRequests, pattern, loaderDataConfig);
//check the strings
assertEquals(10, ParameterizedInputActionClass.getAddedStringsCount());
for (int i = 1; i < 6; i++) {
assertEquals(2, (int) ParameterizedInputActionClass.addedStrings.get("file" + i + ".txt"));
}
//check the integers
assertEquals(4, ParameterizedInputActionClass.addedLongs.size());
for (int i = 1; i < 5; i++) {
assertTrue(ParameterizedInputActionClass.addedLongs.contains(new Long(i)));
}
}
use of com.axway.ats.agent.core.threading.patterns.AllAtOncePattern in project ats-framework by Axway.
the class DisabledTest_MultiThreadedActionHandlerWithParameterizedInputData method paramPresentOnlyOnceInDataProviders.
@Test
public void paramPresentOnlyOnceInDataProviders() throws Exception {
int nThreads = 1;
int nInvocations = 3;
List<ActionRequest> actions = new ArrayList<ActionRequest>();
LoaderDataConfig loaderDataConfig = new LoaderDataConfig();
for (int i = 0; i < nInvocations; i++) {
actions.add(fileUploadActionRequest);
}
loaderDataConfig.addParameterConfig(parameterDataProviders[0]);
AllAtOncePattern pattern = new AllAtOncePattern(nThreads, true);
QueueExecutionStatistics.getInstance().initActionExecutionResults("test 1");
actionHandler.executeActions("IP", "test 1", -1, actions, pattern, loaderDataConfig);
assertEquals(nInvocations * nThreads, ParameterizedInputActionClass.getAddedStringsCount());
assertEquals(1, (int) ParameterizedInputActionClass.addedStrings.get("X1.txt"));
assertNull(ParameterizedInputActionClass.addedStrings.get("X2.txt"));
assertNull(ParameterizedInputActionClass.addedStrings.get("X3.txt"));
}
use of com.axway.ats.agent.core.threading.patterns.AllAtOncePattern in project ats-framework by Axway.
the class DisabledTest_MultiThreadedActionHandler method executeActionsAllAtOncePatternBlockingVerifyNoDelay.
@Test
public void executeActionsAllAtOncePatternBlockingVerifyNoDelay() throws Exception {
AllAtOncePattern pattern = new AllAtOncePattern(5, true);
long startTime = Calendar.getInstance().getTimeInMillis();
QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
actionHandler.executeActions("IP", QUEUE_1, -1, actionRequests, pattern, new LoaderDataConfig());
long endTime = Calendar.getInstance().getTimeInMillis();
assertTrue(endTime - startTime < 1000);
}
use of com.axway.ats.agent.core.threading.patterns.AllAtOncePattern in project ats-framework by Axway.
the class DisabledTest_MultiThreadedActionHandler method finishedQueuesAreCleanedUpOnSchedule.
@Test
public void finishedQueuesAreCleanedUpOnSchedule() throws Exception {
AllAtOncePattern pattern = new AllAtOncePattern(1, true);
QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
//first queue finished
actionHandler.executeActions("IP", QUEUE_1, -1, actionRequests, pattern, new LoaderDataConfig());
//second queue running
actionHandler.executeActions("IP", QUEUE_1, -1, actionRequests, pattern, new LoaderDataConfig());
//wait until the queue finishes
actionHandler.waitUntilAllQueuesFinish();
}
use of com.axway.ats.agent.core.threading.patterns.AllAtOncePattern in project ats-framework by Axway.
the class DisabledTest_MultiThreadedActionHandler method executeActionsAllAtOncePatternBlockingPositive.
@Test
public void executeActionsAllAtOncePatternBlockingPositive() throws Exception {
AllAtOncePattern pattern = new AllAtOncePattern(5, true);
QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
actionHandler.executeActions("IP", QUEUE_1, -1, actionRequests, pattern, new LoaderDataConfig());
expectedNumExecutions = 5;
}
Aggregations