Search in sources :

Example 31 with RampUpPattern

use of com.axway.ats.agent.core.threading.patterns.RampUpPattern in project ats-framework by Axway.

the class DisabledTest_MultiThreadedActionHandler method waitUntilAllQueuesFinishPositive.

@Test
public void waitUntilAllQueuesFinishPositive() throws Exception {
    RampUpPattern pattern = new RampUpPattern(3, false, 3, 1000, 200, 2);
    //then start the queue
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
    actionHandler.executeActions("IP", QUEUE_1, -1, actionRequests, pattern, new LoaderDataConfig());
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_2);
    actionHandler.executeActions("IP", QUEUE_2, -1, actionRequests, pattern, new LoaderDataConfig());
    //wait until the queue finishes
    actionHandler.waitUntilAllQueuesFinish();
    expectedNumExecutions = 18;
}
Also used : RampUpPattern(com.axway.ats.agent.core.threading.patterns.RampUpPattern) LoaderDataConfig(com.axway.ats.agent.core.threading.data.config.LoaderDataConfig) Test(org.junit.Test)

Example 32 with RampUpPattern

use of com.axway.ats.agent.core.threading.patterns.RampUpPattern in project ats-framework by Axway.

the class DisabledTest_MultiThreadedActionHandler method executeActionsRampUpPatternBlockingPositive.

@Test
public void executeActionsRampUpPatternBlockingPositive() throws Exception {
    RampUpPattern pattern = new RampUpPattern(10, true);
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
    actionHandler.executeActions("IP", QUEUE_1, -1, actionRequests, pattern, new LoaderDataConfig());
    //check that all were executed
    expectedNumExecutions = 10;
}
Also used : RampUpPattern(com.axway.ats.agent.core.threading.patterns.RampUpPattern) LoaderDataConfig(com.axway.ats.agent.core.threading.data.config.LoaderDataConfig) Test(org.junit.Test)

Example 33 with RampUpPattern

use of com.axway.ats.agent.core.threading.patterns.RampUpPattern in project ats-framework by Axway.

the class DisabledTest_RampUpLoaderMultipleInvocations method cancelTasksPositive.

@Test
public void cancelTasksPositive() 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(0, LoadTestActionClass.numExecutions);
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_NAME);
    //then start the loader
    loader.start();
    //sleep until the first and second iterations are executed
    Thread.sleep(3500);
    assertEquals(6, LoadTestActionClass.numExecutions);
    loader.cancel();
}
Also used : RampUpPattern(com.axway.ats.agent.core.threading.patterns.RampUpPattern) ArrayList(java.util.ArrayList) Test(org.junit.Test) BaseTest(com.axway.ats.agent.core.BaseTest)

Example 34 with RampUpPattern

use of com.axway.ats.agent.core.threading.patterns.RampUpPattern in project ats-framework by Axway.

the class DisabledTest_RampUpLoaderMultipleInvocations method cancelFinishedTasksPositive.

@Test
public void cancelFinishedTasksPositive() throws Exception {
    RampUpPattern pattern = new RampUpPattern(3, false, 3, 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);
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_NAME);
    //then start the loader
    loader.start();
    //sleep until the first and second iterations are executed
    Thread.sleep(1000);
    assertEquals(9, LoadTestActionClass.numExecutions);
    loader.cancel();
}
Also used : RampUpPattern(com.axway.ats.agent.core.threading.patterns.RampUpPattern) ArrayList(java.util.ArrayList) Test(org.junit.Test) BaseTest(com.axway.ats.agent.core.BaseTest)

Example 35 with RampUpPattern

use of com.axway.ats.agent.core.threading.patterns.RampUpPattern in project ats-framework by Axway.

the class DisabledTest_RampUpLoaderMultipleInvocations method rampUpPatternBlockingVerifyNoDelayIfNoRampUp.

@Test
public void rampUpPatternBlockingVerifyNoDelayIfNoRampUp() throws Exception {
    RampUpPattern pattern = new RampUpPattern(5, true);
    loader = LoadQueueFactory.createLoadQueue(QUEUE_NAME, actionRequests, pattern, new ArrayList<ParameterDataProvider>(), null);
    //first schedule the threads
    loader.scheduleThreads("IP", false);
    Thread.sleep(1);
    //then start the loader
    long startTime = Calendar.getInstance().getTimeInMillis();
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_NAME);
    loader.start();
    long endTime = Calendar.getInstance().getTimeInMillis();
    assertTrue(endTime - startTime < 2000);
}
Also used : RampUpPattern(com.axway.ats.agent.core.threading.patterns.RampUpPattern) ArrayList(java.util.ArrayList) Test(org.junit.Test) BaseTest(com.axway.ats.agent.core.BaseTest)

Aggregations

RampUpPattern (com.axway.ats.agent.core.threading.patterns.RampUpPattern)36 Test (org.junit.Test)35 LoaderDataConfig (com.axway.ats.agent.core.threading.data.config.LoaderDataConfig)18 ArrayList (java.util.ArrayList)17 BaseTest (com.axway.ats.agent.core.BaseTest)16 ActionRequest (com.axway.ats.agent.core.action.ActionRequest)5 AllAtOncePattern (com.axway.ats.agent.core.threading.patterns.AllAtOncePattern)2 FixedDurationRampUpPattern (com.axway.ats.agent.core.threading.patterns.FixedDurationRampUpPattern)2 ParameterDataProvider (com.axway.ats.agent.core.threading.data.ParameterDataProvider)1 ThreadingPatternNotSupportedException (com.axway.ats.agent.core.threading.exceptions.ThreadingPatternNotSupportedException)1 QueueLoaderListener (com.axway.ats.agent.core.threading.listeners.QueueLoaderListener)1 FixedDurationAllAtOncePattern (com.axway.ats.agent.core.threading.patterns.FixedDurationAllAtOncePattern)1