Search in sources :

Example 6 with ImportParameter

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

the class SarifV1JSONImporterTest method empty_string_is_recognized_as_product_failure.

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

Example 7 with ImportParameter

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

the class SarifV1JSONImporterTest method go_sec_2_8_0_example_with_taxonomy__import_ability_is_true.

@Test
void go_sec_2_8_0_example_with_taxonomy__import_ability_is_true() {
    /* prepare */
    ImportParameter paramGoSec = ImportParameter.builder().importData(sarif_2_1_0_gosec2_8_0_taxonomyExample).importId("id1").productId("PDS_CODESCAN").build();
    /* execute */
    ProductImportAbility ableToImportGosec_2_8_0sarif = importerToTest.isAbleToImportForProduct(paramGoSec);
    /* test */
    assertEquals(ProductImportAbility.ABLE_TO_IMPORT, ableToImportGosec_2_8_0sarif, "Has NOT the ability to import sarif!");
}
Also used : ImportParameter(com.mercedesbenz.sechub.sereco.ImportParameter) Test(org.junit.jupiter.api.Test)

Example 8 with ImportParameter

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

the class SarifV1JSONImporterTest method brakeman_sarif_report_can_be_imported.

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

Example 9 with ImportParameter

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

the class CheckmarxV1XMLImporterTest method bookStoreExampleXMLcanNotBeImported.

@Test
public void bookStoreExampleXMLcanNotBeImported() {
    /* prepare */
    String xml = "<?xml version='1.0'?><bookstore><available><book name='lord of the rings' id='!'/></available></bookstore>";
    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 10 with ImportParameter

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

the class ImportSupportTest method a_null_product_result_can_never_be_imported.

@Test
public void a_null_product_result_can_never_be_imported() {
    /* @formatter:off */
    ImportParameter importParameter = ImportParameter.builder().importId("id1").importData(null).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)

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