All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.testvagrant.optimuscloud.utils.TestFeedToDesiredCapConverter Maven / Gradle / Ivy

Go to download

The Java Client provides access to Optimus cloud for all java based projects.

There is a newer version: 1.1.0
Show newest version
package com.testvagrant.optimuscloud.utils;

import org.json.JSONArray;
import org.json.JSONObject;
import org.openqa.selenium.remote.DesiredCapabilities;

import java.util.ArrayList;
import java.util.List;

public class TestFeedToDesiredCapConverter {

    private JSONObject appJson;
    public TestFeedToDesiredCapConverter(String testFeed) {
        JsonUtil jsonUtil = new JsonUtil();
        appJson = jsonUtil.getAppJson(testFeed);
    }

    public List convert() {
        List desiredCapabilitiesList = new ArrayList<>();
        JSONArray testFeedArray = (JSONArray) appJson.get("testFeed");
        for (int testFeedIterator = 0; testFeedIterator < testFeedArray.length(); testFeedIterator++) {
            JSONObject testFeedJSON = (JSONObject) testFeedArray.get(testFeedIterator);

            System.out.println("updated testFeed -- " + testFeedJSON.toString());
            DesiredCapabilities desiredCapabilities = new CapabilitiesBuilder(testFeedJSON).buildCapabilities();
            desiredCapabilitiesList.add(desiredCapabilities);
        }
        return desiredCapabilitiesList;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy