Search in sources :

Example 1 with RampUpPattern

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

the class DisabledTest_MultiThreadedActionHandler method cancelAllQueuesFinishedTasksPositive.

@Test
public void cancelAllQueuesFinishedTasksPositive() throws Exception {
    RampUpPattern pattern = new RampUpPattern(3, false, 3, 0);
    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(1000);
    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 2 with RampUpPattern

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

the class DisabledTest_MultiThreadedActionHandler method scheduleActionsNegativeQueueAlreadyExists.

@Test(expected = LoadQueueAlreadyExistsException.class)
public void scheduleActionsNegativeQueueAlreadyExists() throws Exception {
    RampUpPattern pattern = new RampUpPattern(10, true, 1, 0, 5000, 2);
    actionHandler.scheduleActions("IP", QUEUE_1, -1, actionRequests, pattern, new LoaderDataConfig(), false);
    actionHandler.scheduleActions("IP", QUEUE_1, -1, actionRequests, pattern, new LoaderDataConfig(), false);
}
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 3 with RampUpPattern

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

the class DisabledTest_MultiThreadedActionHandler method waitUntilAllQueuesFinishPositiveStateDifferentThanRunning.

@Test
public void waitUntilAllQueuesFinishPositiveStateDifferentThanRunning() throws Exception {
    RampUpPattern pattern = new RampUpPattern(3, false, 3, 1000, 200, 2);
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
    //first queue finished
    actionHandler.executeActions("IP", QUEUE_1, -1, actionRequests, new AllAtOncePattern(1, true), new LoaderDataConfig());
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_2);
    //second queue running
    actionHandler.executeActions("IP", QUEUE_2, -1, actionRequests, pattern, new LoaderDataConfig());
    //third queue scheduled
    actionHandler.scheduleActions("IP", "test 3", -1, actionRequests, pattern, new LoaderDataConfig(), false);
    //wait until the queue finishes
    actionHandler.waitUntilAllQueuesFinish();
    expectedNumExecutions = 10;
}
Also used : RampUpPattern(com.axway.ats.agent.core.threading.patterns.RampUpPattern) AllAtOncePattern(com.axway.ats.agent.core.threading.patterns.AllAtOncePattern) LoaderDataConfig(com.axway.ats.agent.core.threading.data.config.LoaderDataConfig) Test(org.junit.Test)

Example 4 with RampUpPattern

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

the class DisabledTest_MultiThreadedActionHandler method cancelAllQueuesDuringExecutionPositive.

@Test
public void cancelAllQueuesDuringExecutionPositive() 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);
    assertEquals(0, LoadTestActionClass.numExecutions);
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
    //then start the queue
    actionHandler.executeActions("IP", QUEUE_1, -1, newActionRequests, pattern, new LoaderDataConfig());
    Thread.sleep(1000);
    actionHandler.cancelAllQueues();
    //assert that only the first execution took place
    expectedNumExecutions = 3;
}
Also used : RampUpPattern(com.axway.ats.agent.core.threading.patterns.RampUpPattern) ActionRequest(com.axway.ats.agent.core.action.ActionRequest) ArrayList(java.util.ArrayList) LoaderDataConfig(com.axway.ats.agent.core.threading.data.config.LoaderDataConfig) Test(org.junit.Test)

Example 5 with RampUpPattern

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

the class DisabledTest_MultiThreadedActionHandler method cancelAllQueuesBeforeStartPositive.

@Test
public void cancelAllQueuesBeforeStartPositive() throws Exception {
    RampUpPattern pattern = new RampUpPattern(3, true, 10, 3000);
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
    //first schedule the threads
    actionHandler.scheduleActions("IP", QUEUE_1, -1, actionRequests, pattern, new LoaderDataConfig(), false);
    actionHandler.cancelAllQueues();
    expectedNumExecutions = 0;
}
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