Search in sources :

Example 36 with PropertyConfiguration

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

the class ShutdownDeciderTest method shouldPreserveScanIfDryRun.

@Test
public void shouldPreserveScanIfDryRun() {
    PropertyConfiguration configuration = ConfigTestUtils.configOf(Pair.of(DetectProperties.DETECT_BLACKDUCK_SIGNATURE_SCANNER_DRY_RUN.getKey(), "true"));
    CleanupDecision decision = new ShutdownDecider().decideCleanup(configuration, null, null);
    assertTrue(decision.shouldPreserveScan());
}
Also used : PropertyConfiguration(com.synopsys.integration.configuration.config.PropertyConfiguration) Test(org.junit.jupiter.api.Test)

Example 37 with PropertyConfiguration

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

the class ShutdownDeciderTest method shouldSkipCleanupIfProvidedFalse.

@Test
public void shouldSkipCleanupIfProvidedFalse() {
    PropertyConfiguration configuration = ConfigTestUtils.configOf(Pair.of(DetectProperties.DETECT_CLEANUP.getKey(), "false"));
    CleanupDecision decision = new ShutdownDecider().decideCleanup(configuration, null, null);
    assertFalse(decision.shouldCleanup());
}
Also used : PropertyConfiguration(com.synopsys.integration.configuration.config.PropertyConfiguration) Test(org.junit.jupiter.api.Test)

Example 38 with PropertyConfiguration

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

the class DiagnosticDecisionTest method commandLineDecision.

@Test
void commandLineDecision() {
    PropertyConfiguration propertyConfiguration = createPropertyConfiguration(false, false);
    DetectArgumentState detectArgumentState = createDetectArgumentState(true, 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 39 with PropertyConfiguration

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

the class DiagnosticDecisionTest method noDiagnostic.

@Test
void noDiagnostic() {
    PropertyConfiguration propertyConfiguration = createPropertyConfiguration(false, false);
    DetectArgumentState detectArgumentState = createDetectArgumentState(false, false);
    DiagnosticDecision diagnosticDecision = DiagnosticDecision.decide(detectArgumentState, propertyConfiguration);
    Assertions.assertFalse(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 40 with PropertyConfiguration

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

the class DiagnosticDecisionTest method createPropertyConfiguration.

private PropertyConfiguration createPropertyConfiguration(boolean isDiagnostic, boolean isExtended) {
    HashMap<String, String> propertySourceMap = new HashMap<>();
    propertySourceMap.put(DetectProperties.DETECT_DIAGNOSTIC.getKey(), String.valueOf(isDiagnostic));
    propertySourceMap.put(DetectProperties.DETECT_DIAGNOSTIC_EXTENDED.getKey(), String.valueOf(isExtended));
    MapPropertySource mapPropertySource = new MapPropertySource(TEST_PROPERTY_SOURCE_NAME, propertySourceMap);
    return new PropertyConfiguration(Collections.singletonList(mapPropertySource));
}
Also used : HashMap(java.util.HashMap) MapPropertySource(com.synopsys.integration.configuration.source.MapPropertySource) PropertyConfiguration(com.synopsys.integration.configuration.config.PropertyConfiguration)

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