Skip to content

Commit

Permalink
Major fixes in the code
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-szrnka committed Jul 20, 2023
1 parent 9da6f5a commit 4f38537
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ hs_err_pid*
/.settings/org.eclipse.m2e.core.prefs
/.settings/org.eclipse.wst.common.project.facet.core.xml
/out.html
.vscode/settings.json
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<java.version>11</java.version>

<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
Expand All @@ -24,7 +24,7 @@
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.2</version>
<version>2.3</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public interface OutputBuilderService {

public static String buildOutput(List<RuleData> ruleDataList, String template) {
VelocityEngine velocityEngine = new VelocityEngine();
velocityEngine.setProperty("resource.loader", "class");
velocityEngine.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
velocityEngine.init();

Template t = velocityEngine.getTemplate(template);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class OutputBuilderServiceTest {
@Test
void testEmptyRuleDataList() throws IOException {
List<RuleData> ruleDataList = new ArrayList<>();
String result = OutputBuilderService.buildOutput(ruleDataList, "src/main/resources/output-template.html");
String result = OutputBuilderService.buildOutput(ruleDataList, "output-template.tpl");

assertNotNull(result);
assertEquals(TestUtils.getFileContent("src/test/resources/empty-resultlist.html"), result);
Expand Down
2 changes: 2 additions & 0 deletions src/test/resources/empty-resultlist.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Rendertheme color map</title>
<meta charset="utf-8">
<style type="text/css">
* {
Expand Down Expand Up @@ -28,6 +29,7 @@
</head>
<body>
<table>
<caption>Rendertheme rule data</caption>
<tr>
<th width="5%">E</th>
<th width="20%">K</th>
Expand Down

0 comments on commit 4f38537

Please sign in to comment.