Search in sources :

Example 1 with TestURLBuilder

use of com.mercedesbenz.sechub.test.TestURLBuilder in project sechub by mercedes-benz.

the class TestAPI method fetchMetaDataInspections.

public static List<Map<String, Object>> fetchMetaDataInspections() {
    TestURLBuilder urlBuilder = IntegrationTestContext.get().getUrlBuilder();
    String url = urlBuilder.buildFetchMetaDataInspectionsURL();
    String json = IntegrationTestContext.get().getSuperAdminRestHelper().getJSON(url);
    TestJSONHelper jsonHelper = TestJSONHelper.get();
    List<Map<String, Object>> data;
    try {
        data = jsonHelper.getMapper().readValue(json, new TypeReference<List<Map<String, Object>>>() {
        });
        return data;
    } catch (JsonProcessingException e) {
        throw new AssertionError("Was not able to read meta data json", e);
    }
}
Also used : TestURLBuilder(com.mercedesbenz.sechub.test.TestURLBuilder) TestJSONHelper(com.mercedesbenz.sechub.integrationtest.internal.TestJSONHelper) TypeReference(com.fasterxml.jackson.core.type.TypeReference) Map(java.util.Map) TreeMap(java.util.TreeMap) SortedMap(java.util.SortedMap) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Example 2 with TestURLBuilder

use of com.mercedesbenz.sechub.test.TestURLBuilder in project sechub by mercedes-benz.

the class TestAPI method getIdForNameByNamePatternProvider.

public static String getIdForNameByNamePatternProvider(String namePatternProviderId, String name) {
    TestURLBuilder urlBuilder = IntegrationTestContext.get().getUrlBuilder();
    String url = urlBuilder.buildIntegrationTestGetIdForNameByNamePatternProvider(namePatternProviderId, name);
    String result = IntegrationTestContext.get().getRestHelper(ANONYMOUS).getStringFromURL(url);
    return result;
}
Also used : TestURLBuilder(com.mercedesbenz.sechub.test.TestURLBuilder)

Example 3 with TestURLBuilder

use of com.mercedesbenz.sechub.test.TestURLBuilder in project sechub by mercedes-benz.

the class TestAPI method getSecurityLogs.

public static List<SecurityLogData> getSecurityLogs() {
    TestURLBuilder urlBuilder = IntegrationTestContext.get().getUrlBuilder();
    String url = urlBuilder.buildIntegrationTestGetSecurityLogs();
    String json = IntegrationTestContext.get().getRestHelper(ANONYMOUS).getJSON(url);
    ObjectMapper mapper = TestJSONHelper.get().getMapper();
    ObjectReader readerForListOf = mapper.readerForListOf(SecurityLogData.class);
    try {
        return readerForListOf.readValue(json);
    } catch (Exception e) {
        throw new IllegalStateException("was not able to fetch security logs", e);
    }
}
Also used : TestURLBuilder(com.mercedesbenz.sechub.test.TestURLBuilder) ObjectReader(com.fasterxml.jackson.databind.ObjectReader) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) HttpStatusCodeException(org.springframework.web.client.HttpStatusCodeException) RestClientException(org.springframework.web.client.RestClientException) IOException(java.io.IOException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) HttpClientErrorException(org.springframework.web.client.HttpClientErrorException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException)

Example 4 with TestURLBuilder

use of com.mercedesbenz.sechub.test.TestURLBuilder in project sechub by mercedes-benz.

the class AsPDSUser method markJobAsReadyToStart.

public void markJobAsReadyToStart(UUID jobUUID) {
    TestRestHelper restHelper = getRestHelper();
    TestURLBuilder urlBuilder = getUrlBuilder();
    markJobAsReadyToStart(jobUUID, restHelper, urlBuilder);
}
Also used : TestRestHelper(com.mercedesbenz.sechub.integrationtest.internal.TestRestHelper) TestURLBuilder(com.mercedesbenz.sechub.test.TestURLBuilder)

Example 5 with TestURLBuilder

use of com.mercedesbenz.sechub.test.TestURLBuilder in project sechub by mercedes-benz.

the class AsPDSUser method createJobFor.

private String createJobFor(UUID sechubJobUUID, String productId, Map<String, String> params) {
    TestRestHelper restHelper = getRestHelper();
    TestURLBuilder urlBuilder = getUrlBuilder();
    return createJobFor(sechubJobUUID, params, productId, restHelper, urlBuilder);
}
Also used : TestRestHelper(com.mercedesbenz.sechub.integrationtest.internal.TestRestHelper) TestURLBuilder(com.mercedesbenz.sechub.test.TestURLBuilder)

Aggregations

TestURLBuilder (com.mercedesbenz.sechub.test.TestURLBuilder)11 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 TestRestHelper (com.mercedesbenz.sechub.integrationtest.internal.TestRestHelper)2 MappingData (com.mercedesbenz.sechub.sharedkernel.mapping.MappingData)2 HttpStatusCodeException (org.springframework.web.client.HttpStatusCodeException)2 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ObjectReader (com.fasterxml.jackson.databind.ObjectReader)1 TestJSONHelper (com.mercedesbenz.sechub.integrationtest.internal.TestJSONHelper)1 MappingEntry (com.mercedesbenz.sechub.sharedkernel.mapping.MappingEntry)1 File (java.io.File)1 IOException (java.io.IOException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 Map (java.util.Map)1 SortedMap (java.util.SortedMap)1 TreeMap (java.util.TreeMap)1 HttpClientErrorException (org.springframework.web.client.HttpClientErrorException)1 RestClientException (org.springframework.web.client.RestClientException)1