use of com.axway.ats.agent.core.threading.patterns.RampUpPattern in project ats-framework by Axway.
the class DisabledTest_MultiThreadedActionHandler method scheduleActionsRampUpPatternBlockingWithRampUpPositive.
@Test
public void scheduleActionsRampUpPatternBlockingWithRampUpPositive() throws Exception {
RampUpPattern pattern = new RampUpPattern(10, true, 1, 0, 5000, 2);
//then start the queue
long startTime = Calendar.getInstance().getTimeInMillis();
actionHandler.scheduleActions("IP", QUEUE_1, -1, actionRequests, pattern, new LoaderDataConfig(), false);
long executionTime = Calendar.getInstance().getTimeInMillis() - startTime;
assertTrue(executionTime < 1000);
}
use of com.axway.ats.agent.core.threading.patterns.RampUpPattern in project ats-framework by Axway.
the class Test_QueueCanceling method ramUp_OneThreadRunning_OneThreadNotStartedYet.
/**
* Cancel a ramp-up pattern while:
* - 1th thread is running its first iteration
* - 2nd thread is waiting to start its first iteration
*/
@Test
public void ramUp_OneThreadRunning_OneThreadNotStartedYet() throws Exception {
expectedNumExecutions = 1;
actionRequests.add(new ActionRequest(TEST_COMPONENT_NAME, ACTION_SLEEP, new Object[] { "1000" }));
RampUpPattern pattern = new RampUpPattern(2, false, 2, 0, 2000, 1);
QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_NAME);
actionHandler.scheduleActions(HOST, QUEUE_NAME, -1, actionRequests, pattern, new LoaderDataConfig(), false);
actionHandler.startQueue(QUEUE_NAME);
Thread.sleep(500);
}
use of com.axway.ats.agent.core.threading.patterns.RampUpPattern in project ats-framework by Axway.
the class DisabledTest_RampUpLoaderMultipleInvocations method cancelTasksBeforeStartPositive.
@Test
public void cancelTasksBeforeStartPositive() throws Exception {
RampUpPattern pattern = new RampUpPattern(3, true, 10, 3000);
loader = LoadQueueFactory.createLoadQueue(QUEUE_NAME, actionRequests, pattern, new ArrayList<ParameterDataProvider>(), null);
//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.RampUpPattern in project ats-framework by Axway.
the class DisabledTest_RampUpLoaderMultipleInvocations method scheduleNegativeAlreadyScheduled.
@Test(expected = ActionTaskLoaderException.class)
public void scheduleNegativeAlreadyScheduled() throws Exception {
RampUpPattern pattern = new RampUpPattern(3, false, 10, 3000);
loader = LoadQueueFactory.createLoadQueue(QUEUE_NAME, actionRequests, pattern, new ArrayList<ParameterDataProvider>(), null);
//first schedule the threads
loader.scheduleThreads("IP", false);
Thread.sleep(1);
try {
loader.scheduleThreads("IP", false);
} finally {
loader.cancel();
}
}
use of com.axway.ats.agent.core.threading.patterns.RampUpPattern in project ats-framework by Axway.
the class DisabledTest_RampUpLoaderMultipleInvocations method startNegativeNotScheduled.
@Test(expected = ActionTaskLoaderException.class)
public void startNegativeNotScheduled() throws Exception {
RampUpPattern pattern = new RampUpPattern(3, false, 10, 3000);
loader = LoadQueueFactory.createLoadQueue(QUEUE_NAME, actionRequests, pattern, new ArrayList<ParameterDataProvider>(), null);
QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_NAME);
//first schedule the threads
loader.start();
}
Aggregations