Search in sources :

Example 11 with ActionRequest

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

the class Test_QueueCanceling method allAtOnce_SetMaxSpeed.

@Test
public void allAtOnce_SetMaxSpeed() throws Exception {
    expectedNumExecutions = 9;
    actionRequests.add(new ActionRequest(TEST_COMPONENT_NAME, ACTION_SLEEP, new Object[] { "500" }));
    AllAtOncePattern pattern = new AllAtOncePattern(9, false);
    pattern.setExecutionSpeed(30, 15);
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_NAME);
    actionHandler.scheduleActions(HOST, QUEUE_NAME, -1, actionRequests, pattern, new LoaderDataConfig(), false);
    actionHandler.startQueue(QUEUE_NAME);
    Thread.sleep(1500);
}
Also used : AllAtOncePattern(com.axway.ats.agent.core.threading.patterns.AllAtOncePattern) ActionRequest(com.axway.ats.agent.core.action.ActionRequest) LoaderDataConfig(com.axway.ats.agent.core.threading.data.config.LoaderDataConfig) Test(org.junit.Test)

Example 12 with ActionRequest

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

the class Test_QueueCanceling method allAtOnce_SynchronizedActions.

/**
     * 2 threads are run synchronized, 1 thread will do its iteration and will be put in sleep by
     * the Thread Manager waiting until the 2 (slower) finish its iteration.
     * This is the moment we will cancel the queue. 
     */
@Test
public void allAtOnce_SynchronizedActions() throws Exception {
    expectedNumExecutions = 2;
    final String paramName = "sleepTime";
    ListDataConfig parameterData = new ListDataConfig(paramName, Arrays.asList(new String[] { "500", "1500" }), ParameterProviderLevel.PER_THREAD_STATIC);
    LoaderDataConfig loaderDataConfig = new LoaderDataConfig();
    loaderDataConfig.addParameterConfig(parameterData);
    actionRequests.add(new ActionRequest(TEST_COMPONENT_NAME, ACTION_SLEEP, new Object[] { paramName }));
    AllAtOncePattern pattern = new AllAtOncePattern(2, false, 2, 0);
    pattern.setUseSynchronizedIterations(true);
    QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_NAME);
    actionHandler.scheduleActions(HOST, QUEUE_NAME, -1, actionRequests, pattern, loaderDataConfig, true);
    actionHandler.startQueue(QUEUE_NAME);
    Thread.sleep(1000);
}
Also used : AllAtOncePattern(com.axway.ats.agent.core.threading.patterns.AllAtOncePattern) ActionRequest(com.axway.ats.agent.core.action.ActionRequest) ListDataConfig(com.axway.ats.agent.core.threading.data.config.ListDataConfig) LoaderDataConfig(com.axway.ats.agent.core.threading.data.config.LoaderDataConfig) Test(org.junit.Test)

Example 13 with ActionRequest

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

the class DisabledTest_RampUpLoaderMultipleInvocations method setUp.

@Before
public void setUp() throws AgentException, InterruptedException {
    ActionRequest actionRequest = new ActionRequest(TEST_COMPONENT_NAME, "sleep action", new Object[] { "3" });
    actionRequests = new ArrayList<ActionRequest>();
    actionRequests.add(actionRequest);
    synchronized (LoadTestActionClass.class) {
        LoadTestActionClass.numExecutions = 0;
        log.warn("clean numInvocations=" + LoadTestActionClass.numExecutions);
    }
}
Also used : ActionRequest(com.axway.ats.agent.core.action.ActionRequest) Before(org.junit.Before)

Example 14 with ActionRequest

use of com.axway.ats.agent.core.action.ActionRequest 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 15 with ActionRequest

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

the class Test_LoadQueueFactory method createQueueFixedDurationAllAtOncePatternPositive.

@Test
public void createQueueFixedDurationAllAtOncePatternPositive() throws Exception {
    FixedDurationAllAtOncePattern pattern = new FixedDurationAllAtOncePattern(100, false, 30);
    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) FixedDurationAllAtOncePattern(com.axway.ats.agent.core.threading.patterns.FixedDurationAllAtOncePattern) 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