Search in sources :

Example 16 with ActionRequest

use of com.axway.ats.agent.core.action.ActionRequest in project ats-framework by Axway.

the class Test_LoadQueueFactory method createQueueFixedDurationRampUpPatternPositive.

@Test
public void createQueueFixedDurationRampUpPatternPositive() throws Exception {
    FixedDurationRampUpPattern pattern = new FixedDurationRampUpPattern(100, false, 3600);
    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) ActionRequest(com.axway.ats.agent.core.action.ActionRequest) FixedDurationRampUpPattern(com.axway.ats.agent.core.threading.patterns.FixedDurationRampUpPattern) Test(org.junit.Test)

Example 17 with ActionRequest

use of com.axway.ats.agent.core.action.ActionRequest in project ats-framework by Axway.

the class DisabledTest_RampUpLoaderMultipleInvocations method cancelTasksDuringExecutionPositive.

@Test
public void cancelTasksDuringExecutionPositive() 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);
    loader = LoadQueueFactory.createLoadQueue(QUEUE_NAME, newActionRequests, pattern, new ArrayList<ParameterDataProvider>(), null);
    //first schedule the threads
    loader.scheduleThreads("IP", false);
    Thread.sleep(1);
    assertEquals(0, LoadTestActionClass.numExecutions);
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_NAME);
    //then start the loader
    loader.start();
    Thread.sleep(1000);
    loader.cancel();
    //assert that only the first execution took place
    assertEquals(3, LoadTestActionClass.numExecutions);
}
Also used : RampUpPattern(com.axway.ats.agent.core.threading.patterns.RampUpPattern) ActionRequest(com.axway.ats.agent.core.action.ActionRequest) ArrayList(java.util.ArrayList) Test(org.junit.Test) BaseTest(com.axway.ats.agent.core.BaseTest)

Example 18 with ActionRequest

use of com.axway.ats.agent.core.action.ActionRequest in project ats-framework by Axway.

the class DisabledTest_RampUpLoaderMultipleInvocations method allAtOnceExceptionThrownInAction.

@Test
public void allAtOnceExceptionThrownInAction() throws Exception {
    AllAtOncePattern pattern = new AllAtOncePattern(50, true);
    ActionRequest actionRequest = new ActionRequest(TEST_COMPONENT_NAME, "exception action", new Object[] {});
    ArrayList<ActionRequest> newActionRequests = new ArrayList<ActionRequest>();
    newActionRequests.add(actionRequest);
    loader = LoadQueueFactory.createLoadQueue(QUEUE_NAME, newActionRequests, pattern, new ArrayList<ParameterDataProvider>(), null);
    //first schedule the threads
    loader.scheduleThreads("IP", false);
    Thread.sleep(1);
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_NAME);
    //then start the loader
    loader.start();
    assertEquals(0, LoadTestActionClass.numExecutions);
}
Also used : AllAtOncePattern(com.axway.ats.agent.core.threading.patterns.AllAtOncePattern) ActionRequest(com.axway.ats.agent.core.action.ActionRequest) ArrayList(java.util.ArrayList) Test(org.junit.Test) BaseTest(com.axway.ats.agent.core.BaseTest)

Example 19 with ActionRequest

use of com.axway.ats.agent.core.action.ActionRequest in project ats-framework by Axway.

the class Test_LoadQueueFactory method createQueueAllAtOncePatternPositive.

@Test
public void createQueueAllAtOncePatternPositive() throws Exception {
    AllAtOncePattern pattern = new AllAtOncePattern(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) AllAtOncePattern(com.axway.ats.agent.core.threading.patterns.AllAtOncePattern) FixedDurationAllAtOncePattern(com.axway.ats.agent.core.threading.patterns.FixedDurationAllAtOncePattern) ActionRequest(com.axway.ats.agent.core.action.ActionRequest) Test(org.junit.Test)

Example 20 with ActionRequest

use of com.axway.ats.agent.core.action.ActionRequest in project ats-framework by Axway.

the class Test_LocalExecutor method executeActionPositive.

@Test
public void executeActionPositive() throws Exception {
    LocalExecutor localExecutor = new LocalExecutor();
    localExecutor.executeAction(new ActionRequest(TEST_COMPONENT_NAME, "action 1", new Object[] { 1 }));
    assertEquals(1, ActionClassOne.ACTION_VALUE);
}
Also used : ActionRequest(com.axway.ats.agent.core.action.ActionRequest) LocalExecutor(com.axway.ats.agent.webapp.client.executors.LocalExecutor) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

ActionRequest (com.axway.ats.agent.core.action.ActionRequest)44 Test (org.junit.Test)36 LoaderDataConfig (com.axway.ats.agent.core.threading.data.config.LoaderDataConfig)26 AllAtOncePattern (com.axway.ats.agent.core.threading.patterns.AllAtOncePattern)24 ArrayList (java.util.ArrayList)20 BaseTest (com.axway.ats.agent.core.BaseTest)6 ParameterDataProvider (com.axway.ats.agent.core.threading.data.ParameterDataProvider)6 FixedDurationAllAtOncePattern (com.axway.ats.agent.core.threading.patterns.FixedDurationAllAtOncePattern)5 RampUpPattern (com.axway.ats.agent.core.threading.patterns.RampUpPattern)5 ListDataConfig (com.axway.ats.agent.core.threading.data.config.ListDataConfig)4 FixedDurationRampUpPattern (com.axway.ats.agent.core.threading.patterns.FixedDurationRampUpPattern)3 LocalExecutor (com.axway.ats.agent.webapp.client.executors.LocalExecutor)3 BeforeClass (org.junit.BeforeClass)3 AgentException (com.axway.ats.agent.core.exceptions.AgentException)2 ThreadingPattern (com.axway.ats.agent.core.threading.patterns.ThreadingPattern)2 RemoteExecutor (com.axway.ats.agent.webapp.client.executors.RemoteExecutor)2 IOException (java.io.IOException)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 Component (com.axway.ats.agent.core.Component)1 ComponentActionMap (com.axway.ats.agent.core.ComponentActionMap)1