use of com.axway.ats.agent.core.threading.patterns.RampUpPattern in project ats-framework by Axway.
the class DisabledTest_RampUpLoaderMultipleInvocations 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);
RampUpPattern pattern = new RampUpPattern(3, false, 10, 0);
loader = LoadQueueFactory.createLoadQueue(QUEUE_NAME, 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_NAME);
//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.RampUpPattern in project ats-framework by Axway.
the class DisabledTest_RampUpLoaderMultipleInvocations method getStateRunningBlockingPositive.
@Test
public void getStateRunningBlockingPositive() throws Exception {
RampUpPattern pattern = new RampUpPattern(3, true);
loader = LoadQueueFactory.createLoadQueue(QUEUE_NAME, actionRequests, pattern, new ArrayList<ParameterDataProvider>(), null);
//first schedule the threads
loader.scheduleThreads("IP", false);
Thread.sleep(1);
assertEquals(ActionTaskLoaderState.SCHEDULED, loader.getState());
QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_NAME);
//then start the loader
loader.start();
assertEquals(ActionTaskLoaderState.FINISHED, loader.getState());
}
use of com.axway.ats.agent.core.threading.patterns.RampUpPattern in project ats-framework by Axway.
the class DisabledTest_RampUpLoaderMultipleInvocations method rampUpPatternBlockingWithRampUpIrregularPatternPositive.
@Test
public void rampUpPatternBlockingWithRampUpIrregularPatternPositive() throws Exception {
RampUpPattern pattern = new RampUpPattern(10, true, 1, 0, 1000, 3);
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);
//then start the loader
long startTime = Calendar.getInstance().getTimeInMillis();
QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_NAME);
loader.start();
long executionTime = Calendar.getInstance().getTimeInMillis() - startTime;
assertEquals(10, LoadTestActionClass.numExecutions);
assertTrue(executionTime > 3000);
assertTrue(executionTime < 5000);
}
use of com.axway.ats.agent.core.threading.patterns.RampUpPattern in project ats-framework by Axway.
the class DisabledTest_RampUpLoaderMultipleInvocations method getStateNonBlockingPositive.
@Test
public void getStateNonBlockingPositive() 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);
assertEquals(ActionTaskLoaderState.SCHEDULED, loader.getState());
QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_NAME);
//then start the loader
loader.start();
assertEquals(ActionTaskLoaderState.RUNNING, loader.getState());
//cancel
loader.cancel();
assertEquals(ActionTaskLoaderState.FINISHED, loader.getState());
}
use of com.axway.ats.agent.core.threading.patterns.RampUpPattern in project ats-framework by Axway.
the class DisabledTest_RampUpLoaderMultipleInvocations method rampUpPatternBlockingMultipleInvocationsNoDelayPositive.
@Test
public void rampUpPatternBlockingMultipleInvocationsNoDelayPositive() throws Exception {
RampUpPattern pattern = new RampUpPattern(2, true, 10, 0);
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);
//then start the loader
long startTime = Calendar.getInstance().getTimeInMillis();
QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_NAME);
loader.start();
long endTime = Calendar.getInstance().getTimeInMillis();
assertEquals(20, LoadTestActionClass.numExecutions);
assertTrue(endTime - startTime < 2000);
}
Aggregations