Search in sources :

Example 1 with BdioOptions

use of com.synopsys.integration.detect.workflow.bdio.BdioOptions 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());
}
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)

Example 2 with BdioOptions

use of com.synopsys.integration.detect.workflow.bdio.BdioOptions in project synopsys-detect by blackducksoftware.

the class IntelligentModeStepRunner method uploadBdio.

public void uploadBdio(BlackDuckRunData blackDuckRunData, BdioResult bdioResult, CodeLocationAccumulator codeLocationAccumulator) throws OperationException, IntegrationException {
    // TODO: Move to a decision
    BdioOptions bdioOptions = operationFactory.calculateBdioOptions();
    BdioUploadResult uploadResult;
    if (bdioOptions.isLegacyUploadEnabled()) {
        if (bdioOptions.isBdio2Enabled()) {
            uploadResult = operationFactory.uploadBdio2(blackDuckRunData, bdioResult);
        } else {
            uploadResult = operationFactory.uploadBdio1(blackDuckRunData, bdioResult);
        }
    } else {
        uploadResult = operationFactory.uploadBdioIntelligentPersistent(blackDuckRunData, bdioResult);
    }
    uploadResult.getUploadOutput().ifPresent(codeLocationAccumulator::addWaitableCodeLocation);
}
Also used : BdioUploadResult(com.synopsys.integration.detect.lifecycle.run.operation.blackduck.BdioUploadResult) BdioOptions(com.synopsys.integration.detect.workflow.bdio.BdioOptions)

Example 3 with BdioOptions

use of com.synopsys.integration.detect.workflow.bdio.BdioOptions 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)

Example 4 with BdioOptions

use of com.synopsys.integration.detect.workflow.bdio.BdioOptions in project synopsys-detect by blackducksoftware.

the class SingletonFactory method createUtilitySingletons.

public UtilitySingletons createUtilitySingletons(EventSingletons eventSingletons) throws DetectUserFriendlyException {
    ExternalIdFactory externalIdFactory = new ExternalIdFactory();
    ConnectionDetails connectionDetails = detectConfigurationFactory.createConnectionDetails();
    ConnectionFactory connectionFactory = new ConnectionFactory(connectionDetails);
    ArtifactResolver artifactResolver = new ArtifactResolver(connectionFactory, gson);
    ArtifactoryZipInstaller artifactoryZipInstaller = new ArtifactoryZipInstaller(artifactResolver);
    AirGapPathFinder airGapPathFinder = new AirGapPathFinder();
    BdioOptions bdioOptions = detectConfigurationFactory.createBdioOptions();
    CodeLocationNameGenerator codeLocationNameGenerator = detectConfigurationFactory.createCodeLocationOverride().map(CodeLocationNameGenerator::withOverride).orElse(CodeLocationNameGenerator.withPrefixSuffix(bdioOptions.getProjectCodeLocationPrefix().orElse(null), bdioOptions.getProjectCodeLocationSuffix().orElse(null)));
    CodeLocationNameManager codeLocationNameManager = new CodeLocationNameManager(codeLocationNameGenerator);
    AirGapInspectorPaths airGapInspectorPaths = new AirGapInspectorPaths(airGapPathFinder);
    DetectExecutableRunner executableRunner = DetectExecutableRunner.newDebug(eventSystem);
    DirectoryExecutableFinder directoryExecutableFinder = DirectoryExecutableFinder.forCurrentOperatingSystem(fileFinder);
    SystemPathExecutableFinder systemExecutableFinder = new SystemPathExecutableFinder(directoryExecutableFinder);
    DetectExecutableResolver detectExecutableResolver = new DetectExecutableResolver(directoryExecutableFinder, systemExecutableFinder, detectConfigurationFactory.createDetectExecutableOptions());
    OperationSystem operationSystem = new OperationSystem(eventSingletons.getStatusEventPublisher());
    OperationWrapper operationWrapper = new OperationWrapper();
    return new UtilitySingletons(externalIdFactory, connectionDetails, artifactResolver, codeLocationNameManager, airGapInspectorPaths, executableRunner, detectExecutableResolver, operationSystem, operationWrapper, artifactoryZipInstaller);
}
Also used : AirGapInspectorPaths(com.synopsys.integration.detect.workflow.airgap.AirGapInspectorPaths) DirectoryExecutableFinder(com.synopsys.integration.detect.tool.detector.executable.DirectoryExecutableFinder) CodeLocationNameManager(com.synopsys.integration.detect.workflow.codelocation.CodeLocationNameManager) ArtifactoryZipInstaller(com.synopsys.integration.detect.tool.detector.inspectors.ArtifactoryZipInstaller) OperationWrapper(com.synopsys.integration.detect.lifecycle.run.step.utility.OperationWrapper) ExternalIdFactory(com.synopsys.integration.bdio.model.externalid.ExternalIdFactory) ConnectionDetails(com.synopsys.integration.detect.configuration.connection.ConnectionDetails) OperationSystem(com.synopsys.integration.detect.workflow.status.OperationSystem) ArtifactResolver(com.synopsys.integration.detect.workflow.ArtifactResolver) SystemPathExecutableFinder(com.synopsys.integration.detect.tool.detector.executable.SystemPathExecutableFinder) BdioOptions(com.synopsys.integration.detect.workflow.bdio.BdioOptions) ConnectionFactory(com.synopsys.integration.detect.configuration.connection.ConnectionFactory) DetectExecutableResolver(com.synopsys.integration.detect.tool.detector.executable.DetectExecutableResolver) AirGapPathFinder(com.synopsys.integration.detect.workflow.airgap.AirGapPathFinder) CodeLocationNameGenerator(com.synopsys.integration.detect.workflow.codelocation.CodeLocationNameGenerator) DetectExecutableRunner(com.synopsys.integration.detect.tool.detector.executable.DetectExecutableRunner)

Aggregations

BdioOptions (com.synopsys.integration.detect.workflow.bdio.BdioOptions)4 Gson (com.google.gson.Gson)2 PropertyConfiguration (com.synopsys.integration.configuration.config.PropertyConfiguration)2 SimplePathResolver (com.synopsys.integration.configuration.property.types.path.SimplePathResolver)2 MapPropertySource (com.synopsys.integration.configuration.source.MapPropertySource)2 PropertySource (com.synopsys.integration.configuration.source.PropertySource)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Test (org.junit.jupiter.api.Test)2 ExternalIdFactory (com.synopsys.integration.bdio.model.externalid.ExternalIdFactory)1 ConnectionDetails (com.synopsys.integration.detect.configuration.connection.ConnectionDetails)1 ConnectionFactory (com.synopsys.integration.detect.configuration.connection.ConnectionFactory)1 BdioUploadResult (com.synopsys.integration.detect.lifecycle.run.operation.blackduck.BdioUploadResult)1 OperationWrapper (com.synopsys.integration.detect.lifecycle.run.step.utility.OperationWrapper)1 DetectExecutableResolver (com.synopsys.integration.detect.tool.detector.executable.DetectExecutableResolver)1 DetectExecutableRunner (com.synopsys.integration.detect.tool.detector.executable.DetectExecutableRunner)1 DirectoryExecutableFinder (com.synopsys.integration.detect.tool.detector.executable.DirectoryExecutableFinder)1 SystemPathExecutableFinder (com.synopsys.integration.detect.tool.detector.executable.SystemPathExecutableFinder)1 ArtifactoryZipInstaller (com.synopsys.integration.detect.tool.detector.inspectors.ArtifactoryZipInstaller)1 ArtifactResolver (com.synopsys.integration.detect.workflow.ArtifactResolver)1