use of com.synopsys.integration.blackduck.codelocation.signaturescanner.command.ScanPaths in project blackduck-common by blackducksoftware.
the class ScannerZipInstallerTest method testActualDownload.
@Test
void testActualDownload() throws Exception {
String signatureScannerDownloadPath = TestingPropertyKey.TEST_BLACKDUCK_SIGNATURE_SCANNER_DOWNLOAD_PATH.fromEnvironment();
String blackDuckUrl = TestingPropertyKey.TEST_BLACK_DUCK_SERVER_URL.fromEnvironment();
String blackDuckUsername = TestingPropertyKey.TEST_USERNAME.fromEnvironment();
String blackDuckPassword = TestingPropertyKey.TEST_PASSWORD.fromEnvironment();
assertTrue(StringUtils.isNotBlank(signatureScannerDownloadPath));
IntLogger logger = new BufferedIntLogger();
BlackDuckServerConfigBuilder blackDuckServerConfigBuilder = BlackDuckServerConfig.newCredentialsBuilder();
blackDuckServerConfigBuilder.setUrl(blackDuckUrl);
blackDuckServerConfigBuilder.setUsername(blackDuckUsername);
blackDuckServerConfigBuilder.setPassword(blackDuckPassword);
blackDuckServerConfigBuilder.setTimeoutInSeconds(120);
blackDuckServerConfigBuilder.setTrustCert(true);
blackDuckServerConfigBuilder.setLogger(logger);
BlackDuckServerConfig blackDuckServerConfig = blackDuckServerConfigBuilder.build();
BlackDuckHttpClient blackDuckHttpClient = blackDuckServerConfig.createBlackDuckHttpClient(logger);
BlackDuckServicesFactory blackDuckServicesFactory = blackDuckServerConfig.createBlackDuckServicesFactory(blackDuckHttpClient, logger);
BlackDuckRegistrationService blackDuckRegistrationService = blackDuckServicesFactory.createBlackDuckRegistrationService();
OperatingSystemType operatingSystemType = OperatingSystemType.determineFromSystem();
ScanPathsUtility scanPathsUtility = new ScanPathsUtility(logger, IntEnvironmentVariables.includeSystemEnv(), operatingSystemType);
CleanupZipExpander cleanupZipExpander = new CleanupZipExpander(logger);
KeyStoreHelper keyStoreHelper = new KeyStoreHelper(logger);
File downloadTarget = new File(signatureScannerDownloadPath);
ScannerZipInstaller scannerZipInstaller = new ScannerZipInstaller(logger, new SignatureScannerClient(blackDuckHttpClient), blackDuckRegistrationService, cleanupZipExpander, scanPathsUtility, keyStoreHelper, new HttpUrl(blackDuckUrl), operatingSystemType, downloadTarget);
scannerZipInstaller.installOrUpdateScanner();
ScanPaths scanPaths = scanPathsUtility.searchForScanPaths(downloadTarget);
assertTrue(scanPaths.isManagedByLibrary());
assertTrue(StringUtils.isNotBlank(scanPaths.getPathToJavaExecutable()));
assertTrue(StringUtils.isNotBlank(scanPaths.getPathToOneJar()));
assertTrue(StringUtils.isNotBlank(scanPaths.getPathToScanExecutable()));
assertTrue(new File(scanPaths.getPathToJavaExecutable()).canExecute());
assertTrue(new File(scanPaths.getPathToOneJar()).canExecute());
assertTrue(new File(scanPaths.getPathToScanExecutable()).canExecute());
}
use of com.synopsys.integration.blackduck.codelocation.signaturescanner.command.ScanPaths in project blackduck-common by blackducksoftware.
the class ScanPathsTest method testJavaExecutablePathWithPackagedJre.
@Test
public void testJavaExecutablePathWithPackagedJre() throws Exception {
intEnvironmentVariables.put(BDS_JAVA_HOME, null);
ScanPaths macScanPaths = macScanPathsUtility.searchForScanPaths(macSetup);
ScanPaths windowsScanPaths = windowsScanPathsUtility.searchForScanPaths(windowsSetup);
ScanPaths linuxScanPaths = linuxScanPathsUtility.searchForScanPaths(linuxSetup);
assertThat(macScanPaths.getPathToJavaExecutable(), startsWith(tempDirectory + File.separator + "mac_setup" + File.separator + getScannerPath()));
assertThat(windowsScanPaths.getPathToJavaExecutable(), startsWith(tempDirectory + File.separator + "windows_setup" + File.separator + getScannerPath()));
assertThat(linuxScanPaths.getPathToJavaExecutable(), startsWith(tempDirectory + File.separator + "linux_setup" + File.separator + getScannerPath()));
}
use of com.synopsys.integration.blackduck.codelocation.signaturescanner.command.ScanPaths in project blackduck-common by blackducksoftware.
the class ScanPathsTest method testSignatureScannerPathsInstalledByThem.
@Test
public void testSignatureScannerPathsInstalledByThem() throws Exception {
ScanPaths macScanPaths = macScanPathsUtility.searchForScanPaths(new File(macSetup, getScannerPath()));
ScanPaths windowsScanPaths = windowsScanPathsUtility.searchForScanPaths(new File(windowsSetup, getScannerPath()));
ScanPaths linuxScanPaths = linuxScanPathsUtility.searchForScanPaths(new File(linuxSetup, getScannerPath()));
assertScanPathsOk(macScanPaths, false);
assertScanPathsOk(windowsScanPaths, false);
assertScanPathsOk(linuxScanPaths, false);
}
use of com.synopsys.integration.blackduck.codelocation.signaturescanner.command.ScanPaths in project blackduck-common by blackducksoftware.
the class ScanPathsTest method testJavaExecutablePathWithBdsJavaHome.
@Test
public void testJavaExecutablePathWithBdsJavaHome() throws Exception {
intEnvironmentVariables.put(BDS_JAVA_HOME, bdsJavaHomeDirectory.getAbsolutePath());
ScanPaths macScanPaths = macScanPathsUtility.searchForScanPaths(macSetup);
ScanPaths windowsScanPaths = windowsScanPathsUtility.searchForScanPaths(windowsSetup);
ScanPaths linuxScanPaths = linuxScanPathsUtility.searchForScanPaths(linuxSetup);
assertThat(macScanPaths.getPathToJavaExecutable(), is(bdsJavaHomeDirectory + File.separator + "bin" + File.separator + "java"));
assertThat(windowsScanPaths.getPathToJavaExecutable(), is(bdsJavaHomeDirectory + File.separator + "bin" + File.separator + "java.exe"));
assertThat(linuxScanPaths.getPathToJavaExecutable(), is(bdsJavaHomeDirectory + File.separator + "bin" + File.separator + "java"));
}
use of com.synopsys.integration.blackduck.codelocation.signaturescanner.command.ScanPaths in project blackduck-common by blackducksoftware.
the class ScanPathsTest method testSignatureScannerPathsInstalledByUs.
@Test
public void testSignatureScannerPathsInstalledByUs() throws Exception {
ScanPaths macScanPaths = macScanPathsUtility.searchForScanPaths(macSetup);
ScanPaths windowsScanPaths = windowsScanPathsUtility.searchForScanPaths(windowsSetup);
ScanPaths linuxScanPaths = linuxScanPathsUtility.searchForScanPaths(linuxSetup);
assertScanPathsOk(macScanPaths, true);
assertScanPathsOk(windowsScanPaths, true);
assertScanPathsOk(linuxScanPaths, true);
}
Aggregations