Search in sources :

Example 41 with LoaderDataConfig

use of com.axway.ats.agent.core.threading.data.config.LoaderDataConfig 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 42 with LoaderDataConfig

use of com.axway.ats.agent.core.threading.data.config.LoaderDataConfig 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 43 with LoaderDataConfig

use of com.axway.ats.agent.core.threading.data.config.LoaderDataConfig 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)

Example 44 with LoaderDataConfig

use of com.axway.ats.agent.core.threading.data.config.LoaderDataConfig 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 45 with LoaderDataConfig

use of com.axway.ats.agent.core.threading.data.config.LoaderDataConfig 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)

Aggregations

LoaderDataConfig (com.axway.ats.agent.core.threading.data.config.LoaderDataConfig)50 Test (org.junit.Test)47 AllAtOncePattern (com.axway.ats.agent.core.threading.patterns.AllAtOncePattern)30 ActionRequest (com.axway.ats.agent.core.action.ActionRequest)26 RampUpPattern (com.axway.ats.agent.core.threading.patterns.RampUpPattern)18 ArrayList (java.util.ArrayList)16 RangeDataConfig (com.axway.ats.agent.core.threading.data.config.RangeDataConfig)5 AgentException (com.axway.ats.agent.core.exceptions.AgentException)3 ListDataConfig (com.axway.ats.agent.core.threading.data.config.ListDataConfig)3 ThreadingPattern (com.axway.ats.agent.core.threading.patterns.ThreadingPattern)2 IOException (java.io.IOException)2 ActionExecutionException (com.axway.ats.agent.core.exceptions.ActionExecutionException)1 InternalComponentException (com.axway.ats.agent.core.exceptions.InternalComponentException)1 NoCompatibleMethodFoundException (com.axway.ats.agent.core.exceptions.NoCompatibleMethodFoundException)1 NoSuchActionException (com.axway.ats.agent.core.exceptions.NoSuchActionException)1 NoSuchComponentException (com.axway.ats.agent.core.exceptions.NoSuchComponentException)1 ImportantThread (com.axway.ats.agent.core.threading.ImportantThread)1 ActionWrapper (com.axway.ats.agent.webapp.client.ActionWrapper)1 AgentException_Exception (com.axway.ats.agent.webapp.client.AgentException_Exception)1 AgentService (com.axway.ats.agent.webapp.client.AgentService)1