use of com.mercedesbenz.sechub.sharedkernel.mapping.MappingData 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.sharedkernel.mapping.MappingData 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.sharedkernel.mapping.MappingData in project sechub by mercedes-benz.
the class NamePatternIdProviderFactory method createProvider.
public NamePatternIdProvider createProvider(String id, String parameterValue) {
NamePatternIdProvider provider;
MappingData mappingData = MappingData.fromString(parameterValue);
List<NamePatternToIdEntry> entries = converter.convert(mappingData);
provider = new NamePatternIdProvider(id);
for (NamePatternToIdEntry entry : entries) {
provider.add(entry);
}
return provider;
}
use of com.mercedesbenz.sechub.sharedkernel.mapping.MappingData in project sechub by mercedes-benz.
the class ScanMappingToScanMappingConfigurationTransformer method transform.
public ScanMappingConfiguration transform(List<ScanMapping> mappings) {
ScanMappingConfiguration config = new ScanMappingConfiguration();
if (mappings == null || mappings.size() == 0) {
return config;
}
for (ScanMapping mapping : mappings) {
MappingData data = MappingData.fromString(mapping.getData());
config.getNamePatternMappings().put(mapping.getId(), converter.convert(data));
}
return config;
}
use of com.mercedesbenz.sechub.sharedkernel.mapping.MappingData in project sechub by mercedes-benz.
the class MappingDataCSVSupport method fromCSVRows.
public MappingData fromCSVRows(List<CSVRow> rows, int headlines) {
MappingData data = new MappingData();
if (rows.size() <= headlines) {
throw new IllegalStateException("Row count must be > headline count:" + headlines);
}
int count = 0;
for (CSVRow row : rows) {
count++;
if (count <= headlines) {
/* ignore headline */
continue;
}
if (row.columns.size() != 3) {
throw new IllegalStateException("column count must be 3, but is:" + row.columns.size());
}
int col = 0;
String pattern = row.columns.get(col++).cell;
String replacement = row.columns.get(col++).cell;
String comment = row.columns.get(col++).cell;
data.getEntries().add(new MappingEntry(pattern, replacement, comment));
}
return data;
}
Aggregations