Search in sources :

Example 1 with ProgramPaths

use of com.synopsys.integration.blackduck.dockerinspector.config.ProgramPaths in project blackduck-docker-inspector by blackducksoftware.

the class DockerClientManagerTest method setUp.

@BeforeAll
public static void setUp() {
    Logger rootLogger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
    rootLogger.setLevel(Level.INFO);
    Logger integrationLogger = (Logger) LoggerFactory.getLogger("com.synopsys.integration");
    integrationLogger.setLevel(Level.DEBUG);
    config = Mockito.mock(Config.class);
    programPaths = Mockito.mock(ProgramPaths.class);
    FileOperations fileOperations = new FileOperations();
    dockerClientManager = new DockerClientManager(fileOperations, new ImageNameResolver(), config, new ImageTarFilename(), programPaths);
}
Also used : ImageTarFilename(com.synopsys.integration.blackduck.dockerinspector.output.ImageTarFilename) Config(com.synopsys.integration.blackduck.dockerinspector.config.Config) ImageNameResolver(com.synopsys.integration.blackduck.imageinspector.api.name.ImageNameResolver) FileOperations(com.synopsys.integration.blackduck.imageinspector.linux.FileOperations) ProgramPaths(com.synopsys.integration.blackduck.dockerinspector.config.ProgramPaths) Logger(ch.qos.logback.classic.Logger) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 2 with ProgramPaths

use of com.synopsys.integration.blackduck.dockerinspector.config.ProgramPaths in project blackduck-docker-inspector by blackducksoftware.

the class ContainerPathsTest method doTest.

private void doTest(String sharedDirPathLocal, String sharedDirPathContainer, String targetFilePathLocal) throws IOException {
    Config config = Mockito.mock(Config.class);
    Mockito.when(config.getSharedDirPathLocal()).thenReturn(sharedDirPathLocal);
    Mockito.when(config.getSharedDirPathImageInspector()).thenReturn(sharedDirPathContainer);
    Mockito.when(config.getWorkingDirPath()).thenReturn(sharedDirPathLocal);
    ProcessId processId = Mockito.mock(ProcessId.class);
    Mockito.when(processId.addProcessIdToName("run")).thenReturn("run_1");
    ProgramPaths programPaths = new ProgramPaths(config, processId);
    ContainerPaths containerPaths = new ContainerPaths(config, programPaths);
    String containerPathToTargetFile = containerPaths.getContainerPathToTargetFile(targetFilePathLocal);
    assertEquals(CONTAINER_PATH_TO_TARGET_FILE, containerPathToTargetFile);
    String containerPathToOutputFile = containerPaths.getContainerPathToOutputFile("test_out.tar");
    assertEquals(CONTAINER_PATH_TO_OUTPUT_FILE, containerPathToOutputFile);
}
Also used : Config(com.synopsys.integration.blackduck.dockerinspector.config.Config) ProgramPaths(com.synopsys.integration.blackduck.dockerinspector.config.ProgramPaths) ProcessId(com.synopsys.integration.blackduck.dockerinspector.ProcessId)

Example 3 with ProgramPaths

use of com.synopsys.integration.blackduck.dockerinspector.config.ProgramPaths in project blackduck-docker-inspector by blackducksoftware.

the class ProgramPathsTest method setup.

@BeforeClass
public static void setup() throws IOException {
    config = Mockito.mock(Config.class);
    processId = Mockito.mock(ProcessId.class);
    Mockito.when(processId.addProcessIdToName(Mockito.anyString())).thenReturn("run_1");
    final File installDir = TestUtils.createTempDirectory();
    installDirPath = installDir.getAbsolutePath();
    Mockito.when(config.getWorkingDirPath()).thenReturn(installDirPath);
    Mockito.when(processId.addProcessIdToName(Mockito.anyString())).thenReturn("test");
    programPaths = new ProgramPaths(config, processId);
}
Also used : Config(com.synopsys.integration.blackduck.dockerinspector.config.Config) ProgramPaths(com.synopsys.integration.blackduck.dockerinspector.config.ProgramPaths) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 4 with ProgramPaths

use of com.synopsys.integration.blackduck.dockerinspector.config.ProgramPaths in project blackduck-docker-inspector by blackducksoftware.

the class SquashedImageTest method setUp.

@BeforeAll
static void setUp() throws IOException {
    Logger rootLogger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
    rootLogger.setLevel(Level.INFO);
    Logger integrationLogger = (Logger) LoggerFactory.getLogger("com.synopsys.integration");
    integrationLogger.setLevel(Level.DEBUG);
    testWorkingDir = new File("test/output/squashingTest");
    ImageTarFilename imageTarFilename = new ImageTarFilename();
    FileOperations fileOperations = new FileOperations();
    Config config = Mockito.mock(Config.class);
    Mockito.when(config.getWorkingDirPath()).thenReturn(testWorkingDir.getCanonicalPath());
    ProgramPaths programPaths = new ProgramPaths(config, new ProcessId());
    dockerClientManager = new DockerClientManager(fileOperations, new ImageNameResolver(), config, imageTarFilename, programPaths);
    squashedImage = new SquashedImage();
    squashedImage.setDockerClientManager(dockerClientManager);
    squashedImage.setFileOperations(new FileOperations());
}
Also used : Config(com.synopsys.integration.blackduck.dockerinspector.config.Config) DockerClientManager(com.synopsys.integration.blackduck.dockerinspector.dockerclient.DockerClientManager) ImageNameResolver(com.synopsys.integration.blackduck.imageinspector.api.name.ImageNameResolver) FileOperations(com.synopsys.integration.blackduck.imageinspector.linux.FileOperations) ProgramPaths(com.synopsys.integration.blackduck.dockerinspector.config.ProgramPaths) ProcessId(com.synopsys.integration.blackduck.dockerinspector.ProcessId) Logger(ch.qos.logback.classic.Logger) File(java.io.File) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

Config (com.synopsys.integration.blackduck.dockerinspector.config.Config)4 ProgramPaths (com.synopsys.integration.blackduck.dockerinspector.config.ProgramPaths)4 Logger (ch.qos.logback.classic.Logger)2 ProcessId (com.synopsys.integration.blackduck.dockerinspector.ProcessId)2 ImageNameResolver (com.synopsys.integration.blackduck.imageinspector.api.name.ImageNameResolver)2 FileOperations (com.synopsys.integration.blackduck.imageinspector.linux.FileOperations)2 File (java.io.File)2 BeforeAll (org.junit.jupiter.api.BeforeAll)2 DockerClientManager (com.synopsys.integration.blackduck.dockerinspector.dockerclient.DockerClientManager)1 ImageTarFilename (com.synopsys.integration.blackduck.dockerinspector.output.ImageTarFilename)1 BeforeClass (org.junit.BeforeClass)1