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: 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)
---
{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: 10686626
Object 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 SeLionDataProviderIOExceptionpublic Iterator<Object[]> getDataByFilter(DataProviderFilter dataFilter) throws IOException
DataProviderException when unexpected error occurs
during processing of YAML file data by filtergetDataByFilter in interface SeLionDataProviderdataFilter - an implementation class of DataProviderFilterIOExceptionpublic 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 SeLionDataProviderkeys - 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 SeLionDataProviderpublic Object[][] getDataByIndex(String indexes) throws IOException, DataProviderException
getDataByIndex in interface SeLionDataProviderindexes - the input string represent the indexes to be parseIOExceptionDataProviderExceptionpublic Object[][] getDataByIndex(int[] indexes) throws IOException
DataProviderException when an unexpected error occurs during data provision from YAML
file.getDataByIndex in interface SeLionDataProviderindexes - The indexes for which data is to be fetched as a conforming string pattern.IOExceptionCopyright © 2016 PayPal Open Source. All rights reserved.