Search in sources :

Example 11 with RampUpPattern

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

the class DisabledTest_RampUpLoaderMultipleInvocations method rampUpPatternNoRampUpNonBlockingPositive.

@Test
public void rampUpPatternNoRampUpNonBlockingPositive() throws Exception {
    RampUpPattern pattern = new RampUpPattern(3, false, 10, 10000);
    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;
    assertTrue(executionTime < 1000);
    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 12 with RampUpPattern

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

the class DisabledTest_RampUpLoaderMultipleInvocations method rampUpPatternNonBlockingPositive.

@Test
public void rampUpPatternNonBlockingPositive() throws Exception {
    RampUpPattern pattern = new RampUpPattern(3, false, 10, 10000, 2000, 1);
    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;
    // as the pattern is not blocking, we will get here right away
    assertTrue(executionTime < 1000);
    Thread.sleep(2000);
    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 13 with RampUpPattern

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

the class Test_LoadQueueFactory method createQueueRampUpPatternPositive.

@Test
public void createQueueRampUpPatternPositive() throws Exception {
    RampUpPattern pattern = new RampUpPattern(100, false);
    QueueLoader loader = LoadQueueFactory.createLoadQueue("test", new ArrayList<ActionRequest>(), pattern, new ArrayList<ParameterDataProvider>(), null);
    assertEquals(RampUpQueueLoader.class, loader.getClass());
}
Also used : ParameterDataProvider(com.axway.ats.agent.core.threading.data.ParameterDataProvider) FixedDurationRampUpPattern(com.axway.ats.agent.core.threading.patterns.FixedDurationRampUpPattern) RampUpPattern(com.axway.ats.agent.core.threading.patterns.RampUpPattern) ActionRequest(com.axway.ats.agent.core.action.ActionRequest) Test(org.junit.Test)

Example 14 with RampUpPattern

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

the class DisabledTest_RampUpLoaderMultipleInvocations method rampUpPatternBlockingMultipleInvocationsWithDelayPositive.

@Test
public void rampUpPatternBlockingMultipleInvocationsWithDelayPositive() throws Exception {
    RampUpPattern pattern = new RampUpPattern(2, true, 4, 1000);
    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(8, LoadTestActionClass.numExecutions);
    assertTrue(endTime - startTime > 3000);
}
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 15 with RampUpPattern

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

the class DisabledTest_RampUpLoaderMultipleInvocations method rampUpPatternBlockingWithRampUpPositive.

@Test
public void rampUpPatternBlockingWithRampUpPositive() throws Exception {
    RampUpPattern pattern = new RampUpPattern(10, true, 1, 0, 1000, 2);
    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 > 4000);
    assertTrue(executionTime < 6000);
}
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