use of com.mercedesbenz.sechub.sharedkernel.mapping.MappingEntry 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.MappingEntry in project sechub by mercedes-benz.
the class MappingDataToNamePatternToIdEntryConverter method convert.
public List<NamePatternToIdEntry> convert(MappingData data) {
List<NamePatternToIdEntry> list = new ArrayList<>();
if (data == null) {
return list;
}
for (MappingEntry mappingEntry : data.getEntries()) {
NamePatternToIdEntry namePattternToIdEntry = new NamePatternToIdEntry(mappingEntry.getPattern(), mappingEntry.getReplacement());
list.add(namePattternToIdEntry);
}
return list;
}
use of com.mercedesbenz.sechub.sharedkernel.mapping.MappingEntry 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;
}
use of com.mercedesbenz.sechub.sharedkernel.mapping.MappingEntry in project sechub by mercedes-benz.
the class CreateExampleJSONAdapterDialogAction method execute.
@Override
protected void execute(ActionEvent e) throws Exception {
boolean confirmed = getDialogUI().getContext().getDialogUI().confirm("Do you really want to replace your JSON data in text area with example code?");
if (!confirmed) {
getDialogUI().getContext().getOutputUI().output("Canceled by user");
return;
}
String exampleFound = getMappingUI().getData().example;
if (exampleFound != null) {
getMappingUI().setJSON(exampleFound);
} else {
MappingData data = new MappingData();
data.getEntries().add(new MappingEntry("pattern1", "replacement1", "comment1"));
data.getEntries().add(new MappingEntry("pattern2", "replacement2", "comment2"));
getMappingUI().setJSON(data.toJSON());
}
}
use of com.mercedesbenz.sechub.sharedkernel.mapping.MappingEntry in project sechub by mercedes-benz.
the class MappingEntryValidationImplTest method check_80_chars_limit_for_id.
@Test
public void check_80_chars_limit_for_id() {
assertTrue(validationToTest.validate(new MappingEntry(CONST_80_CHARS, "", "")).isValid());
assertFalse(validationToTest.validate(new MappingEntry(CONST_80_CHARS + "1", "", "")).isValid());
}
Aggregations