You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:14:02 UTC
[sling-org-apache-sling-scripting-thymeleaf] annotated tag
org.apache.sling.scripting.thymeleaf-1.1.0 created (now 3d4e227)
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a change to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git.
at 3d4e227 (tag)
tagging 50d10e8f0884b1de0b36290a0a6850ed0c642a17 (commit)
by Oliver Lietz
on Fri Mar 17 13:46:28 2017 +0000
- Log -----------------------------------------------------------------
org.apache.sling.scripting.thymeleaf-1.1.0
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new bc1a745 SLING-3649 add initial version of Apache Sling Scripting Thymeleaf
new accb73b SLING-3649 make Thymeleaf scripting configurable and extensible
new e8d40f4 SLING-3649 set default pattern for Html5TemplateModeHandler to *.html
new d34e798 SLING-3649 add patterns descriptions for template mode handlers
new 11ea142 SLING-3649 fix issue with fragments (use Sling's ResourceResolver instead of supplied Reader)
new 02c4d1b SLING-3649 fix label
new 0cc1b60 SLING-3649 make encoding for reading templates configurable
new ebac0f9 SLING-3649 make encoding for reading templates configurable
new e637d3d SLING-3649 down to v19 of parent pom (Java 6 is sufficient again)
new 9fa0ac3 SLING-3649 add ResourceResolver to features
new 6725c44 SLING-3649 add list of relevant Thymeleaf issues
new bd80b51 svn:ignore
new 26513f4 SLING-3649 throw UnsupportedOperationException when deprecated methods are called
new 4527531 SLING-3649 annotate interfaces with @ProviderType and export package org.apache.sling.scripting.thymeleaf
new 8e58ef2 SLING-3649 set version of package org.apache.sling.scripting.thymeleaf to 0.0.2
new f45e9cd [maven-release-plugin] prepare release org.apache.sling.scripting.thymeleaf-0.0.2
new 0d1675d [maven-release-plugin] prepare for next development iteration
new 406426c cleanup/style
new 4c26df6 move classes to package impl
new 248da0a update to parent version 20
new 17c8df7 SLING-3908 embed OGNL to avoid class loading issues
new 6288e10 make bind/unbind synchronized
new cabfbcf [maven-release-plugin] prepare release org.apache.sling.scripting.thymeleaf-0.0.4
new eccb7fc [maven-release-plugin] prepare for next development iteration
new 538b7d0 Update to Sling Parent POM 22 with baselining enabled
new 4ae4686 style, add paragraph Installation
new a166693 rename package impl to internal
new d692342 SLING-4276 update Thymeleaf to 2.1.4
new 9737816 prevent inlining of original AbstractHtmlTemplateParser* classes (default merge-first for split package org.thymeleaf.templateparser.html seems to be broken)
new c1f41d9 SLING-4296 add support for custom dialects
new 571c102 SLING-4297 add a dialect and processors to provide out-of-the-box support for a Sling Include
new b403330 SLING-4297 SLING-4298 align usage
new eaf5500 SLING-4396 make template mode handlers configuration driven
new a3af69b SLING-4297 add a dialect and processors to provide out-of-the-box support for a Sling Include
new 2735b1f SLING-4297 add a dialect and processors to provide out-of-the-box support for a Sling Include
new ab4b6b9 embed CaptureResponseWrapper from Scripting Core and use released version
new 6ab46f9 SLING-4297 add a dialect and processors to provide out-of-the-box support for a Sling Include
new b630890 style
new d31cbe1 SLING-4508 export packages of embedded Thymeleaf
new ec8add3 add SlingDialect to features
new 8cc78ef Remove unused attribtes
new e8ad0e0 SLING-4686 use ResourceResolver from ScriptContext/Bindings in SlingWebContext
new 89c8ad0 SLING-4698 - Set parent.relativePath to empty for all modules
new 709bb9d Update contrib modules to Parent 23
new c9c21a1 Contrib: remove superflous sling.java.version=6 as it's the default now
new 94be070 set parent version to 24 and add empty relativePath where missing
new a8e2a1e add some javadoc
new 8526ccf take over update from org.apache.sling.scripting.core (add some javadoc)
new 0cd20f4 [maven-release-plugin] prepare release org.apache.sling.scripting.thymeleaf-0.0.6
new 0e22f3f [maven-release-plugin] prepare for next development iteration
new 0beed6b ignore package org.thymeleaf when baselining
new 501eaa8 SLING-4884 remove embedded CaptureResponseWrapper
new a1cd3cb SLING-5075 upgrade Thymeleaf to 3.0
new c6e9cdc Update the contrib reactor to parent 25
new 1c6067b SLING-5351 Thymeleaf fails loading version from properties
new 1e705d1 SLING-5075 Upgrade Thymeleaf to 3.0
new 2f5a44c SLING-5075 Upgrade Thymeleaf to 3.0
new e6340bb SLING-5075 Upgrade Thymeleaf to 3.0
new 531742c Switch to parent pom 26
new 9606b65 SLING-5075 Upgrade Thymeleaf to 3.0
new 1effe5e rename thymeleaf org.apache.sling.scripting.thymeleaf
new cc704ee use Java 7 for now (fix CI build)
new 0b5223b remove redundant configuration (sling.java.version) from Maven Compiler Plugin
new f0e447e SLING-5518 Get resource resolver from bindings by using SlingBindings.RESOLVER
new 9a238ba SLING-5075 Upgrade Thymeleaf to 3.0
new 2e8b800 SLING-5075 Upgrade Thymeleaf to 3.0
new 757a230 SLING-5663 Make Thymeleaf TemplateEngine available as service
new bb9ba99 SLING-5663 Make Thymeleaf TemplateEngine available as service
new d4d9fb7 style
new 7d6b359 fix scm settings
new ab81f83 SLING-5075 Upgrade Thymeleaf to 3.0
new 0b55cfb SLING-5685 Upgrade Commons IO to 2.5
new d720b71 fix typo
new eec0019 SLING-5075 Upgrade Thymeleaf to 3.0
new 25083ed SLING-5075 Upgrade Thymeleaf to 3.0
new 3a311c9 SLING-5075 Upgrade Thymeleaf to 3.0
new c630101 SLING-5075 Upgrade Thymeleaf to 3.0
new 025aeb5 SLING-5075 Upgrade Thymeleaf to 3.0
new 0e72572 fix exists():boolean
new 6b468df rename NonCachingTemplateResolver to SlingResourceTemplateResolver (still non-caching, but the default one)
new 38395bc SLING-5075 Upgrade Thymeleaf to 3.0
new 10fa3a0 use class name
new 121068d SLING-5075 Upgrade Thymeleaf to 3.0
new 512cba0 SLING-5075 Upgrade Thymeleaf to 3.0
new d8033b1 SLING-5075 Upgrade Thymeleaf to 3.0
new cbf96a5 SLING-5075 Upgrade Thymeleaf to 3.0
new 2983f49 SLING-5075 Upgrade Thymeleaf to 3.0
new 4e61c04 SLING-5075 Upgrade Thymeleaf to 3.0
new 1390897 add null check
new 1e9f701 SLING-5075 Upgrade Thymeleaf to 3.0
new 04caf7d SLING-5075 Upgrade Thymeleaf to 3.0
new 515dfbc SLING-5075 Upgrade Thymeleaf to 3.0
new 6cfee8c SLING-5075 Upgrade Thymeleaf to 3.0
new 3f9dbeb SLING-5075 Upgrade Thymeleaf to 3.0
new d11e551 SLING-5075 Upgrade Thymeleaf to 3.0
new 2cc0572 SLING-5075 Upgrade Thymeleaf to 3.0
new aa757a6 update Sling i18n and SLF4J API
new 7061c9e [maven-release-plugin] prepare release org.apache.sling.scripting.thymeleaf-1.0.0
new f0053bd [maven-release-plugin] prepare for next development iteration
new 62ac279 SLING-5680 Add Integration Tests for Scripting Thymeleaf
new 9ed1eb4 add Thymeleaf issue 514
new d0f7553 do not keep caches
new 2b0cb46 add site (uml diagram)
new bb58f69 SLING-5680 Add Integration Tests for Scripting Thymeleaf
new d0c7a0c use Sling parent 27
new 5a19a4f SLING-5680 Add Integration Tests for Scripting Thymeleaf
new c7fc724 use org.apache.sling.testing.paxexam 0.0.2
new f0f66ea switch parent pom reference everywhere to 28 where it was 27 before this can be safely done because the only difference between 27 and 28 is an updated maven-source-plugin (fix heap space error)
new a8546c6 SLING-6047 SlingResourceTemplateResolver allows template resolution with decoupled logic enabled for non-markup template modes
new 4594cc2 fix positions of actual values and matchers
new 678f5de SLING-5680 Add Integration Tests for Scripting Thymeleaf
new 5ade656 SLING-6075 Update Thymeleaf to 3.0.2
new 9b12d69 Use parent 29
new d4f592c remove version of depends-maven-plugin (managed in Sling parent)
new 77be545 remove version of javax.inject (managed in Sling parent)
new 0823788 SLING-5928 Use Service ResourceResolver in SlingResourceTemplateResolver
new 67b2110 SLING-5135 - Whitelist legit usages of loginAdministrative and administrative ResourceResolver
new ea78e01 SLING-5135 - Whitelist legit usages of loginAdministrative and administrative ResourceResolver
new 9e0fd06 SLING-6285 - Implement LoginAdminWhitelist in JCR Base
new d35a48d SLING-6481 Update Thymeleaf to 3.0.3
new e3ff720 update dependencies
new da43b15 redirect test output to file
new 7ce68ad SLING-5928 Use Service ResourceResolver in SlingResourceTemplateResolver
new a93b728 SLING-5928 Use Service ResourceResolver in SlingResourceTemplateResolver
new dd8a8a5 SLING-6486 Use single pattern (regular expression) per template mode in PatternTemplateModeProvider
new 72ef564 SLING-6487 Prevent possible NPE (templateMode) in SlingResourceTemplateResolver
new f53dfda SLING-6486 Use single pattern (regular expression) per template mode in PatternTemplateModeProvider
new 49d6ecb SLING-6425 Update Pax Exam to 4.10
new a9c4822 do not resolve template when resource is null
new 95f5dc4 SLING-6557 Remove embedded AttoParser, Unbescape and OGNL dependencies from bundle
new 7bf9cdf remove unused import
new 93cf930 use Sling Parent 30-SNAPSHOT
new bf79fe5 SLING-6557 Remove embedded AttoParser, Unbescape and OGNL dependencies from bundle
new fad25c7 use Sling Parent 30
new 5f0caf3 use org.apache.felix.framework 5.6.2
new 8599135 [maven-release-plugin] prepare release org.apache.sling.scripting.thymeleaf-1.1.0
new 50d10e8 [maven-release-plugin] copy for tag org.apache.sling.scripting.thymeleaf-1.1.0
The 137 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
--
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].
[sling-org-apache-sling-scripting-thymeleaf] 33/39: remove unused
import
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 7bf9cdfee4f3b30f44e4063293a6b023ad39b971
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Mar 1 08:30:39 2017 +0000
remove unused import
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1784870 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
index 3df68df..7468cff 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
@@ -47,7 +47,6 @@ import static org.ops4j.pax.exam.CoreOptions.composite;
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
public abstract class ThymeleafTestSupport extends TestSupport {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 05/39: add site (uml
diagram)
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 2b0cb46b6c850e3a6f1dba10c7fa1863252984f7
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Jul 13 18:59:43 2016 +0000
add site (uml diagram)
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1752520 13f79535-47bb-0310-9956-ffa450edef68
---
src/site/diagram.png | Bin 0 -> 64028 bytes
src/site/thymeleaf.uml | 149 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 149 insertions(+)
diff --git a/src/site/diagram.png b/src/site/diagram.png
new file mode 100644
index 0000000..033bc39
Binary files /dev/null and b/src/site/diagram.png differ
diff --git a/src/site/thymeleaf.uml b/src/site/thymeleaf.uml
new file mode 100644
index 0000000..4e01a39
--- /dev/null
+++ b/src/site/thymeleaf.uml
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<Diagram>
+ <ID>JAVA</ID>
+ <OriginalElement>org.apache.sling.scripting.thymeleaf</OriginalElement>
+ <nodes>
+ <node x="1235.0" y="105.0">org.thymeleaf.templateparser.markup.decoupled.IDecoupledTemplateLogicResolver</node>
+ <node x="999.0" y="705.0">org.thymeleaf.dialect.IDialect</node>
+ <node x="1443.5" y="825.0">org.apache.sling.scripting.thymeleaf.internal.SlingResourceTemplateResolver</node>
+ <node x="971.0" y="-15.0">org.thymeleaf.ITemplateEngine</node>
+ <node x="1243.5" y="945.0">org.thymeleaf.templateresource.ITemplateResource</node>
+ <node x="768.5" y="705.0">org.thymeleaf.dialect.IProcessorDialect</node>
+ <node x="1191.5" y="825.0">org.apache.sling.scripting.thymeleaf.TemplateModeProvider</node>
+ <node x="1527.5" y="305.0">org.thymeleaf.messageresolver.IMessageResolver</node>
+ <node x="1141.5" y="425.0">org.apache.sling.scripting.thymeleaf.AbsentMessageRepresentationProvider</node>
+ <node x="1255.5" y="545.0">org.thymeleaf.cache.ICacheManager</node>
+ <node x="-39.0" y="105.0">javax.script.ScriptEngineFactory</node>
+ <node x="1306.0" y="225.0">org.thymeleaf.linkbuilder.ILinkBuilder</node>
+ <node x="928.5" y="105.0">org.apache.sling.scripting.thymeleaf.internal.ThymeleafScriptEngineFactory</node>
+ <node x="1470.0" y="945.0">org.apache.sling.scripting.thymeleaf.internal.SlingTemplateResource</node>
+ <node x="471.5" y="185.0">org.apache.sling.scripting.thymeleaf.internal.ThymeleafScriptEngine</node>
+ <node x="785.5" y="825.0">org.apache.sling.scripting.thymeleaf.internal.dialect.SlingDialect</node>
+ <node x="192.0" y="185.0">org.thymeleaf.context.IEngineContextFactory</node>
+ <node x="744.0" y="185.0">javax.script.ScriptEngine</node>
+ <node x="1169.5" y="705.0">org.apache.sling.scripting.thymeleaf.internal.PatternTemplateModeProvider</node>
+ <node x="1480.0" y="425.0">org.apache.sling.scripting.thymeleaf.internal.ResourceBundleMessageResolver</node>
+ <node x="1485.5" y="625.0">org.thymeleaf.templateresolver.ITemplateResolver</node>
+ <node x="434.5" y="825.0">org.apache.sling.scripting.thymeleaf.internal.processor.SlingIncludeAttributeTagProcessor</node>
+ </nodes>
+ <notes />
+ <edges>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.ThymeleafScriptEngineFactory" target="org.thymeleaf.ITemplateEngine">
+ <point x="0.0" y="0.0" />
+ <point x="0.0" y="0.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.PatternTemplateModeProvider" target="org.apache.sling.scripting.thymeleaf.TemplateModeProvider">
+ <point x="0.0" y="15.0" />
+ <point x="0.0" y="-15.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.ThymeleafScriptEngineFactory" target="org.thymeleaf.dialect.IDialect">
+ <point x="0.0" y="0.0" />
+ <point x="0.0" y="0.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.ThymeleafScriptEngineFactory" target="org.thymeleaf.messageresolver.IMessageResolver">
+ <point x="0.0" y="0.0" />
+ <point x="0.0" y="0.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.ThymeleafScriptEngineFactory" target="org.thymeleaf.linkbuilder.ILinkBuilder">
+ <point x="0.0" y="0.0" />
+ <point x="0.0" y="0.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.SlingResourceTemplateResolver" target="org.apache.sling.scripting.thymeleaf.internal.SlingTemplateResource">
+ <point x="0.0" y="0.0" />
+ <point x="0.0" y="0.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.ThymeleafScriptEngineFactory" target="javax.script.ScriptEngineFactory">
+ <point x="-111.5" y="0.0" />
+ <point x="79.0" y="0.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.ThymeleafScriptEngineFactory" target="org.thymeleaf.templateparser.markup.decoupled.IDecoupledTemplateLogicResolver">
+ <point x="0.0" y="0.0" />
+ <point x="0.0" y="0.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.dialect.SlingDialect" target="org.apache.sling.scripting.thymeleaf.internal.processor.SlingIncludeAttributeTagProcessor">
+ <point x="0.0" y="0.0" />
+ <point x="0.0" y="0.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.dialect.SlingDialect" target="org.thymeleaf.dialect.IDialect">
+ <point x="54.5" y="0.0" />
+ <point x="1040.0" y="840.0" />
+ <point x="0.0" y="15.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.ThymeleafScriptEngine" target="org.apache.sling.scripting.thymeleaf.internal.ThymeleafScriptEngineFactory">
+ <point x="0.0" y="0.0" />
+ <point x="0.0" y="0.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.SlingResourceTemplateResolver" target="org.thymeleaf.templateresolver.ITemplateResolver">
+ <point x="0.0" y="-15.0" />
+ <point x="0.0" y="15.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.ThymeleafScriptEngineFactory" target="org.apache.sling.scripting.thymeleaf.internal.ThymeleafScriptEngine">
+ <point x="0.0" y="0.0" />
+ <point x="0.0" y="0.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.ThymeleafScriptEngineFactory" target="org.thymeleaf.cache.ICacheManager">
+ <point x="0.0" y="0.0" />
+ <point x="0.0" y="0.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.ResourceBundleMessageResolver" target="org.thymeleaf.messageresolver.IMessageResolver">
+ <point x="0.0" y="-15.0" />
+ <point x="0.0" y="15.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.SlingTemplateResource" target="org.thymeleaf.templateresource.ITemplateResource">
+ <point x="-90.0" y="0.0" />
+ <point x="76.5" y="0.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.ThymeleafScriptEngineFactory" target="org.thymeleaf.templateresolver.ITemplateResolver">
+ <point x="0.0" y="0.0" />
+ <point x="0.0" y="0.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.ResourceBundleMessageResolver" target="org.apache.sling.scripting.thymeleaf.AbsentMessageRepresentationProvider">
+ <point x="0.0" y="0.0" />
+ <point x="0.0" y="0.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.SlingResourceTemplateResolver" target="org.apache.sling.scripting.thymeleaf.TemplateModeProvider">
+ <point x="0.0" y="0.0" />
+ <point x="0.0" y="0.0" />
+ </edge>
+ <edge source="org.thymeleaf.dialect.IProcessorDialect" target="org.thymeleaf.dialect.IDialect">
+ <point x="71.5" y="0.0" />
+ <point x="-41.0" y="0.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.dialect.SlingDialect" target="org.thymeleaf.dialect.IProcessorDialect">
+ <point x="0.0" y="-15.0" />
+ <point x="0.0" y="15.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.ThymeleafScriptEngine" target="javax.script.ScriptEngine">
+ <point x="88.5" y="0.0" />
+ <point x="-56.0" y="0.0" />
+ </edge>
+ <edge source="org.apache.sling.scripting.thymeleaf.internal.ThymeleafScriptEngineFactory" target="org.thymeleaf.context.IEngineContextFactory">
+ <point x="0.0" y="0.0" />
+ <point x="0.0" y="0.0" />
+ </edge>
+ </edges>
+ <settings layout="Hierarchic Group" zoom="0.6000000000000001" x="819.9999999999998" y="498.66666666666663" />
+ <SelectedNodes />
+ <Categories />
+ <SCOPE>All</SCOPE>
+ <VISIBILITY>private</VISIBILITY>
+</Diagram>
+
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 16/39: remove version
of depends-maven-plugin (managed in Sling parent)
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit d4f592cd4dceb80a055060f2493b49207ca036e9
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Oct 23 16:40:54 2016 +0000
remove version of depends-maven-plugin (managed in Sling parent)
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1766300 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 1 -
1 file changed, 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index a2a4ad0..49c9150 100644
--- a/pom.xml
+++ b/pom.xml
@@ -301,7 +301,6 @@
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
- <version>1.2</version>
<executions>
<execution>
<goals>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 23/39: update
dependencies
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit e3ff720e514d94cafd73096196643cf4838b7e4f
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Jan 25 00:02:44 2017 +0000
update dependencies
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1780125 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/pom.xml b/pom.xml
index 0c5c121..5be9f55 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,7 +44,7 @@
<org.unbescape.version>1.1.4.RELEASE</org.unbescape.version>
<ognl.version>3.1.12</ognl.version>
<com.fasterxml.jackson.version>2.6.3</com.fasterxml.jackson.version>
- <org.ops4j.pax.exam.version>4.9.1</org.ops4j.pax.exam.version>
+ <org.ops4j.pax.exam.version>4.9.2</org.ops4j.pax.exam.version>
</properties>
<scm>
@@ -102,56 +102,56 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
- <version>5.4.0</version>
+ <version>5.6.1</version>
<scope>test</scope>
</dependency>
<!-- Apache Sling -->
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
- <version>2.11.0</version>
+ <version>2.16.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.auth.core</artifactId>
- <version>1.3.12</version>
+ <version>1.3.22</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.engine</artifactId>
- <version>2.4.6</version>
+ <version>2.6.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.i18n</artifactId>
- <version>2.4.6</version>
+ <version>2.5.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.models.api</artifactId>
- <version>1.2.2</version>
+ <version>1.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.serviceusermapper</artifactId>
- <version>1.2.2</version>
+ <version>1.2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.scripting.api</artifactId>
- <version>2.1.8</version>
+ <version>2.1.12</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.scripting.core</artifactId>
- <version>2.0.36</version>
+ <version>2.0.44</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -195,7 +195,7 @@
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
- <version>1.9.1</version>
+ <version>1.10.2</version>
<scope>test</scope>
</dependency>
<!-- jsr305 -->
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 38/39:
[maven-release-plugin] prepare release
org.apache.sling.scripting.thymeleaf-1.1.0
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 85991350a5a8913484769596fcae3d6a4c79a23a
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Mar 17 13:46:13 2017 +0000
[maven-release-plugin] prepare release org.apache.sling.scripting.thymeleaf-1.1.0
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1787382 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
index 53d718b..11661ed 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
</parent>
<artifactId>org.apache.sling.scripting.thymeleaf</artifactId>
- <version>1.0.1-SNAPSHOT</version>
+ <version>1.1.0</version>
<packaging>bundle</packaging>
<name>Apache Sling Scripting Thymeleaf</name>
@@ -45,9 +45,9 @@
</properties>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.scripting.thymeleaf-1.1.0</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.scripting.thymeleaf-1.1.0</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.scripting.thymeleaf-1.1.0</url>
</scm>
<dependencies>
@@ -160,7 +160,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.paxexam</artifactId>
- <version>0.0.3-SNAPSHOT</version>
+ <version>0.0.4</version>
<scope>provided</scope>
</dependency>
<!-- Thymeleaf -->
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 37/39: use
org.apache.felix.framework 5.6.2
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 5f0caf3c215bca3567486e63e7ac08fdbd0cb06c
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Mar 17 09:48:45 2017 +0000
use org.apache.felix.framework 5.6.2
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1787310 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 282781d..53d718b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -105,7 +105,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
- <version>5.6.1</version>
+ <version>5.6.2</version>
<scope>test</scope>
</dependency>
<!-- Apache Sling -->
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 39/39:
[maven-release-plugin] copy for tag
org.apache.sling.scripting.thymeleaf-1.1.0
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 50d10e8f0884b1de0b36290a0a6850ed0c642a17
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Mar 17 13:46:28 2017 +0000
[maven-release-plugin] copy for tag org.apache.sling.scripting.thymeleaf-1.1.0
git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.scripting.thymeleaf-1.1.0@1787383 13f79535-47bb-0310-9956-ffa450edef68
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 27/39: SLING-6486 Use
single pattern (regular expression) per template mode in
PatternTemplateModeProvider
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit dd8a8a5abcf809122b0202376ce825b5fdebb96b
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Thu Jan 26 21:18:48 2017 +0000
SLING-6486 Use single pattern (regular expression) per template mode in PatternTemplateModeProvider
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1780481 13f79535-47bb-0310-9956-ffa450edef68
---
.../internal/PatternTemplateModeProvider.java | 61 ++++++---------
.../PatternTemplateModeProviderConfiguration.java | 46 +++++------
.../it/tests/PatternTemplateModeProviderIT.java | 89 ++++++++++++++++++++++
3 files changed, 132 insertions(+), 64 deletions(-)
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/PatternTemplateModeProvider.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/PatternTemplateModeProvider.java
index 69d5fd4..b25c0c2 100644
--- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/PatternTemplateModeProvider.java
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/PatternTemplateModeProvider.java
@@ -18,9 +18,7 @@
*/
package org.apache.sling.scripting.thymeleaf.internal;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.regex.Pattern;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.scripting.thymeleaf.TemplateModeProvider;
@@ -33,7 +31,6 @@ import org.osgi.service.metatype.annotations.Designate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.thymeleaf.templatemode.TemplateMode;
-import org.thymeleaf.util.PatternSpec;
@Component(
immediate = true,
@@ -47,17 +44,17 @@ import org.thymeleaf.util.PatternSpec;
)
public class PatternTemplateModeProvider implements TemplateModeProvider {
- private final PatternSpec htmlPatternSpec = new PatternSpec();
+ private Pattern htmlPattern;
- private final PatternSpec xmlPatternSpec = new PatternSpec();
+ private Pattern xmlPattern;
- private final PatternSpec textPatternSpec = new PatternSpec();
+ private Pattern textPattern;
- private final PatternSpec javascriptPatternSpec = new PatternSpec();
+ private Pattern javascriptPattern;
- private final PatternSpec cssPatternSpec = new PatternSpec();
+ private Pattern cssPattern;
- private final PatternSpec rawPatternSpec = new PatternSpec();
+ private Pattern rawPattern;
private final Logger logger = LoggerFactory.getLogger(PatternTemplateModeProvider.class);
@@ -83,52 +80,44 @@ public class PatternTemplateModeProvider implements TemplateModeProvider {
private void configure(final PatternTemplateModeProviderConfiguration configuration) {
// HTML
- setPatterns(configuration.htmlPatterns(), htmlPatternSpec);
- logger.debug("configured HTML patterns: {}", htmlPatternSpec.getPatterns());
+ htmlPattern = Pattern.compile(configuration.htmlPattern());
+ logger.debug("configured HTML pattern: {}", htmlPattern.pattern());
// XML
- setPatterns(configuration.xmlPatterns(), xmlPatternSpec);
- logger.debug("configured XML patterns: {}", xmlPatternSpec.getPatterns());
+ xmlPattern = Pattern.compile(configuration.xmlPattern());
+ logger.debug("configured XML pattern: {}", xmlPattern.pattern());
// TEXT
- setPatterns(configuration.textPatterns(), textPatternSpec);
- logger.debug("configured TEXT patterns: {}", textPatternSpec.getPatterns());
+ textPattern = Pattern.compile(configuration.textPattern());
+ logger.debug("configured TEXT pattern: {}", textPattern.pattern());
// JAVASCRIPT
- setPatterns(configuration.javascriptPatterns(), javascriptPatternSpec);
- logger.debug("configured JAVASCRIPT patterns: {}", javascriptPatternSpec.getPatterns());
+ javascriptPattern = Pattern.compile(configuration.javascriptPattern());
+ logger.debug("configured JAVASCRIPT pattern: {}", javascriptPattern.pattern());
// CSS
- setPatterns(configuration.cssPatterns(), cssPatternSpec);
- logger.debug("configured CSS patterns: {}", cssPatternSpec.getPatterns());
+ cssPattern = Pattern.compile(configuration.cssPattern());
+ logger.debug("configured CSS pattern: {}", cssPattern.pattern());
// RAW
- setPatterns(configuration.rawPatterns(), rawPatternSpec);
- logger.debug("configured RAW patterns: {}", rawPatternSpec.getPatterns());
- }
-
- private void setPatterns(final String[] strings, final PatternSpec patternSpec) {
- final Set<String> set = new HashSet<String>();
- if (strings != null) {
- Collections.addAll(set, strings);
- }
- patternSpec.setPatterns(set);
+ rawPattern = Pattern.compile(configuration.rawPattern());
+ logger.debug("configured RAW pattern: {}", rawPattern.pattern());
}
@Override
public TemplateMode provideTemplateMode(final Resource resource) {
final String path = resource.getPath();
- if (htmlPatternSpec.matches(path)) {
+ if (htmlPattern.matcher(path).matches()) {
return TemplateMode.HTML;
}
- if (xmlPatternSpec.matches(path)) {
+ if (xmlPattern.matcher(path).matches()) {
return TemplateMode.XML;
}
- if (textPatternSpec.matches(path)) {
+ if (textPattern.matcher(path).matches()) {
return TemplateMode.TEXT;
}
- if (javascriptPatternSpec.matches(path)) {
+ if (javascriptPattern.matcher(path).matches()) {
return TemplateMode.JAVASCRIPT;
}
- if (cssPatternSpec.matches(path)) {
+ if (cssPattern.matcher(path).matches()) {
return TemplateMode.CSS;
}
- if (rawPatternSpec.matches(path)) {
+ if (rawPattern.matcher(path).matches()) {
return TemplateMode.RAW;
}
return null;
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/PatternTemplateModeProviderConfiguration.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/PatternTemplateModeProviderConfiguration.java
index 3aec55c..8b692ef 100644
--- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/PatternTemplateModeProviderConfiguration.java
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/PatternTemplateModeProviderConfiguration.java
@@ -28,49 +28,39 @@ import org.osgi.service.metatype.annotations.ObjectClassDefinition;
@interface PatternTemplateModeProviderConfiguration {
@AttributeDefinition(
- name = "patterns for template mode HTML",
- description = "The template patterns (regular expressions) for templates which should be processed with template mode HTML (e.g. *.html - NOTE: extension needs to be enabled for this script engine)."
+ name = "pattern for template mode HTML",
+ description = "The template patterns (regular expression) for templates which should be processed with template mode HTML (e.g. *.html - NOTE: extension needs to be enabled for this script engine)."
)
- String[] htmlPatterns() default {
- "*.html"
- };
+ String htmlPattern() default "^.+\\.html$";
@AttributeDefinition(
- name = "patterns for template mode XML",
- description = "The template patterns (regular expressions) for templates which should be processed with template mode XML (e.g. *.xml - NOTE: extension needs to be enabled for this script engine)."
+ name = "pattern for template mode XML",
+ description = "The template pattern (regular expression) for templates which should be processed with template mode XML (e.g. *.xml - NOTE: extension needs to be enabled for this script engine)."
)
- String[] xmlPatterns() default {
- "*.xml"
- };
+ String xmlPattern() default "^.+\\.xml$";
@AttributeDefinition(
- name = "patterns for template mode TEXT",
- description = "The template patterns (regular expressions) for templates which should be processed with template mode TEXT (e.g. *.txt - NOTE: extension needs to be enabled for this script engine)."
+ name = "pattern for template mode TEXT",
+ description = "The template pattern (regular expression) for templates which should be processed with template mode TEXT (e.g. *.txt - NOTE: extension needs to be enabled for this script engine)."
)
- String[] textPatterns() default {
- "*.txt"
- };
+ String textPattern() default "^.+\\.txt$";
@AttributeDefinition(
- name = "patterns for template mode JAVASCRIPT",
- description = "The template patterns (regular expressions) for templates which should be processed with template mode JAVASCRIPT (e.g. *.js - NOTE: extension needs to be enabled for this script engine)."
+ name = "pattern for template mode JAVASCRIPT",
+ description = "The template pattern (regular expression) for templates which should be processed with template mode JAVASCRIPT (e.g. *.js - NOTE: extension needs to be enabled for this script engine)."
)
- String[] javascriptPatterns() default {
- "*.js"
- };
+ String javascriptPattern() default "^.+\\.js$";
@AttributeDefinition(
- name = "patterns for template mode CSS",
- description = "The template patterns (regular expressions) for templates which should be processed with template mode CSS (e.g. *.css - NOTE: extension needs to be enabled for this script engine)."
+ name = "pattern for template mode CSS",
+ description = "The template pattern (regular expression) for templates which should be processed with template mode CSS (e.g. *.css - NOTE: extension needs to be enabled for this script engine)."
)
- String[] cssPatterns() default {
- "*.css"
- };
+ String cssPattern() default "^.+\\.css$";
@AttributeDefinition(
- name = "patterns for template mode RAW",
- description = "The template patterns (regular expressions) for templates which should be processed with template mode RAW (e.g. *.raw - NOTE: extension needs to be enabled for this script engine)."
+ name = "pattern for template mode RAW",
+ description = "The template pattern (regular expression) for templates which should be processed with template mode RAW (e.g. *.raw - NOTE: extension needs to be enabled for this script engine)."
)
- String[] rawPatterns();
+ String rawPattern() default "^.+$";
}
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/PatternTemplateModeProviderIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/PatternTemplateModeProviderIT.java
new file mode 100644
index 0000000..b401055
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/PatternTemplateModeProviderIT.java
@@ -0,0 +1,89 @@
+/*
+ * 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.sling.scripting.thymeleaf.it.tests;
+
+import javax.inject.Inject;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.SyntheticResource;
+import org.apache.sling.scripting.thymeleaf.TemplateModeProvider;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.thymeleaf.templatemode.TemplateMode;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class PatternTemplateModeProviderIT extends ThymeleafTestSupport {
+
+ @Inject
+ protected TemplateModeProvider templateModeProvider;
+
+ private static Resource mockResource(final String path) {
+ return new SyntheticResource(null, path, null);
+ }
+
+ @Test
+ public void provideTemplateMode_HTML() throws Exception {
+ final Resource resource = mockResource("/apps/thymeleaf/page/foo.html");
+ final TemplateMode templateMode = templateModeProvider.provideTemplateMode(resource);
+ assertThat(templateMode, is(TemplateMode.HTML));
+ }
+
+ @Test
+ public void provideTemplateMode_XML() throws Exception {
+ final Resource resource = mockResource("/apps/thymeleaf/page/foo.xml");
+ final TemplateMode templateMode = templateModeProvider.provideTemplateMode(resource);
+ assertThat(templateMode, is(TemplateMode.XML));
+ }
+
+ @Test
+ public void provideTemplateMode_TEXT() throws Exception {
+ final Resource resource = mockResource("/apps/thymeleaf/text/foo.txt");
+ final TemplateMode templateMode = templateModeProvider.provideTemplateMode(resource);
+ assertThat(templateMode, is(TemplateMode.TEXT));
+ }
+
+ @Test
+ public void provideTemplateMode_JAVASCRIPT() throws Exception {
+ final Resource resource = mockResource("/apps/thymeleaf/assets/foo.js");
+ final TemplateMode templateMode = templateModeProvider.provideTemplateMode(resource);
+ assertThat(templateMode, is(TemplateMode.JAVASCRIPT));
+ }
+
+ @Test
+ public void provideTemplateMode_CSS() throws Exception {
+ final Resource resource = mockResource("/apps/thymeleaf/assets/foo.css");
+ final TemplateMode templateMode = templateModeProvider.provideTemplateMode(resource);
+ assertThat(templateMode, is(TemplateMode.CSS));
+ }
+
+ @Test
+ public void provideTemplateMode_fall_through() throws Exception {
+ final Resource resource = mockResource("foohtml");
+ final TemplateMode templateMode = templateModeProvider.provideTemplateMode(resource);
+ assertThat(templateMode, is(TemplateMode.RAW));
+ }
+
+}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 08/39: SLING-5680 Add
Integration Tests for Scripting Thymeleaf
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 5a19a4f43e1599af03828d5a1d9c77f798c68313
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Thu Jul 28 09:16:05 2016 +0000
SLING-5680 Add Integration Tests for Scripting Thymeleaf
adjust to updates in Testing PaxExam
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1754371 13f79535-47bb-0310-9956-ffa450edef68
---
.../thymeleaf/it/tests/ThymeleafTestSupport.java | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
index 34de29a..693b94e 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
@@ -18,8 +18,6 @@
*/
package org.apache.sling.scripting.thymeleaf.it.tests;
-import java.io.File;
-
import javax.inject.Inject;
import javax.script.ScriptEngineFactory;
@@ -27,7 +25,6 @@ import org.apache.sling.api.servlets.ServletResolver;
import org.apache.sling.auth.core.AuthenticationSupport;
import org.apache.sling.engine.SlingRequestProcessor;
import org.apache.sling.scripting.thymeleaf.it.app.Activator;
-import org.apache.sling.testing.paxexam.SlingOptions;
import org.apache.sling.testing.paxexam.TestSupport;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
@@ -40,12 +37,9 @@ import org.thymeleaf.ITemplateEngine;
import static org.apache.sling.testing.paxexam.SlingOptions.slingExtensionI18n;
import static org.apache.sling.testing.paxexam.SlingOptions.slingExtensionModels;
-import static org.apache.sling.testing.paxexam.SlingOptions.slingJcrOak;
-import static org.apache.sling.testing.paxexam.SlingOptions.slingLaunchpadOak;
-import static org.apache.sling.testing.paxexam.SlingOptions.slingLaunchpadOakTarConfiguration;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingLaunchpadOakTar;
import static org.apache.sling.testing.paxexam.SlingOptions.slingScripting;
import static org.apache.sling.testing.paxexam.SlingOptions.slingScriptingJsp;
-import static org.ops4j.pax.exam.CoreOptions.bundle;
import static org.ops4j.pax.exam.CoreOptions.composite;
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
@@ -73,13 +67,11 @@ public abstract class ThymeleafTestSupport extends TestSupport {
@Configuration
public Option[] configuration() {
- final String filename = System.getProperty("bundle.filename");
- final File file = new File(filename);
return new Option[]{
baseConfiguration(),
launchpad(),
// Sling Scripting Thymeleaf
- bundle(file.toURI().toString()),
+ testBundle("bundle.filename"),
mavenBundle().groupId("org.javassist").artifactId("javassist").versionAsInProject(),
// testing
mavenBundle().groupId("org.jsoup").artifactId("jsoup").versionAsInProject(),
@@ -105,14 +97,11 @@ public abstract class ThymeleafTestSupport extends TestSupport {
final int httpPort = findFreePort();
final String workingDirectory = workingDirectory();
return composite(
- slingLaunchpadOakTarConfiguration(workingDirectory, httpPort),
- slingJcrOak(), // TODO if slingJcrOak() is called elsewhere, ResourceResolverFactory will not be created
- slingLaunchpadOak(),
+ slingLaunchpadOakTar(workingDirectory, httpPort),
slingExtensionI18n(),
slingExtensionModels(),
slingScripting(),
- slingScriptingJsp(),
- mavenBundle().groupId("org.apache.jackrabbit").artifactId("oak-segment").version(SlingOptions.versionResolver)
+ slingScriptingJsp()
);
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 21/39: SLING-6285 -
Implement LoginAdminWhitelist in JCR Base
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 9e0fd06a3073c45fdb7839f417c6718944a58089
Author: Julian Sedding <js...@apache.org>
AuthorDate: Wed Nov 16 12:00:01 2016 +0000
SLING-6285 - Implement LoginAdminWhitelist in JCR Base
- adjust to moved LoginAdminWhitelist
-minor cleanup
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1769963 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
index 096d71c..ea1a28e 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
@@ -124,7 +124,7 @@ public abstract class ThymeleafTestSupport extends TestSupport {
factoryConfiguration("org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended")
.put("user.mapping", "org.apache.sling.scripting.thymeleaf=sling-scripting")
.asOption(),
- newConfiguration("org.apache.sling.jcr.oak.server.internal.LoginAdminWhitelist")
+ newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist")
.put("whitelist.bundles.regexp", "org.apache.sling.*")
.asOption()
);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 07/39: use Sling
parent 27
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit d0c7a0cbf665fe8fc252fbf18c52041c054b0e9d
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jul 24 09:45:41 2016 +0000
use Sling parent 27
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1753890 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/pom.xml b/pom.xml
index a487a9e..cd3c112 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>26</version>
+ <version>27</version>
<relativePath />
</parent>
@@ -63,38 +63,33 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
+ <artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- OSGi -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.annotation</artifactId>
- <version>6.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.cmpn</artifactId>
- <version>6.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.core</artifactId>
- <version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.component.annotations</artifactId>
- <version>1.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.metatype.annotations</artifactId>
- <version>1.3.0</version>
<scope>provided</scope>
</dependency>
<!-- Apache Commons -->
@@ -202,7 +197,6 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.7.21</version>
<scope>provided</scope>
</dependency>
<!-- testing -->
@@ -252,11 +246,6 @@
<build>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.3</version>
- </plugin>
- <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
@@ -278,8 +267,6 @@
</DynamicImport-Package>
<ScriptEngine-Name>${project.name}</ScriptEngine-Name>
<ScriptEngine-Version>${project.version}</ScriptEngine-Version>
- <_dsannotations>*</_dsannotations>
- <_metatypeannotations>*</_metatypeannotations>
<_removeheaders>
Embed-Dependency,
Private-Package,
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 29/39: SLING-6486 Use
single pattern (regular expression) per template mode in
PatternTemplateModeProvider
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit f53dfda63425e7b352c275b6ea8c80f7358f12cf
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jan 29 20:31:33 2017 +0000
SLING-6486 Use single pattern (regular expression) per template mode in PatternTemplateModeProvider
* handle blank patterns
* remove default for template mode RAW
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1780851 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 6 ++++
.../internal/PatternTemplateModeProvider.java | 37 +++++++++++-----------
.../PatternTemplateModeProviderConfiguration.java | 2 +-
.../it/tests/PatternTemplateModeProviderIT.java | 3 +-
4 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/pom.xml b/pom.xml
index d3f8ddb..f64a9fd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -98,6 +98,12 @@
<version>2.5</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.5</version>
+ <scope>provided</scope>
+ </dependency>
<!-- Apache Felix -->
<dependency>
<groupId>org.apache.felix</groupId>
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/PatternTemplateModeProvider.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/PatternTemplateModeProvider.java
index b25c0c2..84108ca 100644
--- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/PatternTemplateModeProvider.java
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/PatternTemplateModeProvider.java
@@ -20,6 +20,7 @@ package org.apache.sling.scripting.thymeleaf.internal;
import java.util.regex.Pattern;
+import org.apache.commons.lang3.StringUtils;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.scripting.thymeleaf.TemplateModeProvider;
import org.osgi.framework.Constants;
@@ -80,44 +81,44 @@ public class PatternTemplateModeProvider implements TemplateModeProvider {
private void configure(final PatternTemplateModeProviderConfiguration configuration) {
// HTML
- htmlPattern = Pattern.compile(configuration.htmlPattern());
- logger.debug("configured HTML pattern: {}", htmlPattern.pattern());
+ htmlPattern = StringUtils.isNotBlank(configuration.htmlPattern()) ? Pattern.compile(configuration.htmlPattern()) : null;
+ logger.debug("configured HTML pattern: {}", htmlPattern);
// XML
- xmlPattern = Pattern.compile(configuration.xmlPattern());
- logger.debug("configured XML pattern: {}", xmlPattern.pattern());
+ xmlPattern = StringUtils.isNotBlank(configuration.xmlPattern()) ? Pattern.compile(configuration.xmlPattern()) : null;
+ logger.debug("configured XML pattern: {}", xmlPattern);
// TEXT
- textPattern = Pattern.compile(configuration.textPattern());
- logger.debug("configured TEXT pattern: {}", textPattern.pattern());
+ textPattern = StringUtils.isNotBlank(configuration.textPattern()) ? Pattern.compile(configuration.textPattern()) : null;
+ logger.debug("configured TEXT pattern: {}", textPattern);
// JAVASCRIPT
- javascriptPattern = Pattern.compile(configuration.javascriptPattern());
- logger.debug("configured JAVASCRIPT pattern: {}", javascriptPattern.pattern());
+ javascriptPattern = StringUtils.isNotBlank(configuration.javascriptPattern()) ? Pattern.compile(configuration.javascriptPattern()) : null;
+ logger.debug("configured JAVASCRIPT pattern: {}", javascriptPattern);
// CSS
- cssPattern = Pattern.compile(configuration.cssPattern());
- logger.debug("configured CSS pattern: {}", cssPattern.pattern());
+ cssPattern = StringUtils.isNotBlank(configuration.cssPattern()) ? Pattern.compile(configuration.cssPattern()) : null;
+ logger.debug("configured CSS pattern: {}", cssPattern);
// RAW
- rawPattern = Pattern.compile(configuration.rawPattern());
- logger.debug("configured RAW pattern: {}", rawPattern.pattern());
+ rawPattern = StringUtils.isNotBlank(configuration.rawPattern()) ? Pattern.compile(configuration.rawPattern()) : null;
+ logger.debug("configured RAW pattern: {}", rawPattern);
}
@Override
public TemplateMode provideTemplateMode(final Resource resource) {
final String path = resource.getPath();
- if (htmlPattern.matcher(path).matches()) {
+ if (htmlPattern != null && htmlPattern.matcher(path).matches()) {
return TemplateMode.HTML;
}
- if (xmlPattern.matcher(path).matches()) {
+ if (xmlPattern != null && xmlPattern.matcher(path).matches()) {
return TemplateMode.XML;
}
- if (textPattern.matcher(path).matches()) {
+ if (textPattern != null && textPattern.matcher(path).matches()) {
return TemplateMode.TEXT;
}
- if (javascriptPattern.matcher(path).matches()) {
+ if (javascriptPattern != null && javascriptPattern.matcher(path).matches()) {
return TemplateMode.JAVASCRIPT;
}
- if (cssPattern.matcher(path).matches()) {
+ if (cssPattern != null && cssPattern.matcher(path).matches()) {
return TemplateMode.CSS;
}
- if (rawPattern.matcher(path).matches()) {
+ if (rawPattern != null && rawPattern.matcher(path).matches()) {
return TemplateMode.RAW;
}
return null;
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/PatternTemplateModeProviderConfiguration.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/PatternTemplateModeProviderConfiguration.java
index 8b692ef..956b4f9 100644
--- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/PatternTemplateModeProviderConfiguration.java
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/PatternTemplateModeProviderConfiguration.java
@@ -61,6 +61,6 @@ import org.osgi.service.metatype.annotations.ObjectClassDefinition;
name = "pattern for template mode RAW",
description = "The template pattern (regular expression) for templates which should be processed with template mode RAW (e.g. *.raw - NOTE: extension needs to be enabled for this script engine)."
)
- String rawPattern() default "^.+$";
+ String rawPattern();
}
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/PatternTemplateModeProviderIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/PatternTemplateModeProviderIT.java
index b401055..32b1eae 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/PatternTemplateModeProviderIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/PatternTemplateModeProviderIT.java
@@ -31,6 +31,7 @@ import org.ops4j.pax.exam.spi.reactors.PerClass;
import org.thymeleaf.templatemode.TemplateMode;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
@RunWith(PaxExam.class)
@@ -83,7 +84,7 @@ public class PatternTemplateModeProviderIT extends ThymeleafTestSupport {
public void provideTemplateMode_fall_through() throws Exception {
final Resource resource = mockResource("foohtml");
final TemplateMode templateMode = templateModeProvider.provideTemplateMode(resource);
- assertThat(templateMode, is(TemplateMode.RAW));
+ assertThat(templateMode, is(nullValue()));
}
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 17/39: remove version
of javax.inject (managed in Sling parent)
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 77be5453f846fa64b444f56843712f9910257373
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Oct 23 16:43:40 2016 +0000
remove version of javax.inject (managed in Sling parent)
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1766302 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 1 -
1 file changed, 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 49c9150..e71dff2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -58,7 +58,6 @@
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
- <version>1</version>
<scope>test</scope>
</dependency>
<dependency>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 31/39: do not resolve
template when resource is null
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit a9c482286ca61c40a862c9fe5f28e8286ce00f7d
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Feb 7 23:35:43 2017 +0000
do not resolve template when resource is null
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1782090 13f79535-47bb-0310-9956-ffa450edef68
---
.../scripting/thymeleaf/internal/SlingResourceTemplateResolver.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingResourceTemplateResolver.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingResourceTemplateResolver.java
index f28087b..bc40258 100644
--- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingResourceTemplateResolver.java
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingResourceTemplateResolver.java
@@ -115,6 +115,10 @@ public class SlingResourceTemplateResolver implements ITemplateResolver {
final SlingContext slingContext = (SlingContext) context;
final ResourceResolver resourceResolver = slingContext.getResourceResolver();
final Resource resource = resourceResolver.getResource(template);
+ if (resource == null) {
+ logger.warn("resource for template '{}' is null, not resolving template", template);
+ return null;
+ }
final ITemplateResource templateResource = new SlingTemplateResource(resource);
final boolean templateResourceExistenceVerified = false;
final TemplateMode templateMode = templateModeProvider.provideTemplateMode(resource);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 20/39: SLING-5135 -
Whitelist legit usages of loginAdministrative and administrative
ResourceResolver
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit ea78e01f29bc52dec1694d41fa07a54749b9193d
Author: Julian Sedding <js...@apache.org>
AuthorDate: Thu Nov 10 12:35:27 2016 +0000
SLING-5135 - Whitelist legit usages of loginAdministrative and administrative ResourceResolver
- move LoginAdminWhitelist from o.a.s.jcr.base to o.a.s.jcr.oak-server and do NOT export it
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1769105 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
index 802e864..096d71c 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
@@ -124,7 +124,7 @@ public abstract class ThymeleafTestSupport extends TestSupport {
factoryConfiguration("org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended")
.put("user.mapping", "org.apache.sling.scripting.thymeleaf=sling-scripting")
.asOption(),
- newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelistImpl")
+ newConfiguration("org.apache.sling.jcr.oak.server.internal.LoginAdminWhitelist")
.put("whitelist.bundles.regexp", "org.apache.sling.*")
.asOption()
);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 14/39: SLING-6075
Update Thymeleaf to 3.0.2
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 5ade65689ddb42f6ca1a8107f45df7b7316c539e
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Thu Sep 29 17:34:54 2016 +0000
SLING-6075 Update Thymeleaf to 3.0.2
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1762815 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 0b746ec..45895f4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,10 +39,10 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sling.java.version>8</sling.java.version>
- <org.thymeleaf.version>3.0.0.RELEASE</org.thymeleaf.version>
- <org.attoparser.version>2.0.0.RELEASE</org.attoparser.version>
- <org.unbescape.version>1.1.3.RELEASE</org.unbescape.version>
- <ognl.version>3.1.3</ognl.version>
+ <org.thymeleaf.version>3.0.2.RELEASE</org.thymeleaf.version>
+ <org.attoparser.version>2.0.1.RELEASE</org.attoparser.version>
+ <org.unbescape.version>1.1.4.RELEASE</org.unbescape.version>
+ <ognl.version>3.1.10</ognl.version>
<com.fasterxml.jackson.version>2.6.3</com.fasterxml.jackson.version>
<org.ops4j.pax.exam.version>4.9.1</org.ops4j.pax.exam.version>
</properties>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 13/39: SLING-5680 Add
Integration Tests for Scripting Thymeleaf
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 678f5defe9112647dacb6e022596d1de501beb8c
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sat Sep 17 12:48:48 2016 +0000
SLING-5680 Add Integration Tests for Scripting Thymeleaf
move HTML tests to package html
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1761210 13f79535-47bb-0310-9956-ffa450edef68
---
.../sling/scripting/thymeleaf/it/tests/{ => html}/AdaptToModelIT.java | 3 ++-
.../sling/scripting/thymeleaf/it/tests/{ => html}/LinkBuilderIT.java | 3 ++-
.../sling/scripting/thymeleaf/it/tests/{ => html}/SlingIncludeIT.java | 3 ++-
.../it/tests/{ => html}/ThymeleafDecoupledTemplateLogicIT.java | 3 ++-
.../scripting/thymeleaf/it/tests/{ => html}/ThymeleafReplaceIT.java | 3 ++-
.../sling/scripting/thymeleaf/it/tests/{ => html}/ThymeleafTextIT.java | 3 ++-
6 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/AdaptToModelIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/AdaptToModelIT.java
similarity index 93%
rename from src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/AdaptToModelIT.java
rename to src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/AdaptToModelIT.java
index 6dcba31..fcd193c 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/AdaptToModelIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/AdaptToModelIT.java
@@ -16,10 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.sling.scripting.thymeleaf.it.tests;
+package org.apache.sling.scripting.thymeleaf.it.tests.html;
import java.io.IOException;
+import org.apache.sling.scripting.thymeleaf.it.tests.ThymeleafTestSupport;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/LinkBuilderIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/LinkBuilderIT.java
similarity index 93%
rename from src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/LinkBuilderIT.java
rename to src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/LinkBuilderIT.java
index d8cb750..f93a41c 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/LinkBuilderIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/LinkBuilderIT.java
@@ -16,10 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.sling.scripting.thymeleaf.it.tests;
+package org.apache.sling.scripting.thymeleaf.it.tests.html;
import java.io.IOException;
+import org.apache.sling.scripting.thymeleaf.it.tests.ThymeleafTestSupport;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/SlingIncludeIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/SlingIncludeIT.java
similarity index 94%
rename from src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/SlingIncludeIT.java
rename to src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/SlingIncludeIT.java
index 8c53201..7422fab 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/SlingIncludeIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/SlingIncludeIT.java
@@ -16,10 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.sling.scripting.thymeleaf.it.tests;
+package org.apache.sling.scripting.thymeleaf.it.tests.html;
import java.io.IOException;
+import org.apache.sling.scripting.thymeleaf.it.tests.ThymeleafTestSupport;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafDecoupledTemplateLogicIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafDecoupledTemplateLogicIT.java
similarity index 92%
rename from src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafDecoupledTemplateLogicIT.java
rename to src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafDecoupledTemplateLogicIT.java
index 0184522..70ba63c 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafDecoupledTemplateLogicIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafDecoupledTemplateLogicIT.java
@@ -16,10 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.sling.scripting.thymeleaf.it.tests;
+package org.apache.sling.scripting.thymeleaf.it.tests.html;
import java.io.IOException;
+import org.apache.sling.scripting.thymeleaf.it.tests.ThymeleafTestSupport;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.junit.Before;
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafReplaceIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafReplaceIT.java
similarity index 92%
rename from src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafReplaceIT.java
rename to src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafReplaceIT.java
index adc010a..5afa509 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafReplaceIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafReplaceIT.java
@@ -16,10 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.sling.scripting.thymeleaf.it.tests;
+package org.apache.sling.scripting.thymeleaf.it.tests.html;
import java.io.IOException;
+import org.apache.sling.scripting.thymeleaf.it.tests.ThymeleafTestSupport;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.junit.Before;
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTextIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafTextIT.java
similarity index 93%
rename from src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTextIT.java
rename to src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafTextIT.java
index 6b0798d..3cb76be 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTextIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafTextIT.java
@@ -16,10 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.sling.scripting.thymeleaf.it.tests;
+package org.apache.sling.scripting.thymeleaf.it.tests.html;
import java.io.IOException;
+import org.apache.sling.scripting.thymeleaf.it.tests.ThymeleafTestSupport;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 32/39: SLING-6557
Remove embedded AttoParser, Unbescape and OGNL dependencies from bundle
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 95f5dc42df0e3d7b0e6e01aa9f93c701c31b7075
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Mar 1 08:27:34 2017 +0000
SLING-6557 Remove embedded AttoParser, Unbescape and OGNL dependencies from bundle
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1784869 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 27 ++++++++--------------
.../thymeleaf/it/tests/ThymeleafTestSupport.java | 3 +++
2 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/pom.xml b/pom.xml
index 1c07af9..3d4e6b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,9 +40,6 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sling.java.version>8</sling.java.version>
<org.thymeleaf.version>3.0.3.RELEASE</org.thymeleaf.version>
- <org.attoparser.version>2.0.2.RELEASE</org.attoparser.version>
- <org.unbescape.version>1.1.4.RELEASE</org.unbescape.version>
- <ognl.version>3.1.12</ognl.version>
<com.fasterxml.jackson.version>2.6.3</com.fasterxml.jackson.version>
<org.ops4j.pax.exam.version>4.10.0</org.ops4j.pax.exam.version>
</properties>
@@ -176,20 +173,20 @@
<dependency>
<groupId>org.attoparser</groupId>
<artifactId>attoparser</artifactId>
- <version>${org.attoparser.version}</version>
- <scope>compile</scope>
+ <version>2.0.2.RELEASE</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.unbescape</groupId>
<artifactId>unbescape</artifactId>
- <version>${org.unbescape.version}</version>
- <scope>compile</scope>
+ <version>1.1.4.RELEASE</version>
+ <scope>provided</scope>
</dependency>
<dependency>
- <groupId>ognl</groupId>
- <artifactId>ognl</artifactId>
- <version>${ognl.version}</version>
- <scope>compile</scope>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.ognl</artifactId>
+ <version>3.2_1</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
@@ -273,14 +270,8 @@
</Import-Package>
<Export-Package>
org.apache.sling.scripting.thymeleaf,
- org.thymeleaf.*;version=${org.thymeleaf.version};-split-package:=merge-first,
- org.attoparser.*;version=${org.attoparser.version},
- org.unbescape.*;version=${org.unbescape.version},
- ognl.*;version=${ognl.version}
+ org.thymeleaf.*;version=${org.thymeleaf.version};-split-package:=merge-first
</Export-Package>
- <DynamicImport-Package>
- *
- </DynamicImport-Package>
<ScriptEngine-Name>${project.name}</ScriptEngine-Name>
<ScriptEngine-Version>${project.version}</ScriptEngine-Version>
<_removeheaders>
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
index 521e5da..3df68df 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
@@ -80,6 +80,9 @@ public abstract class ThymeleafTestSupport extends TestSupport {
launchpad(),
// Sling Scripting Thymeleaf
testBundle("bundle.filename"),
+ mavenBundle().groupId("org.attoparser").artifactId("attoparser").versionAsInProject(),
+ mavenBundle().groupId("org.unbescape").artifactId("unbescape").versionAsInProject(),
+ mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.ognl").versionAsInProject(),
mavenBundle().groupId("org.javassist").artifactId("javassist").versionAsInProject(),
// testing
mavenBundle().groupId("org.jsoup").artifactId("jsoup").versionAsInProject(),
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 15/39: Use parent 29
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 9b12d6987c91c5f1ebac3d6413ef1885ed369a16
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Oct 17 13:28:59 2016 +0000
Use parent 29
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1765281 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 45895f4..a2a4ad0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>28</version>
+ <version>29</version>
<relativePath />
</parent>
@@ -281,7 +281,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
- <version>2.18.1</version>
<executions>
<execution>
<goals>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 26/39: SLING-5928 Use
Service ResourceResolver in SlingResourceTemplateResolver
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit a93b728ddb558b8010569dff3803f17c6858a71c
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Jan 25 00:15:51 2017 +0000
SLING-5928 Use Service ResourceResolver in SlingResourceTemplateResolver
adjust testing
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1780129 13f79535-47bb-0310-9956-ffa450edef68
---
.../thymeleaf/it/tests/ThymeleafTestSupport.java | 30 +++++--------------
...UserMapperImpl.amended-scripting_thymeleaf.json | 7 +++++
src/test/resources/repoinit.txt | 34 ----------------------
3 files changed, 15 insertions(+), 56 deletions(-)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
index ea1a28e..521e5da 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
@@ -25,8 +25,7 @@ import org.apache.sling.api.servlets.ServletResolver;
import org.apache.sling.auth.core.AuthenticationSupport;
import org.apache.sling.engine.SlingRequestProcessor;
import org.apache.sling.scripting.thymeleaf.it.app.Activator;
-import org.apache.sling.testing.paxexam.SlingOptions;
-import org.apache.sling.testing.paxexam.SlingVersionResolver;
+import org.apache.sling.serviceusermapping.ServiceUserMapped;
import org.apache.sling.testing.paxexam.TestSupport;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
@@ -40,6 +39,7 @@ import org.thymeleaf.ITemplateEngine;
import static org.apache.sling.testing.paxexam.SlingOptions.slingExtensionI18n;
import static org.apache.sling.testing.paxexam.SlingOptions.slingExtensionModels;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingInstallerProviderJcr;
import static org.apache.sling.testing.paxexam.SlingOptions.slingLaunchpadOakTar;
import static org.apache.sling.testing.paxexam.SlingOptions.slingScripting;
import static org.apache.sling.testing.paxexam.SlingOptions.slingScriptingJsp;
@@ -47,7 +47,6 @@ import static org.ops4j.pax.exam.CoreOptions.composite;
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
public abstract class ThymeleafTestSupport extends TestSupport {
@@ -71,16 +70,11 @@ public abstract class ThymeleafTestSupport extends TestSupport {
@Inject
protected ITemplateEngine templateEngine;
+ @Inject
+ protected ServiceUserMapped serviceUserMapped;
+
@Configuration
public Option[] configuration() {
- // SlingOptions.versionResolver.setVersionFromProject(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.scripting.api");
- // SlingOptions.versionResolver.setVersionFromProject(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.scripting.core");
- SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.api", "2.14.3-SNAPSHOT");
- SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.jcr.base", "2.4.1-SNAPSHOT");
- SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.jcr.oak.server", "1.1.1-SNAPSHOT");
- SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.jcr.repoinit", "1.0.3-SNAPSHOT");
- SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.jcr.resource", "2.8.1-SNAPSHOT");
- SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.resourceresolver", "1.4.19-SNAPSHOT");
return new Option[]{
baseConfiguration(),
launchpad(),
@@ -98,6 +92,7 @@ public abstract class ThymeleafTestSupport extends TestSupport {
@ProbeBuilder
public TestProbeBuilder probeConfiguration(final TestProbeBuilder testProbeBuilder) {
testProbeBuilder.setHeader(Constants.BUNDLE_ACTIVATOR, Activator.class.getName());
+ testProbeBuilder.setHeader(Constants.BUNDLE_SYMBOLICNAME, "org.apache.sling.scripting.thymeleaf.it.app");
testProbeBuilder.setHeader(Constants.EXPORT_PACKAGE, "org.apache.sling.scripting.thymeleaf.it.app");
testProbeBuilder.setHeader("Sling-Model-Packages", "org.apache.sling.scripting.thymeleaf.it.app");
testProbeBuilder.setHeader("Sling-Initial-Content", String.join(",",
@@ -111,22 +106,13 @@ public abstract class ThymeleafTestSupport extends TestSupport {
protected Option launchpad() {
final int httpPort = findFreePort();
final String workingDirectory = workingDirectory();
- final String repoinit = String.format("raw:file:%s/src/test/resources/repoinit.txt", PathUtils.getBaseDir());
return composite(
slingLaunchpadOakTar(workingDirectory, httpPort),
slingExtensionI18n(),
slingExtensionModels(),
+ slingInstallerProviderJcr(),
slingScripting(),
- slingScriptingJsp(),
- newConfiguration("org.apache.sling.jcr.repoinit.impl.RepositoryInitializer")
- .put("references", new String[]{repoinit})
- .asOption(),
- factoryConfiguration("org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended")
- .put("user.mapping", "org.apache.sling.scripting.thymeleaf=sling-scripting")
- .asOption(),
- newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist")
- .put("whitelist.bundles.regexp", "org.apache.sling.*")
- .asOption()
+ slingScriptingJsp()
);
}
diff --git a/src/test/resources/apps/thymeleaf/config/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-scripting_thymeleaf.json b/src/test/resources/apps/thymeleaf/config/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-scripting_thymeleaf.json
new file mode 100644
index 0000000..9ace1b3
--- /dev/null
+++ b/src/test/resources/apps/thymeleaf/config/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-scripting_thymeleaf.json
@@ -0,0 +1,7 @@
+{
+ "jcr:primaryType": "sling:OsgiConfig",
+ "user.mapping": [
+ "org.apache.sling.scripting.thymeleaf=sling-scripting",
+ "org.apache.sling.scripting.thymeleaf.it.app=sling-scripting"
+ ]
+}
diff --git a/src/test/resources/repoinit.txt b/src/test/resources/repoinit.txt
deleted file mode 100644
index fc4c50c..0000000
--- a/src/test/resources/repoinit.txt
+++ /dev/null
@@ -1,34 +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.
-#
-################################################################################
-
-create service user sling-scripting
-
-create path (sling:Folder) /apps
-create path (sling:Folder) /libs
-
-set ACL for sling-scripting
- allow jcr:read on /apps
- allow jcr:read on /libs
-end
-
-create path (sling:OrderedFolder) /content
-
-set ACL for everyone
- allow jcr:read on /content
-end
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 04/39: do not keep
caches
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit d0f755374c5517f5df9c9b69f6c7b3d3b31486db
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jul 12 09:37:28 2016 +0000
do not keep caches
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1752254 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
index 6ff98a3..1433b4f 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
@@ -50,7 +50,6 @@ import static org.apache.sling.testing.paxexam.SlingOptions.slingScriptingJsp;
import static org.ops4j.pax.exam.CoreOptions.bundle;
import static org.ops4j.pax.exam.CoreOptions.composite;
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
-import static org.ops4j.pax.exam.CoreOptions.keepCaches;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.workingDirectory;
import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
@@ -101,7 +100,6 @@ public abstract class ThymeleafTestSupport {
final String filename = System.getProperty("bundle.filename");
final File file = new File(filename);
return new Option[]{
- keepCaches(),
workingDirectory(workingDirectory),
launchpad(workingDirectory),
// Sling Scripting Thymeleaf
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 24/39: redirect test
output to file
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit da43b154db546afa3e2554d74a489fe78c3b3bde
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Jan 25 00:03:51 2017 +0000
redirect test output to file
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1780126 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/pom.xml b/pom.xml
index 5be9f55..d3f8ddb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -300,6 +300,7 @@
</execution>
</executions>
<configuration>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
<systemProperties>
<property>
<name>bundle.filename</name>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 19/39: SLING-5135 -
Whitelist legit usages of loginAdministrative and administrative
ResourceResolver
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 67b21106fd904f5437e73eef31392fae72f9c9da
Author: Julian Sedding <js...@apache.org>
AuthorDate: Thu Nov 10 12:35:00 2016 +0000
SLING-5135 - Whitelist legit usages of loginAdministrative and administrative ResourceResolver
- rename configuration properties
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1769103 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
index ef295be..802e864 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
@@ -125,7 +125,7 @@ public abstract class ThymeleafTestSupport extends TestSupport {
.put("user.mapping", "org.apache.sling.scripting.thymeleaf=sling-scripting")
.asOption(),
newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelistImpl")
- .put("whitelist.regexp", "org.apache.sling.*")
+ .put("whitelist.bundles.regexp", "org.apache.sling.*")
.asOption()
);
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 36/39: use Sling
Parent 30
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit fad25c7a944d9dea269936edc1002bc664efb349
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Mar 6 10:22:30 2017 +0000
use Sling Parent 30
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1785621 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 0ca8219..282781d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>30-SNAPSHOT</version>
+ <version>30</version>
<relativePath />
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 10/39: switch parent
pom reference everywhere to 28 where it was 27 before this can be safely
done because the only difference between 27 and 28 is an updated
maven-source-plugin (fix heap space error)
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit f0f66eab8a6889e2440bce750c6229b1775d75a4
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Fri Aug 19 21:15:35 2016 +0000
switch parent pom reference everywhere to 28 where it was 27 before
this can be safely done because the only difference between 27 and 28 is an updated maven-source-plugin (fix heap space error)
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1756968 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 24a67eb..0b746ec 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>27</version>
+ <version>28</version>
<relativePath />
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 18/39: SLING-5928 Use
Service ResourceResolver in SlingResourceTemplateResolver
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 08237880e5c1f425ae4c3abfdccb896eac881380
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Oct 23 17:38:16 2016 +0000
SLING-5928 Use Service ResourceResolver in SlingResourceTemplateResolver
* (re)add and use Sling contexts
* add a Sling engine context factory
* add preliminary request-scoped resource resolver provider (SLING-6165)
* improve logging in tests
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1766307 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 13 +-
.../scripting/thymeleaf/DefaultSlingContext.java | 41 ++++
.../sling/scripting/thymeleaf/SlingContext.java | 30 +++
.../thymeleaf/internal/SlingEngineContext.java | 44 ++++
.../internal/SlingEngineContextFactory.java | 63 ++++++
.../internal/SlingResourceTemplateResolver.java | 26 ++-
.../thymeleaf/internal/SlingWebContext.java | 70 +++++++
.../thymeleaf/internal/ThymeleafScriptEngine.java | 12 +-
.../internal/ThymeleafScriptEngineFactory.java | 19 +-
.../ThymeleafScriptEngineFactoryConfiguration.java | 2 +-
.../DelegatingResourceResolver.java | 231 +++++++++++++++++++++
.../RequestScopedResourceResolverProvider.java | 90 ++++++++
.../thymeleaf/it/tests/ThymeleafTestSupport.java | 40 +++-
src/test/resources/exam.properties | 19 ++
src/test/resources/logback.xml | 30 +++
src/test/resources/repoinit.txt | 34 +++
16 files changed, 747 insertions(+), 17 deletions(-)
diff --git a/pom.xml b/pom.xml
index e71dff2..6db782c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -138,6 +138,12 @@
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.serviceusermapper</artifactId>
+ <version>1.2.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.scripting.api</artifactId>
<version>2.1.8</version>
<scope>provided</scope>
@@ -151,7 +157,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.paxexam</artifactId>
- <version>0.0.2</version>
+ <version>0.0.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Thymeleaf -->
@@ -192,6 +198,11 @@
<version>1.9.1</version>
<scope>test</scope>
</dependency>
+ <!-- jsr305 -->
+ <dependency>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>jsr305</artifactId>
+ </dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/DefaultSlingContext.java b/src/main/java/org/apache/sling/scripting/thymeleaf/DefaultSlingContext.java
new file mode 100644
index 0000000..f6d4d1d
--- /dev/null
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/DefaultSlingContext.java
@@ -0,0 +1,41 @@
+/*
+ * 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.sling.scripting.thymeleaf;
+
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.sling.api.resource.ResourceResolver;
+import org.thymeleaf.context.AbstractContext;
+
+public class DefaultSlingContext extends AbstractContext implements SlingContext {
+
+ private final ResourceResolver resourceResolver;
+
+ public DefaultSlingContext(final ResourceResolver resourceResolver, final Locale locale, final Map<String, Object> variables) {
+ super(locale, variables);
+ this.resourceResolver = resourceResolver;
+ }
+
+ @Override
+ public ResourceResolver getResourceResolver() {
+ return resourceResolver;
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/SlingContext.java b/src/main/java/org/apache/sling/scripting/thymeleaf/SlingContext.java
new file mode 100644
index 0000000..4b2c282
--- /dev/null
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/SlingContext.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.sling.scripting.thymeleaf;
+
+import org.apache.sling.api.resource.ResourceResolver;
+import org.osgi.annotation.versioning.ProviderType;
+import org.thymeleaf.context.IContext;
+
+@ProviderType
+public interface SlingContext extends IContext {
+
+ ResourceResolver getResourceResolver();
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingEngineContext.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingEngineContext.java
new file mode 100644
index 0000000..c5dc3b6
--- /dev/null
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingEngineContext.java
@@ -0,0 +1,44 @@
+/*
+ * 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.sling.scripting.thymeleaf.internal;
+
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.scripting.thymeleaf.SlingContext;
+import org.thymeleaf.IEngineConfiguration;
+import org.thymeleaf.context.EngineContext;
+import org.thymeleaf.engine.TemplateData;
+
+public class SlingEngineContext extends EngineContext implements SlingContext {
+
+ private final ResourceResolver resourceResolver;
+
+ public SlingEngineContext(final ResourceResolver resourceResolver, final IEngineConfiguration configuration, final TemplateData templateData, final Map<String, Object> templateResolutionAttributes, final Locale locale, final Map<String, Object> variables) {
+ super(configuration, templateData, templateResolutionAttributes, locale, variables);
+ this.resourceResolver = resourceResolver;
+ }
+
+ @Override
+ public ResourceResolver getResourceResolver() {
+ return resourceResolver;
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingEngineContextFactory.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingEngineContextFactory.java
new file mode 100644
index 0000000..e25715e
--- /dev/null
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingEngineContextFactory.java
@@ -0,0 +1,63 @@
+/*
+ * 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.sling.scripting.thymeleaf.internal;
+
+import java.util.LinkedHashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.scripting.thymeleaf.SlingContext;
+import org.osgi.framework.Constants;
+import org.osgi.service.component.annotations.Component;
+import org.thymeleaf.IEngineConfiguration;
+import org.thymeleaf.context.IContext;
+import org.thymeleaf.context.IEngineContext;
+import org.thymeleaf.context.IEngineContextFactory;
+import org.thymeleaf.engine.TemplateData;
+
+@Component(
+ immediate = true,
+ property = {
+ Constants.SERVICE_DESCRIPTION + "=Sling EngineContextFactory for Sling Scripting Thymeleaf",
+ Constants.SERVICE_VENDOR + "=The Apache Software Foundation"
+ }
+)
+public class SlingEngineContextFactory implements IEngineContextFactory {
+
+ @Override
+ public IEngineContext createEngineContext(final IEngineConfiguration configuration, final TemplateData templateData, final Map<String, Object> templateResolutionAttributes, final IContext context) {
+ if (context instanceof SlingContext) {
+ // TODO web context
+ final SlingContext slingContext = (SlingContext) context;
+ final ResourceResolver resourceResolver = slingContext.getResourceResolver();
+ final Locale locale = context.getLocale();
+ final Set<String> variableNames = context.getVariableNames();
+ final Map<String, Object> variables = new LinkedHashMap<>(variableNames.size() + 1, 1.0f);
+ for (final String variableName : variableNames) {
+ variables.put(variableName, context.getVariable(variableName));
+ }
+ return new SlingEngineContext(resourceResolver, configuration, templateData, templateResolutionAttributes, locale, variables);
+ } else {
+ throw new IllegalStateException("context is not an instance of SlingContext");
+ }
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingResourceTemplateResolver.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingResourceTemplateResolver.java
index 5f53242..790cfdc 100644
--- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingResourceTemplateResolver.java
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingResourceTemplateResolver.java
@@ -22,7 +22,7 @@ import java.util.Map;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
-import org.apache.sling.api.scripting.SlingBindings;
+import org.apache.sling.scripting.thymeleaf.SlingContext;
import org.apache.sling.scripting.thymeleaf.TemplateModeProvider;
import org.osgi.framework.Constants;
import org.osgi.service.component.annotations.Activate;
@@ -111,15 +111,21 @@ public class SlingResourceTemplateResolver implements ITemplateResolver {
@Override
public TemplateResolution resolveTemplate(final IEngineConfiguration engineConfiguration, final IContext context, final String ownerTemplate, final String template, final Map<String, Object> templateResolutionAttributes) {
logger.debug("resolving template '{}'", template);
- final ResourceResolver resourceResolver = (ResourceResolver) context.getVariable(SlingBindings.RESOLVER);
- final Resource resource = resourceResolver.getResource(template);
- final ITemplateResource templateResource = new SlingTemplateResource(resource);
- final boolean templateResourceExistenceVerified = false;
- final TemplateMode templateMode = templateModeProvider.provideTemplateMode(resource);
- logger.debug("using template mode {} for template '{}'", templateMode, template);
- final boolean useDecoupledLogic = templateMode.isMarkup() && configuration.useDecoupledLogic();
- final ICacheEntryValidity validity = NonCacheableCacheEntryValidity.INSTANCE;
- return new TemplateResolution(templateResource, templateResourceExistenceVerified, templateMode, useDecoupledLogic, validity);
+ if (context instanceof SlingContext) {
+ final SlingContext slingContext = (SlingContext) context;
+ final ResourceResolver resourceResolver = slingContext.getResourceResolver();
+ final Resource resource = resourceResolver.getResource(template);
+ final ITemplateResource templateResource = new SlingTemplateResource(resource);
+ final boolean templateResourceExistenceVerified = false;
+ final TemplateMode templateMode = templateModeProvider.provideTemplateMode(resource);
+ logger.debug("using template mode {} for template '{}'", templateMode, template);
+ final boolean useDecoupledLogic = templateMode.isMarkup() && configuration.useDecoupledLogic();
+ final ICacheEntryValidity validity = NonCacheableCacheEntryValidity.INSTANCE;
+ return new TemplateResolution(templateResource, templateResourceExistenceVerified, templateMode, useDecoupledLogic, validity);
+ } else {
+ logger.error("context is not an instance of SlingContext");
+ return null;
+ }
}
}
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingWebContext.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingWebContext.java
new file mode 100644
index 0000000..e977d46
--- /dev/null
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingWebContext.java
@@ -0,0 +1,70 @@
+/*
+ * 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.sling.scripting.thymeleaf.internal;
+
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.scripting.thymeleaf.DefaultSlingContext;
+import org.thymeleaf.context.IWebContext;
+
+public class SlingWebContext extends DefaultSlingContext implements IWebContext {
+
+ private final SlingHttpServletRequest servletRequest;
+
+ private final SlingHttpServletResponse servletResponse;
+
+ private final ServletContext servletContext;
+
+ public SlingWebContext(final SlingHttpServletRequest servletRequest, final SlingHttpServletResponse servletResponse, final ServletContext servletContext, final ResourceResolver resourceResolver, final Locale locale, final Map<String, Object> variables) {
+ super(resourceResolver, locale, variables);
+ this.servletRequest = servletRequest;
+ this.servletResponse = servletResponse;
+ this.servletContext = servletContext;
+ }
+
+ @Override
+ public HttpServletRequest getRequest() {
+ return servletRequest;
+ }
+
+ @Override
+ public HttpServletResponse getResponse() {
+ return servletResponse;
+ }
+
+ @Override
+ public HttpSession getSession() {
+ return servletRequest.getSession(false);
+ }
+
+ @Override
+ public ServletContext getServletContext() {
+ return servletContext;
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ThymeleafScriptEngine.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ThymeleafScriptEngine.java
index 80ea877..d653556 100644
--- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ThymeleafScriptEngine.java
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ThymeleafScriptEngine.java
@@ -25,13 +25,16 @@ import java.util.Locale;
import javax.script.Bindings;
import javax.script.ScriptContext;
import javax.script.ScriptException;
+import javax.servlet.ServletContext;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.scripting.SlingBindings;
import org.apache.sling.api.scripting.SlingScriptHelper;
import org.apache.sling.scripting.api.AbstractSlingScriptEngine;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.thymeleaf.context.Context;
import org.thymeleaf.context.IContext;
public final class ThymeleafScriptEngine extends AbstractSlingScriptEngine {
@@ -54,12 +57,17 @@ public final class ThymeleafScriptEngine extends AbstractSlingScriptEngine {
throw new ScriptException("SlingScriptHelper missing from bindings");
}
+ final SlingHttpServletRequest request = helper.getRequest();
+ final SlingHttpServletResponse response = helper.getResponse();
+ final ServletContext servletContext = null; // only used by Thymeleaf's ServletContextResourceResolver (TODO check if still true for 3.0)
+
final Locale locale = helper.getResponse().getLocale();
final String scriptName = helper.getScript().getScriptResource().getPath();
final Writer writer = scriptContext.getWriter();
try {
- final IContext context = new Context(locale, bindings);
+ final ResourceResolver resourceResolver = thymeleafScriptEngineFactory.getRequestScopedResourceResolver();
+ final IContext context = new SlingWebContext(request, response, servletContext, resourceResolver, locale, bindings);
thymeleafScriptEngineFactory.getTemplateEngine().process(scriptName, context, writer);
} catch (Exception e) {
logger.error("Failure rendering Thymeleaf template '{}': {}", scriptName, e.getMessage());
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ThymeleafScriptEngineFactory.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ThymeleafScriptEngineFactory.java
index f475925..846b210 100644
--- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ThymeleafScriptEngineFactory.java
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ThymeleafScriptEngineFactory.java
@@ -28,7 +28,9 @@ import java.util.Set;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineFactory;
+import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.scripting.api.AbstractScriptEngineFactory;
+import org.apache.sling.scripting.thymeleaf.internal.resourceresolver.RequestScopedResourceResolverProvider;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;
@@ -120,7 +122,6 @@ public final class ThymeleafScriptEngineFactory extends AbstractScriptEngineFact
private volatile ICacheManager cacheManager;
@Reference(
- cardinality = ReferenceCardinality.OPTIONAL,
policy = ReferencePolicy.DYNAMIC,
policyOption = ReferencePolicyOption.GREEDY,
bind = "setEngineContextFactory",
@@ -128,6 +129,12 @@ public final class ThymeleafScriptEngineFactory extends AbstractScriptEngineFact
)
private volatile IEngineContextFactory engineContextFactory;
+ @Reference(
+ policy = ReferencePolicy.DYNAMIC,
+ policyOption = ReferencePolicyOption.GREEDY
+ )
+ private volatile RequestScopedResourceResolverProvider resourceResolverProvider;
+
private ThymeleafScriptEngineFactoryConfiguration configuration;
private BundleContext bundleContext;
@@ -338,6 +345,12 @@ public final class ThymeleafScriptEngineFactory extends AbstractScriptEngineFact
logger.info("configuration is null, not setting up new template engine");
return;
}
+
+ if (!configuration.useStandardEngineContextFactory() && engineContextFactory == null) {
+ logger.info("no engine context factory available, not setting up new template engine");
+ return;
+ }
+
// setup template engine
final TemplateEngine templateEngine = new TemplateEngine();
// Template Resolvers
@@ -415,4 +428,8 @@ public final class ThymeleafScriptEngineFactory extends AbstractScriptEngineFact
}
}
+ ResourceResolver getRequestScopedResourceResolver() {
+ return resourceResolverProvider.getResourceResolver();
+ }
+
}
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ThymeleafScriptEngineFactoryConfiguration.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ThymeleafScriptEngineFactoryConfiguration.java
index 3830241..e73c710 100644
--- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ThymeleafScriptEngineFactoryConfiguration.java
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ThymeleafScriptEngineFactoryConfiguration.java
@@ -92,6 +92,6 @@ import org.osgi.service.metatype.annotations.ObjectClassDefinition;
name = "use standard engine context factory",
description = "Enables Thymeleaf's standard engine context factory and uses it exclusively."
)
- boolean useStandardEngineContextFactory() default true;
+ boolean useStandardEngineContextFactory() default false;
}
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/resourceresolver/DelegatingResourceResolver.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/resourceresolver/DelegatingResourceResolver.java
new file mode 100644
index 0000000..25b1c4d
--- /dev/null
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/resourceresolver/DelegatingResourceResolver.java
@@ -0,0 +1,231 @@
+/*
+ * 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.sling.scripting.thymeleaf.internal.resourceresolver;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.sling.api.resource.LoginException;
+import org.apache.sling.api.resource.PersistenceException;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DelegatingResourceResolver implements ResourceResolver {
+
+ private final ResourceResolver resourceResolver;
+
+ private final Logger logger = LoggerFactory.getLogger(DelegatingResourceResolver.class);
+
+ public DelegatingResourceResolver(final ResourceResolver resourceResolver) {
+ this.resourceResolver = resourceResolver;
+ }
+
+ void closeInternal() {
+ resourceResolver.close();
+ }
+
+ @Override
+ @Nonnull
+ public Resource resolve(@Nonnull HttpServletRequest httpServletRequest,@Nonnull String s) {
+ return resourceResolver.resolve(httpServletRequest, s);
+ }
+
+ @Override
+ @Nonnull
+ public Resource resolve(@Nonnull String s) {
+ return resourceResolver.resolve(s);
+ }
+
+ @Override
+ @Deprecated
+ @Nonnull
+ public Resource resolve(@Nonnull HttpServletRequest httpServletRequest) {
+ return resourceResolver.resolve(httpServletRequest);
+ }
+
+ @Override
+ @Nonnull
+ public String map(@Nonnull String s) {
+ return resourceResolver.map(s);
+ }
+
+ @Override
+ @CheckForNull
+ public String map(@Nonnull HttpServletRequest httpServletRequest, @Nonnull String s) {
+ return resourceResolver.map(httpServletRequest, s);
+ }
+
+ @Override
+ @CheckForNull
+ public Resource getResource(@Nonnull String s) {
+ return resourceResolver.getResource(s);
+ }
+
+ @Override
+ @CheckForNull
+ public Resource getResource(Resource resource, @Nonnull String s) {
+ return resourceResolver.getResource(resource, s);
+ }
+
+ @Override
+ @Nonnull
+ public String[] getSearchPath() {
+ return resourceResolver.getSearchPath();
+ }
+
+ @Override
+ @Nonnull
+ public Iterator<Resource> listChildren(@Nonnull Resource resource) {
+ return resourceResolver.listChildren(resource);
+ }
+
+ @Override
+ @CheckForNull
+ public Resource getParent(@Nonnull Resource resource) {
+ return resourceResolver.getParent(resource);
+ }
+
+ @Override
+ @Nonnull
+ public Iterable<Resource> getChildren(@Nonnull Resource resource) {
+ return resourceResolver.getChildren(resource);
+ }
+
+ @Override
+ @Nonnull
+ public Iterator<Resource> findResources(@Nonnull String s, String s1) {
+ return resourceResolver.findResources(s, s1);
+ }
+
+ @Override
+ @Nonnull
+ public Iterator<Map<String, Object>> queryResources(@Nonnull String s, String s1) {
+ return resourceResolver.queryResources(s, s1);
+ }
+
+ @Override
+ public boolean hasChildren(@Nonnull Resource resource) {
+ return resourceResolver.hasChildren(resource);
+ }
+
+ @Override
+ @Nonnull
+ public ResourceResolver clone(Map<String, Object> map) throws LoginException {
+ return resourceResolver.clone(map);
+ }
+
+ @Override
+ public boolean isLive() {
+ return resourceResolver.isLive();
+ }
+
+ @Override
+ public void close() {
+ // do not close
+ }
+
+ @Override
+ @CheckForNull
+ public String getUserID() {
+ return resourceResolver.getUserID();
+ }
+
+ @Override
+ @Nonnull
+ public Iterator<String> getAttributeNames() {
+ return resourceResolver.getAttributeNames();
+ }
+
+ @Override
+ @CheckForNull
+ public Object getAttribute(@Nonnull String s) {
+ return resourceResolver.getAttribute(s);
+ }
+
+ @Override
+ public void delete(@Nonnull Resource resource) throws PersistenceException {
+ resourceResolver.delete(resource);
+ }
+
+ @Override
+ @Nonnull
+ public Resource create(@Nonnull Resource resource, @Nonnull String s, Map<String, Object> map) throws PersistenceException {
+ return resourceResolver.create(resource, s, map);
+ }
+
+ @Override
+ public void revert() {
+ resourceResolver.revert();
+ }
+
+ @Override
+ public void commit() throws PersistenceException {
+ resourceResolver.commit();
+ }
+
+ @Override
+ public boolean hasChanges() {
+ return resourceResolver.hasChanges();
+ }
+
+ @Override
+ @CheckForNull
+ public String getParentResourceType(Resource resource) {
+ return resourceResolver.getParentResourceType(resource);
+ }
+
+ @Override
+ @CheckForNull
+ public String getParentResourceType(String s) {
+ return resourceResolver.getParentResourceType(s);
+ }
+
+ @Override
+ public boolean isResourceType(Resource resource, String s) {
+ return resourceResolver.isResourceType(resource, s);
+ }
+
+ @Override
+ public void refresh() {
+ resourceResolver.refresh();
+ }
+
+ @Override
+ public Resource copy(String s, String s1) throws PersistenceException {
+ return resourceResolver.copy(s, s1);
+ }
+
+ @Override
+ public Resource move(String s, String s1) throws PersistenceException {
+ return resourceResolver.move(s, s1);
+ }
+
+ @Override
+ @CheckForNull
+ public <AdapterType> AdapterType adaptTo(@Nonnull Class<AdapterType> aClass) {
+ return resourceResolver.adaptTo(aClass);
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/resourceresolver/RequestScopedResourceResolverProvider.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/resourceresolver/RequestScopedResourceResolverProvider.java
new file mode 100644
index 0000000..4da19ad
--- /dev/null
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/resourceresolver/RequestScopedResourceResolverProvider.java
@@ -0,0 +1,90 @@
+/*
+ * 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.sling.scripting.thymeleaf.internal.resourceresolver;
+
+import org.apache.sling.api.request.SlingRequestEvent;
+import org.apache.sling.api.request.SlingRequestEvent.EventType;
+import org.apache.sling.api.request.SlingRequestListener;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceResolverFactory;
+import org.apache.sling.serviceusermapping.ServiceUserMapped;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.ReferencePolicy;
+import org.osgi.service.component.annotations.ReferencePolicyOption;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Component(
+ service = {
+ RequestScopedResourceResolverProvider.class,
+ SlingRequestListener.class
+ },
+ immediate = true
+)
+public class RequestScopedResourceResolverProvider implements SlingRequestListener {
+
+ private final ThreadLocal<DelegatingResourceResolver> threadLocal = new ThreadLocal<>();
+
+ @Reference(
+ policy = ReferencePolicy.DYNAMIC,
+ policyOption = ReferencePolicyOption.GREEDY
+ )
+ private volatile ResourceResolverFactory resourceResolverFactory;
+
+ @Reference(
+ cardinality = ReferenceCardinality.MANDATORY,
+ policy = ReferencePolicy.DYNAMIC,
+ policyOption = ReferencePolicyOption.GREEDY
+ )
+ private volatile ServiceUserMapped serviceUserMapped;
+
+ private final Logger logger = LoggerFactory.getLogger(RequestScopedResourceResolverProvider.class);
+
+ public ResourceResolver getResourceResolver() {
+ DelegatingResourceResolver resourceResolver = threadLocal.get();
+ if (resourceResolver == null) {
+ try {
+ logger.debug("getting service resource resolver for thread {}", Thread.currentThread().getName());
+ final ResourceResolver delegate = resourceResolverFactory.getServiceResourceResolver(null);
+ resourceResolver = new DelegatingResourceResolver(delegate);
+ logger.debug("setting service resource resolver {} for thread {}", resourceResolver, Thread.currentThread().getName());
+ threadLocal.set(resourceResolver);
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+ return resourceResolver;
+ }
+
+ @Override
+ public void onEvent(final SlingRequestEvent slingRequestEvent) {
+ if (EventType.EVENT_DESTROY.equals(slingRequestEvent.getType())) {
+ final DelegatingResourceResolver resourceResolver = threadLocal.get();
+ logger.debug("removing service resource resolver {} for thread {}", resourceResolver, Thread.currentThread().getName());
+ threadLocal.remove();
+ if (resourceResolver != null) {
+ logger.debug("closing resource resolver {} for thread {}", resourceResolver, Thread.currentThread().getName());
+ resourceResolver.closeInternal();
+ }
+ }
+ }
+
+}
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
index 693b94e..ef295be 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
@@ -25,12 +25,15 @@ import org.apache.sling.api.servlets.ServletResolver;
import org.apache.sling.auth.core.AuthenticationSupport;
import org.apache.sling.engine.SlingRequestProcessor;
import org.apache.sling.scripting.thymeleaf.it.app.Activator;
+import org.apache.sling.testing.paxexam.SlingOptions;
+import org.apache.sling.testing.paxexam.SlingVersionResolver;
import org.apache.sling.testing.paxexam.TestSupport;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.ProbeBuilder;
import org.ops4j.pax.exam.TestProbeBuilder;
import org.ops4j.pax.exam.util.Filter;
+import org.ops4j.pax.exam.util.PathUtils;
import org.osgi.framework.Constants;
import org.osgi.service.http.HttpService;
import org.thymeleaf.ITemplateEngine;
@@ -43,6 +46,9 @@ import static org.apache.sling.testing.paxexam.SlingOptions.slingScriptingJsp;
import static org.ops4j.pax.exam.CoreOptions.composite;
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
public abstract class ThymeleafTestSupport extends TestSupport {
@@ -67,6 +73,14 @@ public abstract class ThymeleafTestSupport extends TestSupport {
@Configuration
public Option[] configuration() {
+ // SlingOptions.versionResolver.setVersionFromProject(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.scripting.api");
+ // SlingOptions.versionResolver.setVersionFromProject(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.scripting.core");
+ SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.api", "2.14.3-SNAPSHOT");
+ SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.jcr.base", "2.4.1-SNAPSHOT");
+ SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.jcr.oak.server", "1.1.1-SNAPSHOT");
+ SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.jcr.repoinit", "1.0.3-SNAPSHOT");
+ SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.jcr.resource", "2.8.1-SNAPSHOT");
+ SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.resourceresolver", "1.4.19-SNAPSHOT");
return new Option[]{
baseConfiguration(),
launchpad(),
@@ -76,7 +90,8 @@ public abstract class ThymeleafTestSupport extends TestSupport {
// testing
mavenBundle().groupId("org.jsoup").artifactId("jsoup").versionAsInProject(),
mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
- junitBundles()
+ junitBundles(),
+ logging()
};
}
@@ -96,12 +111,33 @@ public abstract class ThymeleafTestSupport extends TestSupport {
protected Option launchpad() {
final int httpPort = findFreePort();
final String workingDirectory = workingDirectory();
+ final String repoinit = String.format("raw:file:%s/src/test/resources/repoinit.txt", PathUtils.getBaseDir());
return composite(
slingLaunchpadOakTar(workingDirectory, httpPort),
slingExtensionI18n(),
slingExtensionModels(),
slingScripting(),
- slingScriptingJsp()
+ slingScriptingJsp(),
+ newConfiguration("org.apache.sling.jcr.repoinit.impl.RepositoryInitializer")
+ .put("references", new String[]{repoinit})
+ .asOption(),
+ factoryConfiguration("org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended")
+ .put("user.mapping", "org.apache.sling.scripting.thymeleaf=sling-scripting")
+ .asOption(),
+ newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelistImpl")
+ .put("whitelist.regexp", "org.apache.sling.*")
+ .asOption()
+ );
+ }
+
+ protected Option logging() {
+ final String filename = String.format("file:%s/src/test/resources/logback.xml", PathUtils.getBaseDir());
+ return composite(
+ systemProperty("logback.configurationFile").value(filename),
+ mavenBundle().groupId("org.slf4j").artifactId("slf4j-api").version("1.7.21"),
+ mavenBundle().groupId("org.slf4j").artifactId("jcl-over-slf4j").version("1.7.21"),
+ mavenBundle().groupId("ch.qos.logback").artifactId("logback-core").version("1.1.7"),
+ mavenBundle().groupId("ch.qos.logback").artifactId("logback-classic").version("1.1.7")
);
}
diff --git a/src/test/resources/exam.properties b/src/test/resources/exam.properties
new file mode 100644
index 0000000..c98a668
--- /dev/null
+++ b/src/test/resources/exam.properties
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+pax.exam.logging=none
diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml
new file mode 100644
index 0000000..d46a4ae
--- /dev/null
+++ b/src/test/resources/logback.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<configuration>
+ <appender name="file" class="ch.qos.logback.core.FileAppender">
+ <file>target/testing.log</file>
+ <encoder>
+ <pattern>%date %level [%thread] %logger{10} [%file : %line] %msg%n</pattern>
+ </encoder>
+ </appender>
+ <root level="debug">
+ <appender-ref ref="file"/>
+ </root>
+</configuration>
diff --git a/src/test/resources/repoinit.txt b/src/test/resources/repoinit.txt
new file mode 100644
index 0000000..fc4c50c
--- /dev/null
+++ b/src/test/resources/repoinit.txt
@@ -0,0 +1,34 @@
+################################################################################
+#
+# 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.
+#
+################################################################################
+
+create service user sling-scripting
+
+create path (sling:Folder) /apps
+create path (sling:Folder) /libs
+
+set ACL for sling-scripting
+ allow jcr:read on /apps
+ allow jcr:read on /libs
+end
+
+create path (sling:OrderedFolder) /content
+
+set ACL for everyone
+ allow jcr:read on /content
+end
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 34/39: use Sling
Parent 30-SNAPSHOT
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 93cf9306c96ffc689c581e3d7b447bb37fb094e7
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Mar 1 08:32:46 2017 +0000
use Sling Parent 30-SNAPSHOT
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1784871 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 3d4e6b9..0ca8219 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>29</version>
+ <version>30-SNAPSHOT</version>
<relativePath />
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 25/39: SLING-5928 Use
Service ResourceResolver in SlingResourceTemplateResolver
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 7ce68ada7d286692d69d0a0eef3f1f91d373c2ee
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Jan 25 00:09:18 2017 +0000
SLING-5928 Use Service ResourceResolver in SlingResourceTemplateResolver
use RequestScopedResourceResolver
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1780128 13f79535-47bb-0310-9956-ffa450edef68
---
.../internal/ThymeleafScriptEngineFactory.java | 6 +-
.../DelegatingResourceResolver.java | 231 ---------------------
.../RequestScopedResourceResolverProvider.java | 90 --------
3 files changed, 3 insertions(+), 324 deletions(-)
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ThymeleafScriptEngineFactory.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ThymeleafScriptEngineFactory.java
index 846b210..22a18f1 100644
--- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ThymeleafScriptEngineFactory.java
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/ThymeleafScriptEngineFactory.java
@@ -30,7 +30,7 @@ import javax.script.ScriptEngineFactory;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.scripting.api.AbstractScriptEngineFactory;
-import org.apache.sling.scripting.thymeleaf.internal.resourceresolver.RequestScopedResourceResolverProvider;
+import org.apache.sling.scripting.api.resource.ScriptingResourceResolverProvider;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;
@@ -133,7 +133,7 @@ public final class ThymeleafScriptEngineFactory extends AbstractScriptEngineFact
policy = ReferencePolicy.DYNAMIC,
policyOption = ReferencePolicyOption.GREEDY
)
- private volatile RequestScopedResourceResolverProvider resourceResolverProvider;
+ private volatile ScriptingResourceResolverProvider scriptingResourceResolverProvider;
private ThymeleafScriptEngineFactoryConfiguration configuration;
@@ -429,7 +429,7 @@ public final class ThymeleafScriptEngineFactory extends AbstractScriptEngineFact
}
ResourceResolver getRequestScopedResourceResolver() {
- return resourceResolverProvider.getResourceResolver();
+ return scriptingResourceResolverProvider.getRequestScopedResourceResolver();
}
}
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/resourceresolver/DelegatingResourceResolver.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/resourceresolver/DelegatingResourceResolver.java
deleted file mode 100644
index 25b1c4d..0000000
--- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/resourceresolver/DelegatingResourceResolver.java
+++ /dev/null
@@ -1,231 +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.sling.scripting.thymeleaf.internal.resourceresolver;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.sling.api.resource.LoginException;
-import org.apache.sling.api.resource.PersistenceException;
-import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ResourceResolver;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DelegatingResourceResolver implements ResourceResolver {
-
- private final ResourceResolver resourceResolver;
-
- private final Logger logger = LoggerFactory.getLogger(DelegatingResourceResolver.class);
-
- public DelegatingResourceResolver(final ResourceResolver resourceResolver) {
- this.resourceResolver = resourceResolver;
- }
-
- void closeInternal() {
- resourceResolver.close();
- }
-
- @Override
- @Nonnull
- public Resource resolve(@Nonnull HttpServletRequest httpServletRequest,@Nonnull String s) {
- return resourceResolver.resolve(httpServletRequest, s);
- }
-
- @Override
- @Nonnull
- public Resource resolve(@Nonnull String s) {
- return resourceResolver.resolve(s);
- }
-
- @Override
- @Deprecated
- @Nonnull
- public Resource resolve(@Nonnull HttpServletRequest httpServletRequest) {
- return resourceResolver.resolve(httpServletRequest);
- }
-
- @Override
- @Nonnull
- public String map(@Nonnull String s) {
- return resourceResolver.map(s);
- }
-
- @Override
- @CheckForNull
- public String map(@Nonnull HttpServletRequest httpServletRequest, @Nonnull String s) {
- return resourceResolver.map(httpServletRequest, s);
- }
-
- @Override
- @CheckForNull
- public Resource getResource(@Nonnull String s) {
- return resourceResolver.getResource(s);
- }
-
- @Override
- @CheckForNull
- public Resource getResource(Resource resource, @Nonnull String s) {
- return resourceResolver.getResource(resource, s);
- }
-
- @Override
- @Nonnull
- public String[] getSearchPath() {
- return resourceResolver.getSearchPath();
- }
-
- @Override
- @Nonnull
- public Iterator<Resource> listChildren(@Nonnull Resource resource) {
- return resourceResolver.listChildren(resource);
- }
-
- @Override
- @CheckForNull
- public Resource getParent(@Nonnull Resource resource) {
- return resourceResolver.getParent(resource);
- }
-
- @Override
- @Nonnull
- public Iterable<Resource> getChildren(@Nonnull Resource resource) {
- return resourceResolver.getChildren(resource);
- }
-
- @Override
- @Nonnull
- public Iterator<Resource> findResources(@Nonnull String s, String s1) {
- return resourceResolver.findResources(s, s1);
- }
-
- @Override
- @Nonnull
- public Iterator<Map<String, Object>> queryResources(@Nonnull String s, String s1) {
- return resourceResolver.queryResources(s, s1);
- }
-
- @Override
- public boolean hasChildren(@Nonnull Resource resource) {
- return resourceResolver.hasChildren(resource);
- }
-
- @Override
- @Nonnull
- public ResourceResolver clone(Map<String, Object> map) throws LoginException {
- return resourceResolver.clone(map);
- }
-
- @Override
- public boolean isLive() {
- return resourceResolver.isLive();
- }
-
- @Override
- public void close() {
- // do not close
- }
-
- @Override
- @CheckForNull
- public String getUserID() {
- return resourceResolver.getUserID();
- }
-
- @Override
- @Nonnull
- public Iterator<String> getAttributeNames() {
- return resourceResolver.getAttributeNames();
- }
-
- @Override
- @CheckForNull
- public Object getAttribute(@Nonnull String s) {
- return resourceResolver.getAttribute(s);
- }
-
- @Override
- public void delete(@Nonnull Resource resource) throws PersistenceException {
- resourceResolver.delete(resource);
- }
-
- @Override
- @Nonnull
- public Resource create(@Nonnull Resource resource, @Nonnull String s, Map<String, Object> map) throws PersistenceException {
- return resourceResolver.create(resource, s, map);
- }
-
- @Override
- public void revert() {
- resourceResolver.revert();
- }
-
- @Override
- public void commit() throws PersistenceException {
- resourceResolver.commit();
- }
-
- @Override
- public boolean hasChanges() {
- return resourceResolver.hasChanges();
- }
-
- @Override
- @CheckForNull
- public String getParentResourceType(Resource resource) {
- return resourceResolver.getParentResourceType(resource);
- }
-
- @Override
- @CheckForNull
- public String getParentResourceType(String s) {
- return resourceResolver.getParentResourceType(s);
- }
-
- @Override
- public boolean isResourceType(Resource resource, String s) {
- return resourceResolver.isResourceType(resource, s);
- }
-
- @Override
- public void refresh() {
- resourceResolver.refresh();
- }
-
- @Override
- public Resource copy(String s, String s1) throws PersistenceException {
- return resourceResolver.copy(s, s1);
- }
-
- @Override
- public Resource move(String s, String s1) throws PersistenceException {
- return resourceResolver.move(s, s1);
- }
-
- @Override
- @CheckForNull
- public <AdapterType> AdapterType adaptTo(@Nonnull Class<AdapterType> aClass) {
- return resourceResolver.adaptTo(aClass);
- }
-
-}
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/resourceresolver/RequestScopedResourceResolverProvider.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/resourceresolver/RequestScopedResourceResolverProvider.java
deleted file mode 100644
index 4da19ad..0000000
--- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/resourceresolver/RequestScopedResourceResolverProvider.java
+++ /dev/null
@@ -1,90 +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.sling.scripting.thymeleaf.internal.resourceresolver;
-
-import org.apache.sling.api.request.SlingRequestEvent;
-import org.apache.sling.api.request.SlingRequestEvent.EventType;
-import org.apache.sling.api.request.SlingRequestListener;
-import org.apache.sling.api.resource.ResourceResolver;
-import org.apache.sling.api.resource.ResourceResolverFactory;
-import org.apache.sling.serviceusermapping.ServiceUserMapped;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.osgi.service.component.annotations.ReferencePolicy;
-import org.osgi.service.component.annotations.ReferencePolicyOption;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@Component(
- service = {
- RequestScopedResourceResolverProvider.class,
- SlingRequestListener.class
- },
- immediate = true
-)
-public class RequestScopedResourceResolverProvider implements SlingRequestListener {
-
- private final ThreadLocal<DelegatingResourceResolver> threadLocal = new ThreadLocal<>();
-
- @Reference(
- policy = ReferencePolicy.DYNAMIC,
- policyOption = ReferencePolicyOption.GREEDY
- )
- private volatile ResourceResolverFactory resourceResolverFactory;
-
- @Reference(
- cardinality = ReferenceCardinality.MANDATORY,
- policy = ReferencePolicy.DYNAMIC,
- policyOption = ReferencePolicyOption.GREEDY
- )
- private volatile ServiceUserMapped serviceUserMapped;
-
- private final Logger logger = LoggerFactory.getLogger(RequestScopedResourceResolverProvider.class);
-
- public ResourceResolver getResourceResolver() {
- DelegatingResourceResolver resourceResolver = threadLocal.get();
- if (resourceResolver == null) {
- try {
- logger.debug("getting service resource resolver for thread {}", Thread.currentThread().getName());
- final ResourceResolver delegate = resourceResolverFactory.getServiceResourceResolver(null);
- resourceResolver = new DelegatingResourceResolver(delegate);
- logger.debug("setting service resource resolver {} for thread {}", resourceResolver, Thread.currentThread().getName());
- threadLocal.set(resourceResolver);
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- }
- }
- return resourceResolver;
- }
-
- @Override
- public void onEvent(final SlingRequestEvent slingRequestEvent) {
- if (EventType.EVENT_DESTROY.equals(slingRequestEvent.getType())) {
- final DelegatingResourceResolver resourceResolver = threadLocal.get();
- logger.debug("removing service resource resolver {} for thread {}", resourceResolver, Thread.currentThread().getName());
- threadLocal.remove();
- if (resourceResolver != null) {
- logger.debug("closing resource resolver {} for thread {}", resourceResolver, Thread.currentThread().getName());
- resourceResolver.closeInternal();
- }
- }
- }
-
-}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 09/39: use
org.apache.sling.testing.paxexam 0.0.2
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit c7fc7242bd40c38652b90d076b720ebb950df311
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Aug 17 20:47:46 2016 +0000
use org.apache.sling.testing.paxexam 0.0.2
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1756685 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index cd3c112..24a67eb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -152,7 +152,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.paxexam</artifactId>
- <version>0.0.1-SNAPSHOT</version>
+ <version>0.0.2</version>
<scope>provided</scope>
</dependency>
<!-- Thymeleaf -->
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 28/39: SLING-6487
Prevent possible NPE (templateMode) in SlingResourceTemplateResolver
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 72ef564dec0519d97c8212ad402f2328cd0f5abb
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Thu Jan 26 21:29:19 2017 +0000
SLING-6487 Prevent possible NPE (templateMode) in SlingResourceTemplateResolver
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1780482 13f79535-47bb-0310-9956-ffa450edef68
---
.../thymeleaf/internal/SlingResourceTemplateResolver.java | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingResourceTemplateResolver.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingResourceTemplateResolver.java
index 790cfdc..f28087b 100644
--- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingResourceTemplateResolver.java
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingResourceTemplateResolver.java
@@ -118,10 +118,15 @@ public class SlingResourceTemplateResolver implements ITemplateResolver {
final ITemplateResource templateResource = new SlingTemplateResource(resource);
final boolean templateResourceExistenceVerified = false;
final TemplateMode templateMode = templateModeProvider.provideTemplateMode(resource);
- logger.debug("using template mode {} for template '{}'", templateMode, template);
- final boolean useDecoupledLogic = templateMode.isMarkup() && configuration.useDecoupledLogic();
- final ICacheEntryValidity validity = NonCacheableCacheEntryValidity.INSTANCE;
- return new TemplateResolution(templateResource, templateResourceExistenceVerified, templateMode, useDecoupledLogic, validity);
+ if (templateMode == null) {
+ logger.warn("template mode for template '{}' is null, not resolving template", template);
+ return null;
+ } else {
+ logger.debug("using template mode {} for template '{}'", templateMode, template);
+ final boolean useDecoupledLogic = templateMode.isMarkup() && configuration.useDecoupledLogic();
+ final ICacheEntryValidity validity = NonCacheableCacheEntryValidity.INSTANCE;
+ return new TemplateResolution(templateResource, templateResourceExistenceVerified, templateMode, useDecoupledLogic, validity);
+ }
} else {
logger.error("context is not an instance of SlingContext");
return null;
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 12/39: fix positions
of actual values and matchers
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 4594cc2b1bedf4b8fad82ba871ede2923e852791
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sat Sep 17 12:35:36 2016 +0000
fix positions of actual values and matchers
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1761206 13f79535-47bb-0310-9956-ffa450edef68
---
.../sling/scripting/thymeleaf/it/tests/AdaptToModelIT.java | 2 +-
.../sling/scripting/thymeleaf/it/tests/SlingIncludeIT.java | 10 +++++-----
.../thymeleaf/it/tests/ThymeleafScriptEngineFactoryIT.java | 4 ++--
.../sling/scripting/thymeleaf/it/tests/ThymeleafTextIT.java | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/AdaptToModelIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/AdaptToModelIT.java
index 8424ad4..6dcba31 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/AdaptToModelIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/AdaptToModelIT.java
@@ -53,7 +53,7 @@ public class AdaptToModelIT extends ThymeleafTestSupport {
@Test
public void testPageName() {
final Element name = document.getElementById("name");
- assertThat("adaptto", is(name.text()));
+ assertThat(name.text(), is("adaptto"));
}
}
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/SlingIncludeIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/SlingIncludeIT.java
index d245d43..8c53201 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/SlingIncludeIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/SlingIncludeIT.java
@@ -48,21 +48,21 @@ public class SlingIncludeIT extends ThymeleafTestSupport {
@Test
public void testJspIncludeSimple() {
final Element simple = document.getElementById("simple");
- assertThat("/content/thymeleaf/include", is(simple.text()));
+ assertThat(simple.text(), is("/content/thymeleaf/include"));
}
@Test
public void testJspIncludeWrap() {
final Element wrap = document.getElementById("wrap");
- assertThat(1, is(wrap.children().size()));
- assertThat("/content/thymeleaf/include", is(wrap.child(0).text()));
+ assertThat(wrap.children().size(), is(1));
+ assertThat(wrap.child(0).text(), is("/content/thymeleaf/include"));
}
@Test
public void testJspIncludeUnwrap() {
final Element unwrap = document.getElementById("unwrap");
- assertThat(0, is(unwrap.children().size()));
- assertThat("/content/thymeleaf/include", is(unwrap.text()));
+ assertThat(unwrap.children().size(), is(0));
+ assertThat(unwrap.text(), is("/content/thymeleaf/include"));
}
}
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafScriptEngineFactoryIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafScriptEngineFactoryIT.java
index 4b16c7a..de0db6b 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafScriptEngineFactoryIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafScriptEngineFactoryIT.java
@@ -41,12 +41,12 @@ public class ThymeleafScriptEngineFactoryIT extends ThymeleafTestSupport {
@Test
public void testScriptEngineFactoryEngineName() {
- assertThat("Apache Sling Scripting Thymeleaf", is(scriptEngineFactory.getEngineName()));
+ assertThat(scriptEngineFactory.getEngineName(), is("Apache Sling Scripting Thymeleaf"));
}
@Test
public void testScriptEngineFactoryLanguageName() {
- assertThat("Thymeleaf", is(scriptEngineFactory.getLanguageName()));
+ assertThat(scriptEngineFactory.getLanguageName(), is("Thymeleaf"));
}
@Test
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTextIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTextIT.java
index dc827bc..6b0798d 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTextIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTextIT.java
@@ -53,7 +53,7 @@ public class ThymeleafTextIT extends ThymeleafTestSupport {
@Test
public void testResourceName() {
final Element name = document.getElementById("name");
- assertThat("text", is(name.text()));
+ assertThat(name.text(), is("text"));
}
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 35/39: SLING-6557
Remove embedded AttoParser, Unbescape and OGNL dependencies from bundle
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit bf79fe5871fcbe218d159fa9f0b30bfeef21e9dd
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Mar 1 08:41:50 2017 +0000
SLING-6557 Remove embedded AttoParser, Unbescape and OGNL dependencies from bundle
update README
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1784877 13f79535-47bb-0310-9956-ffa450edef68
---
README.md | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index c562d5c..efedfad 100644
--- a/README.md
+++ b/README.md
@@ -16,8 +16,11 @@ Features
Installation
------------
-For running Sling Scripting Thymeleaf with Sling's Launchpad some dependencies need to be resolved. This can be achieved by installing the following bundle:
+For running Sling Scripting Thymeleaf with Sling's Launchpad some dependencies need to be resolved. This can be achieved by installing the following bundles:
+ mvn:org.attoparser/attoparser/2.0.2.RELEASE
+ mvn:org.unbescape/unbescape/1.1.4.RELEASE
+ mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.ognl/3.2_1
mvn:org.javassist/javassist/3.20.0-GA
There is a feature for [Karaf](https://github.com/apache/sling/tree/trunk/contrib/launchpad/karaf):
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 22/39: SLING-6481
Update Thymeleaf to 3.0.3
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit d35a48d65177b807355d6b6c7d59ef667ada19d6
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jan 24 23:55:51 2017 +0000
SLING-6481 Update Thymeleaf to 3.0.3
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1780124 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index 6db782c..0c5c121 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,10 +39,10 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sling.java.version>8</sling.java.version>
- <org.thymeleaf.version>3.0.2.RELEASE</org.thymeleaf.version>
- <org.attoparser.version>2.0.1.RELEASE</org.attoparser.version>
+ <org.thymeleaf.version>3.0.3.RELEASE</org.thymeleaf.version>
+ <org.attoparser.version>2.0.2.RELEASE</org.attoparser.version>
<org.unbescape.version>1.1.4.RELEASE</org.unbescape.version>
- <ognl.version>3.1.10</ognl.version>
+ <ognl.version>3.1.12</ognl.version>
<com.fasterxml.jackson.version>2.6.3</com.fasterxml.jackson.version>
<org.ops4j.pax.exam.version>4.9.1</org.ops4j.pax.exam.version>
</properties>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 02/39: SLING-5680 Add
Integration Tests for Scripting Thymeleaf
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 62ac2799ee96563af1a85dfffc92edef598601ae
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Jul 6 09:32:43 2016 +0000
SLING-5680 Add Integration Tests for Scripting Thymeleaf
merge module org.apache.sling.scripting.thymeleaf.it into org.apache.sling.scripting.thymeleaf
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1751643 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 140 +++++++++++++++++-
.../scripting/thymeleaf/it/app/Activator.java | 55 ++++++++
.../thymeleaf/it/app/FooBarLinkBuilder.java | 49 +++++++
.../sling/scripting/thymeleaf/it/app/Page.java | 52 +++++++
.../thymeleaf/it/tests/AdaptToModelIT.java | 59 ++++++++
.../thymeleaf/it/tests/LinkBuilderIT.java | 60 ++++++++
.../thymeleaf/it/tests/SlingIncludeIT.java | 68 +++++++++
.../thymeleaf/it/tests/TemplateEngineIT.java | 59 ++++++++
.../tests/ThymeleafDecoupledTemplateLogicIT.java | 52 +++++++
.../thymeleaf/it/tests/ThymeleafReplaceIT.java | 52 +++++++
.../it/tests/ThymeleafScriptEngineFactoryIT.java | 62 ++++++++
.../thymeleaf/it/tests/ThymeleafTestSupport.java | 156 +++++++++++++++++++++
.../thymeleaf/it/tests/ThymeleafTextIT.java | 59 ++++++++
src/test/resources/apps/jsp/page/resource/html.jsp | 22 +++
src/test/resources/apps/thymeleaf/ROOT.json | 6 +
.../apps/thymeleaf/page/adaptto/html.html | 28 ++++
.../apps/thymeleaf/page/decoupled/html.html | 26 ++++
.../apps/thymeleaf/page/decoupled/html.th.xml | 22 +++
.../apps/thymeleaf/page/fragments/head.html | 27 ++++
.../apps/thymeleaf/page/include/html.html | 37 +++++
.../resources/apps/thymeleaf/page/link/html.html | 29 ++++
.../resources/apps/thymeleaf/page/main/html.html | 29 ++++
.../apps/thymeleaf/page/replace/html.html | 26 ++++
.../resources/apps/thymeleaf/page/text/html.html | 28 ++++
src/test/resources/content/thymeleaf.json | 42 ++++++
25 files changed, 1238 insertions(+), 7 deletions(-)
diff --git a/pom.xml b/pom.xml
index 2724483..a487a9e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,12 +38,13 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <sling.java.version>7</sling.java.version>
+ <sling.java.version>8</sling.java.version>
<org.thymeleaf.version>3.0.0.RELEASE</org.thymeleaf.version>
<org.attoparser.version>2.0.0.RELEASE</org.attoparser.version>
<org.unbescape.version>1.1.3.RELEASE</org.unbescape.version>
<ognl.version>3.1.3</ognl.version>
<com.fasterxml.jackson.version>2.6.3</com.fasterxml.jackson.version>
+ <org.ops4j.pax.exam.version>4.9.1</org.ops4j.pax.exam.version>
</properties>
<scm>
@@ -55,6 +56,12 @@
<dependencies>
<!-- javax -->
<dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
@@ -62,14 +69,20 @@
<!-- OSGi -->
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>osgi.core</artifactId>
- <version>6.0.0</version>
+ <artifactId>osgi.annotation</artifactId>
+ <version>6.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>osgi.annotation</artifactId>
- <version>6.0.1</version>
+ <artifactId>osgi.cmpn</artifactId>
+ <version>6.0.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.core</artifactId>
+ <version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -91,6 +104,13 @@
<version>2.5</version>
<scope>provided</scope>
</dependency>
+ <!-- Apache Felix -->
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>5.4.0</version>
+ <scope>test</scope>
+ </dependency>
<!-- Apache Sling -->
<dependency>
<groupId>org.apache.sling</groupId>
@@ -100,6 +120,30 @@
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.auth.core</artifactId>
+ <version>1.3.12</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.engine</artifactId>
+ <version>2.4.6</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.i18n</artifactId>
+ <version>2.4.6</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.models.api</artifactId>
+ <version>1.2.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.scripting.api</artifactId>
<version>2.1.8</version>
<scope>provided</scope>
@@ -112,8 +156,8 @@
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.i18n</artifactId>
- <version>2.4.6</version>
+ <artifactId>org.apache.sling.testing.paxexam</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Thymeleaf -->
@@ -147,6 +191,13 @@
<version>3.20.0-GA</version>
<scope>provided</scope>
</dependency>
+ <!-- jsoup -->
+ <dependency>
+ <groupId>org.jsoup</groupId>
+ <artifactId>jsoup</artifactId>
+ <version>1.9.1</version>
+ <scope>test</scope>
+ </dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
@@ -154,6 +205,48 @@
<version>1.7.21</version>
<scope>provided</scope>
</dependency>
+ <!-- testing -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.hamcrest</artifactId>
+ <version>1.3_1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam</artifactId>
+ <version>${org.ops4j.pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-cm</artifactId>
+ <version>${org.ops4j.pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-forked</artifactId>
+ <version>${org.ops4j.pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit4</artifactId>
+ <version>${org.ops4j.pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-link-mvn</artifactId>
+ <version>${org.ops4j.pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -198,6 +291,39 @@
</filters>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.18.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>bundle.filename</name>
+ <value>${basedir}/target/${project.build.finalName}.jar</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/app/Activator.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/app/Activator.java
new file mode 100644
index 0000000..eaf47db
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/app/Activator.java
@@ -0,0 +1,55 @@
+/*
+ * 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.sling.scripting.thymeleaf.it.app;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
+import org.thymeleaf.linkbuilder.ILinkBuilder;
+
+public class Activator implements BundleActivator {
+
+ private ServiceRegistration linkBuilderRegistration;
+
+ @Override
+ public void start(final BundleContext bundleContext) throws Exception {
+ registerLinkBuilder(bundleContext);
+ }
+
+ @Override
+ public void stop(final BundleContext bundleContext) throws Exception {
+ if (linkBuilderRegistration != null) {
+ linkBuilderRegistration.unregister();
+ linkBuilderRegistration = null;
+ }
+ }
+
+ private void registerLinkBuilder(final BundleContext bundleContext) {
+ final FooBarLinkBuilder linkBuilder = new FooBarLinkBuilder();
+ final Dictionary<String, String> properties = new Hashtable<>();
+ properties.put(Constants.SERVICE_DESCRIPTION, "Apache Sling Scripting Thymeleaf IT FooBarLinkBuilder");
+ properties.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
+ linkBuilderRegistration = bundleContext.registerService(ILinkBuilder.class, linkBuilder, properties);
+ }
+
+}
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/app/FooBarLinkBuilder.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/app/FooBarLinkBuilder.java
new file mode 100644
index 0000000..c7f2b8c
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/app/FooBarLinkBuilder.java
@@ -0,0 +1,49 @@
+/*
+ * 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.sling.scripting.thymeleaf.it.app;
+
+import java.util.Map;
+
+import org.thymeleaf.context.IExpressionContext;
+import org.thymeleaf.linkbuilder.ILinkBuilder;
+
+public class FooBarLinkBuilder implements ILinkBuilder {
+
+ public FooBarLinkBuilder() {
+ }
+
+ @Override
+ public String getName() {
+ return getClass().getSimpleName();
+ }
+
+ @Override
+ public Integer getOrder() {
+ return 0;
+ }
+
+ @Override
+ public String buildLink(final IExpressionContext expressionContext, final String base, final Map<String, Object> parameters) {
+ if ("foo".equals(base)) {
+ return "foobar";
+ }
+ return null;
+ }
+
+}
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/app/Page.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/app/Page.java
new file mode 100644
index 0000000..5c7417d
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/app/Page.java
@@ -0,0 +1,52 @@
+/*
+ * 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.sling.scripting.thymeleaf.it.app;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.models.annotations.Model;
+import org.apache.sling.models.annotations.injectorspecific.SlingObject;
+
+import static org.apache.sling.models.annotations.injectorspecific.InjectionStrategy.OPTIONAL;
+
+@Model(adaptables = {Resource.class, SlingHttpServletRequest.class})
+public class Page {
+
+ @SlingObject
+ protected Resource resource;
+
+ @SlingObject(injectionStrategy = OPTIONAL)
+ protected SlingHttpServletRequest request;
+
+ public Page() {
+ }
+
+ public String getName() {
+ return resource.getName();
+ }
+
+ public String getPath() {
+ return resource.getPath();
+ }
+
+ public String getTitle() {
+ return resource.getValueMap().get("title", String.class);
+ }
+
+}
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/AdaptToModelIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/AdaptToModelIT.java
new file mode 100644
index 0000000..8424ad4
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/AdaptToModelIT.java
@@ -0,0 +1,59 @@
+/*
+ * 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.sling.scripting.thymeleaf.it.tests;
+
+import java.io.IOException;
+
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class AdaptToModelIT extends ThymeleafTestSupport {
+
+ private Document document;
+
+ @Before
+ public void setup() throws IOException {
+ final String url = String.format("http://localhost:%s/thymeleaf/adaptto.html", httpPort());
+ document = Jsoup.connect(url).get();
+ }
+
+ @Test
+ public void testTitle() {
+ assertThat(document.title(), is("Sling Models adaptTo()"));
+ }
+
+ @Test
+ public void testPageName() {
+ final Element name = document.getElementById("name");
+ assertThat("adaptto", is(name.text()));
+ }
+
+}
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/LinkBuilderIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/LinkBuilderIT.java
new file mode 100644
index 0000000..d8cb750
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/LinkBuilderIT.java
@@ -0,0 +1,60 @@
+/*
+ * 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.sling.scripting.thymeleaf.it.tests;
+
+import java.io.IOException;
+
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class LinkBuilderIT extends ThymeleafTestSupport {
+
+ private Document document;
+
+ @Before
+ public void setup() throws IOException {
+ final String url = String.format("http://localhost:%s/thymeleaf/link.html", httpPort());
+ document = Jsoup.connect(url).get();
+ }
+
+ @Test
+ public void testFooLink() throws IOException {
+ final Element link = document.getElementById("foo");
+ assertThat(link.attributes().get("href"), is("foobar"));
+ }
+
+ @Test
+ public void testBarLink() throws IOException {
+ final Element link = document.getElementById("bar");
+ assertThat(link.attributes().get("href"), is("bar"));
+ }
+
+}
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/SlingIncludeIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/SlingIncludeIT.java
new file mode 100644
index 0000000..d245d43
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/SlingIncludeIT.java
@@ -0,0 +1,68 @@
+/*
+ * 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.sling.scripting.thymeleaf.it.tests;
+
+import java.io.IOException;
+
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class SlingIncludeIT extends ThymeleafTestSupport {
+
+ private Document document;
+
+ @Before
+ public void setup() throws IOException {
+ final String url = String.format("http://localhost:%s/thymeleaf/include.html", httpPort());
+ document = Jsoup.connect(url).get();
+ }
+
+ @Test
+ public void testJspIncludeSimple() {
+ final Element simple = document.getElementById("simple");
+ assertThat("/content/thymeleaf/include", is(simple.text()));
+ }
+
+ @Test
+ public void testJspIncludeWrap() {
+ final Element wrap = document.getElementById("wrap");
+ assertThat(1, is(wrap.children().size()));
+ assertThat("/content/thymeleaf/include", is(wrap.child(0).text()));
+ }
+
+ @Test
+ public void testJspIncludeUnwrap() {
+ final Element unwrap = document.getElementById("unwrap");
+ assertThat(0, is(unwrap.children().size()));
+ assertThat("/content/thymeleaf/include", is(unwrap.text()));
+ }
+
+}
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/TemplateEngineIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/TemplateEngineIT.java
new file mode 100644
index 0000000..dbd84b4
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/TemplateEngineIT.java
@@ -0,0 +1,59 @@
+/*
+ * 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.sling.scripting.thymeleaf.it.tests;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.greaterThan;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class TemplateEngineIT extends ThymeleafTestSupport {
+
+ @Test
+ public void testTemplateEngine() {
+ assertNotNull(templateEngine);
+ }
+
+ @Test
+ public void testTemplateResolvers() {
+ final int size = templateEngine.getConfiguration().getTemplateResolvers().size();
+ assertThat(size, is(greaterThan(0)));
+ }
+
+ @Test
+ public void testMessageResolvers() {
+ final int size = templateEngine.getConfiguration().getMessageResolvers().size();
+ assertThat(size, is(greaterThan(0)));
+ }
+
+ @Test
+ public void testDialects() {
+ final int size = templateEngine.getConfiguration().getDialects().size();
+ assertThat(size, is(greaterThan(0)));
+ }
+
+}
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafDecoupledTemplateLogicIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafDecoupledTemplateLogicIT.java
new file mode 100644
index 0000000..0184522
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafDecoupledTemplateLogicIT.java
@@ -0,0 +1,52 @@
+/*
+ * 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.sling.scripting.thymeleaf.it.tests;
+
+import java.io.IOException;
+
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class ThymeleafDecoupledTemplateLogicIT extends ThymeleafTestSupport {
+
+ private Document document;
+
+ @Before
+ public void setup() throws IOException {
+ final String url = String.format("http://localhost:%s/thymeleaf/decoupled.html", httpPort());
+ document = Jsoup.connect(url).get();
+ }
+
+ @Test
+ public void testTitle() {
+ assertThat(document.title(), is("Thymeleaf Decoupled Template Logic"));
+ }
+
+}
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafReplaceIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafReplaceIT.java
new file mode 100644
index 0000000..adc010a
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafReplaceIT.java
@@ -0,0 +1,52 @@
+/*
+ * 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.sling.scripting.thymeleaf.it.tests;
+
+import java.io.IOException;
+
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class ThymeleafReplaceIT extends ThymeleafTestSupport {
+
+ private Document document;
+
+ @Before
+ public void setup() throws IOException {
+ final String url = String.format("http://localhost:%s/thymeleaf/replace.html", httpPort());
+ document = Jsoup.connect(url).get();
+ }
+
+ @Test
+ public void testTitle() {
+ assertThat(document.title(), is("Head Title"));
+ }
+
+}
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafScriptEngineFactoryIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafScriptEngineFactoryIT.java
new file mode 100644
index 0000000..4b16c7a
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafScriptEngineFactoryIT.java
@@ -0,0 +1,62 @@
+/*
+ * 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.sling.scripting.thymeleaf.it.tests;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.startsWith;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class ThymeleafScriptEngineFactoryIT extends ThymeleafTestSupport {
+
+ @Test
+ public void testScriptEngineFactory() {
+ assertNotNull(scriptEngineFactory);
+ }
+
+ @Test
+ public void testScriptEngineFactoryEngineName() {
+ assertThat("Apache Sling Scripting Thymeleaf", is(scriptEngineFactory.getEngineName()));
+ }
+
+ @Test
+ public void testScriptEngineFactoryLanguageName() {
+ assertThat("Thymeleaf", is(scriptEngineFactory.getLanguageName()));
+ }
+
+ @Test
+ public void testScriptEngineFactoryLanguageVersion() {
+ assertThat(scriptEngineFactory.getLanguageVersion(), startsWith("3.0"));
+ }
+
+ @Test
+ public void testScriptEngineFactoryNames() {
+ assertThat(scriptEngineFactory.getNames(), hasItem("thymeleaf"));
+ }
+
+}
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
new file mode 100644
index 0000000..6ff98a3
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
@@ -0,0 +1,156 @@
+/*
+ * 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.sling.scripting.thymeleaf.it.tests;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.util.Dictionary;
+
+import javax.inject.Inject;
+import javax.script.ScriptEngineFactory;
+
+import org.apache.sling.api.servlets.ServletResolver;
+import org.apache.sling.auth.core.AuthenticationSupport;
+import org.apache.sling.engine.SlingRequestProcessor;
+import org.apache.sling.scripting.thymeleaf.it.app.Activator;
+import org.apache.sling.testing.paxexam.SlingOptions;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.ProbeBuilder;
+import org.ops4j.pax.exam.TestProbeBuilder;
+import org.ops4j.pax.exam.util.Filter;
+import org.osgi.framework.Constants;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.http.HttpService;
+import org.thymeleaf.ITemplateEngine;
+
+import static org.apache.sling.testing.paxexam.SlingOptions.slingExtensionI18n;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingExtensionModels;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingJcrOak;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingLaunchpadOak;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingScripting;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingScriptingJsp;
+import static org.ops4j.pax.exam.CoreOptions.bundle;
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.keepCaches;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.workingDirectory;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
+
+public abstract class ThymeleafTestSupport {
+
+ @Inject
+ protected ServletResolver servletResolver;
+
+ @Inject
+ protected SlingRequestProcessor slingRequestProcessor;
+
+ @Inject
+ protected AuthenticationSupport authenticationSupport;
+
+ @Inject
+ protected HttpService httpService;
+
+ @Inject
+ @Filter(value = "(names=thymeleaf)")
+ protected ScriptEngineFactory scriptEngineFactory;
+
+ @Inject
+ protected ITemplateEngine templateEngine;
+
+ @Inject
+ protected ConfigurationAdmin configurationAdmin;
+
+ protected static synchronized int findFreePort() {
+ try {
+ final ServerSocket serverSocket = new ServerSocket(0);
+ final int port = serverSocket.getLocalPort();
+ serverSocket.close();
+ return port;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected int httpPort() throws IOException {
+ final Dictionary<String, Object> properties = configurationAdmin.getConfiguration("org.apache.felix.http").getProperties();
+ return Integer.parseInt(properties.get("org.osgi.service.http.port").toString());
+ }
+
+ @Configuration
+ public Option[] configuration() {
+ final String workingDirectory = String.format("target/paxexam/%s", getClass().getSimpleName());
+ final String filename = System.getProperty("bundle.filename");
+ final File file = new File(filename);
+ return new Option[]{
+ keepCaches(),
+ workingDirectory(workingDirectory),
+ launchpad(workingDirectory),
+ // Sling Scripting Thymeleaf
+ bundle(file.toURI().toString()),
+ mavenBundle().groupId("org.javassist").artifactId("javassist").versionAsInProject(),
+ // testing
+ mavenBundle().groupId("org.jsoup").artifactId("jsoup").versionAsInProject(),
+ mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
+ junitBundles()
+ };
+ }
+
+ @ProbeBuilder
+ public TestProbeBuilder probeConfiguration(final TestProbeBuilder testProbeBuilder) {
+ testProbeBuilder.setHeader(Constants.BUNDLE_ACTIVATOR, Activator.class.getName());
+ testProbeBuilder.setHeader(Constants.EXPORT_PACKAGE, "org.apache.sling.scripting.thymeleaf.it.app");
+ testProbeBuilder.setHeader("Sling-Model-Packages", "org.apache.sling.scripting.thymeleaf.it.app");
+ testProbeBuilder.setHeader("Sling-Initial-Content", String.join(",",
+ "apps/jsp;path:=/apps/jsp;overwrite:=true;uninstall:=true",
+ "apps/thymeleaf;path:=/apps/thymeleaf;overwrite:=true;uninstall:=true",
+ "content;path:=/content;overwrite:=true;uninstall:=true"
+ ));
+ return testProbeBuilder;
+ }
+
+ protected static Option launchpad(final String workingDirectory) {
+ final int httpPort = findFreePort();
+ final String slingHome = String.format("%s/sling", workingDirectory);
+ final String repositoryHome = String.format("%s/repository", slingHome);
+ final String localIndexDir = String.format("%s/index", repositoryHome);
+ return composite(
+ slingJcrOak(), // TODO if slingJcrOak() is called elsewhere, ResourceResolverFactory will not be created
+ slingLaunchpadOak(),
+ slingExtensionI18n(),
+ slingExtensionModels(),
+ slingScripting(),
+ slingScriptingJsp(),
+ newConfiguration("org.apache.felix.http")
+ .put("org.osgi.service.http.port", httpPort)
+ .asOption(),
+ newConfiguration("org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStoreService")
+ .put("repository.home", repositoryHome)
+ .put("name", "Default NodeStore")
+ .asOption(),
+ newConfiguration("org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProviderService")
+ .put("localIndexDir", localIndexDir)
+ .asOption(),
+ mavenBundle().groupId("org.apache.jackrabbit").artifactId("oak-segment").version(SlingOptions.versionResolver)
+ );
+ }
+
+}
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTextIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTextIT.java
new file mode 100644
index 0000000..dc827bc
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTextIT.java
@@ -0,0 +1,59 @@
+/*
+ * 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.sling.scripting.thymeleaf.it.tests;
+
+import java.io.IOException;
+
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class ThymeleafTextIT extends ThymeleafTestSupport {
+
+ private Document document;
+
+ @Before
+ public void setup() throws IOException {
+ final String url = String.format("http://localhost:%s/thymeleaf/text.html", httpPort());
+ document = Jsoup.connect(url).get();
+ }
+
+ @Test
+ public void testTitle() {
+ assertThat(document.title(), is("Thymeleaf Text"));
+ }
+
+ @Test
+ public void testResourceName() {
+ final Element name = document.getElementById("name");
+ assertThat("text", is(name.text()));
+ }
+
+}
diff --git a/src/test/resources/apps/jsp/page/resource/html.jsp b/src/test/resources/apps/jsp/page/resource/html.jsp
new file mode 100644
index 0000000..197eefa
--- /dev/null
+++ b/src/test/resources/apps/jsp/page/resource/html.jsp
@@ -0,0 +1,22 @@
+<%--
+ 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.
+--%><%@page session="false" %><%
+%><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling" %><%
+%><sling:defineObjects/><%
+%><%= resource.getPath() %><%
+%>
\ No newline at end of file
diff --git a/src/test/resources/apps/thymeleaf/ROOT.json b/src/test/resources/apps/thymeleaf/ROOT.json
new file mode 100644
index 0000000..5832d7c
--- /dev/null
+++ b/src/test/resources/apps/thymeleaf/ROOT.json
@@ -0,0 +1,6 @@
+{
+ "jcr:primaryType": "sling:Folder",
+ "sling:scripting": [
+ "html=thymeleaf"
+ ]
+}
diff --git a/src/test/resources/apps/thymeleaf/page/adaptto/html.html b/src/test/resources/apps/thymeleaf/page/adaptto/html.html
new file mode 100644
index 0000000..40ae135
--- /dev/null
+++ b/src/test/resources/apps/thymeleaf/page/adaptto/html.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<!--
+ 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.
+-->
+<html data-th-with="page=${request.adaptTo(@org.apache.sling.scripting.thymeleaf.it.app.Page@class)}">
+<head>
+ <meta charset="UTF-8"/>
+ <title data-th-text="${page.title}">Thymeleaf With with Sling Model</title>
+</head>
+<body>
+<span id="name" data-th-text="${page.name}"></span>
+</body>
+</html>
diff --git a/src/test/resources/apps/thymeleaf/page/decoupled/html.html b/src/test/resources/apps/thymeleaf/page/decoupled/html.html
new file mode 100644
index 0000000..90779c9
--- /dev/null
+++ b/src/test/resources/apps/thymeleaf/page/decoupled/html.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<!--
+ 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.
+-->
+<html>
+<head>
+ <title id="title">Thymeleaf</title>
+</head>
+<body>
+</body>
+</html>
diff --git a/src/test/resources/apps/thymeleaf/page/decoupled/html.th.xml b/src/test/resources/apps/thymeleaf/page/decoupled/html.th.xml
new file mode 100644
index 0000000..453c28d
--- /dev/null
+++ b/src/test/resources/apps/thymeleaf/page/decoupled/html.th.xml
@@ -0,0 +1,22 @@
+<?xml version="1.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.
+-->
+<thlogic xmlns:th="http://www.thymeleaf.org">
+ <attr sel="#title" th:text="${resource.getValueMap().get('title')}"></attr>
+</thlogic>
diff --git a/src/test/resources/apps/thymeleaf/page/fragments/head.html b/src/test/resources/apps/thymeleaf/page/fragments/head.html
new file mode 100644
index 0000000..e256136
--- /dev/null
+++ b/src/test/resources/apps/thymeleaf/page/fragments/head.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<!--
+ 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.
+-->
+<html>
+<head data-th-fragment="default">
+ <meta charset="UTF-8"/>
+ <title>Head Title</title>
+</head>
+<body>
+</body>
+</html>
diff --git a/src/test/resources/apps/thymeleaf/page/include/html.html b/src/test/resources/apps/thymeleaf/page/include/html.html
new file mode 100644
index 0000000..96c2ace
--- /dev/null
+++ b/src/test/resources/apps/thymeleaf/page/include/html.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<!--
+ 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.
+-->
+<html>
+<head>
+ <meta charset="UTF-8"/>
+ <title>Sling Include (with JSP)</title>
+</head>
+<body>
+<!-- simple include with resource type -->
+<span id="simple" data-sling-include="${resource}" data-sling-resourceType="'jsp/page/resource'"></span>
+<!-- include (keeping container element) -->
+<div id="wrap">
+ <span data-sling-include="${resource}" data-sling-resourceType="'jsp/page/resource'" data-sling-unwrap="false"></span>
+</div>
+<!-- include (unwrapping) -->
+<div id="unwrap">
+ <span data-sling-include="${resource}" data-sling-resourceType="'jsp/page/resource'" data-sling-unwrap="true"></span>
+</div>
+</body>
+</html>
diff --git a/src/test/resources/apps/thymeleaf/page/link/html.html b/src/test/resources/apps/thymeleaf/page/link/html.html
new file mode 100644
index 0000000..e9171f3
--- /dev/null
+++ b/src/test/resources/apps/thymeleaf/page/link/html.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<!--
+ 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.
+-->
+<html>
+<head>
+ <meta charset="UTF-8"/>
+ <title></title>
+</head>
+<body>
+<a id="foo" href="#" data-th-href="@{foo}">foo</a>
+<a id="bar" href="#" data-th-href="@{bar}">bar</a>
+</body>
+</html>
diff --git a/src/test/resources/apps/thymeleaf/page/main/html.html b/src/test/resources/apps/thymeleaf/page/main/html.html
new file mode 100644
index 0000000..35937bc
--- /dev/null
+++ b/src/test/resources/apps/thymeleaf/page/main/html.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<!--
+ 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.
+-->
+<html data-th-with="page=${request.adaptTo(@org.apache.sling.scripting.thymeleaf.it.app.Page@class)}">
+<head>
+ <meta charset="UTF-8"/>
+ <title data-th-text="${page.title}">Page Title</title>
+</head>
+<body>
+<p data-th-text="${page.name}">Page Name</p>
+<p data-th-text="${page.path}">Page Path</p>
+</body>
+</html>
diff --git a/src/test/resources/apps/thymeleaf/page/replace/html.html b/src/test/resources/apps/thymeleaf/page/replace/html.html
new file mode 100644
index 0000000..1c9ea89
--- /dev/null
+++ b/src/test/resources/apps/thymeleaf/page/replace/html.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<!--
+ 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.
+-->
+<html>
+<head data-th-replace="/apps/thymeleaf/page/fragments/head.html::default">
+ <title>Thymeleaf Replace</title>
+</head>
+<body>
+</body>
+</html>
diff --git a/src/test/resources/apps/thymeleaf/page/text/html.html b/src/test/resources/apps/thymeleaf/page/text/html.html
new file mode 100644
index 0000000..b177352
--- /dev/null
+++ b/src/test/resources/apps/thymeleaf/page/text/html.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<!--
+ 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.
+-->
+<html>
+<head>
+ <meta charset="UTF-8"/>
+ <title data-th-text="${resource.getValueMap().get('title')}"></title>
+</head>
+<body>
+<span id="name" data-th-text="${resource.name}"></span>
+</body>
+</html>
diff --git a/src/test/resources/content/thymeleaf.json b/src/test/resources/content/thymeleaf.json
new file mode 100644
index 0000000..b79a222
--- /dev/null
+++ b/src/test/resources/content/thymeleaf.json
@@ -0,0 +1,42 @@
+{
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "thymeleaf/page/main",
+ "sling:resourceSuperType": "thymeleaf/page",
+ "title": "Apache Sling Scripting Thymeleaf",
+ "adaptto": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "thymeleaf/page/adaptto",
+ "sling:resourceSuperType": "thymeleaf/page",
+ "title": "Sling Models adaptTo()"
+ },
+ "decoupled": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "thymeleaf/page/decoupled",
+ "sling:resourceSuperType": "thymeleaf/page",
+ "title": "Thymeleaf Decoupled Template Logic"
+ },
+ "include": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "thymeleaf/page/include",
+ "sling:resourceSuperType": "thymeleaf/page",
+ "title": "Sling Include"
+ },
+ "link": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "thymeleaf/page/link",
+ "sling:resourceSuperType": "thymeleaf/page",
+ "title": "Thymeleaf Link Builder"
+ },
+ "replace": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "thymeleaf/page/replace",
+ "sling:resourceSuperType": "thymeleaf/page",
+ "title": "Thymeleaf Replace"
+ },
+ "text": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "thymeleaf/page/text",
+ "sling:resourceSuperType": "thymeleaf/page",
+ "title": "Thymeleaf Text"
+ }
+}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 03/39: add Thymeleaf
issue 514
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 9ed1eb4e59cdff6b419b1b55e6da70572a6c1673
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Jul 11 12:31:24 2016 +0000
add Thymeleaf issue 514
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1752149 13f79535-47bb-0310-9956-ffa450edef68
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 43565e0..c562d5c 100644
--- a/README.md
+++ b/README.md
@@ -31,3 +31,4 @@ relevant Thymeleaf issues
* [Create OSGi bundle](https://github.com/thymeleaf/thymeleaf/issues/32)
* [keep (custom) IContext accessible](https://github.com/thymeleaf/thymeleaf/issues/388)
+* [Make IContext available in ITemplateResolver](https://github.com/thymeleaf/thymeleaf/issues/514)
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 06/39: SLING-5680 Add
Integration Tests for Scripting Thymeleaf
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit bb58f693283993a7b8a0726150658aae29951297
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Jul 22 17:37:32 2016 +0000
SLING-5680 Add Integration Tests for Scripting Thymeleaf
simplify (use test support and default Launchpad Oak Tar configuration)
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1753819 13f79535-47bb-0310-9956-ffa450edef68
---
.../thymeleaf/it/tests/ThymeleafTestSupport.java | 51 ++++------------------
1 file changed, 8 insertions(+), 43 deletions(-)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
index 1433b4f..34de29a 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
@@ -19,9 +19,6 @@
package org.apache.sling.scripting.thymeleaf.it.tests;
import java.io.File;
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.util.Dictionary;
import javax.inject.Inject;
import javax.script.ScriptEngineFactory;
@@ -31,13 +28,13 @@ import org.apache.sling.auth.core.AuthenticationSupport;
import org.apache.sling.engine.SlingRequestProcessor;
import org.apache.sling.scripting.thymeleaf.it.app.Activator;
import org.apache.sling.testing.paxexam.SlingOptions;
+import org.apache.sling.testing.paxexam.TestSupport;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.ProbeBuilder;
import org.ops4j.pax.exam.TestProbeBuilder;
import org.ops4j.pax.exam.util.Filter;
import org.osgi.framework.Constants;
-import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.http.HttpService;
import org.thymeleaf.ITemplateEngine;
@@ -45,16 +42,15 @@ import static org.apache.sling.testing.paxexam.SlingOptions.slingExtensionI18n;
import static org.apache.sling.testing.paxexam.SlingOptions.slingExtensionModels;
import static org.apache.sling.testing.paxexam.SlingOptions.slingJcrOak;
import static org.apache.sling.testing.paxexam.SlingOptions.slingLaunchpadOak;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingLaunchpadOakTarConfiguration;
import static org.apache.sling.testing.paxexam.SlingOptions.slingScripting;
import static org.apache.sling.testing.paxexam.SlingOptions.slingScriptingJsp;
import static org.ops4j.pax.exam.CoreOptions.bundle;
import static org.ops4j.pax.exam.CoreOptions.composite;
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.workingDirectory;
-import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
-public abstract class ThymeleafTestSupport {
+public abstract class ThymeleafTestSupport extends TestSupport {
@Inject
protected ServletResolver servletResolver;
@@ -75,33 +71,13 @@ public abstract class ThymeleafTestSupport {
@Inject
protected ITemplateEngine templateEngine;
- @Inject
- protected ConfigurationAdmin configurationAdmin;
-
- protected static synchronized int findFreePort() {
- try {
- final ServerSocket serverSocket = new ServerSocket(0);
- final int port = serverSocket.getLocalPort();
- serverSocket.close();
- return port;
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- protected int httpPort() throws IOException {
- final Dictionary<String, Object> properties = configurationAdmin.getConfiguration("org.apache.felix.http").getProperties();
- return Integer.parseInt(properties.get("org.osgi.service.http.port").toString());
- }
-
@Configuration
public Option[] configuration() {
- final String workingDirectory = String.format("target/paxexam/%s", getClass().getSimpleName());
final String filename = System.getProperty("bundle.filename");
final File file = new File(filename);
return new Option[]{
- workingDirectory(workingDirectory),
- launchpad(workingDirectory),
+ baseConfiguration(),
+ launchpad(),
// Sling Scripting Thymeleaf
bundle(file.toURI().toString()),
mavenBundle().groupId("org.javassist").artifactId("javassist").versionAsInProject(),
@@ -125,28 +101,17 @@ public abstract class ThymeleafTestSupport {
return testProbeBuilder;
}
- protected static Option launchpad(final String workingDirectory) {
+ protected Option launchpad() {
final int httpPort = findFreePort();
- final String slingHome = String.format("%s/sling", workingDirectory);
- final String repositoryHome = String.format("%s/repository", slingHome);
- final String localIndexDir = String.format("%s/index", repositoryHome);
+ final String workingDirectory = workingDirectory();
return composite(
+ slingLaunchpadOakTarConfiguration(workingDirectory, httpPort),
slingJcrOak(), // TODO if slingJcrOak() is called elsewhere, ResourceResolverFactory will not be created
slingLaunchpadOak(),
slingExtensionI18n(),
slingExtensionModels(),
slingScripting(),
slingScriptingJsp(),
- newConfiguration("org.apache.felix.http")
- .put("org.osgi.service.http.port", httpPort)
- .asOption(),
- newConfiguration("org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStoreService")
- .put("repository.home", repositoryHome)
- .put("name", "Default NodeStore")
- .asOption(),
- newConfiguration("org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProviderService")
- .put("localIndexDir", localIndexDir)
- .asOption(),
mavenBundle().groupId("org.apache.jackrabbit").artifactId("oak-segment").version(SlingOptions.versionResolver)
);
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 01/39:
[maven-release-plugin] prepare for next development iteration
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit f0053bdd675cd93e2cb9e87c4c14f32190729786
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Jul 1 19:42:11 2016 +0000
[maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1750998 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 86a6722..2724483 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
</parent>
<artifactId>org.apache.sling.scripting.thymeleaf</artifactId>
- <version>1.0.0</version>
+ <version>1.0.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Apache Sling Scripting Thymeleaf</name>
@@ -47,9 +47,9 @@
</properties>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.scripting.thymeleaf-1.0.0</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.scripting.thymeleaf-1.0.0</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.scripting.thymeleaf-1.0.0</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf</url>
</scm>
<dependencies>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 11/39: SLING-6047
SlingResourceTemplateResolver allows template resolution with decoupled
logic enabled for non-markup template modes
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit a8546c69000247c04d788703592a9c755eae75c3
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Thu Sep 8 22:35:12 2016 +0000
SLING-6047 SlingResourceTemplateResolver allows template resolution with decoupled logic enabled for non-markup template modes
check template mode
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1759921 13f79535-47bb-0310-9956-ffa450edef68
---
.../scripting/thymeleaf/internal/SlingResourceTemplateResolver.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingResourceTemplateResolver.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingResourceTemplateResolver.java
index 34d9d9d..5f53242 100644
--- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingResourceTemplateResolver.java
+++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/SlingResourceTemplateResolver.java
@@ -117,7 +117,7 @@ public class SlingResourceTemplateResolver implements ITemplateResolver {
final boolean templateResourceExistenceVerified = false;
final TemplateMode templateMode = templateModeProvider.provideTemplateMode(resource);
logger.debug("using template mode {} for template '{}'", templateMode, template);
- final boolean useDecoupledLogic = configuration.useDecoupledLogic();
+ final boolean useDecoupledLogic = templateMode.isMarkup() && configuration.useDecoupledLogic();
final ICacheEntryValidity validity = NonCacheableCacheEntryValidity.INSTANCE;
return new TemplateResolution(templateResource, templateResourceExistenceVerified, templateMode, useDecoupledLogic, validity);
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-scripting-thymeleaf] 30/39: SLING-6425
Update Pax Exam to 4.10
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit 49d6ecb6766cf9145e6c817974afa5ce092e22ee
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jan 31 09:21:38 2017 +0000
SLING-6425 Update Pax Exam to 4.10
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1781036 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index f64a9fd..1c07af9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,7 +44,7 @@
<org.unbescape.version>1.1.4.RELEASE</org.unbescape.version>
<ognl.version>3.1.12</ognl.version>
<com.fasterxml.jackson.version>2.6.3</com.fasterxml.jackson.version>
- <org.ops4j.pax.exam.version>4.9.2</org.ops4j.pax.exam.version>
+ <org.ops4j.pax.exam.version>4.10.0</org.ops4j.pax.exam.version>
</properties>
<scm>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.