use of com.synopsys.integration.configuration.source.MapPropertySource in project synopsys-detect by blackducksoftware.
the class DetectConfigurationTest method testDeprecated.
@Test
public void testDeprecated() throws DetectUserFriendlyException {
HashMap<String, String> values = new HashMap<>();
values.put(DetectProperties.DETECT_BDIO2_ENABLED.getKey(), "false");
List<PropertySource> propertySources = new ArrayList<>();
propertySources.add(new MapPropertySource("test", values));
PropertyConfiguration propertyConfiguration = new PropertyConfiguration(propertySources);
DetectPropertyConfiguration detectPropertyConfiguration = new DetectPropertyConfiguration(propertyConfiguration, new SimplePathResolver());
DetectConfigurationFactory detectConfigurationFactory = new DetectConfigurationFactory(detectPropertyConfiguration, new Gson());
BdioOptions bdioOptions = detectConfigurationFactory.createBdioOptions();
Assertions.assertFalse(bdioOptions.isBdio2Enabled());
}
use of com.synopsys.integration.configuration.source.MapPropertySource in project synopsys-detect by blackducksoftware.
the class MapPropertySourceTests method testNormalizesKeys.
@Test
public void testNormalizesKeys() {
PropertySource source = new MapPropertySource("test", Collections.singletonMap("CAPITAL_UNDERSCORE", "value"));
Set<String> keys = source.getKeys();
Assertions.assertEquals(Collections.singleton("capital.underscore"), keys);
}
use of com.synopsys.integration.configuration.source.MapPropertySource in project synopsys-detect by blackducksoftware.
the class MapPropertySourceTests method returnsKey.
@Test
public void returnsKey() {
PropertySource source = new MapPropertySource("test", Collections.singletonMap("property.key", "value"));
Assertions.assertEquals("value", source.getValue("property.key"));
Assertions.assertEquals("test", source.getOrigin("property.key"));
Assertions.assertEquals("test", source.getName());
}
use of com.synopsys.integration.configuration.source.MapPropertySource in project synopsys-detect by blackducksoftware.
the class DetectConfigurationFactoryTestUtils method factoryOf.
@SafeVarargs
public static DetectConfigurationFactory factoryOf(Pair<Property, String>... properties) {
Map<String, String> propertyMap = Bds.of(properties).toMap(pair -> pair.getLeft().getKey(), Pair::getRight);
PropertySource inMemoryPropertySource = new MapPropertySource("test", propertyMap);
PropertyConfiguration propertyConfiguration = new PropertyConfiguration(Collections.singletonList(inMemoryPropertySource));
DetectPropertyConfiguration detectPropertyConfiguration = new DetectPropertyConfiguration(propertyConfiguration, new SimplePathResolver());
return new DetectConfigurationFactory(detectPropertyConfiguration, new Gson());
}
use of com.synopsys.integration.configuration.source.MapPropertySource in project synopsys-detect by blackducksoftware.
the class DetectConfigurationTest method testGenericProperty.
@Test
public void testGenericProperty() {
HashMap<String, String> values = new HashMap<>();
values.put(DetectProperties.DETECT_PROJECT_CODELOCATION_PREFIX.getKey(), "some_prefix");
List<PropertySource> propertySources = new ArrayList<>();
propertySources.add(new MapPropertySource("test", values));
PropertyConfiguration propertyConfiguration = new PropertyConfiguration(propertySources);
DetectPropertyConfiguration detectPropertyConfiguration = new DetectPropertyConfiguration(propertyConfiguration, new SimplePathResolver());
DetectConfigurationFactory detectConfigurationFactory = new DetectConfigurationFactory(detectPropertyConfiguration, new Gson());
BdioOptions bdioOptions = detectConfigurationFactory.createBdioOptions();
assertTrue(bdioOptions.getProjectCodeLocationPrefix().isPresent());
assertEquals("some_prefix", bdioOptions.getProjectCodeLocationPrefix().get());
}
Aggregations