Search in sources :

Example 16 with ArgumentValue

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

the class Test_IntegerRangeParameterDataProvider method perInvocationGeneration.

@Test
public void perInvocationGeneration() {
    IntegerRangeParameterDataProvider dataProvider = new IntegerRangeParameterDataProvider("param1", 10, 20, ParameterProviderLevel.PER_INVOCATION);
    ArgumentValue generatedValue = dataProvider.getValue(new ArrayList<ArgumentValue>());
    assertEquals("param1", generatedValue.getName());
    assertEquals(10, generatedValue.getValue());
    //make sure only one instance per thread is returned
    generatedValue = dataProvider.getValue(new ArrayList<ArgumentValue>());
    assertEquals("param1", generatedValue.getName());
    assertEquals(11, generatedValue.getValue());
}
Also used : ArrayList(java.util.ArrayList) ArgumentValue(com.axway.ats.agent.core.action.ArgumentValue) Test(org.junit.Test) BaseTest(com.axway.ats.agent.core.BaseTest)

Example 17 with ArgumentValue

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

the class Test_IntegerRangeParameterDataProvider method whenRangeEndIsReachedProviderGoesBackToRangeStart.

@Test
public void whenRangeEndIsReachedProviderGoesBackToRangeStart() {
    IntegerRangeParameterDataProvider dataProvider = new IntegerRangeParameterDataProvider("param1", 10, 14, ParameterProviderLevel.PER_INVOCATION);
    ArgumentValue generatedValue;
    for (int i = 10; i < 15; i++) {
        generatedValue = dataProvider.getValue(new ArrayList<ArgumentValue>());
        assertEquals("param1", generatedValue.getName());
        assertEquals(i, generatedValue.getValue());
    }
    //make sure only one instance per thread is returned
    generatedValue = dataProvider.getValue(new ArrayList<ArgumentValue>());
    assertEquals("param1", generatedValue.getName());
    assertEquals(10, generatedValue.getValue());
}
Also used : ArrayList(java.util.ArrayList) ArgumentValue(com.axway.ats.agent.core.action.ArgumentValue) Test(org.junit.Test) BaseTest(com.axway.ats.agent.core.BaseTest)

Example 18 with ArgumentValue

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

the class Test_IntegerRangeParameterDataProvider method initialize.

@Test
public void initialize() throws AgentException {
    IntegerRangeParameterDataProvider dataProvider = new IntegerRangeParameterDataProvider("param1", 10, 20, ParameterProviderLevel.PER_INVOCATION);
    ArgumentValue generatedValue = dataProvider.getValue(new ArrayList<ArgumentValue>());
    assertEquals("param1", generatedValue.getName());
    assertEquals(10, generatedValue.getValue());
    dataProvider.initialize();
    //make sure only one instance per thread is returned
    generatedValue = dataProvider.getValue(new ArrayList<ArgumentValue>());
    assertEquals("param1", generatedValue.getName());
    assertEquals(10, generatedValue.getValue());
}
Also used : ArrayList(java.util.ArrayList) ArgumentValue(com.axway.ats.agent.core.action.ArgumentValue) Test(org.junit.Test) BaseTest(com.axway.ats.agent.core.BaseTest)

Example 19 with ArgumentValue

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

the class Test_ListParameterDataProvider method initialize.

@Test
public void initialize() throws AgentException {
    List<String> values = new ArrayList<String>();
    for (int i = 10; i < 14; i++) {
        values.add("value" + i);
    }
    ListParameterDataProvider dataProvider = new ListParameterDataProvider("param1", values, ParameterProviderLevel.PER_THREAD);
    ArgumentValue generatedValue = dataProvider.getValue(new ArrayList<ArgumentValue>());
    assertEquals("param1", generatedValue.getName());
    assertEquals("value10", generatedValue.getValue());
    dataProvider.initialize();
    //make sure only one instance per thread is returned
    generatedValue = dataProvider.getValue(new ArrayList<ArgumentValue>());
    assertEquals("param1", generatedValue.getName());
    assertEquals("value10", generatedValue.getValue());
}
Also used : ArrayList(java.util.ArrayList) ArgumentValue(com.axway.ats.agent.core.action.ArgumentValue) Test(org.junit.Test) BaseTest(com.axway.ats.agent.core.BaseTest)

Example 20 with ArgumentValue

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

the class Test_ListParameterDataProvider method perThreadStaticGeneration.

@Test
public void perThreadStaticGeneration() {
    List<String> values = new ArrayList<String>();
    for (int i = 10; i < 20; i++) {
        values.add("value" + i);
    }
    ListParameterDataProvider dataProvider = new ListParameterDataProvider("param1", values, ParameterProviderLevel.PER_THREAD_STATIC);
    ArgumentValue generatedValue = dataProvider.getValue(new ArrayList<ArgumentValue>());
    assertEquals("param1", generatedValue.getName());
    assertEquals("value10", generatedValue.getValue());
    //make sure only one instance per thread is returned
    generatedValue = dataProvider.getValue(new ArrayList<ArgumentValue>());
    assertEquals("param1", generatedValue.getName());
    assertEquals("value10", generatedValue.getValue());
}
Also used : ArrayList(java.util.ArrayList) ArgumentValue(com.axway.ats.agent.core.action.ArgumentValue) Test(org.junit.Test) BaseTest(com.axway.ats.agent.core.BaseTest)

Aggregations

ArgumentValue (com.axway.ats.agent.core.action.ArgumentValue)33 BaseTest (com.axway.ats.agent.core.BaseTest)32 Test (org.junit.Test)32 ArrayList (java.util.ArrayList)25 RangeDataConfig (com.axway.ats.agent.core.threading.data.config.RangeDataConfig)2 HashMap (java.util.HashMap)2 FileNamesDataConfig (com.axway.ats.agent.core.threading.data.config.FileNamesDataConfig)1 ListDataConfig (com.axway.ats.agent.core.threading.data.config.ListDataConfig)1 File (java.io.File)1 URL (java.net.URL)1 Pattern (java.util.regex.Pattern)1