use of com.axway.ats.agent.core.action.ActionRequest in project ats-framework by Axway.
the class DisabledTest_MultiThreadedActionHandlerWithParameterizedInputData method twoThreadsWithThreeInvocations.
@Test
public void twoThreadsWithThreeInvocations() throws Exception {
int nThreads = 2;
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[i]);
}
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"));
assertEquals(1, (int) ParameterizedInputActionClass.addedStrings.get("X2.txt"));
assertNull(ParameterizedInputActionClass.addedStrings.get("X3.txt"));
assertNull(ParameterizedInputActionClass.addedStrings.get("Z3.txt"));
assertNull(ParameterizedInputActionClass.addedStrings.get("Z4.txt"));
}
use of com.axway.ats.agent.core.action.ActionRequest in project ats-framework by Axway.
the class DisabledTest_MultiThreadedActionHandlerWithParameterizedInputData method fourThreadsWithThreeInvocations.
@Test
public void fourThreadsWithThreeInvocations() throws Exception {
int nThreads = 4;
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[i]);
}
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(2, (int) ParameterizedInputActionClass.addedStrings.get("X1.txt"));
assertEquals(1, (int) ParameterizedInputActionClass.addedStrings.get("X2.txt"));
assertEquals(1, (int) ParameterizedInputActionClass.addedStrings.get("X3.txt"));
}
use of com.axway.ats.agent.core.action.ActionRequest in project ats-framework by Axway.
the class DisabledTest_MultiThreadedActionHandler method cancelAllQueuesDuringExecutionPositive.
@Test
public void cancelAllQueuesDuringExecutionPositive() throws Exception {
ActionRequest actionRequest = new ActionRequest(TEST_COMPONENT_NAME, "sleep action", new Object[] { "10000" });
ArrayList<ActionRequest> newActionRequests = new ArrayList<ActionRequest>();
newActionRequests.add(actionRequest);
RampUpPattern pattern = new RampUpPattern(3, false, 10, 0);
assertEquals(0, LoadTestActionClass.numExecutions);
QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
//then start the queue
actionHandler.executeActions("IP", QUEUE_1, -1, newActionRequests, pattern, new LoaderDataConfig());
Thread.sleep(1000);
actionHandler.cancelAllQueues();
//assert that only the first execution took place
expectedNumExecutions = 3;
}
use of com.axway.ats.agent.core.action.ActionRequest in project ats-framework by Axway.
the class DisabledTest_MultiThreadedActionHandlerWithParameterizedInputData method twoThreadsWithTwoInvocations.
@Test
public void twoThreadsWithTwoInvocations() throws Exception {
int nThreads = 2;
int nInvocations = 2;
List<ActionRequest> actions = new ArrayList<ActionRequest>();
LoaderDataConfig loaderDataConfig = new LoaderDataConfig();
for (int i = 0; i < nInvocations; i++) {
actions.add(fileUploadActionRequest);
loaderDataConfig.addParameterConfig(parameterDataProviders[i]);
}
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"));
assertEquals(1, (int) ParameterizedInputActionClass.addedStrings.get("X2.txt"));
assertNull(ParameterizedInputActionClass.addedStrings.get("X3.txt"));
}
use of com.axway.ats.agent.core.action.ActionRequest in project ats-framework by Axway.
the class DisabledTest_MultiThreadedActionHandlerWithParameterizedInputData method oneThreadWithTwoInvocations.
@Test
public void oneThreadWithTwoInvocations() throws Exception {
int nThreads = 1;
int nInvocations = 2;
List<ActionRequest> actions = new ArrayList<ActionRequest>();
LoaderDataConfig loaderDataConfig = new LoaderDataConfig();
for (int i = 0; i < nInvocations; i++) {
actions.add(fileUploadActionRequest);
loaderDataConfig.addParameterConfig(parameterDataProviders[i]);
}
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"));
assertNull(ParameterizedInputActionClass.addedStrings.get("Y2.txt"));
}
Aggregations