You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2014/05/13 17:11:49 UTC

svn commit: r1594243 - in /sling/trunk/tooling/ide/eclipse-test: META-INF/MANIFEST.MF src/org/apache/sling/ide/test/impl/helpers/RepositoryAccessor.java

Author: rombert
Date: Tue May 13 15:11:49 2014
New Revision: 1594243

URL: http://svn.apache.org/r1594243
Log:
SLING-3122 - Incorrect filtering for full coverage nodes

Add RepositoryAccessor.createNode

Modified:
    sling/trunk/tooling/ide/eclipse-test/META-INF/MANIFEST.MF
    sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/RepositoryAccessor.java

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=1594243&r1=1594242&r2=1594243&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/META-INF/MANIFEST.MF (original)
+++ sling/trunk/tooling/ide/eclipse-test/META-INF/MANIFEST.MF Tue May 13 15:11:49 2014
@@ -23,6 +23,7 @@ Require-Bundle: org.junit,
  org.hamcrest.core
 Import-Package: javax.jcr,
  javax.jcr.nodetype,
+ org.apache.jackrabbit.util,
  org.apache.sling.ide.jcr
 Bundle-Activator: org.apache.sling.ide.test.impl.Activator
 Bundle-ActivationPolicy: lazy

Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/RepositoryAccessor.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/RepositoryAccessor.java?rev=1594243&r1=1594242&r2=1594243&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/RepositoryAccessor.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/RepositoryAccessor.java Tue May 13 15:11:49 2014
@@ -31,6 +31,7 @@ import org.apache.commons.httpclient.Htt
 import org.apache.commons.httpclient.UsernamePasswordCredentials;
 import org.apache.commons.httpclient.auth.AuthScope;
 import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.jackrabbit.util.Text;
 import org.apache.sling.ide.jcr.RepositoryUtils;
 import org.apache.sling.ide.transport.RepositoryInfo;
 import org.hamcrest.CoreMatchers;
@@ -100,12 +101,27 @@ public class RepositoryAccessor {
         }
     }
 
-
     public Node getNode(String nodePath) throws RepositoryException {
 
         return login().getNode(nodePath);
     }
 
+    public void createNode(String path, String primaryNodeType) throws RepositoryException {
+
+        Session session = login();
+        try {
+            if (session.nodeExists(path)) {
+                return;
+            }
+
+            Node parent = session.getNode(Text.getRelativeParent(path, 1));
+            parent.addNode(Text.getName(path), primaryNodeType);
+            session.save();
+        } finally {
+            session.logout();
+        }
+    }
+
     private Session login() throws RepositoryException {
         
         RepositoryInfo repositoryInfo = new RepositoryInfo(config.getUsername(), config.getPassword(), config.getUrl());
@@ -121,4 +137,5 @@ public class RepositoryAccessor {
         return repository.login(credentials);
     }
 
+
 }