Search in sources :

Example 11 with TestJSONHelper

use of com.mercedesbenz.sechub.integrationtest.internal.TestJSONHelper in project sechub by mercedes-benz.

the class DeveloperAdministration method fetchProjectWhiteList.

public List<String> fetchProjectWhiteList(String projectId) {
    List<String> result = new ArrayList<>();
    String json = getRestHelper().getJSON(getUrlBuilder().buildAdminFetchProjectInfoUrl(projectId));
    TestJSONHelper jsonHelper = TestJSONHelper.get();
    JsonNode jsonNode = jsonHelper.readTree(json);
    JsonNode whitelist = jsonNode.get("whiteList");
    if (whitelist instanceof ArrayNode) {
        ArrayNode arrayNode = (ArrayNode) whitelist;
        for (JsonNode node : arrayNode) {
            String uriText = node.textValue();
            if (!uriText.trim().isEmpty()) {
                result.add(uriText);
            }
        }
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) TestJSONHelper(com.mercedesbenz.sechub.integrationtest.internal.TestJSONHelper) JsonNode(com.fasterxml.jackson.databind.JsonNode) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode)

Aggregations

TestJSONHelper (com.mercedesbenz.sechub.integrationtest.internal.TestJSONHelper)11 JsonNode (com.fasterxml.jackson.databind.JsonNode)8 ArrayList (java.util.ArrayList)4 Map (java.util.Map)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 Grid (com.mercedesbenz.sechub.developertools.admin.export.Grid)1 Row (com.mercedesbenz.sechub.developertools.admin.export.Row)1 TestURLBuilder (com.mercedesbenz.sechub.test.TestURLBuilder)1 BufferedWriter (java.io.BufferedWriter)1 IOException (java.io.IOException)1 Path (java.nio.file.Path)1 SortedMap (java.util.SortedMap)1 TreeMap (java.util.TreeMap)1