Search in sources :

Example 1 with ImportParameter

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

the class CheckmarxV1XMLImporterTest method emptyXMLcanNotBeImported.

@Test
public void emptyXMLcanNotBeImported() {
    /* prepare */
    String xml = "<?xml version='1.0'?>";
    ImportParameter param = ImportParameter.builder().importData(xml).importId("id1").productId("Checkmarx").build();
    /* execute */
    ProductImportAbility ableToImport = importerToTest.isAbleToImportForProduct(param);
    /* test */
    assertEquals("Was able to import xml!", ProductImportAbility.NOT_ABLE_TO_IMPORT, ableToImport);
}
Also used : ImportParameter(com.mercedesbenz.sechub.sereco.ImportParameter) Test(org.junit.Test)

Example 2 with ImportParameter

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

the class CheckmarxV1XMLImporterTest method xmlReportFromCheckmarxV8canBeImported.

@Test
public void xmlReportFromCheckmarxV8canBeImported() {
    /* prepare */
    String xml = SerecoTestFileSupport.INSTANCE.loadTestFile("checkmarx/sechub-continous-integration.xml");
    ImportParameter param = ImportParameter.builder().importData(xml).importId("id1").productId("Checkmarx").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 3 with ImportParameter

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

the class NetsparkerV1XMLImporterTest method xmlReportFromNetsparkerCanBeImported.

@Test
public void xmlReportFromNetsparkerCanBeImported() {
    /* prepare */
    String xml = SerecoTestFileSupport.INSTANCE.loadTestFile("netsparker/netsparker_v1.0.40.109_scan_result_output_vulnerabilities.xml");
    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 4 with ImportParameter

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

the class ProductFailureMetaDataBuilderTest method creates_a_meta_model_with_product_information_nothing_set_will_at_least_work.

@Test
public void creates_a_meta_model_with_product_information_nothing_set_will_at_least_work() {
    /* prepare */
    ImportParameter param = ImportParameter.builder().build();
    /* execute */
    SerecoMetaData result = builderToTest.forParam(param).build();
    /* test */
    assertNotNull(result);
    List<SerecoVulnerability> vulnerabilities = result.getVulnerabilities();
    assertNotNull(vulnerabilities);
    assertEquals(1, vulnerabilities.size());
    SerecoVulnerability v = vulnerabilities.iterator().next();
    assertEquals(SerecoSeverity.CRITICAL, v.getSeverity());
    assertEquals("SecHub failure", v.getType());
    assertEquals("Security product 'null' failed, so cannot give a correct answer.", v.getDescription());
}
Also used : SerecoVulnerability(com.mercedesbenz.sechub.sereco.metadata.SerecoVulnerability) SerecoMetaData(com.mercedesbenz.sechub.sereco.metadata.SerecoMetaData) ImportParameter(com.mercedesbenz.sechub.sereco.ImportParameter) Test(org.junit.Test)

Example 5 with ImportParameter

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

the class ProductFailureMetaDataBuilderTest method creates_a_meta_model_with_product_information.

@Test
public void creates_a_meta_model_with_product_information() {
    /* prepare */
    ImportParameter param = ImportParameter.builder().importId("id1").productId("productId").build();
    /* execute */
    SerecoMetaData result = builderToTest.forParam(param).build();
    /* test */
    assertNotNull(result);
    List<SerecoVulnerability> vulnerabilities = result.getVulnerabilities();
    assertNotNull(vulnerabilities);
    assertEquals(1, vulnerabilities.size());
    SerecoVulnerability v = vulnerabilities.iterator().next();
    assertEquals(SerecoSeverity.CRITICAL, v.getSeverity());
    assertEquals("SecHub failure", v.getType());
    assertEquals("Security product 'productId' failed, so cannot give a correct answer.", v.getDescription());
}
Also used : SerecoVulnerability(com.mercedesbenz.sechub.sereco.metadata.SerecoVulnerability) SerecoMetaData(com.mercedesbenz.sechub.sereco.metadata.SerecoMetaData) ImportParameter(com.mercedesbenz.sechub.sereco.ImportParameter) Test(org.junit.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