public final class XmlDataProviderImpl extends Object implements XmlDataProvider
Constructor and Description |
---|
XmlDataProviderImpl(XmlDataSource resource) |
Modifier and Type | Method and Description |
---|---|
Object[][] |
getAllData()
Generates a two dimensional array for TestNG DataProvider from the XML data.
|
Object[][] |
getAllKeyValueData()
Generates a two dimensional array for TestNG DataProvider from the XML data representing a map of name value
collection.
|
Hashtable<String,Object> |
getDataAsHashtable()
Gets xml data and returns in a hashtable instead of an Object 2D array.
|
Iterator<Object[]> |
getDataByFilter(DataProviderFilter dataFilter)
Generates an object array in iterator as TestNG DataProvider from the XML data filtered per
dataFilter . |
Object[][] |
getDataByIndex(int[] indexes)
Generates an object array in iterator as TestNG DataProvider from the XML data filtered per given indexes.
|
Object[][] |
getDataByIndex(String filterIndexes)
Generates an object array in iterator as TestNG DataProvider from the XML data filtered per given indexes string.
|
Object[][] |
getDataByKeys(String[] keys)
Generates a two dimensional array for TestNG DataProvider from the XML data representing a map of name value
collection filtered by keys.
|
public XmlDataProviderImpl(XmlDataSource resource)
public Object[][] getAllData()
getAllData
in interface SeLionDataProvider
public Iterator<Object[]> getDataByFilter(DataProviderFilter dataFilter)
dataFilter
.getDataByFilter
in interface SeLionDataProvider
dataFilter
- an implementation class of DataProviderFilter
public Object[][] getDataByIndex(String filterIndexes)
DataProviderException
when an unexpected error occurs during data provision from
XML file.getDataByIndex
in interface SeLionDataProvider
filterIndexes
- The indexes for which data is to be fetched as a conforming string pattern.public Object[][] getDataByIndex(int[] indexes)
DataProviderException
when an unexpected error occurs during data provision from XML
file.getDataByIndex
in interface SeLionDataProvider
indexes
- The indexes for which data is to be fetched as a conforming string pattern.public Object[][] getAllKeyValueData()
DataResource
to be instantiated using its constructors with
parameter Class<?> cls
and set to KeyValueMap.class
. The implementation in this method is tightly
coupled with KeyValueMap
and KeyValuePair
.
The hierarchy and name of the nodes are strictly as instructed. A name value pair should be represented as nodes
'key' and 'value' as child nodes contained in a parent node named 'item'. A sample data with proper tag names is
shown here as an example:
k1 val1 k2 val2 k3 val3
getAllKeyValueData
in interface XmlDataProvider
public Object[][] getDataByKeys(String[] keys)
KeyValuePair
class. The structure of an item in collection is shown below where 'key' and 'value' are
child nodes contained in a parent node named 'item':
k1 val1 k2 val2 k3 val3
getDataByKeys
in interface SeLionDataProvider
keys
- The string keys to filter the data.public Hashtable<String,Object> getDataAsHashtable()
k1 val1 k2 val2 k3 val3
getDataAsHashtable
in interface SeLionDataProvider
Copyright © 2016 PayPal Open Source. All rights reserved.