use of com.axway.ats.agent.core.threading.patterns.AllAtOncePattern in project ats-framework by Axway.
the class Test_QueueCanceling method allAtOnce_SetMaxSpeed_BothThreadsPaused.
/**
* Both threads will do 1 iteration and will be paused for 30 seconds due to the max speed.
* At this moment we will cancel both threads.
*/
@Test
public void allAtOnce_SetMaxSpeed_BothThreadsPaused() throws Exception {
expectedNumExecutions = 2;
actionRequests.add(new ActionRequest(TEST_COMPONENT_NAME, ACTION_SLEEP, new Object[] { "500" }));
AllAtOncePattern pattern = new AllAtOncePattern(2, false, 5, 500);
pattern.setExecutionSpeed(30, 2);
QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_NAME);
actionHandler.scheduleActions(HOST, QUEUE_NAME, -1, actionRequests, pattern, new LoaderDataConfig(), false);
actionHandler.startQueue(QUEUE_NAME);
Thread.sleep(1500);
}
use of com.axway.ats.agent.core.threading.patterns.AllAtOncePattern in project ats-framework by Axway.
the class Test_QueueCanceling method allAtOnce_OneThreadRunning_OneThreadPaused.
/**
* We cancel 1 thread while running its 1st iteration and 2nd thread while waiting between its 1st and 2nd iterations
*/
@Test
public void allAtOnce_OneThreadRunning_OneThreadPaused() throws Exception {
expectedNumExecutions = 2;
ListDataConfig parameterData = new ListDataConfig("sleepTime", Arrays.asList(new String[] { "500", "2000" }), ParameterProviderLevel.PER_THREAD_STATIC);
LoaderDataConfig loaderDataConfig = new LoaderDataConfig();
loaderDataConfig.addParameterConfig(parameterData);
actionRequests.add(new ActionRequest(TEST_COMPONENT_NAME, ACTION_SLEEP, new Object[] { "sleepTime" }));
AllAtOncePattern pattern = new AllAtOncePattern(2, false, 2, 1000);
QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_NAME);
actionHandler.scheduleActions(HOST, QUEUE_NAME, -1, actionRequests, pattern, loaderDataConfig, false);
actionHandler.startQueue(QUEUE_NAME);
Thread.sleep(1000);
}
Aggregations