Skip to content

Commit

Permalink
Updates for 1.2.0. Fixed Velocity
Browse files Browse the repository at this point in the history
  • Loading branch information
meriouma committed Jan 15, 2015
1 parent 0a76850 commit 599da0c
Show file tree
Hide file tree
Showing 19 changed files with 69 additions and 78 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.project
.settings
target
.idea
Binary file removed lib/velocity-1.5-source.jar
Binary file not shown.
Binary file removed lib/velocity-1.5.jar
Binary file not shown.
Binary file removed lib/velocity-idea.jar
Binary file not shown.
38 changes: 22 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
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>

<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
<version>9</version>
</parent>

<groupId>com.arcbees.plugin</groupId>
Expand Down Expand Up @@ -56,16 +56,19 @@
<!-- project -->
<target.jdk>1.6</target.jdk>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<repackage>com.arcbees.repackaged</repackage>

<!-- libs -->
<velocity.version>1.5</velocity.version>
<restassured.version>1.8.0</restassured.version>
<junit.version>4.11</junit.version>
<velocity.version>1.7</velocity.version>
<restassured.version>2.4.0</restassured.version>
<junit.version>4.12</junit.version>
<commons.version>1.9</commons.version>
<commons-io.version>2.4</commons-io.version>

<!-- maven -->
<maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version>
<org.apache.commons.collections.version>3.2.1</org.apache.commons.collections.version>
<maven-shade-plugin.version>2.3</maven-shade-plugin.version>
</properties>

<build>
Expand Down Expand Up @@ -94,38 +97,41 @@
</build>

