Search in sources :

Example 26 with PropertyConfiguration

use of com.synopsys.integration.configuration.config.PropertyConfiguration in project synopsys-detect by blackducksoftware.

the class DiagnosticDecisionTest method commandLineDecisionExtended.

@Test
void commandLineDecisionExtended() {
    PropertyConfiguration propertyConfiguration = createPropertyConfiguration(false, false);
    DetectArgumentState detectArgumentState = createDetectArgumentState(false, true);
    DiagnosticDecision diagnosticDecision = DiagnosticDecision.decide(detectArgumentState, propertyConfiguration);
    Assertions.assertTrue(diagnosticDecision.shouldCreateDiagnosticSystem());
    Assertions.assertTrue(diagnosticDecision.isExtended());
}
Also used : DetectArgumentState(com.synopsys.integration.detect.configuration.help.DetectArgumentState) PropertyConfiguration(com.synopsys.integration.configuration.config.PropertyConfiguration) Test(org.junit.jupiter.api.Test)

Example 27 with PropertyConfiguration

use of com.synopsys.integration.configuration.config.PropertyConfiguration in project synopsys-detect by blackducksoftware.

the class DiagnosticDecisionTest method propertyDecision.

@Test
void propertyDecision() {
    PropertyConfiguration propertyConfiguration = createPropertyConfiguration(true, false);
    DetectArgumentState detectArgumentState = createDetectArgumentState(false, false);
    DiagnosticDecision diagnosticDecision = DiagnosticDecision.decide(detectArgumentState, propertyConfiguration);
    Assertions.assertTrue(diagnosticDecision.shouldCreateDiagnosticSystem());
    Assertions.assertFalse(diagnosticDecision.isExtended());
}
Also used : DetectArgumentState(com.synopsys.integration.detect.configuration.help.DetectArgumentState) PropertyConfiguration(com.synopsys.integration.configuration.config.PropertyConfiguration) Test(org.junit.jupiter.api.Test)

Example 28 with PropertyConfiguration

use of com.synopsys.integration.configuration.config.PropertyConfiguration in project synopsys-detect by blackducksoftware.

the class DiagnosticDecisionTest method propertyDecisionExtended.

@Test
void propertyDecisionExtended() {
    PropertyConfiguration propertyConfiguration = createPropertyConfiguration(false, true);
    DetectArgumentState detectArgumentState = createDetectArgumentState(false, false);
    DiagnosticDecision diagnosticDecision = DiagnosticDecision.decide(detectArgumentState, propertyConfiguration);
    Assertions.assertTrue(diagnosticDecision.shouldCreateDiagnosticSystem());
    Assertions.assertTrue(diagnosticDecision.isExtended());
}
Also used : DetectArgumentState(com.synopsys.integration.detect.configuration.help.DetectArgumentState) PropertyConfiguration(com.synopsys.integration.configuration.config.PropertyConfiguration) Test(org.junit.jupiter.api.Test)

Example 29 with PropertyConfiguration

use of com.synopsys.integration.configuration.config.PropertyConfiguration 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());
}
Also used : MapPropertySource(com.synopsys.integration.configuration.source.MapPropertySource) Gson(com.google.gson.Gson) SimplePathResolver(com.synopsys.integration.configuration.property.types.path.SimplePathResolver) PropertyConfiguration(com.synopsys.integration.configuration.config.PropertyConfiguration) Pair(org.apache.commons.lang3.tuple.Pair) MapPropertySource(com.synopsys.integration.configuration.source.MapPropertySource) PropertySource(com.synopsys.integration.configuration.source.PropertySource)

Example 30 with PropertyConfiguration

use of com.synopsys.integration.configuration.config.PropertyConfiguration 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());
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Gson(com.google.gson.Gson) SimplePathResolver(com.synopsys.integration.configuration.property.types.path.SimplePathResolver) MapPropertySource(com.synopsys.integration.configuration.source.MapPropertySource) PropertySource(com.synopsys.integration.configuration.source.PropertySource) BdioOptions(com.synopsys.integration.detect.workflow.bdio.BdioOptions) MapPropertySource(com.synopsys.integration.configuration.source.MapPropertySource) PropertyConfiguration(com.synopsys.integration.configuration.config.PropertyConfiguration) Test(org.junit.jupiter.api.Test)

Aggregations

PropertyConfiguration (com.synopsys.integration.configuration.config.PropertyConfiguration)58 Test (org.junit.jupiter.api.Test)53 SimplePathResolver (com.synopsys.integration.configuration.property.types.path.SimplePathResolver)7 MapPropertySource (com.synopsys.integration.configuration.source.MapPropertySource)7 Gson (com.google.gson.Gson)5 AllNoneEnumListProperty (com.synopsys.integration.configuration.property.types.enumallnone.property.AllNoneEnumListProperty)5 PropertySource (com.synopsys.integration.configuration.source.PropertySource)5 DetectArgumentState (com.synopsys.integration.detect.configuration.help.DetectArgumentState)5 AllEnumListProperty (com.synopsys.integration.configuration.property.types.enumallnone.property.AllEnumListProperty)4 NoneEnumListProperty (com.synopsys.integration.configuration.property.types.enumallnone.property.NoneEnumListProperty)4 DetectConfigurationFactory (com.synopsys.integration.detect.configuration.DetectConfigurationFactory)4 DetectPropertyConfiguration (com.synopsys.integration.detect.configuration.DetectPropertyConfiguration)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 InstalledToolLocator (com.synopsys.integration.detect.tool.cache.InstalledToolLocator)3 DeprecatedValueUsage (com.synopsys.integration.configuration.property.deprecation.DeprecatedValueUsage)2 ConnectionFactory (com.synopsys.integration.detect.configuration.connection.ConnectionFactory)2 InstalledToolManager (com.synopsys.integration.detect.tool.cache.InstalledToolManager)2 ArtifactResolver (com.synopsys.integration.detect.workflow.ArtifactResolver)2 BdioOptions (com.synopsys.integration.detect.workflow.bdio.BdioOptions)2