Search in sources :

Example 26 with RampUpPattern

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

the class DisabledTest_MultiThreadedActionHandler method startRampUpPatternNonBlockingPositive.

@Test
public void startRampUpPatternNonBlockingPositive() throws Exception {
    RampUpPattern pattern = new RampUpPattern(3, false, 10, 10000, 2000, 1);
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
    actionHandler.scheduleActions("IP", QUEUE_1, -1, actionRequests, pattern, new LoaderDataConfig(), false);
    //then start the queue
    long startTime = Calendar.getInstance().getTimeInMillis();
    actionHandler.startQueue(QUEUE_1);
    long executionTime = Calendar.getInstance().getTimeInMillis() - startTime;
    // as the pattern is not blocking, we will get here right away
    assertTrue(executionTime < 1000);
}
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 27 with RampUpPattern

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

the class DisabledTest_MultiThreadedActionHandler method waitUntilAcitonQueueFinishesPositive.

@Test
public void waitUntilAcitonQueueFinishesPositive() throws Exception {
    RampUpPattern pattern = new RampUpPattern(3, true, 3, 1000, 200, 2);
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
    //then start the queue
    actionHandler.executeActions("IP", QUEUE_1, -1, actionRequests, pattern, new LoaderDataConfig());
    //wait until the queue finishes
    actionHandler.waitUntilQueueFinish(QUEUE_1);
    expectedNumExecutions = 9;
}
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 28 with RampUpPattern

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

the class DisabledTest_MultiThreadedActionHandler method executeActionsRampUpPatternBlockingWithRampUpPositive.

@Test
public void executeActionsRampUpPatternBlockingWithRampUpPositive() throws Exception {
    RampUpPattern pattern = new RampUpPattern(10, true, 1, 0, 1000, 2);
    //then start the queue
    long startTime = Calendar.getInstance().getTimeInMillis();
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
    actionHandler.executeActions("IP", QUEUE_1, -1, actionRequests, pattern, new LoaderDataConfig());
    long executionTime = Calendar.getInstance().getTimeInMillis() - startTime;
    assertTrue(executionTime >= 4000);
    assertTrue(executionTime < 6000);
    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 29 with RampUpPattern

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

the class DisabledTest_MultiThreadedActionHandler method cancelAllQueuesPositive.

@Test
public void cancelAllQueuesPositive() throws Exception {
    RampUpPattern pattern = new RampUpPattern(3, false, 10, 3000);
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
    //then start the queue
    actionHandler.executeActions("IP", QUEUE_1, -1, actionRequests, pattern, new LoaderDataConfig());
    //sleep until the first and second iterations are executed
    Thread.sleep(3500);
    assertEquals(6, LoadTestActionClass.numExecutions);
    actionHandler.cancelAllQueues();
    //assert nothing else was executed
    Thread.sleep(3500);
    assertEquals(6, LoadTestActionClass.numExecutions);
}
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 30 with RampUpPattern

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

the class DisabledTest_MultiThreadedActionHandler method executeActionsRampUpPatternNonBlockingPositive.

@Test
public void executeActionsRampUpPatternNonBlockingPositive() throws Exception {
    RampUpPattern pattern = new RampUpPattern(3, false, 10, 10000, 2000, 1);
    //then start the queue
    long startTime = Calendar.getInstance().getTimeInMillis();
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
    actionHandler.executeActions("IP", QUEUE_1, -1, actionRequests, pattern, new LoaderDataConfig());
    long executionTime = Calendar.getInstance().getTimeInMillis() - startTime;
    // as the pattern is not blocking, we will get here right away
    assertTrue(executionTime < 1000);
}
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)

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