This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.scripting.sightly.testing-content-1.0.6 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-testing-content.git
commit dfe5b106fe27b1acced2d74e17d662aa8e825ca2 Author: Radu Cotescu <[email protected]> AuthorDate: Tue May 12 15:39:47 2015 +0000 SLING-4704 - Move the Sightly scripting engine artifacts from contrib to bundles * moved Sightly artifacts from contrib to bundles * updated SCM info git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/sightly/testing-content@1678979 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 206 +++++++++++++++++++ .../testing/adaptable/RequestAdapterUseObject.java | 25 +++ .../adaptable/ResourceAdapterUseObject.java | 25 +++ .../adaptable/impl/RequestAdapterFactory.java | 60 ++++++ .../impl/RequestAdapterUseObjectImpl.java | 35 ++++ .../adaptable/impl/ResourceAdapterFactory.java | 58 ++++++ .../impl/ResourceAdapterUseObjectImpl.java | 35 ++++ .../sightly/testing/models/RequestModel.java | 40 ++++ .../sightly/testing/models/ResourceModel.java | 37 ++++ .../scripts/includedresource/includedresource.html | 20 ++ .../apps/sightly/scripts/resource/dot.html | 19 ++ .../apps/sightly/scripts/resource/resource.html | 33 +++ .../scripts/siblingdeps/component/component.html | 27 +++ .../scripts/siblingdeps/component/dependency.js | 23 +++ .../apps/sightly/scripts/siblingdeps/dependency.js | 23 +++ .../apps/sightly/scripts/siblingdeps/script.js | 23 +++ .../apps/sightly/scripts/template/bad-id.html | 19 ++ .../apps/sightly/scripts/template/template.html | 20 ++ .../SLING-INF/apps/sightly/scripts/text/text.html | 20 ++ .../apps/sightly/scripts/use/ErrorPojo.java | 38 ++++ .../apps/sightly/scripts/use/javaerror.html | 29 +++ .../SLING-INF/apps/sightly/scripts/use/jsuse.html | 32 +++ .../SLING-INF/apps/sightly/scripts/use/jsuse.js | 26 +++ .../SLING-INF/apps/sightly/scripts/use/use.html | 32 +++ .../apps/sightly/scripts/useinheritance.json | 14 ++ .../sightly/scripts/useinheritance/child/S.java | 23 +++ .../sightly/scripts/useinheritance/child/s.ecma | 1 + .../apps/sightly/scripts/useinheritance/child/s.js | 23 +++ .../scripts/useinheritance/child/templates.html | 19 ++ .../scripts/useinheritance/grandparent/S.java | 23 +++ .../useinheritance/grandparent/grandparent.html | 30 +++ .../scripts/useinheritance/grandparent/s.ecma | 1 + .../scripts/useinheritance/grandparent/s.js | 23 +++ .../useinheritance/grandparent/templates.html | 19 ++ .../sightly/scripts/useinheritance/parent/S.java | 23 +++ .../sightly/scripts/useinheritance/parent/s.ecma | 1 + .../sightly/scripts/useinheritance/parent/s.js | 23 +++ .../scripts/useinheritance/parent/templates.html | 19 ++ .../SLING-INF/apps/sightlyperf/loop/loop.jsp | 25 +++ .../SLING-INF/apps/sightlyperf/test/Test.java | 95 +++++++++ .../SLING-INF/apps/sightlyperf/test/jsp-el.jsp | 35 ++++ .../SLING-INF/apps/sightlyperf/test/mode.jsp | 19 ++ .../SLING-INF/apps/sightlyperf/test/sly-java.html | 27 +++ .../SLING-INF/apps/sightlyperf/test/sly-js.html | 27 +++ .../SLING-INF/apps/sightlyperf/test/test.js | 34 +++ .../SLING-INF/apps/sightlyperf/test/test.jsp | 59 ++++++ .../SLING-INF/apps/sightlytck/install.json | 11 + .../SLING-INF/apps/sightlytck/locales/de.json | 21 ++ src/main/resources/SLING-INF/sightly.json | 32 +++ src/main/resources/SLING-INF/sightlyperf.json | 227 +++++++++++++++++++++ src/main/resources/SLING-INF/sightlytck.json | 100 +++++++++ 51 files changed, 1859 insertions(+) diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..be05001 --- /dev/null +++ b/pom.xml @@ -0,0 +1,206 @@ +<?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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <!-- ======================================================================= --> + <!-- P A R E N T P R O J E C T --> + <!-- ======================================================================= --> + <parent> + <groupId>org.apache.sling</groupId> + <artifactId>sling</artifactId> + <version>22</version> + <relativePath /> + </parent> + + <!-- ======================================================================= --> + <!-- P R O J E C T --> + <!-- ======================================================================= --> + <artifactId>org.apache.sling.scripting.sightly.testing-content</artifactId> + <version>1.0.5-SNAPSHOT</version> + <packaging>bundle</packaging> + + <name>Apache Sling Scripting Sightly Integration Tests Content</name> + + <description> + This bundle contains: + - Content adapted from the Adobe Sightly TCK meant to test the org.apache.sling.scripting.sightly implementations. + - Content meant to test performance of the org.apache.sling.scripting.sightly implementation. + </description> + + <scm> + <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/sightly/testing-content</connection> + <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/sightly/testing-content</developerConnection> + <url>http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/testing-content</url> + </scm> + + <properties> + <sling.java.version>6</sling.java.version> + </properties> + + + <!-- ======================================================================= --> + <!-- B U I L D --> + <!-- ======================================================================= --> + <build> + <resources> + <resource> + <directory>${basedir}/src/main/resources</directory> + </resource> + <resource> + <directory>${project.build.outputDirectory}/SLING-INF/sightlytck</directory> + <targetPath>SLING-INF/sightlytck</targetPath> + </resource> + </resources> + <pluginManagement> + <plugins> + <plugin> + <!-- Extend RAT configuration from parent pom --> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <configuration> + <excludes combine.children="append"> + <exclude>src/main/resources/SLING-INF/**/*.json</exclude> + <exclude>src/main/resources/SLING-INF/**/*.ecma</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </pluginManagement> + + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>unpack</id> + <phase>generate-resources</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>io.sightly</groupId> + <artifactId>io.sightly.tck</artifactId> + <version>1.1.2</version> + <type>jar</type> + <outputDirectory>${project.build.directory}/sightlytck/</outputDirectory> + <includes>**/*.html,**/*.js,**/*.java</includes> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>2.7</version> + <executions> + <execution> + <id>copy-resources</id> + <phase>generate-resources</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.build.outputDirectory}/SLING-INF/sightlytck/scripts</outputDirectory> + <resources> + <resource> + <directory>${project.build.directory}/sightlytck/testfiles/scripts/</directory> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Sling-Initial-Content>SLING-INF;overwrite=true</Sling-Initial-Content> + <Sling-Model-Packages>org.apache.sling.scripting.sightly.testing.models</Sling-Model-Packages> + <Require-Capability>io.sightly; filter:="(&(version>=1.0)(!(version>=2.0)))"</Require-Capability> + </instructions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.sling</groupId> + <artifactId>maven-sling-plugin</artifactId> + <configuration> + <failOnError>true</failOnError> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jslint-maven-plugin</artifactId> + <version>1.0.1</version> + <configuration> + <sourceJsFolder>${basedir}/src/main/resources/SLING-INF</sourceJsFolder> + <includes> + <include>**/*.json</include> + </includes> + <encoding>UTF-8</encoding> + </configuration> + <executions> + <execution> + <goals> + <goal>jslint</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-scr-plugin</artifactId> + <dependencies> + <dependency> + <groupId>javax.jcr</groupId> + <artifactId>jcr</artifactId> + <version>2.0</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + + <dependencies> + <!-- Test bundle dependencies --> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.models.api</artifactId> + <version>1.1.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.api</artifactId> + <version>2.1.0</version> + <scope>provided</scope> + </dependency> + </dependencies> + +</project> diff --git a/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/RequestAdapterUseObject.java b/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/RequestAdapterUseObject.java new file mode 100644 index 0000000..24733ff --- /dev/null +++ b/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/RequestAdapterUseObject.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * 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.sightly.testing.adaptable; + +public interface RequestAdapterUseObject { + + public String getTitle(); + +} diff --git a/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/ResourceAdapterUseObject.java b/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/ResourceAdapterUseObject.java new file mode 100644 index 0000000..dc8b88b --- /dev/null +++ b/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/ResourceAdapterUseObject.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * 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.sightly.testing.adaptable; + +public interface ResourceAdapterUseObject { + + public String getTitle(); + +} diff --git a/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/impl/RequestAdapterFactory.java b/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/impl/RequestAdapterFactory.java new file mode 100644 index 0000000..e1bcf72 --- /dev/null +++ b/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/impl/RequestAdapterFactory.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.sightly.testing.adaptable.impl; + +import org.apache.felix.scr.annotations.Component; +import org.apache.felix.scr.annotations.Properties; +import org.apache.felix.scr.annotations.Property; +import org.apache.felix.scr.annotations.Service; +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.api.adapter.AdapterFactory; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.scripting.sightly.testing.adaptable.RequestAdapterUseObject; + +@Component +@Service +@Properties({ + @Property( + name = AdapterFactory.ADAPTABLE_CLASSES, + value = { + "org.apache.sling.api.SlingHttpServletRequest" + } + ), + @Property( + name = AdapterFactory.ADAPTER_CLASSES, + value = { + "org.apache.sling.scripting.sightly.testing.adaptable.RequestAdapterUseObject" + } + ) +}) +public class RequestAdapterFactory implements AdapterFactory { + + @Override + public <AdapterType> AdapterType getAdapter(Object adaptable, Class<AdapterType> type) { + if (type == RequestAdapterUseObject.class && adaptable instanceof SlingHttpServletRequest) { + SlingHttpServletRequest request = (SlingHttpServletRequest) adaptable; + Resource resource = request.getResource(); + ValueMap properties = resource.adaptTo(ValueMap.class); + String title = (String) properties.get("jcr:title"); + return (AdapterType) new RequestAdapterUseObjectImpl(title); + } + return null; + } +} diff --git a/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/impl/RequestAdapterUseObjectImpl.java b/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/impl/RequestAdapterUseObjectImpl.java new file mode 100644 index 0000000..c7997e2 --- /dev/null +++ b/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/impl/RequestAdapterUseObjectImpl.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * 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.sightly.testing.adaptable.impl; + +import org.apache.sling.scripting.sightly.testing.adaptable.RequestAdapterUseObject; + +public class RequestAdapterUseObjectImpl implements RequestAdapterUseObject { + + private String title; + + public RequestAdapterUseObjectImpl(String title) { + this.title = title; + } + + @Override + public String getTitle() { + return title != null ? title : "FAILED"; + } +} diff --git a/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/impl/ResourceAdapterFactory.java b/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/impl/ResourceAdapterFactory.java new file mode 100644 index 0000000..671ac71 --- /dev/null +++ b/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/impl/ResourceAdapterFactory.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * 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.sightly.testing.adaptable.impl; + +import org.apache.felix.scr.annotations.Component; +import org.apache.felix.scr.annotations.Properties; +import org.apache.felix.scr.annotations.Property; +import org.apache.felix.scr.annotations.Service; +import org.apache.sling.api.adapter.AdapterFactory; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.scripting.sightly.testing.adaptable.ResourceAdapterUseObject; + +@Component +@Service +@Properties({ + @Property( + name = AdapterFactory.ADAPTABLE_CLASSES, + value = { + "org.apache.sling.api.resource.Resource" + } + ), + @Property( + name = AdapterFactory.ADAPTER_CLASSES, + value = { + "org.apache.sling.scripting.sightly.testing.adaptable.ResourceAdapterUseObject" + } + ) +}) +public class ResourceAdapterFactory implements AdapterFactory { + + @Override + public <AdapterType> AdapterType getAdapter(Object adaptable, Class<AdapterType> type) { + if (type == ResourceAdapterUseObject.class && adaptable instanceof Resource) { + Resource resource = (Resource) adaptable; + ValueMap properties = resource.adaptTo(ValueMap.class); + String title = (String) properties.get("jcr:title"); + return (AdapterType) new ResourceAdapterUseObjectImpl(title); + } + return null; + } +} diff --git a/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/impl/ResourceAdapterUseObjectImpl.java b/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/impl/ResourceAdapterUseObjectImpl.java new file mode 100644 index 0000000..2c3a8ad --- /dev/null +++ b/src/main/java/org/apache/sling/scripting/sightly/testing/adaptable/impl/ResourceAdapterUseObjectImpl.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * 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.sightly.testing.adaptable.impl; + +import org.apache.sling.scripting.sightly.testing.adaptable.ResourceAdapterUseObject; + +public class ResourceAdapterUseObjectImpl implements ResourceAdapterUseObject { + + private String title; + + public ResourceAdapterUseObjectImpl(String title) { + this.title = title; + } + + @Override + public String getTitle() { + return title != null ? title : "FAILED"; + } +} diff --git a/src/main/java/org/apache/sling/scripting/sightly/testing/models/RequestModel.java b/src/main/java/org/apache/sling/scripting/sightly/testing/models/RequestModel.java new file mode 100644 index 0000000..2237edb --- /dev/null +++ b/src/main/java/org/apache/sling/scripting/sightly/testing/models/RequestModel.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * 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.sightly.testing.models; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.Via; + +@Model(adaptables = SlingHttpServletRequest.class) +public class RequestModel { + + @Inject + @Via("resource") + @Named("jcr:title") + private String title; + + public String getTitle() { + return title != null ? title : "FAILED"; + } + +} diff --git a/src/main/java/org/apache/sling/scripting/sightly/testing/models/ResourceModel.java b/src/main/java/org/apache/sling/scripting/sightly/testing/models/ResourceModel.java new file mode 100644 index 0000000..bb5ff94 --- /dev/null +++ b/src/main/java/org/apache/sling/scripting/sightly/testing/models/ResourceModel.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * 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.sightly.testing.models; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Model; + +@Model(adaptables = Resource.class) +public class ResourceModel { + + @Inject + @Named("jcr:title") + private String title; + + public String getTitle() { + return title != null ? title : "FAILED"; + } +} diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/includedresource/includedresource.html b/src/main/resources/SLING-INF/apps/sightly/scripts/includedresource/includedresource.html new file mode 100644 index 0000000..023dd40 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/includedresource/includedresource.html @@ -0,0 +1,20 @@ +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<span class="path">path: ${resource.path}</span><br> +<span class="selectors">selectors: ${request.requestPathInfo.selectorString}</span> \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/resource/dot.html b/src/main/resources/SLING-INF/apps/sightly/scripts/resource/dot.html new file mode 100644 index 0000000..a95bbd2 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/resource/dot.html @@ -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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<div id="dot">It works</div> \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/resource/resource.html b/src/main/resources/SLING-INF/apps/sightly/scripts/resource/resource.html new file mode 100644 index 0000000..40c5224 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/resource/resource.html @@ -0,0 +1,33 @@ +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<!DOCTYPE html> +<html> +<head> + <title>Sightly data-sly-resource - Sling implementation</title> +</head> +<body> +<div id="selectors" data-sly-resource="${'/sightly/includedresource' @ selectors=['a', 'b']}"></div> +<div id="selectors-remove-c" data-sly-resource="${'/sightly/includedresource.a.b.c.html' @ selectors=['a', 'b']}"></div> +<div id="removeselectors-remove-b" data-sly-resource="${'/sightly/includedresource.a.b.c.html' @ removeSelectors=['b']}"></div> +<div id="addselectors" data-sly-resource="${'/sightly/includedresource' @ addSelectors=['a', 'b', 'c']}"></div> +<div id="dot-include" data-sly-resource="${ '.' @ selectors='dot'}"></div> +<div id="extension-selectors" data-sly-resource="${'/sightly/text.a.b.txt'}"></div> +<div id="extension-replaceselectors" data-sly-resource="${'/sightly/text.a.b.txt' @ selectors=['c']}"></div> +</body> +</html> \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/component.html b/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/component.html new file mode 100644 index 0000000..9bfb90f --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/component.html @@ -0,0 +1,27 @@ +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<!doctype html> +<html> + <head> + <title>Sightly JS Use-API dependency resolution</title> + </head> + <body> + <div id="js-rep-res" data-sly-use.js="/apps/sightly/scripts/siblingdeps/script.js">${js.result}</div> + </body> +</html> diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/dependency.js b/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/dependency.js new file mode 100644 index 0000000..e887399 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/dependency.js @@ -0,0 +1,23 @@ +/******************************************************************************* + * 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. + ******************************************************************************/ +use(function () { + return { + result: '/apps/sightly/scripts/siblingdeps/component/dependency.js' + } +}); \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/dependency.js b/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/dependency.js new file mode 100644 index 0000000..7e1510b --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/dependency.js @@ -0,0 +1,23 @@ +/******************************************************************************* + * 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. + ******************************************************************************/ +use(function () { + return { + result: '/apps/sightly/scripts/siblingdeps/dependency.js' + } +}); \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/script.js b/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/script.js new file mode 100644 index 0000000..f396934 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/script.js @@ -0,0 +1,23 @@ +/******************************************************************************* + * 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. + ******************************************************************************/ +use('dependency.js', function (dep) { + return { + result: dep.result + }; +}); \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/template/bad-id.html b/src/main/resources/SLING-INF/apps/sightly/scripts/template/bad-id.html new file mode 100644 index 0000000..4fbfd11 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/template/bad-id.html @@ -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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<template data-sly-template.bad-template-id=" @ ">should produce parsing exception</template> diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/template/template.html b/src/main/resources/SLING-INF/apps/sightly/scripts/template/template.html new file mode 100644 index 0000000..5269cef --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/template/template.html @@ -0,0 +1,20 @@ +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<template data-sly-template.templ=" @ ">SUCCESS</template> +<div id="template" data-sly-call="${templ}"></div> \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/text/text.html b/src/main/resources/SLING-INF/apps/sightly/scripts/text/text.html new file mode 100644 index 0000000..023dd40 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/text/text.html @@ -0,0 +1,20 @@ +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<span class="path">path: ${resource.path}</span><br> +<span class="selectors">selectors: ${request.requestPathInfo.selectorString}</span> \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/use/ErrorPojo.java b/src/main/resources/SLING-INF/apps/sightly/scripts/use/ErrorPojo.java new file mode 100644 index 0000000..cc7a48b --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/use/ErrorPojo.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * 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 apps.sightly.scripts.use; + +import javax.script.Bindings; + +import org.apache.sling.scripting.sightly.pojo.Use; + +public class ErrorPojo implements Use { + + @Override + public void init(Bindings bindings) { + Object o = null; + // throw a silly NPE + o.toString(); + } + + public String sayHello() { + return "hello"; + } + +} \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/use/javaerror.html b/src/main/resources/SLING-INF/apps/sightly/scripts/use/javaerror.html new file mode 100644 index 0000000..404ab6e --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/use/javaerror.html @@ -0,0 +1,29 @@ +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<!doctype html> +<html> + <head> + <title>Sightly Use-API - Sling implementation :: Java Use object errors</title> + </head> + <body> + <div data-sly-use.pojo="apps.sightly.scripts.use.ErrorPojo"> + ${pojo.sayHello} + </div> + </body> +</html> \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/use/jsuse.html b/src/main/resources/SLING-INF/apps/sightly/scripts/use/jsuse.html new file mode 100644 index 0000000..62a16f9 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/use/jsuse.html @@ -0,0 +1,32 @@ +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<!DOCTYPE html> +<html> + <head> + <title>Sightly JavaScript Use-API - Sling implementation</title> + </head> + <body> + <section data-sly-use.jsuse="jsuse.js"> + <div id="resource-name">${jsuse.resourceName}</div> + <div id="resource-getName">${jsuse.resourceGetName}</div> + <div id="resource-resourceType">${jsuse.resourceResourceType}</div> + <div id="resource-getResourceType">${jsuse.resourceGetResourceType}</div> + </section> + </body> +</html> \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/use/jsuse.js b/src/main/resources/SLING-INF/apps/sightly/scripts/use/jsuse.js new file mode 100644 index 0000000..1cd9611 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/use/jsuse.js @@ -0,0 +1,26 @@ +/******************************************************************************* + * 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. + ******************************************************************************/ +use(function () { + return { + resourceName: sightly.resource.name, + resourceGetName: sightly.resource.getName(), + resourceResourceType: sightly.resource.resourceType, + resourceGetResourceType: sightly.resource.getResourceType() + }; +}); diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/use/use.html b/src/main/resources/SLING-INF/apps/sightly/scripts/use/use.html new file mode 100644 index 0000000..6efc1d8 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/use/use.html @@ -0,0 +1,32 @@ +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<!DOCTYPE html> +<html> + <head> + <title>Sightly Use-API - Sling implementation</title> + </head> + <body> + <div id="reqmodel" data-sly-use.reqmodel="org.apache.sling.scripting.sightly.testing.models.RequestModel">${reqmodel.title}</div> + <div id="resmodel" data-sly-use.resmodel="org.apache.sling.scripting.sightly.testing.models.ResourceModel">${resmodel.title}</div> + <div id="reqadapt" + data-sly-use.reqadapt="org.apache.sling.scripting.sightly.testing.adaptable.RequestAdapterUseObject">${reqadapt.title}</div> + <div id="resadapt" + data-sly-use.resadapt="org.apache.sling.scripting.sightly.testing.adaptable.ResourceAdapterUseObject">${resadapt.title}</div> + </body> +</html> \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance.json b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance.json new file mode 100644 index 0000000..cf20608 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance.json @@ -0,0 +1,14 @@ +{ + "jcr:primaryType": "sling:Folder", + "grandparent": { + "jcr:primaryType": "sling:Folder" + }, + "parent": { + "jcr:primaryType": "sling:Folder", + "sling:resourceSuperType": "/apps/sightly/scripts/useinheritance/grandparent" + }, + "child": { + "jcr:primaryType": "sling:Folder", + "sling:resourceSuperType": "sightly/scripts/useinheritance/parent" + } +} \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/S.java b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/S.java new file mode 100644 index 0000000..c499920 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/S.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * 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 apps.sightly.scripts.useinheritance.child; + +public class S { + public static final String message = "child.javaobject"; +} diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/s.ecma b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/s.ecma new file mode 100644 index 0000000..0b943e6 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/s.ecma @@ -0,0 +1 @@ +"child.ecmaobject"; \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/s.js b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/s.js new file mode 100644 index 0000000..772b103 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/s.js @@ -0,0 +1,23 @@ +/******************************************************************************* + * 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. + ******************************************************************************/ +use(function () { + return { + message : 'child.javascriptobject' + }; +}); diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/templates.html b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/templates.html new file mode 100644 index 0000000..73c5d4a --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/templates.html @@ -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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<template data-sly-template.template>child.template</template> \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/S.java b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/S.java new file mode 100644 index 0000000..aa99182 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/S.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * 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 apps.sightly.scripts.useinheritance.grandparent; + +public class S { + public static final String message = "grandparent.javaobject"; +} diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/grandparent.html b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/grandparent.html new file mode 100644 index 0000000..eb7c834 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/grandparent.html @@ -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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<!DOCTYPE html> +<html> +<head> + <title>Sightly Use-API - Inheritance</title> +</head> +<body> + <div id="javaobj" data-sly-use.javaobj="S">${javaobj.message}</div> + <div id="javascriptobj" data-sly-use.javascriptobj="s.js">${javascriptobj.message}</div> + <div id="ecmaobj" data-sly-use.ecmaobj="s.ecma">${ecmaobj}</div> + <div id="templateobj" data-sly-use.templateobj="templates.html" data-sly-call="${templateobj.template}"></div> +</body> +</html> \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/s.ecma b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/s.ecma new file mode 100644 index 0000000..fb168e2 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/s.ecma @@ -0,0 +1 @@ +"grandparent.ecmaobject"; \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/s.js b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/s.js new file mode 100644 index 0000000..988c6b8 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/s.js @@ -0,0 +1,23 @@ +/******************************************************************************* + * 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. + ******************************************************************************/ +use(function () { + return { + message : 'grandparent.javascriptobject' + }; +}); diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/templates.html b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/templates.html new file mode 100644 index 0000000..4eba99f --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/templates.html @@ -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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<template data-sly-template.template>grandparent.template</template> \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/S.java b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/S.java new file mode 100644 index 0000000..cd95b3e --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/S.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * 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 apps.sightly.scripts.useinheritance.parent; + +public class S { + public static final String message = "parent.javaobject"; +} diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/s.ecma b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/s.ecma new file mode 100644 index 0000000..5b90afe --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/s.ecma @@ -0,0 +1 @@ +"parent.ecmaobject"; \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/s.js b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/s.js new file mode 100644 index 0000000..8170aba --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/s.js @@ -0,0 +1,23 @@ +/******************************************************************************* + * 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. + ******************************************************************************/ +use(function () { + return { + message : 'parent.javascriptobject' + }; +}); diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/templates.html b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/templates.html new file mode 100644 index 0000000..6850c64 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/templates.html @@ -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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<template data-sly-template.template>parent.template</template> \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightlyperf/loop/loop.jsp b/src/main/resources/SLING-INF/apps/sightlyperf/loop/loop.jsp new file mode 100644 index 0000000..de960bf --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightlyperf/loop/loop.jsp @@ -0,0 +1,25 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling"%> +<%--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%> +<p>selector: ${param.selector} [<strong>jsp</strong>, jsp-el, sly-java, sly-js]</p> +<p>count: ${param.count} [1 - 20, <strong>20</strong>]</p> +<c:forEach begin="1" end="${empty param.count || param.count < 1 || param.count > 20 ? 20 : param.count}"> + <sling:include path="/sightlyperf/test" replaceSelectors="${param.selector == 'sly-java' || param.selector == 'sly-js' || param.selector == 'jsp-el' ? param.selector : 'jsp'}" /> +</c:forEach> \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightlyperf/test/Test.java b/src/main/resources/SLING-INF/apps/sightlyperf/test/Test.java new file mode 100644 index 0000000..7929a30 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightlyperf/test/Test.java @@ -0,0 +1,95 @@ +/******************************************************************************* + * 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 apps.sightlyperf.test; + +import java.util.Iterator; + +import javax.script.Bindings; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.scripting.sightly.pojo.Use; + +public class Test implements Use { + + private String text = null; + + private String tag = null; + + private boolean includeChildren = false; + + private Iterator<Resource> children = null; + + public void init(Bindings bindings) { + Resource resource = (Resource)bindings.get("resource"); + ValueMap properties = (ValueMap)bindings.get("properties"); + + if (properties != null) { + Object text = properties.get("text"); + if (text != null) { + this.text = text.toString(); + } + + Object tag = properties.get("tag"); + if (tag != null) { + this.tag = tag.toString(); + } + + Object includeChildren = properties.get("includeChildren"); + if (includeChildren != null) { + this.includeChildren = Boolean.parseBoolean(includeChildren.toString()); + this.children = resource.listChildren(); + } + } + + if (this.text == null) { + this.text = resource.getPath(); + } + } + + public String getText() { + return this.text; + } + + public String getTag() { + return tag; + } + + public String getStartTag() { + if (tag == null) { + return null; + } + return "<" + tag + ">"; + } + + public String getEndTag() { + if (tag == null) { + return null; + } + return "</" + tag + ">"; + } + + public boolean getIncludeChildren() { + return includeChildren; + } + + public Iterator<Resource> getChildren() { + return this.children; + } +} \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightlyperf/test/jsp-el.jsp b/src/main/resources/SLING-INF/apps/sightlyperf/test/jsp-el.jsp new file mode 100644 index 0000000..cd00709 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightlyperf/test/jsp-el.jsp @@ -0,0 +1,35 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> +<%@ taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling"%> +<%--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%> +<sling:defineObjects /> +<c:set var="properties" value="${sling:adaptTo(resource,'org.apache.sling.api.resource.ValueMap')}" /> +<c:set var="tag" value="${sling:getValue(properties, 'tag', '')}" /> +<c:if test="${tag != ''}"><${tag}></c:if> +${sling:encode(sling:getValue(properties, 'text', resource.path), 'HTML')} +<c:if test="${tag != ''}"></${tag}></c:if> +<sling:call script="mode.jsp" /> +<c:if test="${sling:getValue(properties, 'includeChildren', false)}"> + <ul> + <c:forEach items="${sling:listChildren(resource)}" var="child"> + <li><sling:include path="${child.path}" /></li> + </c:forEach> + </ul> +</c:if> diff --git a/src/main/resources/SLING-INF/apps/sightlyperf/test/mode.jsp b/src/main/resources/SLING-INF/apps/sightlyperf/test/mode.jsp new file mode 100644 index 0000000..2c039d0 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightlyperf/test/mode.jsp @@ -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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%> +<!-- <%="comment"%> --> \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightlyperf/test/sly-java.html b/src/main/resources/SLING-INF/apps/sightlyperf/test/sly-java.html new file mode 100644 index 0000000..ad14853 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightlyperf/test/sly-java.html @@ -0,0 +1,27 @@ +<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/--> +<div data-sly-use.test="apps.sightlyperf.test.Test" data-sly-unwrap> + ${test.tag != null ? test.startTag : '' @ context = "unsafe"} + ${test.text @ context = "text"} + ${test.tag != null ? test.endTag : '' @ context = "unsafe"} + <div data-sly-include="mode.jsp" data-sly-unwrap=""></div> + <ul data-sly-test="${test.includeChildren}" data-sly-list.child="${test.children}"> + <li data-sly-resource="${child.path}"></li> + </ul> +</div> diff --git a/src/main/resources/SLING-INF/apps/sightlyperf/test/sly-js.html b/src/main/resources/SLING-INF/apps/sightlyperf/test/sly-js.html new file mode 100644 index 0000000..e13115f --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightlyperf/test/sly-js.html @@ -0,0 +1,27 @@ +<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/--> +<div data-sly-use.test="test.js" data-sly-unwrap> + ${test.tag != null ? test.startTag : '' @ context = "unsafe"} + ${test.text @ context = "text"} + ${test.tag != null ? test.endTag : '' @ context = "unsafe"} + <div data-sly-include="mode.jsp" data-sly-unwrap=""></div> + <ul data-sly-test="${test.includeChildren}" data-sly-list.child="${test.children}"> + <li data-sly-resource="${child.path}"></li> + </ul> +</div> \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightlyperf/test/test.js b/src/main/resources/SLING-INF/apps/sightlyperf/test/test.js new file mode 100644 index 0000000..d7217cc --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightlyperf/test/test.js @@ -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. + ******************************************************************************/ +use(function () { + var test = {}; + + test.text = properties.get('text') || resource.getPath(); + test.tag = properties.get('tag') || null; + if (test.tag != null) { + test.startTag = '<' + test.tag + '>'; + test.endTag = '</' + test.tag + '>'; + } + test.includeChildren = properties.get('includeChildren') || false; + if (test.includeChildren) { + test.children = sightly.resource.getChildren(); + } + + return test; +}); \ No newline at end of file diff --git a/src/main/resources/SLING-INF/apps/sightlyperf/test/test.jsp b/src/main/resources/SLING-INF/apps/sightlyperf/test/test.jsp new file mode 100644 index 0000000..d9bc147 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightlyperf/test/test.jsp @@ -0,0 +1,59 @@ +<%@ page import="org.apache.sling.api.resource.Resource" %> +<%@ page import="org.apache.sling.api.resource.ValueMap" %> +<%@ page import="org.apache.sling.xss.XSSAPI" %> +<%@ page import="java.util.Iterator" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> +<%@ taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling"%> +<%--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%> +<sling:defineObjects /> +<% + ValueMap properties = resource.adaptTo(ValueMap.class); + + String tag = properties.get("tag", null); + if (tag != null) { + out.println("<" + tag + ">"); + } + XSSAPI xssAPI = sling.getService(XSSAPI.class); + out.println(xssAPI.encodeForHTML(properties.get("text", resource.getPath()).toString())); + if (tag != null) { + out.println("</" + tag + ">"); + } + +%> + <sling:call script="mode.jsp" /> +<% + + if (properties.get("includeChildren", false)) { + Iterator<Resource> iter = resource.listChildren(); +%> +<ul> +<% + while(iter.hasNext()) { + Resource child = iter.next(); +%> + <li><sling:include path="<%=child.getPath()%>" /></li> +<% + } +%> +</ul> +<% + } +%> diff --git a/src/main/resources/SLING-INF/apps/sightlytck/install.json b/src/main/resources/SLING-INF/apps/sightlytck/install.json new file mode 100644 index 0000000..0876b82 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightlytck/install.json @@ -0,0 +1,11 @@ +{ + "jcr:primaryType" : "sling:Folder", + "org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl" : { + "jcr:primaryType" : "sling:OsgiConfig", + "resource.resolver.searchpath" : [ + "/apps", + "/libs", + "/sightlytck/scripts" + ] + } +} diff --git a/src/main/resources/SLING-INF/apps/sightlytck/locales/de.json b/src/main/resources/SLING-INF/apps/sightlytck/locales/de.json new file mode 100644 index 0000000..e26b648 --- /dev/null +++ b/src/main/resources/SLING-INF/apps/sightlytck/locales/de.json @@ -0,0 +1,21 @@ +{ + "jcr:primaryType" : "nt:unstructured", + "jcr:mixinTypes" : ["mix:language"], + "jcr:language" : "de", + "hello" : { + "jcr:primaryType" : "sling:MessageEntry", + "sling:key" : "hello", + "sling:message" : "Hallo" + }, + "hello_some_hint" : { + "jcr:primaryType" : "sling:MessageEntry", + "sling:key" : "hello ((some-hint))", + "sling:message" : "Hallo mit einem Hauch" + }, + "world" : { + "jcr:primaryType" : "sling:MessageEntry", + "sling:key" : "world", + "sling:message" : "Welt" + } + +} diff --git a/src/main/resources/SLING-INF/sightly.json b/src/main/resources/SLING-INF/sightly.json new file mode 100644 index 0000000..040d487 --- /dev/null +++ b/src/main/resources/SLING-INF/sightly.json @@ -0,0 +1,32 @@ +{ + "jcr:primaryType": "sling:Folder", + "use": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightly/scripts/use", + "jcr:title": "SUCCESS" + }, + "resource": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightly/scripts/resource" + }, + "includedresource": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightly/scripts/includedresource" + }, + "template": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightly/scripts/template" + }, + "text.txt": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightly/scripts/text" + }, + "useinheritance": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightly/scripts/useinheritance/child" + }, + "use-sibling-dependency-resolution": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightly/scripts/siblingdeps/component" + } +} diff --git a/src/main/resources/SLING-INF/sightlyperf.json b/src/main/resources/SLING-INF/sightlyperf.json new file mode 100644 index 0000000..59cbae9 --- /dev/null +++ b/src/main/resources/SLING-INF/sightlyperf.json @@ -0,0 +1,227 @@ +{ + "jcr:primaryType": "sling:Folder", + "test" : { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<page>", + "tag": "b", + "includeChildren": "true", + "head": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<head>", + "includeChildren": "true", + "title": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<title>" + }, + "style": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<style>" + } + }, + "body": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<body>", + "includeChildren": "true", + "topnav": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<topnav>", + "includeChildren": "true", + "logo": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<logo>" + }, + "menu": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<menu>", + "includeChildren": "true", + "home": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<home>" + }, + "products": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<products>" + }, + "services": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<services>" + }, + "about": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<about>" + }, + "contact": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<contact>" + } + }, + "breadcrumbs": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<breadcrumbs>", + "includeChildren": "true", + "home": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<home>" + }, + "products": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<products>" + }, + "productPage": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<productPage>" + } + } + }, + "main": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<main>", + "includeChildren": "true", + "sidebar": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<sidebar>", + "includeChildren": "true", + "title": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<title>" + }, + "links": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<links>", + "includeChildren": "true", + "home": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<home>" + }, + "products": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<products>" + }, + "services": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<services>" + }, + "about": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<about>" + }, + "contact": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<contact>" + } + } + }, + "content": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<content>", + "includeChildren": "true", + "carousel": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<carousel>", + "tag": "blink", + "includeChildren": "true", + "image": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<image>" + }, + "video": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<video>" + } + }, + "title": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<title>" + }, + "paragraph1": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<paragraph1>" + }, + "paragraph2": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<paragraph2>" + }, + "paragraph3": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<paragraph3>" + } + }, + "bottomnav": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<bottomnav>", + "includeChildren": "true", + "links": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<links>", + "includeChildren": "true", + "home": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<home>" + }, + "about": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<about>" + }, + "contact": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<contact>" + } + }, + "copyright": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<copyright>" + } + } + } + }, + "foot": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/test", + "text": "<foot>" + } + }, + "loop" : { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/apps/sightlyperf/loop" + } +} \ No newline at end of file diff --git a/src/main/resources/SLING-INF/sightlytck.json b/src/main/resources/SLING-INF/sightlytck.json new file mode 100644 index 0000000..c23dcad --- /dev/null +++ b/src/main/resources/SLING-INF/sightlytck.json @@ -0,0 +1,100 @@ +{ + "jcr:primaryType": "sling:Folder", + "exprlang": { + "jcr:primaryType": "sling:Folder", + "operators": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/exprlang/operators" + }, + "filters": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/exprlang/filters" + }, + "filteroptions": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/exprlang/filteroptions" + }, + "strings": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/exprlang/strings" + }, + "casing": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/exprlang/casing" + }, + "xss" : { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/exprlang/xss" + }, + "escapedexpr": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/exprlang/escapedexpr" + } + }, + "blockstatements": { + "jcr:primaryType": "sling:Folder", + "list": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/blockstatements/list" + }, + "test": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/blockstatements/test" + }, + "use": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/blockstatements/use" + }, + "unwrap": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/blockstatements/unwrap" + }, + "text": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/blockstatements/text" + }, + "resource": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/blockstatements/resource" + }, + "templatecall": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/blockstatements/templatecall" + }, + "attribute": { + "jcr:primartyType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/blockstatements/attribute" + }, + "include": { + "jcr:primartyType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/blockstatements/include" + }, + "element": { + "jcr:primartyType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/blockstatements/element" + }, + "repeat": { + "jcr:primartyType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/blockstatements/repeat" + } + + }, + "tags": { + "jcr:primaryType": "sling:Folder", + "sly": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/tags/sly" + } + }, + "helpers": { + "jcr:primaryType": "sling:Folder", + "testresource": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/helpers/testresource" + }, + "remotetemplate": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "/sightlytck/scripts/helpers/remotetemplate" + } + } +} -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
