use of rhsm.base.ConsumerType in project rhsm-qe by RedHatQE.
the class ContentIntegrationTests method getSubscribeDataAsListOfLists.
protected List<List<Object>> getSubscribeDataAsListOfLists() throws JSONException {
List<List<Object>> ll = new ArrayList<List<Object>>();
/*
sm.content.integrationTestData:[
{
username:'stage_test_5',
password:'redhat',
type:'RHUI', //** OPTIONAL **
variant:'Server,ComputeNode', //** OPTIONAL ** ** COMMA SEPARATED **
arch:'x86,x86_64', //** OPTIONAL ** ** COMMA SEPARATED **
sockets:'8', //** OPTIONAL **
productIdsData:[
{
productId:'RH0179918',
sockets:'8', //** OPTIONAL **
engProductId:'8', //** OPTIONAL ** ** COMMA SEPARATED **
reposData:[ //** NOT YET IMPLEMENTED **
{
repo:'label',
packages:'pkg1,pkg2'
}
]
},
{
productId:'RH1232091'
},
{
productId:'RH1151626'
},
{
productId:'RH1469292'
}
]
}
]
*/
JSONArray jsonIntegrationTestData = sm_contentIntegrationTestData;
for (int i = 0; i < jsonIntegrationTestData.length(); i++) {
JSONObject jsonIntegrationTestDatum = (JSONObject) jsonIntegrationTestData.get(i);
String username = jsonIntegrationTestDatum.getString("username");
String password = jsonIntegrationTestDatum.getString("password");
ConsumerType type = null;
if (jsonIntegrationTestDatum.has("type"))
type = ConsumerType.valueOf(jsonIntegrationTestDatum.getString("type"));
// can be comma separated
String variant = null;
if (jsonIntegrationTestDatum.has("variant"))
variant = jsonIntegrationTestDatum.getString("variant");
// can be comma separated
String arch = null;
if (jsonIntegrationTestDatum.has("arch"))
arch = jsonIntegrationTestDatum.getString("arch");
JSONArray jsonProductIdsData = (JSONArray) jsonIntegrationTestDatum.getJSONArray("productIdsData");
for (int j = 0; j < jsonProductIdsData.length(); j++) {
JSONObject jsonProductIdsDatum = (JSONObject) jsonProductIdsData.get(j);
String productId = jsonProductIdsDatum.getString("productId");
Integer sockets = null;
if (jsonProductIdsDatum.has("sockets"))
sockets = jsonProductIdsDatum.getInt("sockets");
// can be comma separated
String engProductId = null;
if (jsonProductIdsDatum.has("engProductId"))
engProductId = jsonProductIdsDatum.getString("engProductId");
// String username, String password, String productId, Integer sockets
ll.add(Arrays.asList(new Object[] { username, password, type, productId, variant, arch, sockets, engProductId }));
}
}
return ll;
}
Aggregations