use of com.synopsys.integration.configuration.property.Property in project synopsys-detect by blackducksoftware.
the class ValuedListPropertyTest method describeDefault.
@Test
public void describeDefault() {
Property testProperty = new TestListProperty("key", emptyList());
Assertions.assertNotNull(testProperty.describeDefault(), "The default value description should be set.");
}
use of com.synopsys.integration.configuration.property.Property in project synopsys-detect by blackducksoftware.
the class DetectProperties method allProperties.
// Accessor to get all properties
public static Properties allProperties() {
List<Property> properties = new ArrayList<>();
Field[] allFields = DetectProperties.class.getDeclaredFields();
for (Field field : allFields) {
if (Property.class.isAssignableFrom(field.getType())) {
try {
Object property = field.get(Property.class);
Property detectProperty = (Property) property;
properties.add(detectProperty);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
}
return new Properties(properties);
}
use of com.synopsys.integration.configuration.property.Property in project synopsys-detect by blackducksoftware.
the class HelpPrinter method printOptions.
public void printOptions(HelpTextWriter writer, List<Property> options, String notes) {
writer.printColumns("Property Name", "Default", "Description");
writer.printSeparator();
List<Property> sorted = options.stream().sorted(SORT_BY_GROUP_THEN_KEY).collect(Collectors.toList());
if (notes != null) {
writer.println(notes);
writer.println();
}
String group = null;
for (Property detectOption : sorted) {
String currentGroup = detectOption.getPropertyGroupInfo().getPrimaryGroup().getName();
if (group == null) {
group = currentGroup;
writer.println("[" + group + "]");
} else if (!group.equals(currentGroup)) {
group = currentGroup;
writer.println();
writer.println("[" + group + "]");
}
printOption(writer, detectOption);
}
}
use of com.synopsys.integration.configuration.property.Property 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.Property in project synopsys-detect by blackducksoftware.
the class PropertyConfigurationTest method testPropertyIsDeprecated.
@Test
public void testPropertyIsDeprecated() {
Property property1 = new NullableStringProperty("name");
property1.setRemovalDeprecation("desc", new ProductMajorVersion(1));
Assertions.assertTrue(property1.isDeprecatedForRemoval());
Property property2 = new NullableStringProperty("name");
property2.addDeprecatedValueInfo("val", "reason");
Assertions.assertFalse(property2.isDeprecatedForRemoval());
}
Aggregations