use of com.mercedesbenz.sechub.integrationtest.api.WithSecHubClient in project sechub by mercedes-benz.
the class DeveloperAdministration method withSecHubClientOnDefinedBinPath.
public WithSecHubClient withSecHubClientOnDefinedBinPath() {
WithSecHubClient withSechubClient = createAsUserTestObject().withSecHubClient();
String pathToBinaryparentFolder = ConfigurationSetup.SECHUB_PATH_TO_SECHUB_CLIENT_BINARY.getStringValue(null, false);
withSechubClient.fromPath(pathToBinaryparentFolder);
if (ConfigurationSetup.isTrustAllDenied()) {
withSechubClient.denyTrustAll();
}
return withSechubClient;
}
use of com.mercedesbenz.sechub.integrationtest.api.WithSecHubClient in project sechub by mercedes-benz.
the class TriggerSecHubClientSynchronousScanAction method execute.
@Override
public void execute(ActionEvent event) throws Exception {
/* @formatter:off */
Optional<String> optionalProject = getUserInput("Please enter project id (or cancel to leave empty)", InputCacheIdentifier.PROJECT_ID);
Optional<String> optionalPath = getUserInput("Please enter target folder for sechub scan:\n\n" + (optionalProject.isPresent() ? "" : "WARN: You didn't define a project. So this folder must contain a sechub.json having projectId defined inside to work!)") + "\nServer, user and apitoken are used by DAUI setup!\n" + "INFO: You can set a a default by system property:\n" + ConfigurationSetup.SECHUB_TARGETFOLDER_FOR_SECHUB_CLIENT_SCAN.getSystemPropertyid(), InputCacheIdentifier.CLIENT_SCAN_TARGETFOLDER);
/* @formatter:on */
if (!optionalPath.isPresent()) {
return;
}
String path = optionalPath.get();
File file = new File(path);
if (!file.exists()) {
warn("File:" + file.getAbsolutePath() + " does not exist!");
return;
}
WithSecHubClient withClient = getContext().getAdministration().withSecHubClientOnDefinedBinPath();
Map<String, String> environmentVariables = new HashMap<>();
ExecutionResult result = withClient.startSynchronScanFor(optionalProject.isPresent() ? new TestProject(optionalProject.get()) : null, environmentVariables, file, ApiTokenStrategy.HIDEN_BY_ENV, ClientWaitMode.WAIT_WITH_ENV_SETTINGS);
output("synchronous scan done");
output("RESULT:");
output("- exitcode:" + result.getExitCode());
output("- sechub job UUID:" + result.getSechubJobUUID());
output("- traffic light:" + result.getTrafficLight());
output("- last outputline:" + result.getLastOutputLine());
output("- report file location:" + result.getJSONReportFile());
}
Aggregations