Search in sources :

Example 26 with AllAtOncePattern

use of com.axway.ats.agent.core.threading.patterns.AllAtOncePattern 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 27 with AllAtOncePattern

use of com.axway.ats.agent.core.threading.patterns.AllAtOncePattern in project ats-framework by Axway.

the class DisabledTest_MultiThreadedActionHandlerWithParameterizedInputData method paramPresentInDataProvidersButNotInActions.

@Test
public void paramPresentInDataProvidersButNotInActions() throws Exception {
    List<ActionRequest> actions = new ArrayList<ActionRequest>();
    actions.add(actionRequests.get(2));
    LoaderDataConfig loaderDataConfig = new LoaderDataConfig();
    loaderDataConfig.addParameterConfig(parameterDataProviders[0]);
    AllAtOncePattern pattern = new AllAtOncePattern(1, true);
    QueueExecutionStatistics.getInstance().initActionExecutionResults("test 1");
    actionHandler.executeActions("IP", "test 1", -1, actions, pattern, loaderDataConfig);
    assertEquals(0, ParameterizedInputActionClass.getAddedStringsCount());
}
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 AllAtOncePattern

use of com.axway.ats.agent.core.threading.patterns.AllAtOncePattern in project ats-framework by Axway.

the class DisabledTest_MultiThreadedActionHandlerWithParameterizedInputData method paramPresentOnlyOnceInDataProvidersTwoThreads.

@Test
public void paramPresentOnlyOnceInDataProvidersTwoThreads() throws Exception {
    int nThreads = 2;
    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]);
    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"));
    assertNull(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 29 with AllAtOncePattern

use of com.axway.ats.agent.core.threading.patterns.AllAtOncePattern in project ats-framework by Axway.

the class DisabledTest_MultiThreadedActionHandlerWithParameterizedInputData method paremterizedIntegerWithWrapUp.

@Test
public void paremterizedIntegerWithWrapUp() throws Exception {
    LoaderDataConfig loaderDataConfig = new LoaderDataConfig();
    loaderDataConfig.addParameterConfig(new RangeDataConfig("milliseconds", 1, 4));
    AllAtOncePattern pattern = new AllAtOncePattern(5, true);
    QueueExecutionStatistics.getInstance().initActionExecutionResults("test 1");
    actionHandler.executeActions("IP", "test 1", -1, actionRequests, pattern, loaderDataConfig);
    assertEquals(4, ParameterizedInputActionClass.addedLongs.size());
    for (int i = 1; i < 5; i++) {
        assertTrue(ParameterizedInputActionClass.addedLongs.contains(new Long(i)));
    }
}
Also used : RangeDataConfig(com.axway.ats.agent.core.threading.data.config.RangeDataConfig) AllAtOncePattern(com.axway.ats.agent.core.threading.patterns.AllAtOncePattern) LoaderDataConfig(com.axway.ats.agent.core.threading.data.config.LoaderDataConfig) Test(org.junit.Test)

Example 30 with AllAtOncePattern

use of com.axway.ats.agent.core.threading.patterns.AllAtOncePattern in project ats-framework by Axway.

the class DisabledTest_MultiThreadedActionHandlerWithParameterizedInputData method threeThreadsWithThreeInvocations.

@Test
public void threeThreadsWithThreeInvocations() throws Exception {
    int nThreads = 3;
    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[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"));
    assertNull(ParameterizedInputActionClass.addedStrings.get("Z4.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)

Aggregations

AllAtOncePattern (com.axway.ats.agent.core.threading.patterns.AllAtOncePattern)37 Test (org.junit.Test)36 LoaderDataConfig (com.axway.ats.agent.core.threading.data.config.LoaderDataConfig)30 ActionRequest (com.axway.ats.agent.core.action.ActionRequest)24 ArrayList (java.util.ArrayList)17 BaseTest (com.axway.ats.agent.core.BaseTest)5 RangeDataConfig (com.axway.ats.agent.core.threading.data.config.RangeDataConfig)5 ListDataConfig (com.axway.ats.agent.core.threading.data.config.ListDataConfig)3 FixedDurationAllAtOncePattern (com.axway.ats.agent.core.threading.patterns.FixedDurationAllAtOncePattern)3 ParameterDataProvider (com.axway.ats.agent.core.threading.data.ParameterDataProvider)2 RampUpPattern (com.axway.ats.agent.core.threading.patterns.RampUpPattern)2 ThreadingPatternNotSupportedException (com.axway.ats.agent.core.threading.exceptions.ThreadingPatternNotSupportedException)1 QueueLoaderListener (com.axway.ats.agent.core.threading.listeners.QueueLoaderListener)1 FixedDurationRampUpPattern (com.axway.ats.agent.core.threading.patterns.FixedDurationRampUpPattern)1