use of com.mercedesbenz.sechub.test.TestURLBuilder in project sechub by mercedes-benz.
the class TestAPI method changeScanMappingDirectly.
/**
* Changes scan mapping DIRECTLY ! Means without administration domain, but
* directly in scan domain - interesting for testing only,
*
* @param json
*/
public static void changeScanMappingDirectly(String mappingId, MappingEntry... entries) {
MappingData data = new MappingData();
for (MappingEntry entry : entries) {
data.getEntries().add(entry);
}
TestURLBuilder urlBuilder = IntegrationTestContext.get().getUrlBuilder();
String url = urlBuilder.buildIntegrationTestChangeMappingDirectlyURL(mappingId);
IntegrationTestContext.get().getRestHelper(ANONYMOUS).putJSON(url, data.toJSON());
}
use of com.mercedesbenz.sechub.test.TestURLBuilder in project sechub by mercedes-benz.
the class TestAPI method fetchMappingDataDirectlyOrNull.
public static MappingData fetchMappingDataDirectlyOrNull(String mappingId) {
TestURLBuilder urlBuilder = IntegrationTestContext.get().getUrlBuilder();
String url = urlBuilder.buildIntegrationTestFetchMappingDirectlyURL(mappingId);
String result = IntegrationTestContext.get().getRestHelper(ANONYMOUS).getJSON(url);
if (result == null) {
return null;
}
MappingData data = MappingData.fromString(result);
return data;
}
use of com.mercedesbenz.sechub.test.TestURLBuilder in project sechub by mercedes-benz.
the class DeveloperAdministration method getUrlBuilder.
public TestURLBuilder getUrlBuilder() {
if (urlBuilder == null) {
int port = provider.getPort();
String server = provider.getServer();
urlBuilder = new TestURLBuilder(provider.getProtocol(), port, server);
}
return urlBuilder;
}
use of com.mercedesbenz.sechub.test.TestURLBuilder in project sechub by mercedes-benz.
the class TestAPI method getFileUploaded.
/**
* Get uploaded file (means download former uploaded file) from integration test
* server
*
* @param project
* @param jobUUID
* @param fileName
* @return file or <code>null</code> when not found
* @throws IllegalStateException when other problems are occurring
*/
public static File getFileUploaded(TestProject project, UUID jobUUID, String fileName) {
TestURLBuilder urlBuilder = IntegrationTestContext.get().getUrlBuilder();
String url = urlBuilder.buildGetFileUpload(project.getProjectId(), jobUUID.toString(), fileName);
try {
File file = as(ANONYMOUS).downloadAsTempFileFromURL(url, jobUUID);
return file;
} catch (HttpStatusCodeException e) {
if (HttpStatus.NOT_FOUND.equals(e.getStatusCode())) {
/* okay, just not existing ... */
return null;
}
throw new IllegalStateException("Odd status code:" + e.getStatusCode() + ", message:" + e.getMessage(), e);
}
}
use of com.mercedesbenz.sechub.test.TestURLBuilder in project sechub by mercedes-benz.
the class TestAPI method clearMetaDataInspection.
public static void clearMetaDataInspection() {
TestURLBuilder urlBuilder = IntegrationTestContext.get().getUrlBuilder();
String url = urlBuilder.buildClearMetaDataInspectionURL();
IntegrationTestContext.get().getSuperAdminRestHelper().delete(url);
}
Aggregations