use of com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult in project sechub by mercedes-benz.
the class TriggerNewInfraScanJobScenario3User1Action method executeImplAfterRestHelperSwitched.
@Override
protected void executeImplAfterRestHelperSwitched(ActionEvent e) {
ExecutionResult result = TestAPI.as(Scenario3.USER_1).withSecHubClient().createInfraScanAndFetchScanData(Scenario3.PROJECT_1);
outputAsTextOnSuccess("Job executed, data fetched, last output line:" + result.getLastOutputLine());
outputAsTextOnSuccess("Job UID was:" + result.getSechubJobUUID());
}
use of com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult 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());
}
use of com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult in project sechub by mercedes-benz.
the class ProductExecutorConfigurationScenario8IntTest method one_profile_with_two_configs_for_same_product_result_in_scanlog_with_separated_metadata_and_result_entries.
@Test
public void one_profile_with_two_configs_for_same_product_result_in_scanlog_with_separated_metadata_and_result_entries() {
/* prepare */
// info: we use NETSPARKER here, because our standard results for a web scan in
// mocked
// product results for web scans is currently always NETSPARKER
UUID config1UUID = createExecutorConfig(TestExecutorProductIdentifier.NETSPARKER, "exec-config-1");
UUID config2UUID = createExecutorConfig(TestExecutorProductIdentifier.NETSPARKER, "exec-config-2");
String profileId = "profile1";
createOrResetProfile(profileId);
/* @formatter:off */
as(SUPER_ADMIN).addConfigurationToProfile(profileId, config1UUID, config2UUID).addProjectsToProfile(profileId, PROJECT_1);
/* execute */
ExecutionResult result = as(USER_1).createWebScanAndFetchScanData(PROJECT_1);
/* test */
File zipfile = as(SUPER_ADMIN).downloadFullScanDataFor(result.getSechubJobUUID());
AssertFullScanData assertFullScanDataZipFile = assertFullScanDataZipFile(zipfile);
assertFullScanDataZipFile.dumpDownloadFilePath().containsFile(// fallback means no config, so no postfix
"SERECO.json").containsFile(// fallback means no config, so no postfix
"metadata_SERECO.json").containsFile("NETSPARKER_" + config1UUID + ".xml").containsFile("metadata_NETSPARKER_" + config1UUID + ".json").containsFile("NETSPARKER_" + config2UUID + ".xml").containsFile("metadata_NETSPARKER_" + config2UUID + ".json").containsFileStartingWith("log_").containsFiles(7);
AdapterMetaData metaData1 = assertFullScanDataZipFile.resolveFile("metadata_NETSPARKER_" + config1UUID + ".json").asAdapterMetaData();
assertEquals("+1+1", metaData1.getValue(AbstractMockedAdapter.KEY_METADATA_REUSED));
AdapterMetaData metaData2 = assertFullScanDataZipFile.resolveFile("metadata_NETSPARKER_" + config2UUID + ".json").asAdapterMetaData();
assertEquals("+1+1", metaData2.getValue(AbstractMockedAdapter.KEY_METADATA_REUSED));
/* @formatter:on */
}
use of com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult in project sechub by mercedes-benz.
the class ProductExecutorConfigurationScenario8IntTest method two_profiles_with_two_configs_for_same_product_result_in_scanlog_with_separeted_metadata_and_result_entries.
@Test
public void two_profiles_with_two_configs_for_same_product_result_in_scanlog_with_separeted_metadata_and_result_entries() {
/* prepare */
// info: we use NETSPARKER here, because our standard results for a web scan in
// mocked
// product results for web scans is currently always NETSPARKER
UUID config1UUID = createExecutorConfig(TestExecutorProductIdentifier.NETSPARKER, "exec-config-1");
UUID config2UUID = createExecutorConfig(TestExecutorProductIdentifier.NETSPARKER, "exec-config-2");
String profileId1 = "profile1";
createOrResetProfile(profileId1);
/* @formatter:off */
as(SUPER_ADMIN).addConfigurationToProfile(profileId1, config1UUID).addProjectsToProfile(profileId1, PROJECT_1);
String profileId2 = "profile2";
createOrResetProfile(profileId2);
as(SUPER_ADMIN).addConfigurationToProfile(profileId1, config2UUID).addProjectsToProfile(profileId1, PROJECT_1);
/* execute */
ExecutionResult result = as(USER_1).createWebScanAndFetchScanData(PROJECT_1);
/* test */
File zipfile = as(SUPER_ADMIN).downloadFullScanDataFor(result.getSechubJobUUID());
AssertFullScanData assertFullScanDataZipFile = assertFullScanDataZipFile(zipfile);
assertFullScanDataZipFile.dumpDownloadFilePath().containsFile(// fallback means no config, so no postfix
"SERECO.json").containsFile(// fallback means no config, so no postfix
"metadata_SERECO.json").containsFile("NETSPARKER_" + config1UUID + ".xml").containsFile("metadata_NETSPARKER_" + config1UUID + ".json").containsFile("NETSPARKER_" + config2UUID + ".xml").containsFile("metadata_NETSPARKER_" + config2UUID + ".json").containsFileStartingWith("log_").containsFiles(7);
/* check adapter persistence of reused meta data not more than two times called */
AdapterMetaData metaData1 = assertFullScanDataZipFile.resolveFile("metadata_NETSPARKER_" + config1UUID + ".json").asAdapterMetaData();
assertEquals("+1+1", metaData1.getValue(AbstractMockedAdapter.KEY_METADATA_REUSED));
AdapterMetaData metaData2 = assertFullScanDataZipFile.resolveFile("metadata_NETSPARKER_" + config2UUID + ".json").asAdapterMetaData();
assertEquals("+1+1", metaData2.getValue(AbstractMockedAdapter.KEY_METADATA_REUSED));
/* @formatter:on */
}
use of com.mercedesbenz.sechub.integrationtest.internal.SecHubClientExecutor.ExecutionResult in project sechub by mercedes-benz.
the class ProductExecutorConfigurationScenario8IntTest method two_profiles_with_same_config_inside_for_same_product_result_in_scanlog_with_one_metadata_and_result_entry_for_product.
@Test
public void two_profiles_with_same_config_inside_for_same_product_result_in_scanlog_with_one_metadata_and_result_entry_for_product() {
/* prepare */
// info: we use NETSPARKER here, because our standard results for a web scan in
// mocked
// product results for web scans is currently always NETSPARKER
UUID config1UUID = createExecutorConfig(TestExecutorProductIdentifier.NETSPARKER, "exec-config-1");
/* @formatter:off */
String profileId1 = "profile1";
createOrResetProfile(profileId1);
as(SUPER_ADMIN).addConfigurationToProfile(profileId1, config1UUID).addProjectsToProfile(profileId1, PROJECT_1);
String profileId2 = "profile2";
createOrResetProfile(profileId2);
as(SUPER_ADMIN).addConfigurationToProfile(profileId2, config1UUID).addProjectsToProfile(profileId2, PROJECT_1);
/* execute */
ExecutionResult result = as(USER_1).createWebScanAndFetchScanData(PROJECT_1);
/* test */
File zipfile = as(SUPER_ADMIN).downloadFullScanDataFor(result.getSechubJobUUID());
AssertFullScanData assertFullScanDataZipFile = assertFullScanDataZipFile(zipfile);
assertFullScanDataZipFile.dumpDownloadFilePath().containsFile(// fallback means no config, so no postfix
"SERECO.json").containsFile(// fallback means no config, so no postfix
"metadata_SERECO.json").containsFile("NETSPARKER_" + config1UUID + ".xml").containsFile("metadata_NETSPARKER_" + config1UUID + ".json").containsFileStartingWith("log_").containsFiles(5);
/* check adapter persistence of reused meta data not more than two times called */
AdapterMetaData metaData = assertFullScanDataZipFile.resolveFile("metadata_NETSPARKER_" + config1UUID + ".json").asAdapterMetaData();
assertEquals("+1+1", metaData.getValue(AbstractMockedAdapter.KEY_METADATA_REUSED));
/* @formatter:on */
}
Aggregations