use of com.axway.ats.agent.core.action.ActionRequest in project ats-framework by Axway.
the class DisabledTest_RampUpQueueLoaderFixedDuration 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);
FixedDurationRampUpPattern pattern = new FixedDurationRampUpPattern(3, false, 10, 0);
loader = LoadQueueFactory.createLoadQueue(QUEUE_1, 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_1);
//then start the loader
loader.start();
Thread.sleep(1000);
loader.cancel();
//assert that only the first execution took place
assertEquals(3, LoadTestActionClass.numExecutions);
}
use of com.axway.ats.agent.core.action.ActionRequest in project ats-framework by Axway.
the class Test_ActionTaskFactory method createActionTaskFixedDuration.
@Test
public void createActionTaskFixedDuration() throws ActionExecutionException, NoSuchComponentException, NoSuchActionException, NoCompatibleMethodFoundException, ThreadingPatternNotSupportedException {
FixedDurationAllAtOncePattern pattern = new FixedDurationAllAtOncePattern(10, true, 20, 1400);
Runnable actionTask = ActionTaskFactory.createTask("IP", "Action_Queue", pattern, pattern.getExecutionsPerTimeFrame(), new ThreadsManager(), null, new ArrayList<ActionRequest>(), new ArrayList<ParameterDataProvider>(), null, false);
assertEquals(FixedDurationActionTask.class, actionTask.getClass());
}
use of com.axway.ats.agent.core.action.ActionRequest in project ats-framework by Axway.
the class Test_ActionTaskFactory method createActionTaskMultipleInvocations.
@Test
public void createActionTaskMultipleInvocations() throws ActionExecutionException, NoSuchComponentException, NoSuchActionException, NoCompatibleMethodFoundException, ThreadingPatternNotSupportedException {
AllAtOncePattern pattern = new AllAtOncePattern(10, true, 20, 1400);
Runnable actionTask = ActionTaskFactory.createTask("IP", "Action_Queue", pattern, pattern.getExecutionsPerTimeFrame(), new ThreadsManager(), null, new ArrayList<ActionRequest>(), new ArrayList<ParameterDataProvider>(), null, false);
assertEquals(MultipleInvocationsActionTask.class, actionTask.getClass());
}
use of com.axway.ats.agent.core.action.ActionRequest in project ats-framework by Axway.
the class DisabledTest_RampUpQueueLoaderFixedDuration method setUpTest_ActionInvoker.
@BeforeClass
public static void setUpTest_ActionInvoker() throws AgentException {
Component component = new Component(TEST_COMPONENT_NAME);
ComponentActionMap actionMap = new ComponentActionMap(TEST_COMPONENT_NAME);
actionMap.registerActionClass(LoadTestActionClass.class);
component.setActionMap(actionMap);
ComponentRepository componentRepository = ComponentRepository.getInstance();
componentRepository.clear();
componentRepository.putComponent(component);
ActionRequest actionRequest = new ActionRequest(TEST_COMPONENT_NAME, "action 1", new Object[] { 3 });
actionRequests = new ArrayList<ActionRequest>();
actionRequests.add(actionRequest);
}
use of com.axway.ats.agent.core.action.ActionRequest in project ats-framework by Axway.
the class DisabledTest_RampUpQueueLoaderFixedDuration method allAtOnceExceptionThrownInAction.
@Test
public void allAtOnceExceptionThrownInAction() throws Exception {
FixedDurationAllAtOncePattern pattern = new FixedDurationAllAtOncePattern(50, true, 5);
ActionRequest actionRequest = new ActionRequest(TEST_COMPONENT_NAME, "exception action", new Object[] {});
ArrayList<ActionRequest> newActionRequests = new ArrayList<ActionRequest>();
newActionRequests.add(actionRequest);
loader = LoadQueueFactory.createLoadQueue(QUEUE_1, newActionRequests, pattern, new ArrayList<ParameterDataProvider>(), null);
//first schedule the threads
loader.scheduleThreads("IP", false);
Thread.sleep(1);
//then start the loader
long startTime = Calendar.getInstance().getTimeInMillis();
QueueExecutionStatistics.getInstance().initActionExecutionResults(QUEUE_1);
loader.start();
long endTime = Calendar.getInstance().getTimeInMillis();
//verify that execution will not stop
assertTrue(endTime - startTime > 5);
}
Aggregations