sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject svn commit: r1717969 - in /sling/trunk/tooling/ide: eclipse-test/ eclipse-test/META-INF/ eclipse-test/src/org/apache/sling/ide/test/impl/ui/ eclipse-test/src/org/apache/sling/ide/test/impl/ui/sightly/ target-definition/
Date Fri, 04 Dec 2015 14:20:08 GMT
Author: rombert
Date: Fri Dec  4 14:20:08 2015
New Revision: 1717969

URL: http://svn.apache.org/viewvc?rev=1717969&view=rev
Log:
SLING-5140 - Add tests for Sightly editor auto-completion 

Add SightlyAutocompletionTest, based on SWTBot, initially testing just
tag auto-completion.

Added:
    sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ui/
    sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ui/sightly/
    sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ui/sightly/SightlyAutocompletionTest.java
Modified:
    sling/trunk/tooling/ide/eclipse-test/META-INF/MANIFEST.MF
    sling/trunk/tooling/ide/eclipse-test/pom.xml
    sling/trunk/tooling/ide/target-definition/org.apache.sling.ide.target-definition.target

Modified: sling/trunk/tooling/ide/eclipse-test/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/META-INF/MANIFEST.MF?rev=1717969&r1=1717968&r2=1717969&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/META-INF/MANIFEST.MF (original)
+++ sling/trunk/tooling/ide/eclipse-test/META-INF/MANIFEST.MF Fri Dec  4 14:20:08 2015
@@ -23,7 +23,11 @@ Require-Bundle: org.junit,
  org.eclipse.m2e.core,
  org.eclipse.m2e.maven.runtime,
  org.apache.commons.io,
- org.hamcrest.core
+ org.hamcrest.core,
+ org.eclipse.swtbot.eclipse.finder,
+ org.eclipse.swtbot.junit4_x,
+ org.eclipse.ui.ide,
+ org.eclipse.swt
 Import-Package: javax.jcr,
  javax.jcr.nodetype,
  org.apache.jackrabbit.util,

Modified: sling/trunk/tooling/ide/eclipse-test/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/pom.xml?rev=1717969&r1=1717968&r2=1717969&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/pom.xml (original)
+++ sling/trunk/tooling/ide/eclipse-test/pom.xml Fri Dec  4 14:20:08 2015
@@ -57,6 +57,11 @@
                                 <id>org.apache.sling.ide.feature</id>
                                 <versionRange>0.0.0</versionRange>
                             </requirement>
+                            <requirement>
+                                <type>eclipse-feature</type>
+                                <id>org.apache.sling.ide.sightly-feature</id>
+                                <versionRange>0.0.0</versionRange>
+                            </requirement>
                         </extraRequirements>
                     </dependency-resolution>
                 </configuration>

Added: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ui/sightly/SightlyAutocompletionTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ui/sightly/SightlyAutocompletionTest.java?rev=1717969&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ui/sightly/SightlyAutocompletionTest.java
(added)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ui/sightly/SightlyAutocompletionTest.java
Fri Dec  4 14:20:08 2015
@@ -0,0 +1,92 @@
+/*
+ * 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.ide.test.impl.ui.sightly;
+
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.io.ByteArrayInputStream;
+import java.util.List;
+
+import org.apache.sling.ide.test.impl.helpers.ProjectAdapter;
+import org.apache.sling.ide.test.impl.helpers.TemporaryProject;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class SightlyAutocompletionTest {
+    
+    private static SWTWorkbenchBot bot;
+    
+    @Rule
+    public TemporaryProject projectRule = new TemporaryProject();
+    
+    @BeforeClass
+    public static void closeWelcomeView() throws Exception {
+        bot = new SWTWorkbenchBot();
+        if ( bot.activeView().getTitle().equals("Welcome") ) {
+            bot.activeView().close();
+        }
+    }    
+
+    @Test
+    public void tagNameAutocompletion() throws Exception {
+        
+        // create faceted project
+        IProject contentProject = projectRule.getProject();
+
+        ProjectAdapter project = new ProjectAdapter(contentProject);
+        project.addNatures(JavaCore.NATURE_ID, "org.eclipse.wst.common.project.facet.core.nature");
+
+        // install facets
+        project.installFacet("sling.content", "1.0");
+        project.installFacet("sightly", "1.1");
+        
+        // create basic html file
+        project.createOrUpdateFile(Path.fromOSString("jcr_root/index.html"), new ByteArrayInputStream("".getBytes()));
+        Thread.sleep(1000); // TODO - wait for project to be registered in the UI
+        
+        // ensure that we get the tree from the project explorer
+        bot.viewByTitle("Project Explorer").setFocus();
+        
+        // open editor
+        SWTBotTreeItem projectItem = bot.tree().expandNode(contentProject.getName());
+        // it seems that two 'jcr_root' nodes confuse SWTBot so we expand and navigate manually
+        SWTBotTreeItem folderNode = projectItem.getItems()[0].expand();
+        folderNode.getItems()[0].select().doubleClick();
+        
+        // generate auto-completion proposals
+        SWTBotEclipseEditor editor = bot.editorByTitle("index.html").toTextEditor();
+        editor.insertText("<html>\n\n</html>");
+        editor.navigateTo(1, 0);
+        List<String> proposals = editor.getAutoCompleteProposals("");
+        editor.saveAndClose();
+
+        // validate auto-completion proposals
+        assertThat("proposal list does not contain 'sly'", proposals, hasItem("sly"));
+    }
+
+}

Modified: sling/trunk/tooling/ide/target-definition/org.apache.sling.ide.target-definition.target
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/target-definition/org.apache.sling.ide.target-definition.target?rev=1717969&r1=1717968&r2=1717969&view=diff
==============================================================================
--- sling/trunk/tooling/ide/target-definition/org.apache.sling.ide.target-definition.target
(original)
+++ sling/trunk/tooling/ide/target-definition/org.apache.sling.ide.target-definition.target
Fri Dec  4 14:20:08 2015
@@ -15,7 +15,7 @@
     See the License for the specific language governing permissions
     and limitations under the License.
 -->
-<?pde version="3.8"?><target name="Sling IDE Tools" sequenceNumber="44">
+<?pde version="3.8"?><target name="Sling IDE Tools" sequenceNumber="45">
 <locations>
 <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner"
includeSource="true" type="InstallableUnit">
 <unit id="org.sonatype.tycho.m2e.feature.feature.group" version="0.6.0.201207302152"/>
@@ -43,5 +43,11 @@
 <unit id="org.eclipse.jst.enterprise_ui.feature.feature.group" version="3.6.3.v201501281502"/>
 <repository location="http://download.eclipse.org/releases/luna"/>
 </location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner"
includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.swtbot.feature.group" version="2.3.0.201506081302"/>
+<unit id="org.eclipse.swtbot.eclipse.feature.group" version="2.3.0.201506081302"/>
+<unit id="org.eclipse.swtbot.eclipse.test.junit.feature.group" version="2.3.0.201506081302"/>
+<repository location="http://download.eclipse.org/technology/swtbot/releases/2.3.0/"/>
+</location>
 </locations>
 </target>



Mime
View raw message