You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ol...@apache.org on 2018/02/09 10:47:13 UTC
[sling-org-apache-sling-launchpad-content] branch master updated:
SLING-7485 Do not rely on Launchpad Content
This is an automated email from the ASF dual-hosted git repository.
olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-launchpad-content.git
The following commit(s) were added to refs/heads/master by this push:
new 056b9da SLING-7485 Do not rely on Launchpad Content
056b9da is described below
commit 056b9dad38e2bba391e4a99ebbcbab44202790be
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Feb 9 11:36:48 2018 +0100
SLING-7485 Do not rely on Launchpad Content
remove test content
---
.../content/sling-test/initial-content-folder.json | 6 -
.../resources/content/sling-test/sling/assert.js | 42 ------
.../sling-test/sling/initial-content-test.json | 4 -
.../content/sling-test/sling/sling-test.html | 153 ---------------------
4 files changed, 205 deletions(-)
diff --git a/src/main/resources/content/sling-test/initial-content-folder.json b/src/main/resources/content/sling-test/initial-content-folder.json
deleted file mode 100644
index b1042e9..0000000
--- a/src/main/resources/content/sling-test/initial-content-folder.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "folder-content-test" : {
- "text" : "This node is used to test initial content loading",
- "marker" : "46"
- }
-}
diff --git a/src/main/resources/content/sling-test/sling/assert.js b/src/main/resources/content/sling-test/sling/assert.js
deleted file mode 100755
index 7337816..0000000
--- a/src/main/resources/content/sling-test/sling/assert.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Minimal javascript assertion framework, used for sling client library automated testing.
-
-function assert(message,condition) {
- if(condition != true) {
- alert("Assertion failed: " + message);
- }
-}
-
-function assertEquals(message,a,b) {
- if(a!=b) {
- alert("assertEquals failed: " + message + ": " + a + "!=" + b);
- }
-}
-
-function assertNotNull(message,o) {
- if(o==null) {
- alert("assertNotNull failed: " + message);
- }
-}
-
-function assertNull(message,o) {
- if(o!=null) {
- alert("assertNull failed: " + message);
- }
-}
diff --git a/src/main/resources/content/sling-test/sling/initial-content-test.json b/src/main/resources/content/sling-test/sling/initial-content-test.json
deleted file mode 100644
index 3e3de03..0000000
--- a/src/main/resources/content/sling-test/sling/initial-content-test.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "text" : "This node is used to test initial content loading",
- "marker" : "42"
-}
\ No newline at end of file
diff --git a/src/main/resources/content/sling-test/sling/sling-test.html b/src/main/resources/content/sling-test/sling/sling-test.html
deleted file mode 100755
index 3066d65..0000000
--- a/src/main/resources/content/sling-test/sling/sling-test.html
+++ /dev/null
@@ -1,153 +0,0 @@
- <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.
--->
-
-<head>
- <title>Sling client library test page</title>
-
- <script src="/system/sling.js"></script>
- <script src="assert.js"></script>
-
- <style type="text/css">
- .output {
- background-color: #FFFF99;
- border: solid #FF9900 1px;
- padding: 2px;
- }
- .warning {
- border: solid yellow 1px;
- background-color: red;
- color: white;
- padding: 0.5em;
- font-weight: bold;
- }
- </style>
-</head>
-
-<body onload="runTests()">
-
-<h1>Automated Sling client library tests</h1>
-<p>Loading this page executes some simple automated javascript tests
-of the Sling client library.</p>
-
-<p>
-Note that you need to <a href="../../../?sling:authRequestLogin=1">login</a> before running these tests.
-</p>
-
-<h2>Test results</h2>
-<p>If all goes well, the paragraph styled <span class="output">like
-this</span> below should say "Done running tests".</p>
-<p>Tests run quickly, this might have happened already.</p>
-<p>To run the tests again click <a href="javascript:runTests()">here</a>.
-</p>
-<div id="output" class="output" style="padding: 1em;">Tests are
-running...</div>
-
-<h2>More info</h2>
-<p>After running the tests at least once, <a
- href="/test-data/sling-test/testhtml-nodes.infinity.json">/sling-test/testhtml-nodes.json</a>
-should show the JSON data of the nodes created by the test cases.</p>
-<p>See the source code of this page for details.</p>
-
-
-<script language="javascript">
- function slingPost(url,params) {
- var httpcon = Sling.getXHR();
- httpcon.open("POST", url, false);
- httpcon.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- httpcon.setRequestHeader("Content-length", params.length);
- httpcon.setRequestHeader("Connection", "close");
- httpcon.send(params);
- return httpcon;
- }
-
- function uniqueId() {
- return new Date().getTime();
- }
-
- var passes = 0;
- var baseTestPath = "/test-data/sling-test/testhtml-nodes";
- var testPath = baseTestPath + "/test-" + uniqueId();
- var testTime = uniqueId();
-
- function testPost() {
- var path = testPath + "/" + uniqueId();
- var c = slingPost(path,"title=hello&created=&empty=&time=" + testTime);
- assert("testPost(): Expected 201 status for POST, got " + c.status,c.status == 201);
- return path;
- }
-
- function verifyPostedElement(path) {
- var data = Sling.getContent(path,1);
- assertNotNull("data",data);
- assertEquals("verifyPostedElement: title matches","hello",data.title);
- assertEquals("verifyPostedElement: time matches",testTime,data.time);
- assertEquals("verifyPostedElement: created property is a string","string",typeof(data.created));
- // TODO implement 'created' autoset property
- // assert("created property is not empty",data.created.length > 0);
- assertEquals("verifyPostedElement: empty property is not stored","undefined",typeof(data.dummy));
- }
-
- function testGetSessionInfo() {
- var session = Sling.getSessionInfo();
- assertNotNull("testGetSessionInfo: Sling.getSessionInfo()", session);
- assertEquals("testGetSessionInfo: session.userID is a string","string",typeof(session.userID));
- assertEquals("testGetSessionInfo: session.userID == 'admin'","admin",session.userID);
-
- // since using Oak this is undefined
- assertEquals("testGetSessionInfo: session.workspace is undefined","undefined",typeof(session.workspace));
- }
-
- function testRemoveContent() {
- var deletePath = baseTestPath + "/sling-test/testhtml-nodes/delete-" + uniqueId();
- var c = slingPost(deletePath,"title=hello&created=&dummy=&time=" + uniqueId());
- assert("testRemoveContent: Expected 201 status for POST, got " + c.status,c.status == 201);
-
- var data = Sling.getContent(deletePath,1);
- assertNotNull("testRemoveContent: data must be found before removeContent",data);
-
- var d = Sling.removeContent(deletePath);
- assert("testRemoveContent: Expected 200 status for removeContent, got " + d.status,d.status == 200);
- data = Sling.getContent(deletePath,1);
- assertNull("testRemoveContent: data should be gone after deletePath (" + deletePath + ")",data);
- }
-
- function testJsonLevels() {
- var c = slingPost(baseTestPath + "/json-levels", "title=JsonLevelsTest");
- var data0 = Sling.getContent(baseTestPath,0);
- var data1 = Sling.getContent(baseTestPath,1);
- assert("testJsonLevels: Level 0 must not provide child", typeof data0['json-levels'] == "undefined");
- assert("testJsonLevels: Level 1 must provide child", typeof data1['json-levels'] == "object");
- assert("testJsonLevels: Level 1 must provide child title", data1['json-levels'].title == "JsonLevelsTest");
- }
-
- function runTests() {
- var out = document.getElementById("output");
- out.innerHTML = "Tests are running...";
- assert(null,2 + 2 == 4);
- var path = testPost();
- verifyPostedElement(path);
- testGetSessionInfo();
- testRemoveContent();
- testJsonLevels();
- out.innerHTML = "<b>Done running tests, pass " + (++passes) + "</b>";
- }
- </script>
-
-</body>
-</html>
--
To stop receiving notification emails like this one, please contact
olli@apache.org.