Search in sources :

Example 6 with ConsumerType

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;
}
Also used : JSONObject(org.json.JSONObject) ArrayList(java.util.ArrayList) JSONArray(org.json.JSONArray) ArrayList(java.util.ArrayList) List(java.util.List) JSONObject(org.json.JSONObject) ConsumerType(rhsm.base.ConsumerType)

Aggregations

JSONObject (org.json.JSONObject)6 ConsumerType (rhsm.base.ConsumerType)6 ArrayList (java.util.ArrayList)4 List (java.util.List)4 TestDefinition (com.github.redhatqe.polarize.metadata.TestDefinition)2 SSHCommandResult (com.redhat.qe.tools.SSHCommandResult)2 JSONArray (org.json.JSONArray)2 SkipException (org.testng.SkipException)2 Test (org.testng.annotations.Test)2 ContentNamespace (rhsm.data.ContentNamespace)2 EntitlementCert (rhsm.data.EntitlementCert)2 BlockedByBzBug (com.redhat.qe.auto.bugzilla.BlockedByBzBug)1 BugzillaAPIException (com.redhat.qe.auto.bugzilla.BugzillaAPIException)1 HashMap (java.util.HashMap)1 SubscriptionPool (rhsm.data.SubscriptionPool)1