use of com.mercedesbenz.sechub.integrationtest.internal.TestJSONHelper in project sechub by mercedes-benz.
the class DeveloperAdministration method fetchProjectDescription.
public String fetchProjectDescription(String projectId) {
String json = fetchProjectInfo(projectId);
TestJSONHelper jsonHelper = TestJSONHelper.get();
JsonNode jsonNode = jsonHelper.readTree(json);
return jsonNode.get("description").textValue();
}
use of com.mercedesbenz.sechub.integrationtest.internal.TestJSONHelper in project sechub by mercedes-benz.
the class DeveloperAdministration method fetchProjectMetaData.
public String fetchProjectMetaData(String projectId) {
String json = getRestHelper().getJSON(getUrlBuilder().buildAdminFetchProjectInfoUrl(projectId));
TestJSONHelper jsonHelper = TestJSONHelper.get();
JsonNode jsonNode = jsonHelper.readTree(json);
JsonNode metaData = jsonNode.get("metaData");
return metaData.toPrettyString();
}
use of com.mercedesbenz.sechub.integrationtest.internal.TestJSONHelper in project sechub by mercedes-benz.
the class CreateOverviewCSVExportAction method loadUserIds.
private List<String> loadUserIds() {
String data = getContext().getAdministration().fetchUserList();
TestJSONHelper jsonHelper = TestJSONHelper.get();
JsonNode tree = jsonHelper.readTree(data);
List<String> ids = new ArrayList<>();
Iterator<JsonNode> iditerator = tree.elements();
while (iditerator.hasNext()) {
JsonNode dNode = iditerator.next();
ids.add(dNode.asText());
}
outputAsTextOnSuccess("Found " + ids.size() + " users in system.");
return ids;
}
use of com.mercedesbenz.sechub.integrationtest.internal.TestJSONHelper in project sechub by mercedes-benz.
the class CreateOverviewCSVExportAction method loadProjectIds.
private List<String> loadProjectIds() {
String data = getContext().getAdministration().fetchProjectList();
TestJSONHelper jsonHelper = TestJSONHelper.get();
JsonNode tree = jsonHelper.readTree(data);
List<String> projectIds = new ArrayList<>();
Iterator<JsonNode> projectIditerator = tree.elements();
while (projectIditerator.hasNext()) {
JsonNode projectIdNode = projectIditerator.next();
projectIds.add(projectIdNode.asText());
}
outputAsTextOnSuccess("Found " + projectIds.size() + " projects in system.");
return projectIds;
}
use of com.mercedesbenz.sechub.integrationtest.internal.TestJSONHelper in project sechub by mercedes-benz.
the class DeveloperAdministration method createProject.
public String createProject(String projectId, String description, String owner, List<String> whiteListURLs, Map<String, String> metaData) {
/* @formatter:off */
StringBuilder json = new StringBuilder();
if (description == null) {
description = "";
}
TestJSONHelper jsonHelper = TestJSONHelper.get();
json.append("{\n" + " \"apiVersion\":\"1.0\",\n" + " \"name\":\"" + projectId + "\",\n" + " \"owner\":\"" + owner + "\",\n" + " \"description\":\"" + description + "\"");
if (!whiteListURLs.isEmpty()) {
json.append(",\n \"whiteList\" : {\"uris\":[");
for (Iterator<String> it = whiteListURLs.iterator(); it.hasNext(); ) {
String url = it.next();
json.append("\"" + url + "\"");
if (it.hasNext()) {
json.append(",");
}
}
json.append("]\n");
json.append(" }\n");
}
if (!metaData.isEmpty()) {
json.append(",\n \"metaData\" : {\n");
for (Iterator<Map.Entry<String, String>> it = metaData.entrySet().iterator(); it.hasNext(); ) {
Map.Entry<String, String> pair = it.next();
String key = pair.getKey();
String value = pair.getValue();
json.append("\"" + key + "\":\"" + value + "\"");
if (it.hasNext()) {
json.append(",\n");
}
}
json.append("\n}\n");
}
json.append("}\n");
jsonHelper.assertValidJson(json.toString());
/* @formatter:on */
return getRestHelper().postJson(getUrlBuilder().buildAdminCreatesProjectUrl(), json.toString());
}
Aggregations