Search in sources :

Example 1 with DockerDetectableOptions

use of com.synopsys.integration.detectable.detectables.docker.DockerDetectableOptions in project synopsys-detect by blackducksoftware.

the class DetectableOptionFactory method createDockerDetectableOptions.

public DockerDetectableOptions createDockerDetectableOptions() {
    Boolean dockerPathRequired = detectConfiguration.getValue(DetectProperties.DETECT_DOCKER_PATH_REQUIRED);
    String suppliedDockerImage = detectConfiguration.getNullableValue(DetectProperties.DETECT_DOCKER_IMAGE);
    String dockerImageId = detectConfiguration.getNullableValue(DetectProperties.DETECT_DOCKER_IMAGE_ID);
    String suppliedDockerTar = detectConfiguration.getNullableValue(DetectProperties.DETECT_DOCKER_TAR);
    LogLevel dockerInspectorLoggingLevel;
    if (detectConfiguration.wasPropertyProvided(DetectProperties.LOGGING_LEVEL_DETECT)) {
        dockerInspectorLoggingLevel = detectConfiguration.getValue(DetectProperties.LOGGING_LEVEL_DETECT);
    } else {
        dockerInspectorLoggingLevel = detectConfiguration.getValue(DetectProperties.LOGGING_LEVEL_COM_SYNOPSYS_INTEGRATION);
    }
    String dockerInspectorVersion = detectConfiguration.getNullableValue(DetectProperties.DETECT_DOCKER_INSPECTOR_VERSION);
    Map<String, String> additionalDockerProperties = detectConfiguration.getRaw(DetectProperties.DOCKER_PASSTHROUGH);
    if (diagnosticSystem != null) {
        additionalDockerProperties.putAll(diagnosticSystem.getAdditionalDockerProperties());
    }
    Path dockerInspectorPath = detectConfiguration.getPathOrNull(DetectProperties.DETECT_DOCKER_INSPECTOR_PATH);
    String dockerPlatformTopLayerId = detectConfiguration.getNullableValue(DetectProperties.DETECT_DOCKER_PLATFORM_TOP_LAYER_ID);
    return new DockerDetectableOptions(dockerPathRequired, suppliedDockerImage, dockerImageId, suppliedDockerTar, dockerInspectorLoggingLevel, dockerInspectorVersion, additionalDockerProperties, dockerInspectorPath, dockerPlatformTopLayerId);
}
Also used : Path(java.nio.file.Path) LogLevel(com.synopsys.integration.log.LogLevel) DockerDetectableOptions(com.synopsys.integration.detectable.detectables.docker.DockerDetectableOptions)

Example 2 with DockerDetectableOptions

use of com.synopsys.integration.detectable.detectables.docker.DockerDetectableOptions in project synopsys-detect by blackducksoftware.

the class DockerDetectableTest method testApplicable.

@Test
public void testApplicable() {
    DetectableEnvironment environment = null;
    DockerInspectorResolver dockerInspectorResolver = null;
    JavaResolver javaResolver = null;
    DockerResolver dockerResolver = null;
    DockerExtractor dockerExtractor = null;
    DockerDetectableOptions dockerDetectableOptions = Mockito.mock(DockerDetectableOptions.class);
    Mockito.when(dockerDetectableOptions.hasDockerImageOrTar()).thenReturn(Boolean.TRUE);
    DockerDetectable detectable = new DockerDetectable(environment, dockerInspectorResolver, javaResolver, dockerResolver, dockerExtractor, dockerDetectableOptions);
    DetectableResult result = detectable.applicable();
    assertTrue(result.getPassed() || result instanceof WrongOperatingSystemResult);
}
Also used : JavaResolver(com.synopsys.integration.detectable.detectable.executable.resolver.JavaResolver) WrongOperatingSystemResult(com.synopsys.integration.detectable.detectable.result.WrongOperatingSystemResult) DockerDetectable(com.synopsys.integration.detectable.detectables.docker.DockerDetectable) DetectableResult(com.synopsys.integration.detectable.detectable.result.DetectableResult) DockerExtractor(com.synopsys.integration.detectable.detectables.docker.DockerExtractor) DetectableEnvironment(com.synopsys.integration.detectable.DetectableEnvironment) DockerInspectorResolver(com.synopsys.integration.detectable.detectables.docker.DockerInspectorResolver) DockerResolver(com.synopsys.integration.detectable.detectable.executable.resolver.DockerResolver) DockerDetectableOptions(com.synopsys.integration.detectable.detectables.docker.DockerDetectableOptions) Test(org.junit.jupiter.api.Test)

Aggregations

DockerDetectableOptions (com.synopsys.integration.detectable.detectables.docker.DockerDetectableOptions)2 DetectableEnvironment (com.synopsys.integration.detectable.DetectableEnvironment)1 DockerResolver (com.synopsys.integration.detectable.detectable.executable.resolver.DockerResolver)1 JavaResolver (com.synopsys.integration.detectable.detectable.executable.resolver.JavaResolver)1 DetectableResult (com.synopsys.integration.detectable.detectable.result.DetectableResult)1 WrongOperatingSystemResult (com.synopsys.integration.detectable.detectable.result.WrongOperatingSystemResult)1 DockerDetectable (com.synopsys.integration.detectable.detectables.docker.DockerDetectable)1 DockerExtractor (com.synopsys.integration.detectable.detectables.docker.DockerExtractor)1 DockerInspectorResolver (com.synopsys.integration.detectable.detectables.docker.DockerInspectorResolver)1 LogLevel (com.synopsys.integration.log.LogLevel)1 Path (java.nio.file.Path)1 Test (org.junit.jupiter.api.Test)1