use of com.axway.ats.agent.core.threading.patterns.FixedDurationRampUpPattern in project ats-framework by Axway.
the class DisabledTest_RampUpQueueLoaderFixedDuration method cancelTasksDuringExecutionPositive.
@Test
public void cancelTasksDuringExecutionPositive() throws Exception {
ActionRequest actionRequest = new ActionRequest(TEST_COMPONENT_NAME, "sleep action", new Object[] { "10000" });
ArrayList<ActionRequest> newActionRequests = new ArrayList<ActionRequest>();
newActionRequests.add(actionRequest);
FixedDurationRampUpPattern pattern = new FixedDurationRampUpPattern(3, false, 10, 0);
loader = LoadQueueFactory.createLoadQueue(QUEUE_1, newActionRequests, pattern, new ArrayList<ParameterDataProvider>(), null);
//first schedule the threads
loader.scheduleThreads("IP", false);
Thread.sleep(1);
assertEquals(0, LoadTestActionClass.numExecutions);
QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
//then start the loader
loader.start();
Thread.sleep(1000);
loader.cancel();
//assert that only the first execution took place
assertEquals(3, LoadTestActionClass.numExecutions);
}
use of com.axway.ats.agent.core.threading.patterns.FixedDurationRampUpPattern in project ats-framework by Axway.
the class DisabledTest_RampUpQueueLoaderFixedDuration method cancelTasksBeforeStartPositive.
@Test
public void cancelTasksBeforeStartPositive() throws Exception {
FixedDurationRampUpPattern pattern = new FixedDurationRampUpPattern(3, true, 10, 3000);
loader = LoadQueueFactory.createLoadQueue(QUEUE_1, actionRequests, pattern, new ArrayList<ParameterDataProvider>(), null);
QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
//first schedule the threads
loader.scheduleThreads("IP", false);
Thread.sleep(1);
assertEquals(0, LoadTestActionClass.numExecutions);
loader.cancel();
assertEquals(0, LoadTestActionClass.numExecutions);
}
use of com.axway.ats.agent.core.threading.patterns.FixedDurationRampUpPattern in project ats-framework by Axway.
the class DisabledTest_RampUpQueueLoaderFixedDuration method cancelFinishedTasksPositive.
@Test
public void cancelFinishedTasksPositive() throws Exception {
FixedDurationRampUpPattern pattern = new FixedDurationRampUpPattern(3, false, 1, 100);
loader = LoadQueueFactory.createLoadQueue(QUEUE_1, actionRequests, pattern, new ArrayList<ParameterDataProvider>(), null);
//first schedule the threads
loader.scheduleThreads("IP", false);
Thread.sleep(1);
assertEquals(0, LoadTestActionClass.numExecutions);
QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
//then start the loader
loader.start();
//sleep until the first and second iterations are executed
Thread.sleep(1500);
assertTrue(LoadTestActionClass.numExecutions > 20);
loader.cancel();
}
Aggregations