use of com.synopsys.integration.configuration.property.base.PassthroughProperty in project synopsys-detect by blackducksoftware.
the class PropertyConfiguration method getMaskedRawValueMap.
@NotNull
public Map<String, String> getMaskedRawValueMap(@NotNull Set<Property> properties, Predicate<String> shouldMask) {
Map<String, String> rawMap = new HashMap<>();
for (Property property : properties) {
String rawKey = property.getKey();
if (property instanceof PassthroughProperty) {
getRaw((PassthroughProperty) property).entrySet().forEach(passThrough -> {
String fullPassThroughKey = String.format("%s.%s", rawKey, passThrough.getKey());
rawMap.put(fullPassThroughKey, maskValue(fullPassThroughKey, passThrough.getValue(), shouldMask));
});
} else {
getRaw(property).ifPresent(rawValue -> rawMap.put(rawKey, maskValue(rawKey, rawValue, shouldMask)));
}
}
return rawMap;
}
use of com.synopsys.integration.configuration.property.base.PassthroughProperty in project synopsys-detect by blackducksoftware.
the class PropertyConfigurationTest method getRawPassthroughPrimary.
@Test
public void getRawPassthroughPrimary() {
PassthroughProperty passthrough = new PassthroughProperty("pass");
PropertySource secondarySource = propertySourceOf("secondary", Pair.of("pass.shared", "secondaryValue"));
PropertySource primarySource = propertySourceOf("primary", Pair.of("pass.shared", "primaryValue"));
PropertyConfiguration configuration = configOf(primarySource, secondarySource);
Map<String, String> properties = Bds.mapOf(Pair.of("shared", "primaryValue"));
Assertions.assertEquals(properties, configuration.getRaw(passthrough));
}
use of com.synopsys.integration.configuration.property.base.PassthroughProperty in project synopsys-detect by blackducksoftware.
the class PropertyConfigurationTest method getRawPassthroughMultipleValues.
@Test
public void getRawPassthroughMultipleValues() {
PassthroughProperty passthrough = new PassthroughProperty("pass");
PropertySource secondarySource = propertySourceOf("secondary", Pair.of("pass.two", "two value"), Pair.of("ignore", "ignore value"));
PropertySource primarySource = propertySourceOf("primary", Pair.of("pass.one", "one value"));
PropertyConfiguration configuration = configOf(primarySource, secondarySource);
Map<String, String> properties = Bds.mapOf(Pair.of("one", "one value"), Pair.of("two", "two value"));
Assertions.assertEquals(properties, configuration.getRaw(passthrough));
}
use of com.synopsys.integration.configuration.property.base.PassthroughProperty 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"));
}
Aggregations