Search in sources :

Example 26 with ActionRequest

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

the class DisabledTest_MultiThreadedActionHandlerWithParameterizedInputData method paramPresentInDataProvidersLessTimeThanInTheInvokers.

@Test
public void paramPresentInDataProvidersLessTimeThanInTheInvokers() throws Exception {
    int nThreads = 1;
    int nInvocations = 3;
    List<ActionRequest> actions = new ArrayList<ActionRequest>();
    LoaderDataConfig loaderDataConfig = new LoaderDataConfig();
    for (int i = 0; i < nInvocations; i++) {
        actions.add(fileUploadActionRequest);
    }
    loaderDataConfig.addParameterConfig(parameterDataProviders[0]);
    loaderDataConfig.addParameterConfig(parameterDataProviders[1]);
    AllAtOncePattern pattern = new AllAtOncePattern(nThreads, true);
    QueueExecutionStatistics.getInstance().initActionExecutionResults("test 1");
    actionHandler.executeActions("IP", "test 1", -1, actions, pattern, loaderDataConfig);
    assertEquals(nInvocations * nThreads, ParameterizedInputActionClass.getAddedStringsCount());
    assertEquals(1, (int) ParameterizedInputActionClass.addedStrings.get("X1.txt"));
    assertNull(ParameterizedInputActionClass.addedStrings.get("X2.txt"));
    assertNull(ParameterizedInputActionClass.addedStrings.get("X3.txt"));
    assertNull(ParameterizedInputActionClass.addedStrings.get("Y2.txt"));
}
Also used : AllAtOncePattern(com.axway.ats.agent.core.threading.patterns.AllAtOncePattern) ActionRequest(com.axway.ats.agent.core.action.ActionRequest) ArrayList(java.util.ArrayList) LoaderDataConfig(com.axway.ats.agent.core.threading.data.config.LoaderDataConfig) Test(org.junit.Test)

Example 27 with ActionRequest

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

the class DisabledTest_MultiThreadedActionHandlerWithParameterizedInputData method threeThreadsWithTwoInvocations.

@Test
public void threeThreadsWithTwoInvocations() throws Exception {
    int nThreads = 3;
    int nInvocations = 2;
    List<ActionRequest> actions = new ArrayList<ActionRequest>();
    LoaderDataConfig loaderDataConfig = new LoaderDataConfig();
    for (int i = 0; i < nInvocations; i++) {
        actions.add(fileUploadActionRequest);
        loaderDataConfig.addParameterConfig(parameterDataProviders[i]);
    }
    AllAtOncePattern pattern = new AllAtOncePattern(nThreads, true);
    QueueExecutionStatistics.getInstance().initActionExecutionResults("test 1");
    actionHandler.executeActions("IP", "test 1", -1, actions, pattern, loaderDataConfig);
    assertEquals(nInvocations * nThreads, ParameterizedInputActionClass.getAddedStringsCount());
    assertEquals(1, (int) ParameterizedInputActionClass.addedStrings.get("X1.txt"));
    assertEquals(1, (int) ParameterizedInputActionClass.addedStrings.get("X2.txt"));
    assertEquals(1, (int) ParameterizedInputActionClass.addedStrings.get("X3.txt"));
}
Also used : AllAtOncePattern(com.axway.ats.agent.core.threading.patterns.AllAtOncePattern) ActionRequest(com.axway.ats.agent.core.action.ActionRequest) ArrayList(java.util.ArrayList) LoaderDataConfig(com.axway.ats.agent.core.threading.data.config.LoaderDataConfig) Test(org.junit.Test)

Example 28 with ActionRequest

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

the class DisabledTest_MultiThreadedActionHandler method setUpTest_MultiThreadedActionHandler.

@BeforeClass
public static void setUpTest_MultiThreadedActionHandler() 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.add(actionRequest);
}
Also used : ActionRequest(com.axway.ats.agent.core.action.ActionRequest) BeforeClass(org.junit.BeforeClass)

Example 29 with ActionRequest

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

the class DisabledTest_MultiThreadedActionHandlerWithParameterizedInputData method fourThreadsWithTwoInvocations.

@Test
public void fourThreadsWithTwoInvocations() throws Exception {
    int nThreads = 4;
    int nInvocations = 2;
    List<ActionRequest> actions = new ArrayList<ActionRequest>();
    LoaderDataConfig loaderDataConfig = new LoaderDataConfig();
    for (int i = 0; i < nInvocations; i++) {
        actions.add(fileUploadActionRequest);
        loaderDataConfig.addParameterConfig(parameterDataProviders[i]);
    }
    AllAtOncePattern pattern = new AllAtOncePattern(nThreads, true);
    QueueExecutionStatistics.getInstance().initActionExecutionResults("test 1");
    actionHandler.executeActions("IP", "test 1", -1, actions, pattern, loaderDataConfig);
    assertEquals(nInvocations * nThreads, ParameterizedInputActionClass.getAddedStringsCount());
    assertEquals(2, (int) ParameterizedInputActionClass.addedStrings.get("X1.txt"));
    assertEquals(1, (int) ParameterizedInputActionClass.addedStrings.get("X2.txt"));
    assertEquals(1, (int) ParameterizedInputActionClass.addedStrings.get("X3.txt"));
}
Also used : AllAtOncePattern(com.axway.ats.agent.core.threading.patterns.AllAtOncePattern) ActionRequest(com.axway.ats.agent.core.action.ActionRequest) ArrayList(java.util.ArrayList) LoaderDataConfig(com.axway.ats.agent.core.threading.data.config.LoaderDataConfig) Test(org.junit.Test)

Example 30 with ActionRequest

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

the class DisabledTest_MultiThreadedActionHandlerWithParameterizedInputData 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(ParameterizedInputActionClass.class);
    component.setActionMap(actionMap);
    ComponentRepository componentRepository = ComponentRepository.getInstance();
    componentRepository.clear();
    componentRepository.putComponent(component);
    ActionRequest actionRequest1 = new ActionRequest(TEST_COMPONENT_NAME, "create file", new Object[] { "test" });
    ActionRequest actionRequest2 = new ActionRequest(TEST_COMPONENT_NAME, "upload file", new Object[] { "test" });
    ActionRequest actionRequest3 = new ActionRequest(TEST_COMPONENT_NAME, "action long", new Object[] { -120 });
    actionRequests = new ArrayList<ActionRequest>();
    actionRequests.add(actionRequest1);
    actionRequests.add(actionRequest2);
    actionRequests.add(actionRequest3);
    fileUploadActionRequest = new ActionRequest(TEST_COMPONENT_NAME, "upload file", new Object[] { "fileName" });
    parameterDataProviders = new ListDataConfig[] { new ListDataConfig("fileName", new String[] { "X1.txt", "X2.txt", "X3.txt" }, ParameterProviderLevel.PER_INVOCATION), new ListDataConfig("fileName", new String[] { "Y1.txt", "Y2.txt" }, ParameterProviderLevel.PER_INVOCATION), new ListDataConfig("fileName", new String[] { "Z1.txt", "Z2.txt", "Z3.txt", "Z4.txt" }, ParameterProviderLevel.PER_INVOCATION) };
}
Also used : ActionRequest(com.axway.ats.agent.core.action.ActionRequest) ListDataConfig(com.axway.ats.agent.core.threading.data.config.ListDataConfig) BeforeClass(org.junit.BeforeClass)

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