Search in sources :

Example 6 with RampUpPattern

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);
}
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 7 with RampUpPattern

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);
}
Also used : RampUpPattern(com.axway.ats.agent.core.threading.patterns.RampUpPattern) ActionRequest(com.axway.ats.agent.core.action.ActionRequest) LoaderDataConfig(com.axway.ats.agent.core.threading.data.config.LoaderDataConfig) Test(org.junit.Test)

Example 8 with RampUpPattern

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);
}
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 9 with RampUpPattern

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();
    }
}
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 10 with RampUpPattern

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();
}
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