Skip to content

Commit e8514b6

Browse files
authored
Merge pull request #71 from sdeleuze/freemarker
Add Freemarker metadata
2 parents 6aaa412 + 546b18b commit e8514b6

File tree

14 files changed

+208
-0
lines changed

14 files changed

+208
-0
lines changed

metadata/index.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,9 @@
9898
{
9999
"directory": "org.thymeleaf/thymeleaf-spring6",
100100
"module": "org.thymeleaf:thymeleaf-spring6"
101+
},
102+
{
103+
"directory": "org.freemarker/freemarker",
104+
"module": "org.freemarker:freemarker"
101105
}
102106
]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[
2+
"resource-config.json"
3+
]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"bundles": [],
3+
"resources": {
4+
"includes": [
5+
{
6+
"pattern": "\\Qfreemarker/ext/beans/DefaultMemberAccessPolicy-rules\\E",
7+
"condition": {
8+
"typeReachable": "freemarker.ext.beans.DefaultMemberAccessPolicy"
9+
}
10+
},
11+
{
12+
"pattern": "\\Qfreemarker/version.properties\\E",
13+
"condition": {
14+
"typeReachable": "freemarker.template.utility.ClassUtil"
15+
}
16+
}
17+
]
18+
}
19+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{
3+
"latest": true,
4+
"metadata-version": "2.3.31",
5+
"module": "org.freemarker:freemarker",
6+
"tested-versions": [
7+
"2.3.31"
8+
]
9+
}
10+
]

tests/src/index.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,5 +251,16 @@
251251
]
252252
}
253253
]
254+
},
255+
{
256+
"test-project-path": "org.freemarker/freemarker/2.3.31",
257+
"libraries": [
258+
{
259+
"name": "org.freemarker:freemarker",
260+
"versions": [
261+
"2.3.31"
262+
]
263+
}
264+
]
254265
}
255266
]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright and related rights waived via CC0
3+
*
4+
* You should have received a copy of the CC0 legalcode along with this
5+
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
6+
*/
7+
8+
import org.graalvm.internal.tck.TestUtils
9+
10+
plugins {
11+
id "org.graalvm.internal.tck"
12+
}
13+
14+
String libraryVersion = TestUtils.testedLibraryVersion
15+
16+
dependencies {
17+
testImplementation("org.slf4j:slf4j-api:1.7.36")
18+
testImplementation("org.slf4j:slf4j-simple:1.7.36")
19+
testImplementation("org.freemarker:freemarker:$libraryVersion")
20+
testImplementation('org.assertj:assertj-core:3.22.0')
21+
}
22+
23+
graalvmNative {
24+
binaries {
25+
test {
26+
buildArgs.add('--no-fallback')
27+
}
28+
}
29+
agent {
30+
defaultMode = "conditional"
31+
modes {
32+
conditional {
33+
userCodeFilterPath = "user-code-filter.json"
34+
}
35+
}
36+
}
37+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
library.version = 2.3.31
2+
metadata.dir = org.freemarker/freemarker/2.3.31/
3+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
pluginManagement {
2+
def tckPath = Objects.requireNonNullElse(
3+
System.getenv("GVM_TCK_TCKDIR"),
4+
"../../../../tck-build-logic"
5+
)
6+
includeBuild(tckPath)
7+
}
8+
9+
plugins {
10+
id "org.graalvm.internal.tck-settings" version "1.0.0-SNAPSHOT"
11+
}
12+
13+
rootProject.name = 'freemarker-runtime-tests'
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright and related rights waived via CC0
3+
*
4+
* You should have received a copy of the CC0 legalcode along with this
5+
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
6+
*/
7+
package fm;
8+
9+
import java.io.IOException;
10+
import java.io.StringWriter;
11+
import java.util.HashMap;
12+
import java.util.Map;
13+
14+
import freemarker.template.Configuration;
15+
import freemarker.template.Template;
16+
import freemarker.template.TemplateException;
17+
import org.assertj.core.api.Assertions;
18+
import org.junit.jupiter.api.Test;
19+
20+
public class FreemarkerTest {
21+
22+
@Test
23+
void test() throws IOException, TemplateException {
24+
Map<String, Object> root = new HashMap<>();
25+
root.put("user", "Big Joe");
26+
Product latest = new Product();
27+
latest.setUrl("products/greenmouse.html");
28+
latest.setName("green mouse");
29+
root.put("latestProduct", latest);
30+
31+
Configuration configuration = new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS);
32+
configuration.setClassForTemplateLoading(this.getClass(), "/");
33+
Template template = configuration.getTemplate("test.ftlh");
34+
StringWriter writer = new StringWriter();
35+
template.process(root, writer);
36+
37+
Assertions.assertThat(writer.toString()).isNotEmpty();
38+
}
39+
40+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright and related rights waived via CC0
3+
*
4+
* You should have received a copy of the CC0 legalcode along with this
5+
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
6+
*/
7+
package fm;
8+
9+
public class Product {
10+
11+
private String url;
12+
private String name;
13+
14+
public String getUrl() {
15+
return url;
16+
}
17+
18+
public void setUrl(String url) {
19+
this.url = url;
20+
}
21+
22+
23+
public String getName() {
24+
return name;
25+
}
26+
27+
public void setName(String name) {
28+
this.name = name;
29+
}
30+
}

0 commit comments

Comments
 (0)