use of com.mercedesbenz.sechub.adapter.checkmarx.CheckmarxConfig.CheckmarxConfigBuilder in project sechub by mercedes-benz.
the class CheckmarxProjectSupportTest method updatePresetIdWhenSetInAdapterConfig_preset_id_set_in_sechub.
@Test
public void updatePresetIdWhenSetInAdapterConfig_preset_id_set_in_sechub() {
/* prepare */
long secHubPresetId = 39203;
long checkmarxPresetId = 1;
CheckmarxConfigBuilder builder = createBuilderWithMandatoryParamatersSet();
builder.setPresetIdForNewProjects(secHubPresetId);
CheckmarxConfig config = builder.build();
CheckmarxSastScanSettings checkmarxScanSettings = new CheckmarxSastScanSettings();
checkmarxScanSettings.setPresetId(checkmarxPresetId);
InternalUpdateContext updateContext = supportToTest.new InternalUpdateContext();
/* execute */
supportToTest.updatePresetIdWhenSetInAdapterConfig(config, checkmarxScanSettings, updateContext);
/* test */
assertThat(updateContext.isUpdateOfPresetIdNecessary(), is(true));
assertThat(updateContext.getPresetId(), is(secHubPresetId));
assertThat(updateContext.isUpdateNecessary(), is(true));
}
use of com.mercedesbenz.sechub.adapter.checkmarx.CheckmarxConfig.CheckmarxConfigBuilder in project sechub by mercedes-benz.
the class CheckmarxProjectSupportTest method updatePresetIdWhenSetInAdapterConfig_presetId_sechub_not_set__no_update_necessary.
@Test
public void updatePresetIdWhenSetInAdapterConfig_presetId_sechub_not_set__no_update_necessary() {
/* prepare */
long presetId = 443940;
CheckmarxConfigBuilder builder = createBuilderWithMandatoryParamatersSet();
builder.setPresetIdForNewProjects(null);
CheckmarxConfig config = builder.build();
CheckmarxSastScanSettings checkmarxScanSettings = new CheckmarxSastScanSettings();
checkmarxScanSettings.setPresetId(presetId);
InternalUpdateContext updateContext = supportToTest.new InternalUpdateContext();
/* execute */
supportToTest.updatePresetIdWhenSetInAdapterConfig(config, checkmarxScanSettings, updateContext);
/* test */
assertThat(updateContext.isUpdateOfPresetIdNecessary(), is(false));
assertThat(updateContext.getPresetId(), is(presetId));
assertThat(updateContext.isUpdateNecessary(), is(false));
}
use of com.mercedesbenz.sechub.adapter.checkmarx.CheckmarxConfig.CheckmarxConfigBuilder in project sechub by mercedes-benz.
the class CheckmarxConfigTest method builder_creates_config_with_engine_configuration_name_set.
@Test
public void builder_creates_config_with_engine_configuration_name_set() {
/* prepare */
String engineConfigurationName = "test-configuration";
CheckmarxConfigBuilder builder = createBuilderWithMandatoryParamatersSet();
builder.setEngineConfigurationName(engineConfigurationName);
/* execute */
CheckmarxConfig config = builder.build();
/* test */
assertEquals(engineConfigurationName, config.getEngineConfigurationName());
}
use of com.mercedesbenz.sechub.adapter.checkmarx.CheckmarxConfig.CheckmarxConfigBuilder in project sechub by mercedes-benz.
the class CheckmarxConfigTest method createBuilderWithMandatoryParamatersSet.
private CheckmarxConfigBuilder createBuilderWithMandatoryParamatersSet() {
CheckmarxConfigBuilder builder = CheckmarxConfig.builder();
builder.setUser("testuserId");
builder.setPasswordOrAPIToken("testapitoken");
builder.setProjectId("testprojectid");
builder.setTeamIdForNewProjects("testteamid");
return builder;
}
use of com.mercedesbenz.sechub.adapter.checkmarx.CheckmarxConfig.CheckmarxConfigBuilder in project sechub by mercedes-benz.
the class CheckmarxConfigTest method builder_creates_config_with_default_engine_configuration_name.
@Test
public void builder_creates_config_with_default_engine_configuration_name() {
/* prepare */
CheckmarxConfigBuilder builder = createBuilderWithMandatoryParamatersSet();
/* execute */
CheckmarxConfig config = builder.build();
/* test */
assertEquals(CheckmarxConstants.DEFAULT_CHECKMARX_ENGINECONFIGURATION_MULTILANGANGE_SCAN_NAME, config.getEngineConfigurationName());
}
Aggregations