public final class YamlDataProviderImpl extends Object implements SeLionDataProvider
Constructor and Description |
---|
YamlDataProviderImpl(DataResource resource) |
Modifier and Type | Method and Description |
---|---|
Object[][] |
getAllData()
Converts a yaml file into an Object 2D array for TestNG Dataprovider
consumption.
|
Hashtable<String,Object> |
getDataAsHashtable()
Gets yaml data and returns in a hashtable instead of an Object 2D array.
|
Iterator<Object[]> |
getDataByFilter(DataProviderFilter dataFilter)
Gets yaml data by applying the given filter.
|
Object[][] |
getDataByIndex(int[] indexes)
Generates an object array in iterator as TestNG DataProvider from the YAML data filtered per given indexes.
|
Object[][] |
getDataByIndex(String indexes)
Gets yaml data for requested indexes.
|
Object[][] |
getDataByKeys(String[] keys)
Gets yaml data by key identifiers.
|
public YamlDataProviderImpl(DataResource resource)
public Object[][] getAllData() throws IOException
-US - GB - AUObject array returned:
Object[0][0] = US Object[1][0] = GB Object[2][0] = AUTest method signature example:
public void testExample(String countryCode)
[US, GB, AU]Object array returned:
Object[0][0] = US Object[1][0] = GB Object[2][0] = AUTest method signature example:
public void testExample(String countryCode)
- {name: 1, userEmail: user1@paypal.com, userId: 10686626} - {name: 2, email: user2@paypal.com, userId: 10686627}Object array returned (LinkedHashMap):
Object[0][0] = {name=1, email=user1@paypal.com, userId=10686626} Object[1][0] = {name=2, email=user2@paypal.com, userId=10686627}Test method signature example:
public void testExample(LinkedHashMap, ?> test)
test1: name: 1 email: user1@paypal.com userId: 10686626 test2: name: 2 email: user2@paypal.com userId: 10686627Object array returned (contains LinkedHashMap):
Object[0][0] = {name=1, email=user1@paypal.com, userId=10686626} Object[1][0] = {name=2, email=user2@paypal.com, userId=10686627}Test method signature example:
public void testExample(LinkedHashMap, ?> test)
--- {name: 1, email: user1@paypal.com, userId: 10686626} --- {name: 2, email: user2@paypal.com, userId: 10686627}Object array returned (contains LinkedHashMap):
Object[0][0] = {name=1, email=user1@paypal.com, userId=10686626} Object[1][0] = {name=2, email=user2@paypal.com, userId=10686627}Test method signature example:
public void testExample(LinkedHashMap, ?> test)
- !!com.paypal.test.resources.MyObject name: 1 email: user1@paypal.com userId: 10686626 - !!com.paypal.test.resources.MyObject name: 2 email: user2@paypal.com userId: 10686626
- !MyObject name: 1 email: user1@paypal.com userId: 10686626 - !MyObject name: 2 email: user2@paypal.com userId: 10686626Object array returned:
Object[1][0] = com.paypal.test.dataobject.MyObject@54bb7759 Object[2][0] = com.paypal.test.dataobject.MyObject@5f989f84Test method signature example:
public void testExample(MyObject myObject)
DataProviderHelper.serializeObjectToYamlString(Object)
DataProviderHelper.serializeObjectToYamlStringAsList(Object...)
DataProviderHelper.serializeObjectToYamlStringAsMap(Object...)
DataProviderHelper.serializeObjectToYamlStringAsDocuments(Object...)
getAllData
in interface SeLionDataProvider
IOException
public Iterator<Object[]> getDataByFilter(DataProviderFilter dataFilter) throws IOException
DataProviderException
when unexpected error occurs
during processing of YAML file data by filtergetDataByFilter
in interface SeLionDataProvider
dataFilter
- an implementation class of DataProviderFilter
IOException
public Object[][] getDataByKeys(String[] keys)
test1: name: 1 email: user1@paypal.com userId: 10686626 test2: name: 2 email: user2@paypal.com userId: 10686627
getDataByKeys
in interface SeLionDataProvider
keys
- A String array that represents the keys.public Hashtable<String,Object> getDataAsHashtable()
test1: name: 1 email: user1@paypal.com userId: 10686626 test2: name: 2 email: user2@paypal.com userId: 10686627
getDataAsHashtable
in interface SeLionDataProvider
public Object[][] getDataByIndex(String indexes) throws IOException, DataProviderException
getDataByIndex
in interface SeLionDataProvider
indexes
- the input string represent the indexes to be parseIOException
DataProviderException
public Object[][] getDataByIndex(int[] indexes) throws IOException
DataProviderException
when an unexpected error occurs during data provision from YAML
file.getDataByIndex
in interface SeLionDataProvider
indexes
- The indexes for which data is to be fetched as a conforming string pattern.IOException
Copyright © 2016 PayPal Open Source. All rights reserved.