use of com.synopsys.integration.configuration.property.Property in project synopsys-detect by blackducksoftware.
the class PropertyConfigurationTest method getRawValueMapWithPassthroughs.
@Test
public void getRawValueMapWithPassthroughs() {
Set<Property> properties = new HashSet<>();
PassthroughProperty passthrough = new PassthroughProperty("blackduck.passthrough");
properties.add(passthrough);
Map<String, String> propertyMap = Bds.mapOf(Pair.of("blackduck.passthrough.password", "password"));
PropertyConfiguration configuration = configOf(propertyMap);
Map<String, String> rawPropertyValues = configuration.getMaskedRawValueMap(properties, rawKey -> rawKey.contains("password"));
Assertions.assertEquals("********", rawPropertyValues.get("blackduck.passthrough.password"));
}
use of com.synopsys.integration.configuration.property.Property in project synopsys-detect by blackducksoftware.
the class ValuedListPropertyTest method isCommaSeparated.
@Test
public void isCommaSeparated() {
Property testProperty = new TestListProperty("key", emptyList());
Assertions.assertTrue(testProperty.isCommaSeparated(), "This parser should separate on comma and should report that it does.");
}
use of com.synopsys.integration.configuration.property.Property in project synopsys-detect by blackducksoftware.
the class PropertyConfigurationHelpContext method findPropertyParseErrors.
public Map<String, List<String>> findPropertyParseErrors(List<Property> knownProperties) {
Map<String, List<String>> exceptions = new HashMap<>();
for (Property property : knownProperties) {
if (property.getClass().isAssignableFrom(TypedProperty.class)) {
// TODO: Can we do this without reflection?
Optional<ValueParseException> exception = propertyConfiguration.getPropertyException((TypedProperty) property);
if (exception.isPresent()) {
List<String> propertyExceptions = exceptions.getOrDefault(property.getKey(), new ArrayList<>());
if (StringUtils.isNotBlank(exception.get().getMessage())) {
propertyExceptions.add(exception.get().getMessage());
} else {
propertyExceptions.add(exception.get().toString());
}
exceptions.put(property.getKey(), propertyExceptions);
}
}
}
return exceptions;
}
Aggregations