Skip to content

Commit

Permalink
Merge branch 'dev_tempeng_velocity' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
maybeec committed Sep 14, 2020
2 parents 56606ea + 2125e6a commit c8c7a92
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
23 changes: 11 additions & 12 deletions cobigen/cobigen-templateengines/cobigen-tempeng-velocity/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>tempeng-velocity</artifactId>
<version>2.0.1</version>
<version>7.0.0</version>
<name>CobiGen - Velocity Template Engine</name>
<description>CobiGen - Velocity Template Engine</description>

Expand All @@ -19,31 +19,30 @@
<dependency>
<groupId>com.devonfw.cobigen</groupId>
<artifactId>core-api</artifactId>
<version>5.0.0</version>
<version>[7.0.0,)</version>
</dependency>

<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>

<dependency>
<groupId>com.devonfw.cobigen</groupId>
<artifactId>core-test</artifactId>
<version>6.0.0</version>
<version>7.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.devonfw.cobigen</groupId>
<artifactId>core</artifactId>
<version>6.0.0</version>
<version>7.0.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>com.devonfw.cobigen</groupId>
<artifactId>javaplugin</artifactId>
<version>2.0.0</version>
<version>7.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,19 @@
import org.apache.velocity.runtime.RuntimeConstants;
import org.slf4j.LoggerFactory;

import com.devonfw.cobigen.api.annotation.Name;
import com.devonfw.cobigen.api.exception.CobiGenRuntimeException;
import com.devonfw.cobigen.api.extension.TextTemplate;
import com.devonfw.cobigen.api.extension.TextTemplateEngine;
import com.devonfw.cobigen.tempeng.velocity.constant.VelocityMetadata;
import com.devonfw.cobigen.tempeng.velocity.log.LogChuteDelegate;
import com.devonfw.cobigen.tempeng.velocity.runtime.resources.NullResourceCache;
import com.devonfw.cobigen.tempeng.velocity.runtime.resources.ResourceManagerDelegate;
import com.devonfw.cobigen.tempeng.velocity.log.LogChuteDelegate;

/** Template engine for Apache Velocity */
@Name("Velocity")
public class VelocityTemplateEngine implements TextTemplateEngine {

/** Template Engine name */
private static final String ENGINE_NAME = "Velocity";

/** The file extension of the template files. */
private static final String TEMPLATE_EXTENSION = ".vm";

Expand Down Expand Up @@ -56,11 +55,6 @@ public VelocityTemplateEngine() {
engine.setProperty(RuntimeConstants.RESOURCE_MANAGER_CACHE_CLASS, NullResourceCache.class.getName());
}

@Override
public String getName() {
return ENGINE_NAME;
}

@Override
public String getTemplateFileEnding() {
return TEMPLATE_EXTENSION;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.io.File;
import java.nio.charset.Charset;
import java.util.List;

import org.junit.Rule;
Expand Down Expand Up @@ -32,7 +33,10 @@ public class VelocityTemplateEngineIntegrationTest {
public void testBasicGeneration() throws Exception {

CobiGen cobigen = CobiGenFactory.create(new File("src/test/resources/systemtest").toURI());
List<IncrementTo> increments = cobigen.getMatchingIncrements(Input.class);
Object input = cobigen.read(
new File("src/test/java/com/devonfw/cobigen/tempeng/velocity/systemtest/testobjects/Input.java").toPath(),
Charset.forName("UTF-8"), getClass().getClassLoader());
List<IncrementTo> increments = cobigen.getMatchingIncrements(input);

assertThat(increments).hasSize(1);
assertThat(increments.get(0).getTemplates()).hasSize(1);
Expand Down
2 changes: 1 addition & 1 deletion documentation/master-cobigen.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ DISCLAIMER: All Cobigen plugins are compatible with the latest release of Devonf
* CobiGen - HTML Plug-in v2.1.0
* CobiGen - Open API Plug-in v2.4.0
* CobiGen - FreeMaker Template Engine v7.0.0
* CobiGen - Velocity Template Engine v2.0.1
* CobiGen - Velocity Template Engine v7.0.0

**Authors:**

Expand Down

0 comments on commit c8c7a92

Please sign in to comment.