Added: sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/resources/SLING-INF/libs/sling/sightly/js/internal/promise.js URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/resources/SLING-INF/libs/sling/sightly/js/internal/promise.js?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/resources/SLING-INF/libs/sling/sightly/js/internal/promise.js (added) +++ sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/resources/SLING-INF/libs/sling/sightly/js/internal/promise.js Fri Nov 14 14:04:56 2014 @@ -0,0 +1,36 @@ +/******************************************************************************* + * 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. + ******************************************************************************/ + +/** + * Wrapper factory that transforms objects + * obtained synchronously in promises + */ +use(function() { + return function(Q) { + return { + success: function(x) { + return Q(x); + }, + + failure: function(err) { + return Q.reject(err); + } + }; + } +}); \ No newline at end of file
Added: sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/resources/SLING-INF/libs/sling/sightly/js/internal/request.js URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/resources/SLING-INF/libs/sling/sightly/js/internal/request.js?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/resources/SLING-INF/libs/sling/sightly/js/internal/request.js (added) +++ sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/resources/SLING-INF/libs/sling/sightly/js/internal/request.js Fri Nov 14 14:04:56 2014 @@ -0,0 +1,140 @@ +/******************************************************************************* + * 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(_) { + + function convertParams(paramMap) { + var result = {}; + var it = paramMap.entrySet().iterator(); + while (it.hasNext()) { + var entry = it.next(); + var paramName = entry.getKey(); + var paramValues = entry.getValue(); + if (paramValues) { + paramValues = paramValues.map(function (param) { + return param.getString(); + }); + } + result[paramName] = paramValues; + } + return result; + } + + /** + * @constructor + * @class Properties that contain parts of the request + * @name RequestPathInfo + * @param {object} nativePathInfo The native path info object + */ + function RequestPathInfo(nativePathInfo) { + /** @private */ + this.nativePathInfo = nativePathInfo; + } + + Object.defineProperties(RequestPathInfo.prototype, { + + /** + * The resource path + * @name RequestPathInfo~resourcePath + * @type {String} + * @member + */ + resourcePath: { + get: function() { + return this.nativePathInfo.getResourcePath(); + } + }, + + /** + * The extension in the path + * @name RequestPathInfo~extension + * @type {String} + * @member + */ + extension: { + get: function() { + return this.nativePathInfo.getExtension(); + } + }, + + /** + * The selector string segment + * @name RequestPathInfo~selectorString + * @type {String} + * @member + */ + selectorString: { + get: function() { + return this.nativePathInfo.getSelectorString(); + } + }, + + /** + * The selectors in the request + * @name RequestPathInfo~selectors + * @type {Array.<String>} + * @member + */ + selectors: { + get: function() { + return this.nativePathInfo.getSelectors(); + } + }, + + /** + * The suffix in the request path + * @name RequestPathInfo~suffix + * @type {String} + * @member + */ + suffix: { + get: function() { + return this.nativePathInfo.getSuffix(); + } + } + }); + + /** + * @constructor + * @name Request + * @class The request class + * @param {object} nativeRequest The nativeResource request object + */ + function Request(nativeRequest) { + /** @private */ + this.nativeRequest = nativeRequest; + + /** + * A map of the parameters in this request + * @name Request~parameters + * @type {object.<string, string>} + * @member + */ + this.parameters = convertParams(nativeRequest.getRequestParameterMap()); + + /** + * The path info associated with this request + * @name Request~pathInfo + * @type {RequestPathInfo} + * @member + */ + this.pathInfo = new RequestPathInfo(nativeRequest.getRequestPathInfo()); + } + + return Request; +}); Added: sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/resources/SLING-INF/libs/sling/sightly/js/internal/resource.js URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/resources/SLING-INF/libs/sling/sightly/js/internal/resource.js?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/resources/SLING-INF/libs/sling/sightly/js/internal/resource.js (added) +++ sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/resources/SLING-INF/libs/sling/sightly/js/internal/resource.js Fri Nov 14 14:04:56 2014 @@ -0,0 +1,150 @@ +/******************************************************************************* + * 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(['helper.js'], function(helper) { + + function getParentPath(path) { + var index = path.lastIndexOf('/'); + if (index == -1) { + return null; + } + return path.substring(0, index); + } + + + function getProperties(nativeResource) { + var valueMap = nativeResource.adaptTo(Packages.org.apache.sling.api.resource.ValueMap); + return (valueMap) ? helper.mapToObject(valueMap) : {}; + } + + /** + * @name Resource + * @constructor + * @class The Resource class + * @param {object} nativeResource The nativeResource resource object + */ + function Resource(nativeResource, promise) { + /** + * The absolute path for this resource + * @name Resource~path + * @member + * @type {string} + */ + this.path = nativeResource.getPath(); + + /** + * The map of properties for this object + * @name Resource~properties + * @member + * @type {object.<string, object>} + */ + this.properties = getProperties(nativeResource); + + /** @private */ + this.nativeResource = nativeResource; + + if (!promise) { + throw new Error('No promise library provided'); + } + this._promise = promise; + } + + Resource.prototype = /** @lends Resource.prototype */ { + constructor: Resource, + + /** + * Get the parent resource + * @return {promise.<Resource>} a promise with the parent of this resource, or null if + * the resource has no parent + */ + getParent: function() { + var parentPath = getParentPath(this.path); + if (!parentPath) { + return null; + } + var resolver = this.nativeResource.getResourceResolver(); + var parent = resolver.resolve(parentPath); + return this._promise.success(new Resource(parent, this._promise)); + }, + + /** + * Get the children of this resource + * @return {promise.<array.<Resource>>} a promise with the array of children resource + */ + getChildren: function() { + var resolver = this.nativeResource.getResourceResolver(); + var children = []; + var it = resolver.listChildren(this.nativeResource); + var promise = this._promise; + while (it.hasNext()) { + var childNativeResource = it.next(); + children.push(new Resource(childNativeResource, promise)); + } + return this._promise.success(children); + }, + + /** + * Resolve a path to a resource. The path may be relative + * to this path + * @param {string} path the requested path + * @return {promise.<Resource>} the promise of a resource. If the resource + * does not exist, the promise will fail + */ + resolve: function(path) { + var resolver = this.nativeResource.getResourceResolver(); + var res = resolver.getResource(this.nativeResource, path); + if (res == null) { + return this._promise.failure(new Error('No resource found at path: ' + path)); + } + return this._promise.success(new Resource(res, this._promise)); + } + }; + + Object.defineProperties(Resource.prototype, { + /** + * The name of the resource + * @name Resource~name + * @member + * @type {string} + */ + name: { + get: function() { + var index = this.path.lastIndexOf('/'); + if (index == -1) { + return this.path; + } + return this.path.substring(index + 1); + } + }, + + /** + * The resource type + * @name Resource~resourceType + * @member + * @type {string} + */ + resourceType: { + get: function() { + return this.nativeResource.resourceType; + } + } + }); + + return Resource; + +}); Added: sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/resources/SLING-INF/libs/sling/sightly/js/internal/sly.js URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/resources/SLING-INF/libs/sling/sightly/js/internal/sly.js?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/resources/SLING-INF/libs/sling/sightly/js/internal/sly.js (added) +++ sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/resources/SLING-INF/libs/sling/sightly/js/internal/sly.js Fri Nov 14 14:04:56 2014 @@ -0,0 +1,59 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ******************************************************************************/ +use(['resource.js', 'request.js', 'promise.js'], function(Resource, Request, promiseFactory) { + + return function(bindings, Q) { + var promiseLib = promiseFactory(Q); + var slyResource; + var slyProperties; + var slyRequest; + if (bindings.containsKey('resource')) { + slyResource = new Resource(bindings.get('resource'), promiseLib); + slyProperties = slyResource.properties; + } + if (bindings.containsKey('request')) { + slyRequest = new Request(bindings.get('request')); + } + + /** + * @namespace sly + */ + return /** @lends sly */ { + + /** + * The current resource of the request + * @type {Resource} + */ + resource: slyResource, + + /** + * The properties of the current resource + * @type {Object.<string, Object>} + */ + properties: slyResource.properties, + + /** + * The request object + * @type {Request} + */ + request: slyRequest + }; + } + +}); Added: sling/trunk/contrib/scripting/sightly/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/pom.xml?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/pom.xml (added) +++ sling/trunk/contrib/scripting/sightly/pom.xml Fri Nov 14 14:04:56 2014 @@ -0,0 +1,60 @@ +<?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>20</version> + <relativePath/> + </parent> + + <!-- ======================================================================= --> + <!-- P R O J E C T --> + <!-- ======================================================================= --> + <artifactId>org.apache.sling.scripting.sightly.reactor</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>Apache Sling Scripting Sightly Reactor</name> + + <description> + The Apache Sling Scripting Sightly Reactor project. + </description> + + <scm> + <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/sightly</connection> + <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/sightly</developerConnection> + <url>http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly</url> + </scm> + + <modules> + <module>engine</module> + <module>js-use-provider</module> + <module>repl</module> + <module>testing-content</module> + <module>testing</module> + </modules> + +</project> Added: sling/trunk/contrib/scripting/sightly/rat.exclude URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/rat.exclude?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/rat.exclude (added) +++ sling/trunk/contrib/scripting/sightly/rat.exclude Fri Nov 14 14:04:56 2014 @@ -0,0 +1,7 @@ +README.md +3rd-party* +.gitignore +.*\.json +.*\.iml +.*\.svg +rat.exclude Propchange: sling/trunk/contrib/scripting/sightly/repl/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Fri Nov 14 14:04:56 2014 @@ -0,0 +1,15 @@ +target +bin +*.iml +*.ipr +*.iws +.settings +.project +.classpath +.externalToolBuilders +maven-eclipse.xml +felix-cache +sling-crankstart +derby.log + + Added: sling/trunk/contrib/scripting/sightly/repl/NOTICE URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/repl/NOTICE?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/repl/NOTICE (added) +++ sling/trunk/contrib/scripting/sightly/repl/NOTICE Fri Nov 14 14:04:56 2014 @@ -0,0 +1,5 @@ +Apache Sling Scripting Sightly Read-Eval-Print-Loop Environment +Copyright 2014 The Apache Software Foundation + +The Apache Sling Sightly REPL bundle is based on source code originally developed +by Adobe Systems Inc. (http://www.adobe.com/). Added: sling/trunk/contrib/scripting/sightly/repl/README.md URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/repl/README.md?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/repl/README.md (added) +++ sling/trunk/contrib/scripting/sightly/repl/README.md Fri Nov 14 14:04:56 2014 @@ -0,0 +1,11 @@ +Apache Sling Scripting Sightly Read-Eval-Print Loop Environment +==== + +To install: +``` +mvn clean install sling:install +``` + +Then just browse to [http://localhost:8080/sightly/repl.html](http://localhost:8080/sightly/repl.html). + + Added: sling/trunk/contrib/scripting/sightly/repl/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/repl/pom.xml?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/repl/pom.xml (added) +++ sling/trunk/contrib/scripting/sightly/repl/pom.xml Fri Nov 14 14:04:56 2014 @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>org.apache.sling</groupId> + <artifactId>sling</artifactId> + <version>15</version> + <relativePath/> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>org.apache.sling.scripting.sightly.repl</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>bundle</packaging> + + <name>Apache Sling Scripting Sightly Read-Eval-Print Loop Environment</name> + <description>REPL for Apache Sling Scripting Sightly engine</description> + + <scm> + <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/sightly/repl</connection> + <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/sightly/repl</developerConnection> + <url>http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/repl</url> + </scm> + + <properties> + <sling.java.version>6</sling.java.version> + </properties> + + <build> + <plugins> + <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> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> Added: sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/apps/repl/components/repl/logic.js URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/apps/repl/components/repl/logic.js?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/apps/repl/components/repl/logic.js (added) +++ sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/apps/repl/components/repl/logic.js Fri Nov 14 14:04:56 2014 @@ -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: 'hello world' + }; +}); Added: sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/apps/repl/components/repl/repl.html URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/apps/repl/components/repl/repl.html?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/apps/repl/components/repl/repl.html (added) +++ sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/apps/repl/components/repl/repl.html Fri Nov 14 14:04:56 2014 @@ -0,0 +1,76 @@ +<!DOCTYPE html> +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + + <title>Sightly REPL</title> + + <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> + <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css"> + + <link rel="stylesheet" type="text/css" href="/etc/clientlibs/repl/style.css"> + </head> + + <body data-sly-use.repl="repl.js"> + <div id="logo"> </div> + <h1><small>Read-Eval-Print Loop</small></h1> + + <div id="main" class="row"> + <div id="input" class="col-xs-6"> + <div class="editorContainer"> + <p class="lead">template.html</p> + <div id="template" class="editor" data-src="/apps/repl/components/repl/template.html" data-mode="ace/mode/html" data-writeable></div> + </div> + + <div class="editorContainer"> + <p class="lead">logic.js</p> + <div id="logic" class="editor" data-src="/apps/repl/components/repl/logic.js" data-mode="ace/mode/javascript" data-writeable></div> + </div> + </div> + <div id="output" class="editorContainer col-xs-6"> + <div class="clearfix"> + <p class="lead pull-left">output.html</p> + <ul class="nav nav-pills navbar-right"> + <li class="active"><a data-toggle="tab" href="#source">Source</a></li> + <li><a data-toggle="tab" href="#view">View</a></li> + <li><a data-toggle="tab" href="#java">Java</a></li> + </ul> + </div> + <div id="source" class="output-view editor" data-src="/sightly/repl.template.html" data-mode="ace/mode/html"></div> + <iframe id="view" class="output-view hidden" src="/sightly/repl.template.html"></iframe> + <div id="java" class="output-view editor hidden" data-src="${repl.classPath}" data-mode="ace/mode/java"></div> + </div> + </div> + + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> + <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script> + <script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.1.01/ace.js"></script> + + <!--[if lt IE 9]> + <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> + <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> + <![endif]--> + + <script src="/etc/clientlibs/repl/script.js"></script> + </body> +</html> Added: sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/apps/repl/components/repl/repl.js URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/apps/repl/components/repl/repl.js?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/apps/repl/components/repl/repl.js (added) +++ sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/apps/repl/components/repl/repl.js Fri Nov 14 14:04:56 2014 @@ -0,0 +1,49 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ******************************************************************************/ +use(function () { + + var slingSettings = sling.getService(Packages.org.apache.sling.settings.SlingSettingsService); + var CLASS_ROOT_FOLDER = '/var/classes/' + slingSettings.getSlingId() + '/sightly'; + var COMPONENT_PATH = '/apps/repl/components/repl'; + var JAVA_TEMPLATE_FILE = 'SightlyJava_template.java'; + + // Recursively walks down the given path until it finds an apps folder, then returns the full path of the Java compiled template file. + function getAppsPath(res) { + return res.getChildren().then(function (children) { + var length = children.length; + + // Let's see if one of the children is the apps folder. + for (var i = 0; i < length; i++) { + if (children[i].name === 'apps') { + return res.path + COMPONENT_PATH + '/' + JAVA_TEMPLATE_FILE; + } + } + + // If apps wasn't found but there's only one child folder, then let's recrusively walk that one down. + if (length === 1) { + return getAppsPath(children[0]); + } + }); + } + + return { + classPath: sightly.resource.resolve(CLASS_ROOT_FOLDER).then(getAppsPath) + }; + +}); Added: sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/apps/repl/components/repl/template.html URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/apps/repl/components/repl/template.html?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/apps/repl/components/repl/template.html (added) +++ sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/apps/repl/components/repl/template.html Fri Nov 14 14:04:56 2014 @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> +<html> +<head> + <title>Sightly REPL</title> + <meta charset="utf-8"> +</head> +<body data-sly-use.obj="logic.js"> + + <p>Message is ${obj.message}</p> + +</body> +</html> Added: sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/etc/clientlibs/repl/images/sightly.svg URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/etc/clientlibs/repl/images/sightly.svg?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/etc/clientlibs/repl/images/sightly.svg (added) +++ sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/etc/clientlibs/repl/images/sightly.svg Fri Nov 14 14:04:56 2014 @@ -0,0 +1,114 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1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.4,45.5,57.5z"/> + <rect x="57.5" y="36.9" fill="#389DD7" width="6.3" height="38"/> + <path fill="#454545" d="M210.1,79.8l15.1-42.9h-6.5L211.7,58l-0.9,2.8c-0.3,1.1-0.7,2.2-1,3.3c-0.3,1.1-0.6,2.2-0.8,3.2 + c-0.3,1-0.4,1.8-0.6,2.3h-0.2c-0.1-0.8-0.2-1.7-0.4-2.6c-0.2-0.9-0.5-1.9-0.7-2.9c-0.3-1-0.6-2-0.9-3.1c-0.3-1-0.7-2-1-2.9 + l-7.5-21.2h-6.5l14.4,38.3l-2,5.5c-0.3,0.9-0.7,1.8-1.2,2.5c-0.4,0.7-0.9,1.4-1.5,1.9c-0.6,0.5-1.3,0.9-2.1,1.2 + c-0.8,0.3-1.8,0.4-2.9,0.4c-0.8,0-1.6-0.1-2.3-0.1c-0.7-0.1-1.4-0.2-1.8-0.3v5.1c0.6,0.1,1.4,0.3,2.3,0.4c0.9,0.1,1.9,0.2,3.1,0.2 + c1.8,0,3.4-0.3,4.8-0.9c1.3-0.6,2.5-1.4,3.5-2.4c1-1,1.9-2.3,2.6-3.8C208.8,83.4,209.5,81.7,210.1,79.8z"/> + <path fill="#389DD7" d="M63.3,23.6c-0.3-0.3-0.7-0.6-1.2-0.7c-0.4-0.2-0.9-0.2-1.4-0.2c-1,0-1.9,0.3-2.6,0.9 + c-0.7,0.6-1.1,1.6-1.1,3c0,1.4,0.4,2.4,1.1,3c0.7,0.6,1.6,1,2.6,1c1,0,1.9-0.3,2.6-1c0.7-0.7,1.1-1.7,1.1-3c0-0.7-0.1-1.3-0.3-1.8 + C63.9,24.3,63.7,23.9,63.3,23.6z"/> + <path fill="#389DD7" d="M168.9,70.1c-0.5,0.1-1,0.1-1.5,0.2c-0.5,0-1,0.1-1.4,0.1c-1.7,0-2.9-0.6-3.6-1.7c-0.7-1.1-1.1-2.8-1.1-5.1 + V41.4h9.6v-4.5h-9.6v-8.7h-3.6l-2.7,8l-5.4,2.6v2.7h5.4v22.2c0,2.3,0.2,4.3,0.8,5.8c0.5,1.5,1.2,2.8,2.1,3.7 + c0.9,0.9,1.9,1.5,3.2,1.9c1.2,0.4,2.6,0.6,4,0.6c0.6,0,1.2,0,1.8-0.1c0.6-0.1,1.2-0.1,1.7-0.2c0.6-0.1,1.1-0.2,1.5-0.4 + c0.5-0.1,0.8-0.3,1.1-0.4v-4.8c-0.2,0.1-0.5,0.2-0.9,0.2C169.8,70,169.4,70.1,168.9,70.1z"/> + <rect x="178.5" y="21" fill="#454545" width="6.3" height="53.9"/> + <path fill="#389DD7" d="M130,36.2c-1.1,0-2.2,0.1-3.2,0.3c-1.1,0.2-2.1,0.6-3,1.1c-0.9,0.5-1.8,1.1-2.6,1.8 + c-0.8,0.7-1.5,1.6-2.1,2.6h-0.3l0.3-5V21h-6.3v53.9h6.3V55.2c0-2.2,0.2-4.2,0.5-5.9c0.3-1.7,0.9-3.1,1.7-4.3 + c0.8-1.2,1.8-2.1,3.1-2.7c1.3-0.6,2.8-0.9,4.7-0.9c2.6,0,4.5,0.8,5.7,2.3c1.2,1.5,1.8,3.7,1.8,6.7v24.5h6.3V50.1 + c0-4.8-1.1-8.4-3.2-10.6C137.5,37.3,134.3,36.2,130,36.2z"/> + <path fill="#389DD7" d="M105.9,56.9c0-7.3-4.2-13.7-10.4-16.7V20.8h-6v17.7c-0.7-0.1-1.4-0.1-2.1-0.1c-10.3,0-18.6,8.3-18.6,18.6 + S77,75.5,87.3,75.5c0.7,0,1.4,0,2.1-0.1v16.4c-0.7-0.1-1.4-0.1-2.1-0.1c-10.3,0-18.6,8.3-18.6,18.6s8.3,18.6,18.6,18.6 + c10.3,0,18.6-8.3,18.6-18.6c0-7.3-4.2-13.7-10.4-16.7V73.6C101.7,70.6,105.9,64.2,105.9,56.9z M99.6,110.2c0,6.6-5.5,12-12.3,12 + c-6.8,0-12.3-5.4-12.3-12c0-6.6,5.5-12,12.3-12C94.1,98.2,99.6,103.6,99.6,110.2z M87.3,68.9c-6.8,0-12.3-5.4-12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c0.2-0.5,0.2-1.2,0.2-2v-5c0-0.4-0.1-0.7-0.3-0.9C167.5,107.1,167.3,107,167,107z"/> + <path fill="#303030" d="M180.7,107.1h-6.7c-0.3,0-0.6,0.1-0.8,0.2c-0.2,0.2-0.3,0.4-0.3,0.6c0,0.3,0.1,0.5,0.3,0.6 + c0.2,0.2,0.4,0.2,0.8,0.2h2.3v7.5c0,0.4,0.1,0.7,0.3,1c0.2,0.2,0.4,0.3,0.8,0.3c0.3,0,0.6-0.1,0.7-0.3c0.2-0.2,0.3-0.5,0.3-1v-7.5 + h2.3c0.4,0,0.6-0.1,0.8-0.2c0.2-0.2,0.3-0.4,0.3-0.6c0-0.3-0.1-0.5-0.3-0.6C181.3,107.2,181.1,107.1,180.7,107.1z"/> +</g> +</svg> Added: sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/etc/clientlibs/repl/script.js URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/etc/clientlibs/repl/script.js?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/etc/clientlibs/repl/script.js (added) +++ sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/etc/clientlibs/repl/script.js Fri Nov 14 14:04:56 2014 @@ -0,0 +1,152 @@ +/******************************************************************************* + * 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. + ******************************************************************************/ +/* global jQuery, ace, document, setTimeout, clearTimeout, console */ +jQuery(function ($) { + + 'use strict'; + + var currentState = 'source'; + + // Limits the number of times the function gets called for event handlers + function debounce(fn, delay) { + var timer = null; + + return function () { + var context = this; + var args = arguments; + + clearTimeout(timer); + timer = setTimeout(function () { + fn.apply(context, args); + }, delay); + }; + } + + /** + * The editor object, it will take it's configuration from following attributes: + * id: The unique identifier of the editor (will be used as key in the Editor.all map object). + * data-src: The URL from which the editor's content has to be loaded. + * data-mode: The ACE editor's language mode. + * data-writeable: Boolean attribute to make the editor persisted to the data-src location. + */ + function Editor(DOMElement, reloadOutputCallback) { + var that = this; + var element = $(DOMElement); + var editor = ace.edit(DOMElement); + var mode = element.data('mode'); + var url = element.data('src'); + var isWriteable = element.is('[data-writeable]'); + + function attachSaveHandler() { + if (isWriteable) { + editor.session.on('change', debounce(function () { + that.saveChanges(); + }), 500); + } + } + + function init() { + Editor.all[element.attr('id')] = that; + + editor.renderer.setShowGutter(false); + editor.setHighlightActiveLine(false); + editor.setShowPrintMargin(false); + editor.setReadOnly(!isWriteable); + editor.session.setUseWorker(false); + editor.session.setMode(mode); + + if (element.is(':visible')) { + that.loadContent(attachSaveHandler); + } else { + attachSaveHandler(); + } + } + + that.saveChanges = function (cb) { + if (isWriteable) { + $.ajax({ + url: url, + type: 'PUT', + data: editor.getValue(), + contentType: 'plain/text', + success: reloadOutputCallback, + complete: cb + }); + } + }; + + that.loadContent = function (cb) { + $.ajax(url, { + type: 'GET', + dataType: 'text', + cache: false, + processData: false, + success: function (data) { + editor.setValue(data); + editor.clearSelection(); + }, + error: function (req, textStatus, message) { + editor.setValue(req.responseText); + editor.clearSelection(); + console.error(message); + }, + complete: cb + }); + }; + + init(); + } + + // A map of all the editors, the id attribute of their parent DOM element is used as key. + Editor.all = {}; + + // Refreshes the output after changes were made + function reloadOutput() { + if (Editor.all[currentState] !== undefined) { + Editor.all[currentState].loadContent(); + } else { + document.getElementsByTagName('iframe')[0].contentDocument.location.reload(true); + } + } + + function init() { + // Setup editors + $('.editor').each(function () { + new Editor(this, reloadOutput); + }); + + // Setup output tabs + var allTargets = $('.output-view'); + $('a[data-toggle=tab]').each(function () { + var link = $(this); + var target = allTargets.filter(link.attr('href')); + var state = target.attr('id'); + + link.click(function () { + currentState = state; + allTargets.addClass('hidden'); + target.removeClass('hidden'); + reloadOutput(); + }); + }); + } + + init(); + +}); Added: sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/etc/clientlibs/repl/style.css URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/etc/clientlibs/repl/style.css?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/etc/clientlibs/repl/style.css (added) +++ sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/etc/clientlibs/repl/style.css Fri Nov 14 14:04:56 2014 @@ -0,0 +1,51 @@ +/******************************************************************************* + * 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. + ******************************************************************************/ +body { + margin: 0 10px; +} +h1 { + margin-top: 10px; +} +iframe { + border: none; + width: 100%; +} +#logo { + min-height: 100px; + background: url('./images/sightly.svg') no-repeat 50% 100%; +} +#input .editor { + height: 300px; +} +#output .editor { + height: 650px; +} +@media (max-width: 768px) { + #output .lead { + display: none; + } +} +#output .nav { + margin-top: -3px; +} +@media (max-width: 768px) { + #output .nav { + margin: -8px 0 10px; + } +} Added: sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/sightly/repl.json URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/sightly/repl.json?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/sightly/repl.json (added) +++ sling/trunk/contrib/scripting/sightly/repl/src/main/resources/SLING-INF/sightly/repl.json Fri Nov 14 14:04:56 2014 @@ -0,0 +1,4 @@ +{ + "jcr:primaryType" : "nt:unstructured", + "sling:resourceType":"repl/components/repl" +} Propchange: sling/trunk/contrib/scripting/sightly/testing/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Fri Nov 14 14:04:56 2014 @@ -0,0 +1,12 @@ +target +bin +*.iml +*.ipr +*.iws +.settings +.project +.classpath +.externalToolBuilders +maven-eclipse.xml +sling +derby.log Propchange: sling/trunk/contrib/scripting/sightly/testing-content/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Fri Nov 14 14:04:56 2014 @@ -0,0 +1,15 @@ +target +bin +*.iml +*.ipr +*.iws +.settings +.project +.classpath +.externalToolBuilders +maven-eclipse.xml +felix-cache +sling-crankstart +derby.log + + Added: sling/trunk/contrib/scripting/sightly/testing-content/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/pom.xml?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/testing-content/pom.xml (added) +++ sling/trunk/contrib/scripting/sightly/testing-content/pom.xml Fri Nov 14 14:04:56 2014 @@ -0,0 +1,141 @@ +<?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.0-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. + </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> + <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.0.1</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> + </instructions> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.sling</groupId> + <artifactId>maven-sling-plugin</artifactId> + <configuration> + <failOnError>true</failOnError> + </configuration> + </plugin> + </plugins> + </build> + +</project> Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightlytck/install.json URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightlytck/install.json?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightlytck/install.json (added) +++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightlytck/install.json Fri Nov 14 14:04:56 2014 @@ -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" + ] + } +} Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightlytck/locales/de.json URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightlytck/locales/de.json?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightlytck/locales/de.json (added) +++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightlytck/locales/de.json Fri Nov 14 14:04:56 2014 @@ -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" + } + +} Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/sightlytck.json URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/sightlytck.json?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/sightlytck.json (added) +++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/sightlytck.json Fri Nov 14 14:04:56 2014 @@ -0,0 +1,81 @@ +{ + "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" + }, + "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" + } + }, + "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" + } + + }, + "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" + } + } +} Added: sling/trunk/contrib/scripting/sightly/testing/.gitignore URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing/.gitignore?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/testing/.gitignore (added) +++ sling/trunk/contrib/scripting/sightly/testing/.gitignore Fri Nov 14 14:04:56 2014 @@ -0,0 +1 @@ +/sling/ Added: sling/trunk/contrib/scripting/sightly/testing/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing/pom.xml?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/testing/pom.xml (added) +++ sling/trunk/contrib/scripting/sightly/testing/pom.xml Fri Nov 14 14:04:56 2014 @@ -0,0 +1,343 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + 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> + <parent> + <groupId>org.apache.sling</groupId> + <artifactId>sling</artifactId> + <version>22</version> + <relativePath/> + </parent> + + <artifactId>org.apache.sling.scripting.sightly.testing</artifactId> + <packaging>jar</packaging> + <version>1.0.0-SNAPSHOT</version> + + <name>Apache Sling Scripting Sightly Integration Tests</name> + <description>This project runs the integration tests for validating the Apache Sling Scripting Sightly implementation + against the Adobe Sightly TCK.</description> + + <scm> + <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/sightly/testing</connection> + <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/sightly/testing</developerConnection> + <url>http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/testing</url> + </scm> + + <properties> + <!-- HTTP port to use when running mvn launchpad:run --> + <run.http.port>8888</run.http.port> + + <!-- Timeout when checking for Sling readyness before starting tests --> + <HttpTestBase.readyTimeoutSeconds>62</HttpTestBase.readyTimeoutSeconds> + + <!-- path suffix for HTTP access to Sling --> + <http.base.path /> + + <!-- path suffix for WebDAV access to the repository --> + <webdav.workspace.path /> + + <!-- hostname for integration tests --> + <test.host>localhost</test.host> + + <!-- optionally exclude some integration tests --> + <failsafe.exclude></failsafe.exclude> + + <!-- + Set this to true to stop mvn once the integration test Jetty instance is + started. Useful to manually test the integration testing webapp. + --> + <integration.test.wait>false</integration.test.wait> + + <slf4j.version>1.5.11</slf4j.version> + <logback.version>0.9.20</logback.version> + </properties> + + <build> + <plugins> + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>${basedir}</directory> + <includes> + <include>derby.log</include> + <include>cachedir</include> + <include>sling/**</include> + <include>jackrabbit</include> + <include>coverage.ec</include> + </includes> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>reserve-network-port</id> + <goals> + <goal>reserve-network-port</goal> + </goals> + <phase>process-resources</phase> + <configuration> + <portNames> + <portName>http.port</portName> + <portName>sling.control.port</portName> + </portNames> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + <!-- Version newer than the one declared in the parent pom --> + <executions> + <execution> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + </execution> + </executions> + <configuration> + <includes> + <include>%regex[.*LaunchpadReadyIT.*]</include> + <include>%regex[.*TestsRunner.*]</include> + </includes> + <dependenciesToScan> + <dependency>io.sightly:io.sightly.tck</dependency> + </dependenciesToScan> + <excludes> + <exclude>${failsafe.exclude}</exclude> + </excludes> + <systemPropertyVariables> + <io.sightly.tck.serverURL>http://${test.host}:${http.port}</io.sightly.tck.serverURL> + <launchpad.http.server.url>http://${test.host}:${http.port}/</launchpad.http.server.url> + <launchpad.webdav.server.url>http://${test.host}:${http.port}/${webdav.workspace.path}</launchpad.webdav.server.url> + <HttpTestBase.readyTimeoutSeconds>${HttpTestBase.readyTimeoutSeconds}</HttpTestBase.readyTimeoutSeconds> + + <!-- Additional readyness checks, SLING-3235 --> + <launchpad.ready.1>GET:/index.html:200:.*Welcome to the Sling Launchpad.*</launchpad.ready.1> + </systemPropertyVariables> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.sling</groupId> + <artifactId>maven-launchpad-plugin</artifactId> + <version>2.3.0</version> + <extensions>true</extensions> + <executions> + <execution> + <id>prepare-test-webapp</id> + <goals> + <goal>prepare-test-webapp</goal> + </goals> + </execution> + <execution> + <id>start-container</id> + <phase>pre-integration-test</phase> + <goals> + <goal>start</goal> + </goals> + </execution> + <execution> + <id>stop-container</id> + <phase>post-integration-test</phase> + <goals> + <goal>stop</goal> + </goals> + </execution> + </executions> + <configuration> + <httpPort>${http.port}</httpPort> + <controlHost>${test.host}</controlHost> + <controlPort>${sling.control.port}</controlPort> + <defaultBundleList> + <version>8-SNAPSHOT</version> + </defaultBundleList> + <jarWebSupport> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.http.jetty</artifactId> + <version>2.2.2</version> + </jarWebSupport> + <additionalBundles> + <bundle> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.launchpad.installer</artifactId> + <version>1.2.1-SNAPSHOT</version> + </bundle> + <bundle> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.jcr.compiler</artifactId> + <version>2.1.0</version> + <startLevel>20</startLevel> + </bundle> + <bundle> + <groupId>javax.mail</groupId> + <artifactId>mail</artifactId> + <version>1.4.7</version> + <startLevel>20</startLevel> + </bundle> + <bundle> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.i18n</artifactId> + <version>2.2.10</version> + <startLevel>20</startLevel> + </bundle> + <bundle> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.xss</artifactId> + <version>1.0.0-SNAPSHOT</version> + <startLevel>20</startLevel> + </bundle> + <bundle> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.scripting.sightly</artifactId> + <version>1.0.0-SNAPSHOT</version> + <startLevel>20</startLevel> + </bundle> + <bundle> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.scripting.sightly.js.provider</artifactId> + <version>1.0.0-SNAPSHOT</version> + <startLevel>20</startLevel> + </bundle> + <bundle> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.scripting.sightly.testing-content</artifactId> + <version>1.0.0-SNAPSHOT</version> + <startLevel>20</startLevel> + </bundle> + <bundle> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.scripting.sightly.repl</artifactId> + <version>1.0.0-SNAPSHOT</version> + <startLevel>20</startLevel> + </bundle> + </additionalBundles> + </configuration> + <dependencies> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.launchpad.base</artifactId> + <version>4.4.1-2.5.2</version> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.launchpad.base</artifactId> + <version>4.4.1-2.5.2</version> + <classifier>app</classifier> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <!-- + Run the integration tests. + --> + <id>integrationTesting</id> + <activation> + <property> + <name>!maven.test.skip</name> + </property> + </activation> + <build> + <plugins> + + </plugins> + </build> + </profile> + </profiles> + + <dependencies> + + <!-- The integration tests --> + <dependency> + <groupId>io.sightly</groupId> + <artifactId>io.sightly.tck</artifactId> + <version>1.0.1</version> + <scope>test</scope> + </dependency> + + <!-- The basic Sling WebApp --> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.launchpad.base</artifactId> + <version>4.4.1-2.5.2</version> + <classifier>app</classifier> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.commons.testing</artifactId> + <version>2.0.16</version> + <scope>test</scope> + </dependency> + + <!-- Dependencies for the Test Build and Run --> + <dependency> + <groupId>javax.jcr</groupId> + <artifactId>jcr</artifactId> + <version>2.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>${slf4j.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>log4j-over-slf4j</artifactId> + <version>${slf4j.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>${logback.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.11</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.compendium</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> Added: sling/trunk/contrib/scripting/sightly/testing/src/test/config/sling.properties URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing/src/test/config/sling.properties?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/testing/src/test/config/sling.properties (added) +++ sling/trunk/contrib/scripting/sightly/testing/src/test/config/sling.properties Fri Nov 14 14:04:56 2014 @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +sling.system.packages.class.com.vladium.emma.rt.RT=com.vladium.emma.rt +org.apache.sling.commons.log.julenabled=true + +# jackrabbit and oak run modes are mutually exclusive, +# and cannot be changed after the first startup +sling.run.mode.install.options=jackrabbit,oak Added: sling/trunk/contrib/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/LaunchpadReadyIT.java URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/LaunchpadReadyIT.java?rev=1639641&view=auto ============================================================================== --- sling/trunk/contrib/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/LaunchpadReadyIT.java (added) +++ sling/trunk/contrib/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/LaunchpadReadyIT.java Fri Nov 14 14:04:56 2014 @@ -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. + ******************************************************************************/ +package org.apache.sling.scripting.sightly.it; + +import java.io.IOException; + +import org.apache.sling.commons.testing.integration.HttpTestBase; +import org.junit.Test; + +public class LaunchpadReadyIT extends HttpTestBase { + + @Test + public void testLaunchpadReady() throws IOException { + assertHttpStatus(HTTP_URL + "/index.html", 200); + } + +}