Search in sources :

Example 11 with ImportParameter

use of com.mercedesbenz.sechub.sereco.ImportParameter in project sechub by mercedes-benz.

the class ImportSupportTest method an_empty_product_result_can_never_be_imported.

/**
 * This test is import for failure handling. When a product is not reachable its
 * result will be an empty string, which shall lead to a critical finding about
 * product problems.
 */
@Test
public void an_empty_product_result_can_never_be_imported() {
    /* @formatter:off */
    ImportParameter importParameter = ImportParameter.builder().importId("id1").importData("").productId("productId").build();
    /* @formatter:on */
    assertEquals(ProductImportAbility.PRODUCT_FAILED, ImportSupport.builder().build().isAbleToImport(importParameter));
}
Also used : ImportParameter(com.mercedesbenz.sechub.sereco.ImportParameter) Test(org.junit.Test)

Example 12 with ImportParameter

use of com.mercedesbenz.sechub.sereco.ImportParameter in project sechub by mercedes-benz.

the class NessusV1XMLImporterTest method xmlReportFromNessus7canBeImported.

@Test
public void xmlReportFromNessus7canBeImported() {
    /* prepare */
    String xml = SerecoTestFileSupport.INSTANCE.loadTestFile("nessus/nessus_7.0.2.result.xml");
    ImportParameter param = ImportParameter.builder().importData(xml).importId("id1").productId("Nessus").build();
    /* execute */
    ProductImportAbility ableToImport = importerToTest.isAbleToImportForProduct(param);
    /* test */
    assertEquals("Was not able to import xml!", ProductImportAbility.ABLE_TO_IMPORT, ableToImport);
}
Also used : ImportParameter(com.mercedesbenz.sechub.sereco.ImportParameter) Test(org.junit.Test)

Example 13 with ImportParameter

use of com.mercedesbenz.sechub.sereco.ImportParameter in project sechub by mercedes-benz.

the class NetsparkerV1XMLImporterTest method test_xml_import_netsparker_1_9_1_977_can_be_imported.

@Test
public void test_xml_import_netsparker_1_9_1_977_can_be_imported() throws Exception {
    /* prepare */
    String xml = SerecoTestFileSupport.INSTANCE.loadTestFile(SerecoTestFileSupport.NETSPARKER_V1_9_1_977_XML_TESTFILE);
    ImportParameter param = ImportParameter.builder().importData(xml).importId("id1").productId("Netsparker").build();
    /* execute */
    ProductImportAbility ableToImport = importerToTest.isAbleToImportForProduct(param);
    /* test */
    assertEquals("Was not able to import xml!", ProductImportAbility.ABLE_TO_IMPORT, ableToImport);
}
Also used : ImportParameter(com.mercedesbenz.sechub.sereco.ImportParameter) Test(org.junit.Test)

Example 14 with ImportParameter

use of com.mercedesbenz.sechub.sereco.ImportParameter in project sechub by mercedes-benz.

the class SarifV1JSONImporterTest method threadflow_sarif_report_can_be_imported.

@Test
void threadflow_sarif_report_can_be_imported() {
    /* prepare */
    ImportParameter paramThreadFlows = ImportParameter.builder().importData(sarif_2_1_0_pythonscanner_thread_flows).importId("id1").productId("PDS_CODESCAN").build();
    /* execute */
    ProductImportAbility ableToImportThreadFlowSarif = importerToTest.isAbleToImportForProduct(paramThreadFlows);
    /* test */
    assertEquals(ProductImportAbility.ABLE_TO_IMPORT, ableToImportThreadFlowSarif, "Was NOT able to import sarif!");
}
Also used : ImportParameter(com.mercedesbenz.sechub.sereco.ImportParameter) Test(org.junit.jupiter.api.Test)

Example 15 with ImportParameter

use of com.mercedesbenz.sechub.sereco.ImportParameter in project sechub by mercedes-benz.

the class SarifV1JSONImporterTest method empty_json__can_NOT_be_imported.

@Test
void empty_json__can_NOT_be_imported() {
    /* prepare */
    ImportParameter emptyJSONImportParam = ImportParameter.builder().importData("{}").importId("id1").productId("PDS_CODESCAN").build();
    /* execute */
    ProductImportAbility importAbility = importerToTest.isAbleToImportForProduct(emptyJSONImportParam);
    /* test */
    assertEquals(ProductImportAbility.NOT_ABLE_TO_IMPORT, importAbility, "Not the expected ability!");
}
Also used : ImportParameter(com.mercedesbenz.sechub.sereco.ImportParameter) Test(org.junit.jupiter.api.Test)

Aggregations

ImportParameter (com.mercedesbenz.sechub.sereco.ImportParameter)15 Test (org.junit.Test)10 Test (org.junit.jupiter.api.Test)5 SerecoMetaData (com.mercedesbenz.sechub.sereco.metadata.SerecoMetaData)2 SerecoVulnerability (com.mercedesbenz.sechub.sereco.metadata.SerecoVulnerability)2