@Test public void webscan_alloptions_json_has_webconfig_with_all_examples() throws Exception { String json = SharedKernelTestFileSupport.getTestfileSupport().loadTestFile("webscan/webscan_alloptions.json"); SecHubConfiguration result = SECHUB_CONFIG.fromJSON(json); Optional<SecHubWebScanConfiguration> webScanOption = result.getWebScan(); assertTrue("webscan config must be present", webScanOption.isPresent()); SecHubWebScanConfiguration secHubWebScanConfiguration = webScanOption.get(); Optional<WebLoginConfiguration> loginOption = secHubWebScanConfiguration.getLogin(); assertTrue("login config must be present", loginOption.isPresent()); WebLoginConfiguration loginConfiguration = loginOption.get(); assertEquals(new URL("https: Optional<BasicLoginConfiguration> basic = loginConfiguration.getBasic(); assertTrue("basic login config must be present", basic.isPresent()); assertEquals("realm0", basic.get().getRealm().get()); assertEquals("user0", new String(basic.get().getUser())); assertEquals("pwd0", new String(basic.get().getPassword())); Optional<FormLoginConfiguration> form = loginConfiguration.getForm(); assertTrue("form login config must be present", form.isPresent()); Optional<AutoDetectUserLoginConfiguration> autodetect = form.get().getAutodetect(); assertTrue("auto detect config must be present", autodetect.isPresent()); assertEquals("user1", new String(autodetect.get().getUser())); assertEquals("pwd1", new String(autodetect.get().getPassword())); Optional<List<ScriptEntry>> script = form.get().getScript(); assertTrue("script config must be present", script.isPresent()); List<ScriptEntry> entries = script.get(); assertEquals("Must have 3 script entries", 3,entries.size()); ScriptEntry entry1 = entries.get(0); ScriptEntry entry2 = entries.get(1); ScriptEntry entry3 = entries.get(2); assertEquals("input",entry1.getStep()); assertEquals("#example_login_userid",entry1.getSelector().get()); assertEquals("user2",entry1.getValue().get()); assertEquals("input",entry2.getStep()); assertEquals("#example_login_pwd",entry2.getSelector().get()); assertEquals("pwd2",entry2.getValue().get()); assertEquals("click",entry3.getStep()); assertEquals("#example_login_login_button",entry3.getSelector().get()); }
public Optional<SecHubWebScanConfiguration> getWebScan() { return webScan; }
SecHubConfiguration implements JSONable<SecHubConfiguration> { public Optional<SecHubWebScanConfiguration> getWebScan() { return webScan; } }
SecHubConfiguration implements JSONable<SecHubConfiguration> { public Optional<SecHubWebScanConfiguration> getWebScan() { return webScan; }  }
SecHubConfiguration implements JSONable<SecHubConfiguration> { public Optional<SecHubWebScanConfiguration> getWebScan() { return webScan; }  static SecHubConfiguration createFromJSON(String json); void setProjectId(String projectId); String getProjectId(); void setApiVersion(String apiVersion); String getApiVersion(); void setWebScan(SecHubWebScanConfiguration webScan); Optional<SecHubWebScanConfiguration> getWebScan(); void setCodeScan(SecHubCodeScanConfiguration codeScan); Optional<SecHubCodeScanConfiguration> getCodeScan(); void setInfraScan(SecHubInfrastructureScanConfiguration infraStructureScan); Optional<SecHubInfrastructureScanConfiguration> getInfraScan(); @Override Class<SecHubConfiguration> getJSONTargetClass(); }
SecHubConfiguration implements JSONable<SecHubConfiguration> { public Optional<SecHubWebScanConfiguration> getWebScan() { return webScan; }  static SecHubConfiguration createFromJSON(String json); void setProjectId(String projectId); String getProjectId(); void setApiVersion(String apiVersion); String getApiVersion(); void setWebScan(SecHubWebScanConfiguration webScan); Optional<SecHubWebScanConfiguration> getWebScan(); void setCodeScan(SecHubCodeScanConfiguration codeScan); Optional<SecHubCodeScanConfiguration> getCodeScan(); void setInfraScan(SecHubInfrastructureScanConfiguration infraStructureScan); Optional<SecHubInfrastructureScanConfiguration> getInfraScan(); @Override Class<SecHubConfiguration> getJSONTargetClass(); static final String PROPERTY_PROJECT_ID; static final String PROPERTY_API_VERSION; static final String PROPERTY_WEB_SCAN; static final String PROPERTY_INFRA_SCAN; static final String PROPERTY_CODE_SCAN; }