use of com.axway.ats.agent.core.action.ArgumentValue in project ats-framework by Axway.
the class Test_ParameterDataProviderFactory method createFileNamesProvider.
@Test
public void createFileNamesProvider() throws AgentException, URISyntaxException {
URL testFileURL = Test_ParameterDataProviderFactory.class.getResource("/testfolder/classloader.html");
File testFile = new File(testFileURL.toURI());
FileNamesDataConfig fileNamesConfig = new FileNamesDataConfig("param1", testFile.getParent(), true, ParameterProviderLevel.PER_INVOCATION);
ParameterDataProvider dataProvider = ParameterDataProviderFactory.createDataProvider(fileNamesConfig);
assertEquals(FileNamesParameterDataProvider.class, dataProvider.getClass());
ArgumentValue generatedValue = dataProvider.getValue(new ArrayList<ArgumentValue>());
assertEquals("param1", generatedValue.getName());
assertTrue(((String) generatedValue.getValue()).endsWith(".html"));
}
use of com.axway.ats.agent.core.action.ArgumentValue in project ats-framework by Axway.
the class Test_ListParameterDataProvider method perInvocationGeneration.
@Test
public void perInvocationGeneration() {
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_INVOCATION);
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("value11", generatedValue.getValue());
}
use of com.axway.ats.agent.core.action.ArgumentValue in project ats-framework by Axway.
the class Test_ParameterDataProviderFactory method createStringRangeProvider.
@Test
public void createStringRangeProvider() throws AgentException {
RangeDataConfig rangeConfig = new RangeDataConfig("param1", "user{0}@test.com", 10, 20);
ParameterDataProvider dataProvider = ParameterDataProviderFactory.createDataProvider(rangeConfig);
assertEquals(StringRangeParameterDataProvider.class, dataProvider.getClass());
ArgumentValue generatedValue = dataProvider.getValue(new ArrayList<ArgumentValue>());
assertEquals("param1", generatedValue.getName());
assertEquals("user10@test.com", generatedValue.getValue());
}
use of com.axway.ats.agent.core.action.ArgumentValue in project ats-framework by Axway.
the class Test_ParameterDataProviderFactory method createListProvider.
@Test
public void createListProvider() throws AgentException, URISyntaxException {
ListDataConfig listDataConfig = new ListDataConfig("param1", new String[] { "test1", "test2" }, ParameterProviderLevel.PER_INVOCATION);
ParameterDataProvider dataProvider = ParameterDataProviderFactory.createDataProvider(listDataConfig);
assertEquals(ListParameterDataProvider.class, dataProvider.getClass());
ArgumentValue generatedValue = dataProvider.getValue(new ArrayList<ArgumentValue>());
assertEquals("param1", generatedValue.getName());
assertEquals("test1", generatedValue.getValue());
}
use of com.axway.ats.agent.core.action.ArgumentValue in project ats-framework by Axway.
the class Test_IntegerRangeParameterDataProvider method perThreadGeneration.
@Test
public void perThreadGeneration() {
IntegerRangeParameterDataProvider dataProvider = new IntegerRangeParameterDataProvider("param1", 10, 20, ParameterProviderLevel.PER_THREAD_STATIC);
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(10, generatedValue.getValue());
}
Aggregations