@Test public void presetId_found_name_by_provider_returns_preset_id_from_provider() { NamePatternIdprovider provider = mock(NamePatternIdprovider.class); when(provider.getIdForName("abc")).thenReturn("1234"); when(scanConfigService.getNamePatternIdProvider(MappingIdentifier.CHECKMARX_NEWPROJECT_PRESET_ID)).thenReturn(provider); Long result = setupImplToTest.getPresetIdForNewProjects("abc"); assertEquals(Long.valueOf(1234),result); }
@Override public Long getPresetIdForNewProjects(String projectId) { String id = scanConfigService.getNamePatternIdProvider(MappingIdentifier.CHECKMARX_NEWPROJECT_PRESET_ID).getIdForName(projectId); try { return Long.valueOf(id); }catch(NumberFormatException e) { LOG.error("Was not able to handle preset id for project {} will provide null instead",projectId); return null; } }
CheckmarxInstallSetupImpl extends AbstractInstallSetup implements CheckmarxInstallSetup { @Override public Long getPresetIdForNewProjects(String projectId) { String id = scanConfigService.getNamePatternIdProvider(MappingIdentifier.CHECKMARX_NEWPROJECT_PRESET_ID).getIdForName(projectId); try { return Long.valueOf(id); }catch(NumberFormatException e) { LOG.error("Was not able to handle preset id for project {} will provide null instead",projectId); return null; } } }
CheckmarxInstallSetupImpl extends AbstractInstallSetup implements CheckmarxInstallSetup { @Override public Long getPresetIdForNewProjects(String projectId) { String id = scanConfigService.getNamePatternIdProvider(MappingIdentifier.CHECKMARX_NEWPROJECT_PRESET_ID).getIdForName(projectId); try { return Long.valueOf(id); }catch(NumberFormatException e) { LOG.error("Was not able to handle preset id for project {} will provide null instead",projectId); return null; } }  }
CheckmarxInstallSetupImpl extends AbstractInstallSetup implements CheckmarxInstallSetup { @Override public Long getPresetIdForNewProjects(String projectId) { String id = scanConfigService.getNamePatternIdProvider(MappingIdentifier.CHECKMARX_NEWPROJECT_PRESET_ID).getIdForName(projectId); try { return Long.valueOf(id); }catch(NumberFormatException e) { LOG.error("Was not able to handle preset id for project {} will provide null instead",projectId); return null; } }  @Override String getBaseURL(); String getClientSecret(); @Override String getUserId(); @Override String getPassword(); String getTeamIdForNewProjects(String projectId); @Override Long getPresetIdForNewProjects(String projectId); @Override boolean isHavingUntrustedCertificate(); @Override final boolean isAbleToScan(TargetType type); @Override String getEngineConfigurationName(); }
CheckmarxInstallSetupImpl extends AbstractInstallSetup implements CheckmarxInstallSetup { @Override public Long getPresetIdForNewProjects(String projectId) { String id = scanConfigService.getNamePatternIdProvider(MappingIdentifier.CHECKMARX_NEWPROJECT_PRESET_ID).getIdForName(projectId); try { return Long.valueOf(id); }catch(NumberFormatException e) { LOG.error("Was not able to handle preset id for project {} will provide null instead",projectId); return null; } }  @Override String getBaseURL(); String getClientSecret(); @Override String getUserId(); @Override String getPassword(); String getTeamIdForNewProjects(String projectId); @Override Long getPresetIdForNewProjects(String projectId); @Override boolean isHavingUntrustedCertificate(); @Override final boolean isAbleToScan(TargetType type); @Override String getEngineConfigurationName(); @Value("${sechub.adapter.checkmarx.clientsecret:"+CheckmarxConfig.DEFAULT_CLIENT_SECRET+"}")
    @MustBeDocumented(value = "So called 'client secret' of checkmarx. At leat at the moment this ist just a fixed default value, available in documentation at https://checkmarx.atlassian.net/wiki/spaces/KC/pages/1187774721/Using+the+CxSAST+REST+API+v8.6.0+and+up", secret = false)
    private String clientSecret; }