test_class.file: lang/src/test/java/org/eclipse/steady/report/ReportTest.java
test_class.identifier: ReportTest
test_class.superclass: extends AbstractGoalTest
test_case.body: @Test
    public void testReport() {
      try {
        // Mock REST services
        this.configureBackendServiceUrl(server);
        this.setupMockServices(this.testApp);
  
        // Exemptions
        vulasConfiguration.setProperty(
            ExemptionBug.CFG_PREFIX + ".CVE-2014-0050.reason",
            "The vulnerable library with digest 6F1EBC is no problem because ...");
        vulasConfiguration.setProperty(
            ExemptionBug.CFG_PREFIX + ".CVE-2014-0050.libraries",
            "6F1EBC6CE20AD8B3D4825CEB2E625E5C432A0E10");
  
        vulasConfiguration.setProperty(
            ExemptionBug.CFG_PREFIX + ".CVE-2013-2186.reason",
            "Vulnerability CVE-2013-2186 is no problem because ...");
        vulasConfiguration.setProperty(ExemptionBug.CFG_PREFIX + ".CVE-2013-2186.libraries", "*");
  
        vulasConfiguration.setProperty(
            ExemptionBug.CFG_PREFIX + ".CVE-2019-1234.reason",
            "Vulnerability CVE-2019-1234 is no problem because ...");
  
        vulasConfiguration.setProperty(ExemptionScope.CFG, "teST, provIDED");
        vulasConfiguration.setProperty(ExemptionUnassessed.CFG, "knOWN");
  
        final Configuration cfg = vulasConfiguration.getConfiguration();
  
        final GoalContext goal_context = new GoalContext();
        goal_context.setVulasConfiguration(vulasConfiguration);
        goal_context.setTenant(this.testTenant);
        goal_context.setSpace(this.testSpace);
        goal_context.setApplication(this.testApp);
  
        final Report report = new Report(goal_context, this.testApp, null);
  
        // Set all kinds of exceptions
        report.setExceptionThreshold(
            cfg.getString(CoreConfiguration.REP_EXC_THRESHOLD, Report.THRESHOLD_ACT_EXE));
  
        // Exemptions
        report.setExemptions(ExemptionSet.createFromConfiguration(cfg));
  
        // Fetch the vulns
        report.fetchAppVulnerabilities();
  
        // Loop over vulnerabilities
        report.processVulnerabilities();
  
        final Path report_dir = Paths.get("./target/vulas/report");
        if (!report_dir.toFile().exists()) report_dir.toFile().mkdirs();
  
        report.writeResult(report_dir);
  
        // Check that files exist
        assertTrue(FileUtil.isAccessibleFile(report_dir.resolve(Report.REPORT_FILE_HTML)));
        assertTrue(FileUtil.isAccessibleFile(report_dir.resolve(Report.REPORT_FILE_XML)));
        assertTrue(FileUtil.isAccessibleFile(report_dir.resolve(Report.REPORT_FILE_JSON)));
  
        // Validate Html
        final Tidy tidy = new Tidy();
        tidy.parse(
            new ByteArrayInputStream(
                FileUtil.readInputStream(
                    new FileInputStream(
                        new File("./target/vulas/report/" + Report.REPORT_FILE_HTML)))),
            new FileOutputStream(new File("./target/jtidy-html.txt")));
  
        // Allow no errors
        assertEquals(0, tidy.getParseErrors());
  
        // Allow just the following 3 warnings (interestingly, a missing </table> will only result in
        // additional warnings)
        // line 361 column 41 - Warning: <td> attribute "width" has invalid value "25%"
        // line 381 column 41 - Warning: <td> attribute "width" has invalid value "75%"
        // line 1 column 1 - Warning: html doctype doesn't match content
        assertEquals(3, tidy.getParseWarnings());
  
        // Check the HTTP calls made
        String path = "/backend" + PathBuilder.appVulnDeps(this.testApp, true, false, true);
        path = path.substring(0, path.indexOf('?'));
        verifyHttp(server)
            .times(
                1,
                method(Method.GET),
                uri(path),
                parameter("includeHistorical", "true"),
                parameter("includeAffected", "false"),
                parameter("includeAffectedUnconfirmed", "true"));
        verifyHttp(server)
            .times(
                1,
                method(Method.GET),
                uri(path),
                parameter("includeHistorical", "false"),
                parameter("includeAffected", "true"),
                parameter("includeAffectedUnconfirmed", "true"));
      } catch (Exception e) {
        e.printStackTrace();
        assertTrue(false);
      }
    }
