Search in sources :

Example 36 with LoaderDataConfig

use of com.axway.ats.agent.core.threading.data.config.LoaderDataConfig in project ats-framework by Axway.

the class DisabledTest_MultiThreadedActionHandler method executeActionsRampUpPatternBlockingWithRampUpPositiveMultipleInvocations.

@Test
public void executeActionsRampUpPatternBlockingWithRampUpPositiveMultipleInvocations() throws Exception {
    RampUpPattern pattern = new RampUpPattern(10, true, 2, 1000, 2000, 5);
    //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 = 20;
}
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 37 with LoaderDataConfig

use of com.axway.ats.agent.core.threading.data.config.LoaderDataConfig in project ats-framework by Axway.

the class DisabledTest_MultiThreadedActionHandler method startRampUpPatternBlockingWithRampUpPositive.

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

use of com.axway.ats.agent.core.threading.data.config.LoaderDataConfig in project ats-framework by Axway.

the class DisabledTest_MultiThreadedActionHandler method getRunningQueuesCountPositive.

@Test
public void getRunningQueuesCountPositive() throws Exception {
    RampUpPattern pattern = new RampUpPattern(3, false, 3, 1000, 200, 2);
    assertEquals(0, actionHandler.getRunningQueuesCount());
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
    //first queue finished
    actionHandler.executeActions("IP", QUEUE_1, -1, actionRequests, pattern, new LoaderDataConfig());
    assertEquals(1, actionHandler.getRunningQueuesCount());
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_2);
    //second queue running
    actionHandler.executeActions("IP", QUEUE_2, -1, actionRequests, pattern, new LoaderDataConfig());
    assertEquals(2, actionHandler.getRunningQueuesCount());
    //third queue scheduled
    actionHandler.scheduleActions("IP", "test 3", -1, actionRequests, pattern, new LoaderDataConfig(), false);
    assertEquals(2, actionHandler.getRunningQueuesCount());
    //wait until the queue finishes
    actionHandler.waitUntilAllQueuesFinish();
    assertEquals(0, actionHandler.getRunningQueuesCount());
}
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 39 with LoaderDataConfig

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

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

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