You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2017/06/18 14:30:27 UTC

[1/9] incubator-freemarker git commit: FREEMARKER-54: Adding skeletal freemarker-spring module

Repository: incubator-freemarker
Updated Branches:
  refs/heads/3 c73dc5678 -> 1988dc0c8


FREEMARKER-54: Adding skeletal freemarker-spring module


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/dbbfe990
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/dbbfe990
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/dbbfe990

Branch: refs/heads/3
Commit: dbbfe99074d22fa59437a6d90499f3f3199040ba
Parents: e78181a
Author: Woonsan Ko <wo...@apache.org>
Authored: Wed Jun 14 21:03:35 2017 -0400
Committer: Woonsan Ko <wo...@apache.org>
Committed: Wed Jun 14 21:03:35 2017 -0400

----------------------------------------------------------------------
 freemarker-spring/build.gradle                  | 102 +++++++++++++++++++
 .../spring/SpringConfigurationBuilder.java      |  30 ++++++
 settings.gradle                                 |   1 +
 3 files changed, 133 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/dbbfe990/freemarker-spring/build.gradle
----------------------------------------------------------------------
diff --git a/freemarker-spring/build.gradle b/freemarker-spring/build.gradle
new file mode 100644
index 0000000..fa32eac
--- /dev/null
+++ b/freemarker-spring/build.gradle
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+title = "Apache FreeMarker Spring Framework support"
+description = """\
+FreeMarker template engine, Spring Framework support. \
+This is an optional module, mostly useful in frameworks based on Spring Framework."""
+
+dependencies {
+    compile project(":freemarker-core")
+
+    compileOnly "javax.servlet:servlet-api:2.5"
+
+    def springVersion = "4.3.9.RELEASE"
+
+    compileOnly("org.springframework:spring-core:$springVersion") {
+        exclude group: "commons-logging", module: "commons-logging"
+    }
+    compileOnly("org.springframework:spring-beans:$springVersion") {
+        exclude group: "commons-logging", module: "commons-logging"
+    }
+    compileOnly("org.springframework:spring-context:$springVersion") {
+        exclude group: "commons-logging", module: "commons-logging"
+    }
+    compileOnly("org.springframework:spring-context-support:$springVersion") {
+        exclude group: "commons-logging", module: "commons-logging"
+    }
+    compileOnly("org.springframework:spring-web:$springVersion") {
+        exclude group: "commons-logging", module: "commons-logging"
+    }
+    compileOnly("org.springframework:spring-webmvc:$springVersion") {
+        exclude group: "commons-logging", module: "commons-logging"
+    }
+
+    // ------------------------------------------------------------------------
+    // For tests
+
+    testCompile("org.springframework:spring-test:$springVersion") {
+        exclude group: "commons-logging", module: "commons-logging"
+    }
+}
+
+jar {
+    manifest {
+        // This is needed for "a.class.from.another.Bundle"?new() to work.
+        instructionReplace 'DynamicImport-Package', '*'
+
+        instructionReplace 'Bundle-RequiredExecutionEnvironment', 'JavaSE-1.7'
+        // TODO Gradle adds a "Require-Capability"... is it a problem? If not, do we need the above?
+
+        attributes(
+                "Extension-name": "${project.group}:${project.name}",
+                "Specification-Title": project.title,
+                "Implementation-Title": project.title
+        )
+    }
+}
+
+javadoc {
+    title "${project.title} ${versionCanonical} API"
+}
+
+// The identical parts of Maven "deployer" and "installer" configurations:
+def mavenCommons = { callerDelegate ->
+    delegate = callerDelegate
+
+    pom.project {
+        description project.description
+    }
+}
+
+uploadArchives {
+    repositories {
+        mavenDeployer {
+            mavenCommons(delegate)
+        }
+    }
+}
+
+install {
+    repositories {
+        mavenInstaller {
+            mavenCommons(delegate)
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/dbbfe990/freemarker-spring/src/main/java/org/apache/freemarker/spring/SpringConfigurationBuilder.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/SpringConfigurationBuilder.java b/freemarker-spring/src/main/java/org/apache/freemarker/spring/SpringConfigurationBuilder.java
new file mode 100644
index 0000000..ac0d963
--- /dev/null
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/SpringConfigurationBuilder.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.freemarker.spring;
+
+import org.apache.freemarker.core.Configuration.ExtendableBuilder;
+import org.apache.freemarker.core.Version;
+
+public class SpringConfigurationBuilder extends ExtendableBuilder {
+
+    public SpringConfigurationBuilder(Version incompatibleImprovements) {
+        super(incompatibleImprovements);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/dbbfe990/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index 47fc644..2373331 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -26,4 +26,5 @@ include 'freemarker-servlet'
 include 'freemarker-test-utils'
 include 'freemarker-manual'
 include 'freemarker-dom'
+include 'freemarker-spring'
 


[6/9] incubator-freemarker git commit: FREEMARKER-54: Adding SpringResourceTemplateLoader and test

Posted by dd...@apache.org.
FREEMARKER-54: Adding SpringResourceTemplateLoader and test


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/a571c24f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/a571c24f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/a571c24f

Branch: refs/heads/3
Commit: a571c24f6fc9544e164eeaf71347044b3fe88182
Parents: 18ee8a0
Author: Woonsan Ko <wo...@apache.org>
Authored: Sat Jun 17 23:44:46 2017 -0400
Committer: Woonsan Ko <wo...@apache.org>
Committed: Sat Jun 17 23:44:46 2017 -0400

----------------------------------------------------------------------
 .../SpringResourceTemplateLoader.java           | 123 +++++++++++++++++++
 .../SpringResourceTemplateLoaderTest.java       |  82 +++++++++++++
 .../META-INF/templates/sub1/sub2/t.ftl          |   1 +
 3 files changed, 206 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a571c24f/freemarker-spring/src/main/java/org/apache/freemarker/spring/templateresolver/SpringResourceTemplateLoader.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/templateresolver/SpringResourceTemplateLoader.java b/freemarker-spring/src/main/java/org/apache/freemarker/spring/templateresolver/SpringResourceTemplateLoader.java
new file mode 100644
index 0000000..a327bab
--- /dev/null
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/templateresolver/SpringResourceTemplateLoader.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.freemarker.spring.templateresolver;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Objects;
+
+import org.apache.freemarker.core._CoreLogs;
+import org.apache.freemarker.core.templateresolver.TemplateLoader;
+import org.apache.freemarker.core.templateresolver.TemplateLoaderSession;
+import org.apache.freemarker.core.templateresolver.TemplateLoadingResult;
+import org.apache.freemarker.core.templateresolver.TemplateLoadingSource;
+import org.slf4j.Logger;
+import org.springframework.context.ResourceLoaderAware;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.ResourceLoader;
+
+/**
+ * A {@link TemplateLoader} that uses Spring Framework <code>Resource</code>s which are resolved by locations.
+ */
+public class SpringResourceTemplateLoader implements TemplateLoader, ResourceLoaderAware {
+
+    private static final Logger LOG = _CoreLogs.TEMPLATE_RESOLVER;
+
+    private ResourceLoader resourceLoader;
+
+    @Override
+    public void setResourceLoader(ResourceLoader resourceLoader) {
+        this.resourceLoader = resourceLoader;
+    }
+
+    @Override
+    public TemplateLoaderSession createSession() {
+        return null;
+    }
+
+    @Override
+    public TemplateLoadingResult load(String name, TemplateLoadingSource ifSourceDiffersFrom,
+            Serializable ifVersionDiffersFrom, TemplateLoaderSession session) throws IOException {
+        if (resourceLoader == null) {
+            throw new IllegalStateException("Spring Framework ResourceLoader was not set.");
+        }
+
+        Resource resource = resourceLoader.getResource(name);
+
+        if (!resource.exists()) {
+            return TemplateLoadingResult.NOT_FOUND;
+        }
+
+        ResourceTemplateLoadingSource source = new ResourceTemplateLoadingSource(resource);
+
+        Long version = null;
+
+        try {
+            long lmd = resource.lastModified();
+            if (lmd != -1) {
+                version = lmd;
+            }
+        } catch (IOException e) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("The last modified timestamp of the resource at '{}' may not be resolved. {}", name,
+                        e.toString());
+            }
+        }
+
+        if (ifSourceDiffersFrom != null && ifSourceDiffersFrom.equals(source)
+                && Objects.equals(ifVersionDiffersFrom, version)) {
+            return TemplateLoadingResult.NOT_MODIFIED;
+        }
+
+        return new TemplateLoadingResult(source, version, resource.getInputStream(), null);
+    }
+
+    @Override
+    public void resetState() {
+        // Does nothing
+    }
+
+    @SuppressWarnings("serial")
+    private static class ResourceTemplateLoadingSource implements TemplateLoadingSource {
+
+        private final Resource resource;
+
+        ResourceTemplateLoadingSource(Resource resource) {
+            this.resource = resource;
+        }
+
+        @Override
+        public int hashCode() {
+            return resource.hashCode();
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj)
+                return true;
+            if (obj == null)
+                return false;
+            if (getClass() != obj.getClass())
+                return false;
+            return resource.equals(((ResourceTemplateLoadingSource) obj).resource);
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a571c24f/freemarker-spring/src/test/java/org/apache/freemarker/spring/templateresolver/SpringResourceTemplateLoaderTest.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/test/java/org/apache/freemarker/spring/templateresolver/SpringResourceTemplateLoaderTest.java b/freemarker-spring/src/test/java/org/apache/freemarker/spring/templateresolver/SpringResourceTemplateLoaderTest.java
new file mode 100644
index 0000000..23f604e
--- /dev/null
+++ b/freemarker-spring/src/test/java/org/apache/freemarker/spring/templateresolver/SpringResourceTemplateLoaderTest.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.freemarker.spring.templateresolver;
+
+import static org.hamcrest.Matchers.containsString;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+
+import org.apache.freemarker.core.Configuration;
+import org.apache.freemarker.core.TemplateNotFoundException;
+import org.apache.freemarker.test.TestConfigurationBuilder;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.GenericApplicationContext;
+
+public class SpringResourceTemplateLoaderTest {
+
+    private static final String TEMPLATE_BASE_PATH = "classpath:META-INF/templates/";
+
+    private GenericApplicationContext appContext;
+    private SpringResourceTemplateLoader templateLoader;
+    private Configuration cfg;
+
+    @Before
+    public void setUp() throws IOException {
+        appContext = new GenericApplicationContext();
+        templateLoader = new SpringResourceTemplateLoader();
+        templateLoader.setResourceLoader(appContext);
+        cfg = new TestConfigurationBuilder().templateLoader(templateLoader).build();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        if (appContext.isActive()) {
+            appContext.stop();
+            appContext.destroy();
+            appContext.close();
+        }
+    }
+
+    @Test
+    public void testSuccessful() throws Exception {
+        for (int i = 0; i < 2; i++) {
+            assertEquals("foo", cfg.getTemplate(TEMPLATE_BASE_PATH + "sub1/sub2/t.ftl").toString());
+        }
+    }
+
+    @Test
+    public void testNotFound() throws Exception {
+        for (int i = 0; i < 2; i++) {
+            try {
+                cfg.getTemplate(TEMPLATE_BASE_PATH + "sub1X/sub2/t.ftl");
+                fail();
+            } catch (TemplateNotFoundException e) {
+                assertThat(e.getMessage(), containsString("sub1X"));
+                assertNull(e.getCause());
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a571c24f/freemarker-spring/src/test/resources/META-INF/templates/sub1/sub2/t.ftl
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/test/resources/META-INF/templates/sub1/sub2/t.ftl b/freemarker-spring/src/test/resources/META-INF/templates/sub1/sub2/t.ftl
new file mode 100644
index 0000000..1910281
--- /dev/null
+++ b/freemarker-spring/src/test/resources/META-INF/templates/sub1/sub2/t.ftl
@@ -0,0 +1 @@
+foo
\ No newline at end of file


[8/9] incubator-freemarker git commit: freemareker-spring module, basic functionality

Posted by dd...@apache.org.
freemareker-spring module, basic functionality

Merge commit 'refs/pull/23/head' of https://github.com/apache/incubator-freemarker into 3

Conflicts:
	settings.gradle


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/886fd666
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/886fd666
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/886fd666

Branch: refs/heads/3
Commit: 886fd66684d06d161dbc1b139eb1a35f01030420
Parents: c73dc56 fc1f429
Author: ddekany <dd...@apache.org>
Authored: Sun Jun 18 16:26:51 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sun Jun 18 16:26:51 2017 +0200

----------------------------------------------------------------------
 freemarker-spring/build.gradle                  |  99 +++++++++++++++
 .../spring/ConfigurationFactoryBean.java        | 118 +++++++++++++++++
 .../SpringResourceTemplateLoader.java           | 123 ++++++++++++++++++
 .../spring/ConfigurationFactoryBeanTest.java    | 127 +++++++++++++++++++
 .../SpringResourceTemplateLoaderTest.java       |  82 ++++++++++++
 .../META-INF/templates/sub1/sub2/t.ftl          |   1 +
 settings.gradle                                 |   2 +-
 7 files changed, 551 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/886fd666/settings.gradle
----------------------------------------------------------------------
diff --cc settings.gradle
index 1f07da1,2373331..f8f9b47
--- a/settings.gradle
+++ b/settings.gradle
@@@ -26,5 -26,5 +26,5 @@@ include 'freemarker-servlet
  include 'freemarker-test-utils'
  include 'freemarker-manual'
  include 'freemarker-dom'
+ include 'freemarker-spring'
 -
 +include 'freemarker-converter'
- 


[9/9] incubator-freemarker git commit: Fixed JavaDoc error in freemarker-converter

Posted by dd...@apache.org.
Fixed JavaDoc error in freemarker-converter


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/1988dc0c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/1988dc0c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/1988dc0c

Branch: refs/heads/3
Commit: 1988dc0c88931757ccc7d82b2f711fe67b958090
Parents: 886fd66
Author: ddekany <dd...@apache.org>
Authored: Sun Jun 18 16:30:14 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sun Jun 18 16:30:14 2017 +0200

----------------------------------------------------------------------
 .../src/main/java/freemarker/core/FM2ASTToFM3SourceConverter.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/1988dc0c/freemarker-converter/src/main/java/freemarker/core/FM2ASTToFM3SourceConverter.java
----------------------------------------------------------------------
diff --git a/freemarker-converter/src/main/java/freemarker/core/FM2ASTToFM3SourceConverter.java b/freemarker-converter/src/main/java/freemarker/core/FM2ASTToFM3SourceConverter.java
index 0c95e1d..6afcfa1 100644
--- a/freemarker-converter/src/main/java/freemarker/core/FM2ASTToFM3SourceConverter.java
+++ b/freemarker-converter/src/main/java/freemarker/core/FM2ASTToFM3SourceConverter.java
@@ -42,7 +42,8 @@ import freemarker.template.Template;
  * the insignificant white-space and comments inside the tags is even trickier.
  * This information has to be restored from the source code string ({@link #src}), based on the positions (begin/end
  * column/row number) of the AST nodes, and sometimes that has to be combined with some simple manual parsing.
- * <li>Do not hard-code "<" and ">" into the code where you should use {@link #tagBeginChar} and {@link #tagEndChar}.
+ * <li>Do not hard-code "&lt;" and "&gt;" into the code where you should use {@link #tagBeginChar} and
+ * {@link #tagEndChar}.
  * <li>Stopping with error is always better than risking incorrect output. Use assertions. Don't be permissive with
  * unexpected input.
  * <li>Generally, try to use node parameters (via {@link #getOnlyParam(TemplateObject, ParameterRole, Class)},


[3/9] incubator-freemarker git commit: feature/FREEMARKER-54: ConfigurationFactoryBean tests

Posted by dd...@apache.org.
feature/FREEMARKER-54: ConfigurationFactoryBean tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/2783387e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/2783387e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/2783387e

Branch: refs/heads/3
Commit: 2783387eb495331042e72449f02b2a18527a9e13
Parents: 57270ec
Author: Woonsan Ko <wo...@apache.org>
Authored: Thu Jun 15 00:37:24 2017 -0400
Committer: Woonsan Ko <wo...@apache.org>
Committed: Thu Jun 15 00:37:24 2017 -0400

----------------------------------------------------------------------
 .../freemarker/spring/ConfigurationFactoryBean.java     |  2 ++
 .../freemarker/spring/ConfigurationFactoryBeanTest.java | 12 ++++++++++++
 2 files changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2783387e/freemarker-spring/src/main/java/org/apache/freemarker/spring/ConfigurationFactoryBean.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/ConfigurationFactoryBean.java b/freemarker-spring/src/main/java/org/apache/freemarker/spring/ConfigurationFactoryBean.java
index ead823d..2761b9a 100644
--- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/ConfigurationFactoryBean.java
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/ConfigurationFactoryBean.java
@@ -44,6 +44,8 @@ public class ConfigurationFactoryBean extends ExtendableBuilder<ConfigurationFac
     private Map<String, String> settings = new LinkedHashMap<>();
 
     public ConfigurationFactoryBean() {
+        // By default, set the default version constant.
+        // #setIncompatibleImprovements(Version) can be used to change it.
         super(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS);
 
         delegate = new AbstractFactoryBean<Configuration>() {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/2783387e/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java b/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java
index 7dcbcc5..82a5e74 100644
--- a/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java
+++ b/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java
@@ -18,13 +18,16 @@
  */
 package org.apache.freemarker.spring;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
+import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
 import org.apache.freemarker.core.Configuration;
 import org.apache.freemarker.core.Configuration.ExtendableBuilder;
+import org.apache.freemarker.core.Version;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -55,9 +58,15 @@ public class ConfigurationFactoryBeanTest {
         final Map<String, String> settings = new LinkedHashMap<>();
         settings.put(ExtendableBuilder.LOCALIZED_TEMPLATE_LOOKUP_KEY_CAMEL_CASE, "true");
 
+        final Map<String, Object> sharedVars = new HashMap<>();
+        sharedVars.put("sharedVar1", "sharedVal1");
+        sharedVars.put("sharedVar2", "sharedVal2");
+
         BeanDefinition beanDef =
                 BeanDefinitionBuilder.genericBeanDefinition(ConfigurationFactoryBean.class.getName())
+                .addPropertyValue("incompatibleImprovements", new Version(3, 0, 0))
                 .addPropertyValue("settings", settings)
+                .addPropertyValue("sharedVariables", sharedVars)
                 .getBeanDefinition();
 
         appContext.registerBeanDefinition("freemarkerConfig", beanDef);
@@ -68,7 +77,10 @@ public class ConfigurationFactoryBeanTest {
         assertTrue("Not a Configuration object: " + bean, bean instanceof Configuration);
 
         Configuration config = (Configuration) bean;
+        assertEquals(new Version(3, 0, 0), config.getIncompatibleImprovements());
         assertTrue(config.getLocalizedTemplateLookup());
+        assertEquals("sharedVal1", config.getSharedVariables().get("sharedVar1"));
+        assertEquals("sharedVal2", config.getSharedVariables().get("sharedVar2"));
     }
 
 }


[2/9] incubator-freemarker git commit: FREEMARKER-54: initial ConfigurationFactoryBean design

Posted by dd...@apache.org.
FREEMARKER-54: initial ConfigurationFactoryBean design


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/57270ecf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/57270ecf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/57270ecf

Branch: refs/heads/3
Commit: 57270ecf85744c5c6ca566c89f21f721a7a9d59a
Parents: dbbfe99
Author: Woonsan Ko <wo...@apache.org>
Authored: Thu Jun 15 00:10:58 2017 -0400
Committer: Woonsan Ko <wo...@apache.org>
Committed: Thu Jun 15 00:10:58 2017 -0400

----------------------------------------------------------------------
 freemarker-spring/build.gradle                  |  13 +--
 .../spring/ConfigurationFactoryBean.java        | 115 +++++++++++++++++++
 .../spring/SpringConfigurationBuilder.java      |  30 -----
 .../spring/ConfigurationFactoryBeanTest.java    |  74 ++++++++++++
 4 files changed, 194 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/57270ecf/freemarker-spring/build.gradle
----------------------------------------------------------------------
diff --git a/freemarker-spring/build.gradle b/freemarker-spring/build.gradle
index fa32eac..d5f7e15 100644
--- a/freemarker-spring/build.gradle
+++ b/freemarker-spring/build.gradle
@@ -29,22 +29,19 @@ dependencies {
 
     def springVersion = "4.3.9.RELEASE"
 
-    compileOnly("org.springframework:spring-core:$springVersion") {
+    compile("org.springframework:spring-core:$springVersion") {
         exclude group: "commons-logging", module: "commons-logging"
     }
-    compileOnly("org.springframework:spring-beans:$springVersion") {
+    compile("org.springframework:spring-beans:$springVersion") {
         exclude group: "commons-logging", module: "commons-logging"
     }
-    compileOnly("org.springframework:spring-context:$springVersion") {
+    compile("org.springframework:spring-context:$springVersion") {
         exclude group: "commons-logging", module: "commons-logging"
     }
-    compileOnly("org.springframework:spring-context-support:$springVersion") {
+    compile("org.springframework:spring-web:$springVersion") {
         exclude group: "commons-logging", module: "commons-logging"
     }
-    compileOnly("org.springframework:spring-web:$springVersion") {
-        exclude group: "commons-logging", module: "commons-logging"
-    }
-    compileOnly("org.springframework:spring-webmvc:$springVersion") {
+    compile("org.springframework:spring-webmvc:$springVersion") {
         exclude group: "commons-logging", module: "commons-logging"
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/57270ecf/freemarker-spring/src/main/java/org/apache/freemarker/spring/ConfigurationFactoryBean.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/ConfigurationFactoryBean.java b/freemarker-spring/src/main/java/org/apache/freemarker/spring/ConfigurationFactoryBean.java
new file mode 100644
index 0000000..ead823d
--- /dev/null
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/ConfigurationFactoryBean.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.freemarker.spring;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.apache.freemarker.core.Configuration;
+import org.apache.freemarker.core.Configuration.ExtendableBuilder;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanClassLoaderAware;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.BeanFactoryAware;
+import org.springframework.beans.factory.DisposableBean;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.config.AbstractFactoryBean;
+
+/**
+ * Configuration factory bean to support Spring Framework applications.
+ */
+public class ConfigurationFactoryBean extends ExtendableBuilder<ConfigurationFactoryBean>
+        implements FactoryBean<Configuration>, BeanClassLoaderAware, BeanFactoryAware, InitializingBean, DisposableBean {
+
+    private AbstractFactoryBean<Configuration> delegate;
+
+    private Map<String, String> settings = new LinkedHashMap<>();
+
+    public ConfigurationFactoryBean() {
+        super(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS);
+
+        delegate = new AbstractFactoryBean<Configuration>() {
+
+            @Override
+            public Class<?> getObjectType() {
+                return Configuration.class;
+            }
+
+            @Override
+            protected Configuration createInstance() throws Exception {
+                for (Map.Entry<String, String> entry : settings.entrySet()) {
+                    setSetting(entry.getKey(), entry.getValue());
+                }
+
+                return build();
+            }
+
+        };
+    }
+
+    public Map<String, String> getSettings() {
+        return Collections.unmodifiableMap(settings);
+    }
+
+    public void setSettings(Map<String, String> settings) {
+        this.settings.putAll(settings);
+    }
+
+    @Override
+    public Configuration getObject() throws Exception {
+        return delegate.getObject();
+    }
+
+    @Override
+    public Class<?> getObjectType() {
+        return delegate.getObjectType();
+    }
+
+    public void setSingleton(boolean singleton) {
+        delegate.setSingleton(singleton);
+    }
+
+    @Override
+    public boolean isSingleton() {
+        return delegate.isSingleton();
+    }
+
+    @Override
+    public void destroy() throws Exception {
+        delegate.destroy();
+    }
+
+    @Override
+    public void afterPropertiesSet() throws Exception {
+        delegate.afterPropertiesSet();
+    }
+
+    @Override
+    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
+        delegate.setBeanFactory(beanFactory);
+    }
+
+    @Override
+    public void setBeanClassLoader(ClassLoader classLoader) {
+        delegate.setBeanClassLoader(classLoader);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/57270ecf/freemarker-spring/src/main/java/org/apache/freemarker/spring/SpringConfigurationBuilder.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/SpringConfigurationBuilder.java b/freemarker-spring/src/main/java/org/apache/freemarker/spring/SpringConfigurationBuilder.java
deleted file mode 100644
index ac0d963..0000000
--- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/SpringConfigurationBuilder.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.freemarker.spring;
-
-import org.apache.freemarker.core.Configuration.ExtendableBuilder;
-import org.apache.freemarker.core.Version;
-
-public class SpringConfigurationBuilder extends ExtendableBuilder {
-
-    public SpringConfigurationBuilder(Version incompatibleImprovements) {
-        super(incompatibleImprovements);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/57270ecf/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java b/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java
new file mode 100644
index 0000000..7dcbcc5
--- /dev/null
+++ b/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.freemarker.spring;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.apache.freemarker.core.Configuration;
+import org.apache.freemarker.core.Configuration.ExtendableBuilder;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.context.support.GenericApplicationContext;
+
+public class ConfigurationFactoryBeanTest {
+
+    private GenericApplicationContext appContext;
+
+    @Before
+    public void setUp() throws Exception {
+        appContext = new GenericApplicationContext();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        if (appContext.isActive()) {
+            appContext.stop();
+            appContext.destroy();
+            appContext.close();
+        }
+    }
+
+    @Test
+    public void testConfigurationFactoryBeanDefinition() throws Exception {
+        final Map<String, String> settings = new LinkedHashMap<>();
+        settings.put(ExtendableBuilder.LOCALIZED_TEMPLATE_LOOKUP_KEY_CAMEL_CASE, "true");
+
+        BeanDefinition beanDef =
+                BeanDefinitionBuilder.genericBeanDefinition(ConfigurationFactoryBean.class.getName())
+                .addPropertyValue("settings", settings)
+                .getBeanDefinition();
+
+        appContext.registerBeanDefinition("freemarkerConfig", beanDef);
+        appContext.refresh();
+        appContext.start();
+
+        Object bean = appContext.getBean("freemarkerConfig");
+        assertTrue("Not a Configuration object: " + bean, bean instanceof Configuration);
+
+        Configuration config = (Configuration) bean;
+        assertTrue(config.getLocalizedTemplateLookup());
+    }
+
+}


[4/9] incubator-freemarker git commit: FREEMARKER-54: More setting tests through ConfigurationFactoryBean

Posted by dd...@apache.org.
FREEMARKER-54: More setting tests through ConfigurationFactoryBean


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/99c3c0cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/99c3c0cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/99c3c0cb

Branch: refs/heads/3
Commit: 99c3c0cb45cf500a0fc914332a88f78e17c9d5e6
Parents: 2783387
Author: Woonsan Ko <wo...@apache.org>
Authored: Thu Jun 15 23:15:08 2017 -0400
Committer: Woonsan Ko <wo...@apache.org>
Committed: Thu Jun 15 23:15:08 2017 -0400

----------------------------------------------------------------------
 .../spring/ConfigurationFactoryBean.java        |  1 +
 .../spring/ConfigurationFactoryBeanTest.java    | 46 ++++++++++++++++++--
 2 files changed, 44 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99c3c0cb/freemarker-spring/src/main/java/org/apache/freemarker/spring/ConfigurationFactoryBean.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/main/java/org/apache/freemarker/spring/ConfigurationFactoryBean.java b/freemarker-spring/src/main/java/org/apache/freemarker/spring/ConfigurationFactoryBean.java
index 2761b9a..da275e7 100644
--- a/freemarker-spring/src/main/java/org/apache/freemarker/spring/ConfigurationFactoryBean.java
+++ b/freemarker-spring/src/main/java/org/apache/freemarker/spring/ConfigurationFactoryBean.java
@@ -72,6 +72,7 @@ public class ConfigurationFactoryBean extends ExtendableBuilder<ConfigurationFac
     }
 
     public void setSettings(Map<String, String> settings) {
+        this.settings.clear();
         this.settings.putAll(settings);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99c3c0cb/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java b/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java
index 82a5e74..59261aa 100644
--- a/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java
+++ b/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java
@@ -19,15 +19,25 @@
 package org.apache.freemarker.spring;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import java.nio.charset.Charset;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
+import org.apache.freemarker.core.AutoEscapingPolicy;
 import org.apache.freemarker.core.Configuration;
 import org.apache.freemarker.core.Configuration.ExtendableBuilder;
+import org.apache.freemarker.core.MutableParsingAndProcessingConfiguration;
+import org.apache.freemarker.core.NamingConvention;
+import org.apache.freemarker.core.TagSyntax;
+import org.apache.freemarker.core.TemplateLanguage;
 import org.apache.freemarker.core.Version;
+import org.apache.freemarker.core.model.impl.RestrictedObjectWrapper;
+import org.apache.freemarker.core.templateresolver.CacheStorage;
+import org.apache.freemarker.core.templateresolver.impl.MruCacheStorage;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -54,9 +64,22 @@ public class ConfigurationFactoryBeanTest {
     }
 
     @Test
-    public void testConfigurationFactoryBeanDefinition() throws Exception {
+    public void testConfigurationFactoryBeanSettings() throws Exception {
         final Map<String, String> settings = new LinkedHashMap<>();
-        settings.put(ExtendableBuilder.LOCALIZED_TEMPLATE_LOOKUP_KEY_CAMEL_CASE, "true");
+
+        settings.put(MutableParsingAndProcessingConfiguration.SOURCE_ENCODING_KEY, "UTF-8");
+        settings.put(MutableParsingAndProcessingConfiguration.WHITESPACE_STRIPPING_KEY, "true");
+        settings.put(MutableParsingAndProcessingConfiguration.AUTO_ESCAPING_POLICY_KEY, "enableIfSupported");
+        settings.put(MutableParsingAndProcessingConfiguration.RECOGNIZE_STANDARD_FILE_EXTENSIONS_KEY, "true");
+        settings.put(MutableParsingAndProcessingConfiguration.TEMPLATE_LANGUAGE_KEY, "FTL");
+        settings.put(MutableParsingAndProcessingConfiguration.TAG_SYNTAX_KEY, "squareBracket");
+        settings.put(MutableParsingAndProcessingConfiguration.NAMING_CONVENTION_KEY, "camelCase");
+        settings.put(MutableParsingAndProcessingConfiguration.TAB_SIZE_KEY, "4");
+
+        settings.put(ExtendableBuilder.OBJECT_WRAPPER_KEY, "restricted");
+        settings.put(ExtendableBuilder.LOCALIZED_TEMPLATE_LOOKUP_KEY, "false");
+        settings.put(ExtendableBuilder.TEMPLATE_CACHE_STORAGE_KEY, "strong:20, soft:250");
+        settings.put(ExtendableBuilder.TEMPLATE_UPDATE_DELAY_KEY, "1m");
 
         final Map<String, Object> sharedVars = new HashMap<>();
         sharedVars.put("sharedVar1", "sharedVal1");
@@ -77,8 +100,25 @@ public class ConfigurationFactoryBeanTest {
         assertTrue("Not a Configuration object: " + bean, bean instanceof Configuration);
 
         Configuration config = (Configuration) bean;
+
         assertEquals(new Version(3, 0, 0), config.getIncompatibleImprovements());
-        assertTrue(config.getLocalizedTemplateLookup());
+        assertEquals(Charset.forName("UTF-8"), config.getSourceEncoding());
+        assertTrue(config.isWhitespaceStrippingSet());
+        assertEquals(AutoEscapingPolicy.ENABLE_IF_SUPPORTED, config.getAutoEscapingPolicy());
+        assertTrue(config.isRecognizeStandardFileExtensionsSet());
+        assertEquals(TemplateLanguage.FTL, config.getTemplateLanguage());
+        assertEquals(TagSyntax.SQUARE_BRACKET, config.getTagSyntax());
+        assertEquals(NamingConvention.CAMEL_CASE, config.getNamingConvention());
+        assertEquals(4, config.getTabSize());
+
+        assertTrue(config.getObjectWrapper() instanceof RestrictedObjectWrapper);
+        assertFalse(config.getLocalizedTemplateLookup());
+        CacheStorage cacheStorage = config.getTemplateCacheStorage();
+        assertTrue(cacheStorage instanceof MruCacheStorage);
+        assertEquals(20, ((MruCacheStorage) cacheStorage).getStrongSizeLimit());
+        assertEquals(250, ((MruCacheStorage) cacheStorage).getSoftSizeLimit());
+        assertEquals(60000, config.getTemplateUpdateDelayMilliseconds().longValue());
+
         assertEquals("sharedVal1", config.getSharedVariables().get("sharedVar1"));
         assertEquals("sharedVal2", config.getSharedVariables().get("sharedVar2"));
     }


[5/9] incubator-freemarker git commit: FREEMARKER-54: use property wherever easier than settings map.

Posted by dd...@apache.org.
FREEMARKER-54: use property wherever easier than settings map.


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/18ee8a08
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/18ee8a08
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/18ee8a08

Branch: refs/heads/3
Commit: 18ee8a0846dbbbf4b853af8f76509f331bfb07ae
Parents: 99c3c0c
Author: Woonsan Ko <wo...@apache.org>
Authored: Thu Jun 15 23:23:42 2017 -0400
Committer: Woonsan Ko <wo...@apache.org>
Committed: Thu Jun 15 23:23:42 2017 -0400

----------------------------------------------------------------------
 .../apache/freemarker/spring/ConfigurationFactoryBeanTest.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18ee8a08/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java
----------------------------------------------------------------------
diff --git a/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java b/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java
index 59261aa..0938f5b 100644
--- a/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java
+++ b/freemarker-spring/src/test/java/org/apache/freemarker/spring/ConfigurationFactoryBeanTest.java
@@ -77,19 +77,20 @@ public class ConfigurationFactoryBeanTest {
         settings.put(MutableParsingAndProcessingConfiguration.TAB_SIZE_KEY, "4");
 
         settings.put(ExtendableBuilder.OBJECT_WRAPPER_KEY, "restricted");
-        settings.put(ExtendableBuilder.LOCALIZED_TEMPLATE_LOOKUP_KEY, "false");
         settings.put(ExtendableBuilder.TEMPLATE_CACHE_STORAGE_KEY, "strong:20, soft:250");
-        settings.put(ExtendableBuilder.TEMPLATE_UPDATE_DELAY_KEY, "1m");
 
         final Map<String, Object> sharedVars = new HashMap<>();
         sharedVars.put("sharedVar1", "sharedVal1");
         sharedVars.put("sharedVar2", "sharedVal2");
 
+        // Creating bean definition which is equivalent to <bean/> element in Spring XML configuration.
         BeanDefinition beanDef =
                 BeanDefinitionBuilder.genericBeanDefinition(ConfigurationFactoryBean.class.getName())
                 .addPropertyValue("incompatibleImprovements", new Version(3, 0, 0))
                 .addPropertyValue("settings", settings)
                 .addPropertyValue("sharedVariables", sharedVars)
+                .addPropertyValue("templateUpdateDelayMilliseconds", 60000)
+                .addPropertyValue("localizedTemplateLookup", "false")
                 .getBeanDefinition();
 
         appContext.registerBeanDefinition("freemarkerConfig", beanDef);


[7/9] incubator-freemarker git commit: Merge branch '3' into feature/FREEMARKER-54

Posted by dd...@apache.org.
Merge branch '3' into feature/FREEMARKER-54


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/fc1f429c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/fc1f429c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/fc1f429c

Branch: refs/heads/3
Commit: fc1f429cc4174b8ced71617074718715b81ee575
Parents: a571c24 cb4a93d
Author: Woonsan Ko <wo...@apache.org>
Authored: Sat Jun 17 23:45:59 2017 -0400
Committer: Woonsan Ko <wo...@apache.org>
Committed: Sat Jun 17 23:45:59 2017 -0400

----------------------------------------------------------------------
 build.gradle                                    |   7 +-
 .../org/apache/freemarker/core/ASTPrinter.java  |   2 +-
 .../org/apache/freemarker/core/ast-1.ast        |   2 +-
 .../org/apache/freemarker/core/ast-range.ast    |  26 ++--
 .../org/apache/freemarker/core/ASTComment.java  |   2 +-
 .../apache/freemarker/core/ASTDebugBreak.java   |   2 +-
 .../freemarker/core/ASTDirAssignment.java       |  24 ++--
 .../core/ASTDirAssignmentsContainer.java        |   2 +-
 .../core/ASTDirAttemptRecoverContainer.java     |   8 +-
 .../apache/freemarker/core/ASTDirAutoEsc.java   |   6 +-
 .../org/apache/freemarker/core/ASTDirBreak.java |   4 +-
 .../core/ASTDirCapturingAssignment.java         |   6 +-
 .../org/apache/freemarker/core/ASTDirCase.java  |   4 +-
 .../apache/freemarker/core/ASTDirCompress.java  |   6 +-
 .../freemarker/core/ASTDirElseOfList.java       |   6 +-
 .../apache/freemarker/core/ASTDirEscape.java    |   6 +-
 .../apache/freemarker/core/ASTDirFallback.java  |   4 +-
 .../org/apache/freemarker/core/ASTDirFlush.java |   4 +-
 .../core/ASTDirIfElseIfElseContainer.java       |   4 +-
 .../freemarker/core/ASTDirIfOrElseOrElseIf.java |   4 +-
 .../apache/freemarker/core/ASTDirImport.java    |   4 +-
 .../apache/freemarker/core/ASTDirInclude.java   |   4 +-
 .../org/apache/freemarker/core/ASTDirItems.java |   8 +-
 .../org/apache/freemarker/core/ASTDirList.java  |   6 +-
 .../core/ASTDirListElseContainer.java           |   4 +-
 .../org/apache/freemarker/core/ASTDirMacro.java |   6 +-
 .../apache/freemarker/core/ASTDirNested.java    |   4 +-
 .../apache/freemarker/core/ASTDirNoAutoEsc.java |   6 +-
 .../apache/freemarker/core/ASTDirNoEscape.java  |   8 +-
 .../freemarker/core/ASTDirOutputFormat.java     |   8 +-
 .../apache/freemarker/core/ASTDirRecover.java   |   6 +-
 .../apache/freemarker/core/ASTDirRecurse.java   |   4 +-
 .../apache/freemarker/core/ASTDirReturn.java    |   4 +-
 .../org/apache/freemarker/core/ASTDirSep.java   |   8 +-
 .../apache/freemarker/core/ASTDirSetting.java   |   4 +-
 .../org/apache/freemarker/core/ASTDirStop.java  |   4 +-
 .../apache/freemarker/core/ASTDirSwitch.java    |   6 +-
 .../apache/freemarker/core/ASTDirTOrTrOrTl.java |   4 +-
 .../freemarker/core/ASTDirUserDefined.java      |   2 +-
 .../org/apache/freemarker/core/ASTDirVisit.java |   4 +-
 .../freemarker/core/ASTDollarInterpolation.java |   2 +-
 .../org/apache/freemarker/core/ASTElement.java  |   2 +-
 .../freemarker/core/ASTExpAddOrConcat.java      |   2 +-
 .../org/apache/freemarker/core/ASTExpAnd.java   |   2 +-
 .../freemarker/core/ASTExpArithmetic.java       | 129 +++++++++++++++++++
 .../freemarker/core/ASTExpBooleanLiteral.java   |   2 +-
 .../apache/freemarker/core/ASTExpBuiltIn.java   |   2 +-
 .../freemarker/core/ASTExpBuiltInVariable.java  |   2 +-
 .../freemarker/core/ASTExpComparison.java       |   2 +-
 .../apache/freemarker/core/ASTExpDefault.java   |   2 +-
 .../org/apache/freemarker/core/ASTExpDot.java   |   4 +-
 .../freemarker/core/ASTExpDynamicKeyName.java   |   2 +-
 .../apache/freemarker/core/ASTExpExists.java    |   4 +-
 .../freemarker/core/ASTExpHashLiteral.java      |   2 +-
 .../freemarker/core/ASTExpListLiteral.java      |   2 +-
 .../freemarker/core/ASTExpMethodCall.java       |   2 +-
 .../freemarker/core/ASTExpNegateOrPlus.java     |   2 +-
 .../org/apache/freemarker/core/ASTExpNot.java   |   2 +-
 .../freemarker/core/ASTExpNumberLiteral.java    |   2 +-
 .../org/apache/freemarker/core/ASTExpOr.java    |   2 +-
 .../freemarker/core/ASTExpParenthesis.java      |   2 +-
 .../org/apache/freemarker/core/ASTExpRange.java |   4 +-
 .../freemarker/core/ASTExpStringLiteral.java    |   2 +-
 .../apache/freemarker/core/ASTExpVariable.java  |   2 +-
 .../freemarker/core/ASTHashInterpolation.java   |   2 +-
 .../freemarker/core/ASTImplicitParent.java      |   4 +-
 .../org/apache/freemarker/core/ASTNode.java     |   9 +-
 .../apache/freemarker/core/ASTStaticText.java   |   2 +-
 .../freemarker/core/ArithmeticExpression.java   | 129 -------------------
 .../core/BuiltInWithParseTimeParameters.java    |   4 +-
 .../freemarker/core/ParsingConfiguration.java   |   5 +-
 ...nterruptionSupportTemplatePostProcessor.java |   4 +-
 .../core/_ErrorDescriptionBuilder.java          |   2 +-
 freemarker-core/src/main/javacc/FTL.jj          |  12 +-
 freemarker-test-utils/build.gradle              |   8 +-
 .../src/main/resources/logback-test.xml         |   1 +
 76 files changed, 300 insertions(+), 296 deletions(-)
----------------------------------------------------------------------