test_case.class_method_signature: ReportTest.testReport()
test_case.full_signature: @Test public void testReport()
test_case.identifier: testReport
test_case.invocations: configureBackendServiceUrl setupMockServices setProperty setProperty setProperty setProperty setProperty setProperty setProperty getConfiguration setVulasConfiguration setTenant setSpace setApplication setExceptionThreshold getString setExemptions createFromConfiguration fetchAppVulnerabilities processVulnerabilities get exists toFile mkdirs toFile writeResult assertTrue isAccessibleFile resolve assertTrue isAccessibleFile resolve assertTrue isAccessibleFile resolve parse readInputStream assertEquals getParseErrors assertEquals getParseWarnings appVulnDeps substring indexOf times verifyHttp method uri parameter parameter parameter times verifyHttp method uri parameter parameter parameter printStackTrace assertTrue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testReport()
focal_class.declarator: log = org.apache.logging.log4j.LogManager.getLogger()
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = org.apache.logging.log4j.LogManager.getLogger();
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: dateFormat = new SimpleDateFormat("dd.MM.yyy HH:mm Z")
focal_class.modifier: private final
focal_class.original_string: private final SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyy HH:mm Z");
focal_class.type: SimpleDateFormat
focal_class.var_name: dateFormat
focal_class.declarator: THRESHOLD_NONE = "noException"
focal_class.modifier: public static final
focal_class.original_string: public static final String THRESHOLD_NONE = "noException";
focal_class.type: String
focal_class.var_name: THRESHOLD_NONE
focal_class.declarator: THRESHOLD_DEP_ON = "dependsOn"
focal_class.modifier: public static final
focal_class.original_string: public static final String THRESHOLD_DEP_ON = "dependsOn";
focal_class.type: String
focal_class.var_name: THRESHOLD_DEP_ON
focal_class.declarator: THRESHOLD_POT_EXE = "potentiallyExecutes"
focal_class.modifier: public static final
focal_class.original_string: public static final String THRESHOLD_POT_EXE = "potentiallyExecutes";
focal_class.type: String
focal_class.var_name: THRESHOLD_POT_EXE
focal_class.declarator: THRESHOLD_ACT_EXE = "actuallyExecutes"
focal_class.modifier: public static final
focal_class.original_string: public static final String THRESHOLD_ACT_EXE = "actuallyExecutes";
focal_class.type: String
focal_class.var_name: THRESHOLD_ACT_EXE
focal_class.declarator: TEMPLATE_FILE_HTML = "velocity_template.html"
focal_class.modifier: private static final
focal_class.original_string: private static final String TEMPLATE_FILE_HTML = "velocity_template.html";
focal_class.type: String
focal_class.var_name: TEMPLATE_FILE_HTML
focal_class.declarator: REPORT_FILE_HTML = "vulas-report.html"
focal_class.modifier: static final
focal_class.original_string: static final String REPORT_FILE_HTML = "vulas-report.html";
focal_class.type: String
focal_class.var_name: REPORT_FILE_HTML
focal_class.declarator: TEMPLATE_FILE_XML = "velocity_template.xml"
focal_class.modifier: private static final
focal_class.original_string: private static final String TEMPLATE_FILE_XML = "velocity_template.xml";
focal_class.type: String
focal_class.var_name: TEMPLATE_FILE_XML
focal_class.declarator: REPORT_FILE_XML = "vulas-report.xml"
focal_class.modifier: static final
focal_class.original_string: static final String REPORT_FILE_XML = "vulas-report.xml";
focal_class.type: String
focal_class.var_name: REPORT_FILE_XML
focal_class.declarator: TEMPLATE_FILE_JSON = "velocity_template.json"
focal_class.modifier: private static final
focal_class.original_string: private static final String TEMPLATE_FILE_JSON = "velocity_template.json";
focal_class.type: String
focal_class.var_name: TEMPLATE_FILE_JSON
focal_class.declarator: REPORT_FILE_JSON = "vulas-report.json"
focal_class.modifier: static final
focal_class.original_string: static final String REPORT_FILE_JSON = "vulas-report.json";
focal_class.type: String
focal_class.var_name: REPORT_FILE_JSON
focal_class.declarator: stats = new HashMap<String, Long>()
focal_class.modifier: private
focal_class.original_string: private Map<String, Long> stats = new HashMap<String, Long>();
focal_class.type: Map<String, Long>
focal_class.var_name: stats
focal_class.declarator: exceptionThreshold = THRESHOLD_POT_EXE
focal_class.modifier: private
focal_class.original_string: private String exceptionThreshold = THRESHOLD_POT_EXE;
focal_class.type: String
focal_class.var_name: exceptionThreshold
focal_class.declarator: createAffectedLibraries = false
focal_class.modifier: private
focal_class.original_string: private boolean createAffectedLibraries = false;
focal_class.type: boolean
focal_class.var_name: createAffectedLibraries
focal_class.declarator: affectedLibraries = new HashSet<AffectedLibrary>()
focal_class.modifier: private
focal_class.original_string: private Set<AffectedLibrary> affectedLibraries = new HashSet<AffectedLibrary>();
focal_class.type: Set<AffectedLibrary>
focal_class.var_name: affectedLibraries
focal_class.declarator: exemptions = new ExemptionSet()
focal_class.modifier: private
focal_class.original_string: private ExemptionSet exemptions = new ExemptionSet();
focal_class.type: ExemptionSet
focal_class.var_name: exemptions
focal_class.declarator: app = null
focal_class.modifier: private
focal_class.original_string: private Application app = null;
focal_class.type: Application
focal_class.var_name: app
focal_class.declarator: modules = null
focal_class.modifier: private
focal_class.original_string: private Set<Application> modules = null;
focal_class.type: Set<Application>
focal_class.var_name: modules
focal_class.declarator: vulns = new TreeSet<AggregatedVuln>()
focal_class.modifier: private
focal_class.original_string: private Set<AggregatedVuln> vulns = new TreeSet<AggregatedVuln>();
focal_class.type: Set<AggregatedVuln>
focal_class.var_name: vulns
focal_class.declarator: vulnsAboveThreshold = new TreeSet<AggregatedVuln>()
focal_class.modifier: private
focal_class.original_string: private Set<AggregatedVuln> vulnsAboveThreshold = new TreeSet<AggregatedVuln>();
focal_class.type: Set<AggregatedVuln>
focal_class.var_name: vulnsAboveThreshold
focal_class.declarator: vulnsBelowThreshold = new TreeSet<AggregatedVuln>()
focal_class.modifier: private
focal_class.original_string: private Set<AggregatedVuln> vulnsBelowThreshold = new TreeSet<AggregatedVuln>();
focal_class.type: Set<AggregatedVuln>
focal_class.var_name: vulnsBelowThreshold
focal_class.declarator: historicalVulns = new HashSet<String>()
focal_class.modifier: private
focal_class.original_string: private Set<String> historicalVulns = new HashSet<String>();
focal_class.type: Set<String>
focal_class.var_name: historicalVulns
focal_class.declarator: relevantVulns = new HashSet<String>()
focal_class.modifier: private
focal_class.original_string: private Set<String> relevantVulns = new HashSet<String>();
focal_class.type: Set<String>
focal_class.var_name: relevantVulns
focal_class.declarator: context = new VelocityContext()
focal_class.modifier: final
focal_class.original_string: final VelocityContext context = new VelocityContext();
focal_class.type: VelocityContext
focal_class.var_name: context
focal_class.declarator: goalContext = null
focal_class.modifier: private
focal_class.original_string: private GoalContext goalContext = null;
focal_class.type: GoalContext
focal_class.var_name: goalContext
focal_class.file: lang/src/main/java/org/eclipse/steady/report/Report.java
focal_class.identifier: Report
focal_class.class_method_signature: Report.Report(GoalContext _ctx, Application _app, Set<Application> _modules)
focal_class.full_signature: public  Report(GoalContext _ctx, Application _app, Set<Application> _modules)
focal_class.identifier: Report
focal_class.modifiers: public
focal_class.parameters: (GoalContext _ctx, Application _app, Set<Application> _modules)
focal_class.signature:  Report(GoalContext _ctx, Application _app, Set<Application> _modules)
focal_class.class_method_signature: Report.getExceptionThreshold()
focal_class.full_signature: public String getExceptionThreshold()
focal_class.identifier: getExceptionThreshold
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getExceptionThreshold()
focal_class.class_method_signature: Report.setExceptionThreshold(String _threshold)
focal_class.full_signature: public void setExceptionThreshold(String _threshold)
focal_class.identifier: setExceptionThreshold
focal_class.modifiers: public
focal_class.parameters: (String _threshold)
focal_class.return: void
focal_class.signature: void setExceptionThreshold(String _threshold)
focal_class.class_method_signature: Report.isCreateAffectedLibraries()
focal_class.full_signature: public boolean isCreateAffectedLibraries()
focal_class.identifier: isCreateAffectedLibraries
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isCreateAffectedLibraries()
focal_class.class_method_signature: Report.setCreateAffectedLibraries(boolean createAffectedLibraries)
focal_class.full_signature: public void setCreateAffectedLibraries(boolean createAffectedLibraries)
focal_class.identifier: setCreateAffectedLibraries
focal_class.modifiers: public
focal_class.parameters: (boolean createAffectedLibraries)
focal_class.return: void
focal_class.signature: void setCreateAffectedLibraries(boolean createAffectedLibraries)
focal_class.class_method_signature: Report.writeAffectedLibraries(@NotNull Path _dir)
focal_class.full_signature: private void writeAffectedLibraries(@NotNull Path _dir)
focal_class.identifier: writeAffectedLibraries
focal_class.modifiers: private
focal_class.parameters: (@NotNull Path _dir)
focal_class.return: void
focal_class.signature: void writeAffectedLibraries(@NotNull Path _dir)
focal_class.class_method_signature: Report.setExemptions(ExemptionSet _exemptions)
focal_class.full_signature: public void setExemptions(ExemptionSet _exemptions)
focal_class.identifier: setExemptions
focal_class.modifiers: public
focal_class.parameters: (ExemptionSet _exemptions)
focal_class.return: void
focal_class.signature: void setExemptions(ExemptionSet _exemptions)
focal_class.class_method_signature: Report.isAmongAggregatedModules(LibraryId _libid)
focal_class.full_signature: private boolean isAmongAggregatedModules(LibraryId _libid)
focal_class.identifier: isAmongAggregatedModules
focal_class.modifiers: private
focal_class.parameters: (LibraryId _libid)
focal_class.return: boolean
focal_class.signature: boolean isAmongAggregatedModules(LibraryId _libid)
focal_class.class_method_signature: Report.fetchAppVulnerabilities()
focal_class.full_signature: public void fetchAppVulnerabilities()
focal_class.identifier: fetchAppVulnerabilities
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void fetchAppVulnerabilities()
focal_class.class_method_signature: Report.update(Set<AggregatedVuln> _set, AggregatedVuln _av)
focal_class.full_signature: private AggregatedVuln update(Set<AggregatedVuln> _set, AggregatedVuln _av)
focal_class.identifier: update
focal_class.modifiers: private
focal_class.parameters: (Set<AggregatedVuln> _set, AggregatedVuln _av)
focal_class.return: AggregatedVuln
focal_class.signature: AggregatedVuln update(Set<AggregatedVuln> _set, AggregatedVuln _av)
focal_class.class_method_signature: Report.processVulnerabilities()
focal_class.full_signature: public void processVulnerabilities()
focal_class.identifier: processVulnerabilities
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void processVulnerabilities()
focal_class.class_method_signature: Report.isAggregated()
focal_class.full_signature: private boolean isAggregated()
focal_class.identifier: isAggregated
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isAggregated()
focal_class.class_method_signature: Report.isThrowBuildException()
focal_class.full_signature: public boolean isThrowBuildException()
focal_class.identifier: isThrowBuildException
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isThrowBuildException()
focal_class.class_method_signature: Report.getConfiguration()
focal_class.full_signature: public Map<String, String> getConfiguration()
focal_class.identifier: getConfiguration
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Map<String, String>
focal_class.signature: Map<String, String> getConfiguration()
focal_class.class_method_signature: Report.getStats()
focal_class.full_signature: public Map<String, Long> getStats()
focal_class.identifier: getStats
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Map<String, Long>
focal_class.signature: Map<String, Long> getStats()
focal_class.class_method_signature: Report.getExceptionMessage()
focal_class.full_signature: public String getExceptionMessage()
focal_class.identifier: getExceptionMessage
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getExceptionMessage()
focal_class.class_method_signature: Report.getResultAsString()
focal_class.full_signature: public String getResultAsString()
focal_class.identifier: getResultAsString
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getResultAsString()
focal_class.class_method_signature: Report.writeResult(@NotNull Path _dir)
focal_class.full_signature: public void writeResult(@NotNull Path _dir)
focal_class.identifier: writeResult
focal_class.modifiers: public
focal_class.parameters: (@NotNull Path _dir)
focal_class.return: void
focal_class.signature: void writeResult(@NotNull Path _dir)
focal_class.class_method_signature: Report.writeResult(@NotNull Path _dir, String _template, String _report)
focal_class.full_signature: public Path writeResult(@NotNull Path _dir, String _template, String _report)
focal_class.identifier: writeResult
focal_class.modifiers: public
focal_class.parameters: (@NotNull Path _dir, String _template, String _report)
focal_class.return: Path
focal_class.signature: Path writeResult(@NotNull Path _dir, String _template, String _report)
focal_class.class_method_signature: Report.writeResultAsHtml(@NotNull Path _dir)
focal_class.full_signature: public Path writeResultAsHtml(@NotNull Path _dir)
focal_class.identifier: writeResultAsHtml
focal_class.modifiers: public
focal_class.parameters: (@NotNull Path _dir)
focal_class.return: Path
focal_class.signature: Path writeResultAsHtml(@NotNull Path _dir)
focal_class.class_method_signature: Report.writeResultAsXml(@NotNull Path _dir)
focal_class.full_signature: public Path writeResultAsXml(@NotNull Path _dir)
focal_class.identifier: writeResultAsXml
focal_class.modifiers: public
focal_class.parameters: (@NotNull Path _dir)
focal_class.return: Path
focal_class.signature: Path writeResultAsXml(@NotNull Path _dir)
focal_class.class_method_signature: Report.writeResultAsJson(@NotNull Path _dir)
focal_class.full_signature: public Path writeResultAsJson(@NotNull Path _dir)
focal_class.identifier: writeResultAsJson
focal_class.modifiers: public
focal_class.parameters: (@NotNull Path _dir)
focal_class.return: Path
focal_class.signature: Path writeResultAsJson(@NotNull Path _dir)
focal_method.body: public Report(GoalContext _ctx, Application _app, Set<Application> _modules) {
      this.goalContext = _ctx;
      this.app = _app;
  
      if (_modules == null) {
        this.modules = new HashSet<Application>();
        this.modules.add(this.app);
      } else this.modules = _modules;
  
      Report.log.info(
          "Report to be done for "
              + this.app
              + ", ["
              + this.modules.size()
              + "] modules in total: "
              + this.modules);
    }
focal_method.class_method_signature: Report.Report(GoalContext _ctx, Application _app, Set<Application> _modules)
focal_method.full_signature: public  Report(GoalContext _ctx, Application _app, Set<Application> _modules)
focal_method.identifier: Report
focal_method.modifiers: public
focal_method.parameters: (GoalContext _ctx, Application _app, Set<Application> _modules)
focal_method.signature:  Report(GoalContext _ctx, Application _app, Set<Application> _modules)