<dependencies>
<!-- <dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>${velocity.version}</version>
</dependency> -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>${restassured.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>${commons.version}</version>
<scope>test</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.directory.studio</groupId>
<artifactId>org.apache.commons.collections</artifactId>
<version>3.2.1</version>
<version>${org.apache.commons.collections.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
8 changes: 0 additions & 8 deletions repackage/README.md

This file was deleted.

Binary file removed repackage/jarjar.jar
Binary file not shown.
8 changes: 0 additions & 8 deletions repackage/repackage_velocity_jar.sh

This file was deleted.

1 change: 0 additions & 1 deletion repackage/rules_file

This file was deleted.

Binary file removed repackage/velocity-1.7.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static CreatedNameTokens run(NameTokenOptions nameTokenOptions, boolean r
return created.getCreatedNameTokens();
}

private static final String BASE_REMOTE = "https://raw.github.com/ArcBees/IDE-Templates/1.0.0/src/main/resources/com/arcbees/plugin/template/place/";
private static final String BASE_REMOTE = "https://raw.githubusercontent.com/ArcBees/IDE-Templates/1.2.0/src/main/resources/com/arcbees/plugin/template/place/";
private final static String BASE_LOCAL = "./src/main/resources/com/arcbees/plugin/template/place/";

private VelocityEngine velocityEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static CreatedNestedPresenter run(PresenterOptions presenterOptions,
return createNestedPresenter.getCreatedNestedPresenter();
}

private static final String BASE_REMOTE = "https://raw.github.com/ArcBees/IDE-Templates/1.0.0/src/main/resources/com/arcbees/plugin/template/presenter/nested/";
private static final String BASE_REMOTE = "https://raw.githubusercontent.com/ArcBees/IDE-Templates/1.2.0/src/main/resources/com/arcbees/plugin/template/presenter/nested/";
private final static String BASE_LOCAL = "./src/main/resources/com/arcbees/plugin/template/presenter/nested/";

private final PresenterOptions presenterOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public static CreatedPopupPresenter run(PresenterOptions presenterOptions,
}

// TODO should be more
private static final String BASE_REMOTE_GWT = "https://raw.github.com/ArcBees/IDE-Templates/1.0.0/src/main/resources/com/arcbees/plugin/template/presenter/popup/gwt/";
private static final String BASE_REMOTE_CUSTOM = "https://raw.github.com/ArcBees/IDE-Templates/1.0.0/src/main/resources/com/arcbees/plugin/template/presenter/popup/custom/";
private static final String BASE_REMOTE_GWT = "https://raw.githubusercontent.com/ArcBees/IDE-Templates/1.2.0/src/main/resources/com/arcbees/plugin/template/presenter/popup/gwt/";
private static final String BASE_REMOTE_CUSTOM = "https://raw.githubusercontent.com/ArcBees/IDE-Templates/1.2.0/src/main/resources/com/arcbees/plugin/template/presenter/popup/custom/";
private final static String BASE_LOCAL_GWT = "./src/main/resources/com/arcbees/plugin/template/presenter/popup/gwt/";
private final static String BASE_LOCAL_CUSTOM = "./src/main/resources/com/arcbees/plugin/template/presenter/popup/custom/";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static CreatedPresenterWidget run(PresenterOptions presenterOptions,
return createdPresenterWidget.getCreatedPresenterWidget();
}

private static final String BASE_REMOTE = "https://raw.github.com/ArcBees/IDE-Templates/1.0.0/src/main/resources/com/arcbees/plugin/template/presenter/widget/";
private static final String BASE_REMOTE = "https://raw.githubusercontent.com/ArcBees/IDE-Templates/1.2.0/src/main/resources/com/arcbees/plugin/template/presenter/widget/";
private final static String BASE_LOCAL = "./src/main/resources/com/arcbees/plugin/template/presenter/widget/";

private final PresenterOptions presenterOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.arcbees.plugin.template.domain.presenter;

import com.arcbees.plugin.template.domain.place.CreatedNameTokens;

public class CreatedNestedPresenter {
private RenderedTemplate module;
private RenderedTemplate presenter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,23 @@
import org.apache.velocity.runtime.resource.loader.URLResourceLoader;

public class VelocityUtils {
public static VelocityEngine createRemoveVelocityEngine(String remoteBaseUrl) throws Exception {
Properties properties = new Properties();
properties.setProperty(RuntimeConstants.RESOURCE_LOADER, "url");
properties.setProperty("url.resource.loader.class", URLResourceLoader.class.getName());
properties.setProperty("url.resource.loader.timeout", "5000");
properties.setProperty("url.resource.loader.root", remoteBaseUrl);
properties.setProperty(RuntimeConstants.RESOURCE_MANAGER_CLASS, ResourceManagerImpl.class.getName());
properties.setProperty(RuntimeConstants.RESOURCE_MANAGER_CACHE_CLASS, ResourceCacheImpl.class.getName());

VelocityEngine velocityEngine;
try {
velocityEngine = new VelocityEngine();
//velocityEngine.reset();
velocityEngine.init(properties);
} catch (Exception e) {
throw e;
}

public static VelocityEngine createRemoveVelocityEngine(String remoteBaseUrl) throws Exception {
Properties properties = new Properties();
properties.setProperty(RuntimeConstants.RESOURCE_LOADER, "url");
properties.setProperty("url.resource.loader.class", URLResourceLoader.class.getName());
properties.setProperty("url.resource.loader.timeout", "5000");
properties.setProperty("url.resource.loader.root", remoteBaseUrl);
properties.setProperty(RuntimeConstants.RESOURCE_MANAGER_CLASS, ResourceManagerImpl.class.getName());
properties.setProperty(RuntimeConstants.RESOURCE_MANAGER_CACHE_CLASS, ResourceCacheImpl.class.getName());

VelocityEngine velocityEngine;
try {
velocityEngine = new VelocityEngine();
velocityEngine.init(properties);
} catch (Exception e) {
throw e;
}

return velocityEngine;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import com.jayway.restassured.RestAssured;

public class PresenterRemoteTest {
private String propertiesUrlPath = "https://raw.github.com/ArcBees/IDE-Templates/1.0.0/" +
"src/main/resources/com/arcbees/plugin/template/presenter/template.properties";
private String propertiesUrlPath = "https://raw.githubusercontent.com/ArcBees/IDE-Templates/1.2.0/" +
"src/main/resources/com/arcbees/plugin/template/presenter/nested/template.properties";

@Test
public void testRemoteGet() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public class PresenterTest {
public void testSetup() throws Exception {
velocityEngine = new VelocityEngine();
velocityEngine.setProperty(VelocityEngine.FILE_RESOURCE_LOADER_PATH,
"./src/main/resources/com/arcbees/plugin/template/presenter/");
"./src/main/resources/com/arcbees/plugin/template/presenter/nested/");
velocityEngine.init();
}

@Test
public void testModule() throws ResourceNotFoundException, ParseErrorException, Exception {
Template t = velocityEngine.getTemplate("__name__Module.java");
Template t = velocityEngine.getTemplate("__name__Module.java.vm");

VelocityContext context = new VelocityContext();
context.put("package", "com.arcbees.project.client.application");
Expand All @@ -54,7 +54,7 @@ public void testModule() throws ResourceNotFoundException, ParseErrorException,

@Test
public void testPresenter() throws ResourceNotFoundException, ParseErrorException, Exception {
Template t = velocityEngine.getTemplate("__name__Presenter.java");
Template t = velocityEngine.getTemplate("__name__Presenter.java.vm");

VelocityContext context = new VelocityContext();
context.put("package", "com.arcbees.project.client.application");
Expand All @@ -70,7 +70,7 @@ public void testPresenter() throws ResourceNotFoundException, ParseErrorExceptio

@Test
public void testPresenterWithUiHandlers() throws ResourceNotFoundException, ParseErrorException, Exception {
Template t = velocityEngine.getTemplate("__name__Presenter.java");
Template t = velocityEngine.getTemplate("__name__Presenter.java.vm");

VelocityContext context = new VelocityContext();
context.put("package", "com.arcbees.project.client.application");
Expand All @@ -86,7 +86,7 @@ public void testPresenterWithUiHandlers() throws ResourceNotFoundException, Pars

@Test
public void testUiHandlers() throws ResourceNotFoundException, ParseErrorException, Exception {
Template t = velocityEngine.getTemplate("__name__UiHandlers.java");
Template t = velocityEngine.getTemplate("__name__UiHandlers.java.vm");

VelocityContext context = new VelocityContext();
context.put("package", "com.arcbees.project.client.application");
Expand All @@ -102,7 +102,7 @@ public void testUiHandlers() throws ResourceNotFoundException, ParseErrorExcepti

@Test
public void testView() throws ResourceNotFoundException, ParseErrorException, Exception {
Template t = velocityEngine.getTemplate("__name__View.java");
Template t = velocityEngine.getTemplate("__name__View.java.vm");

VelocityContext context = new VelocityContext();
context.put("name", "ApplicationTest");
Expand All @@ -117,7 +117,7 @@ public void testView() throws ResourceNotFoundException, ParseErrorException, Ex

@Test
public void testViewWithUiHandlers() throws ResourceNotFoundException, ParseErrorException, Exception {
Template t = velocityEngine.getTemplate("__name__View.java");
Template t = velocityEngine.getTemplate("__name__View.java.vm");

VelocityContext context = new VelocityContext();
context.put("name", "ApplicationTest");
Expand All @@ -132,7 +132,7 @@ public void testViewWithUiHandlers() throws ResourceNotFoundException, ParseErro

@Test
public void testViewUi() throws ResourceNotFoundException, ParseErrorException, Exception {
Template t = velocityEngine.getTemplate("__name__View.ui.xml");
Template t = velocityEngine.getTemplate("__name__View.ui.xml.vm");

VelocityContext context = new VelocityContext();
context.put("package", "com.arcbees.project.client.application");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,26 @@
import org.junit.Test;

public class FetchTemplatesTest {
private String BASE = "https://raw.github.com/ArcBees/IDE-Templates/1.0.0/src/main/resources/com/arcbees/plugin/template/presenter/nested";
private static final String BASE =
"https://raw.githubusercontent.com/ArcBees/IDE-Templates/1.0" +
".0/src/main/resources/com/arcbees/plugin/template/presenter/nested";

@Test
public void testGettingTemlateFiles() {
FetchTemplates fetchTemplates = new FetchTemplates();
fetchTemplates.addPath(BASE + "/__name__Module.java.vm");
fetchTemplates.addPath(BASE + "/__name__Presenter.java.vm");
fetchTemplates.addPath(BASE + "/__name__UiHandlers.java.vm");
fetchTemplates.addPath(BASE + "/__name__View.java.vm");
fetchTemplates.addPath(BASE + "/__name__View.ui.xml.vm");

fetchTemplates.setRootPath(BASE);

fetchTemplates.addPath("/__name__Module.java.vm");
fetchTemplates.addPath("/__name__Presenter.java.vm");
fetchTemplates.addPath("/__name__UiHandlers.java.vm");
fetchTemplates.addPath("/__name__View.java.vm");
fetchTemplates.addPath("/__name__View.ui.xml.vm");

fetchTemplates.run();

Map<String, FetchTemplate> fetched = fetchTemplates.getPathsToFetch();
Set<String> paths = fetched.keySet();
for (String path : paths) {
System.out.println("fetched=" + fetched.get(path).getFetched());
Assert.assertNotNull(fetched.get(path).getFetched());
}
}
Expand Down

0 comments on commit 599da0c

Please sign in to comment.