Search in sources :

Example 36 with ResourceProxy

use of org.apache.sling.ide.transport.ResourceProxy in project sling by apache.

the class DefaultBatcherTest method identicalsReorderingsAreCompacted.

@Test
public void identicalsReorderingsAreCompacted() {
    ReorderChildNodesCommand first = new ReorderChildNodesCommand(mockRepo, credentials, new ResourceProxy("/content"), null);
    ReorderChildNodesCommand second = new ReorderChildNodesCommand(mockRepo, credentials, new ResourceProxy("/content"), null);
    batcher.add(first);
    batcher.add(second);
    List<Command<?>> batched = batcher.get();
    assertThat(batched, hasSize(1));
    Command<?> command = batched.get(0);
    assertThat(command, instanceOf(ReorderChildNodesCommand.class));
    assertThat(command.getPath(), equalTo("/content"));
}
Also used : ReorderChildNodesCommand(org.apache.sling.ide.impl.vlt.ReorderChildNodesCommand) DeleteNodeCommand(org.apache.sling.ide.impl.vlt.DeleteNodeCommand) GetNodeContentCommand(org.apache.sling.ide.impl.vlt.GetNodeContentCommand) Command(org.apache.sling.ide.transport.Command) AddOrUpdateNodeCommand(org.apache.sling.ide.impl.vlt.AddOrUpdateNodeCommand) ReorderChildNodesCommand(org.apache.sling.ide.impl.vlt.ReorderChildNodesCommand) ResourceProxy(org.apache.sling.ide.transport.ResourceProxy) Test(org.junit.Test)

Example 37 with ResourceProxy

use of org.apache.sling.ide.transport.ResourceProxy in project sling by apache.

the class ListChildrenCommand method execute0.

@Override
protected ResourceProxy execute0(Session session) throws RepositoryException {
    Node node = session.getNode(getPath());
    NodeIterator nodes = node.getNodes();
    ResourceProxy parent = nodeToResource(node);
    while (nodes.hasNext()) {
        Node childNode = nodes.nextNode();
        // TODO - this should not be needed if we obey the vlt filters
        if (childNode.getPath().equals("/jcr:system")) {
            continue;
        }
        parent.addChild(nodeToResource(childNode));
    }
    return parent;
}
Also used : NodeIterator(javax.jcr.NodeIterator) Node(javax.jcr.Node) ResourceProxy(org.apache.sling.ide.transport.ResourceProxy)

Example 38 with ResourceProxy

use of org.apache.sling.ide.transport.ResourceProxy in project sling by apache.

the class ContentXmlHandlerTest method escapedBraceAtStartOfPropertyValue.

@Test
public void escapedBraceAtStartOfPropertyValue() throws Exception {
    ResourceProxy root = parseContentXmlFile("escaped-braces-at-start-of-property.xml", "/");
    assertThat("properties[org.apache.sling.commons.log.pattern]", root.getProperties(), hasEntry("org.apache.sling.commons.log.pattern", (Object) "{0,date,dd.MM.yyyy HH:mm:ss.SSS} *{4}* [{2}] {3} {5}"));
}
Also used : ResourceProxy(org.apache.sling.ide.transport.ResourceProxy) Test(org.junit.Test)

Example 39 with ResourceProxy

use of org.apache.sling.ide.transport.ResourceProxy in project sling by apache.

the class ContentXmlHandlerTest method parseRootContentXml.

@Test
public void parseRootContentXml() throws ParserConfigurationException, SAXException, IOException {
    ResourceProxy root = parseContentXmlFile("root-content.xml", "/");
    assertThat("root contains /jcr:system", root.getChildren(), hasChildPath("/jcr:system"));
}
Also used : ResourceProxy(org.apache.sling.ide.transport.ResourceProxy) Test(org.junit.Test)

Example 40 with ResourceProxy

use of org.apache.sling.ide.transport.ResourceProxy in project sling by apache.

the class ContentXmlHandlerTest method parseContentXmlWithBinaryProperty.

@Test
public void parseContentXmlWithBinaryProperty() throws ParserConfigurationException, SAXException, IOException {
    ResourceProxy root = parseContentXmlFile("binary-property.xml", "/");
    assertThat("root has 1 property, binary property is ignored", root.getProperties().entrySet(), hasSize(1));
}
Also used : ResourceProxy(org.apache.sling.ide.transport.ResourceProxy) Test(org.junit.Test)

Aggregations

ResourceProxy (org.apache.sling.ide.transport.ResourceProxy)42 Test (org.junit.Test)14 Node (javax.jcr.Node)8 NodeIterator (javax.jcr.NodeIterator)5 IPath (org.eclipse.core.runtime.IPath)5 IOException (java.io.IOException)4 InputStream (java.io.InputStream)4 HashMap (java.util.HashMap)4 FilterResult (org.apache.sling.ide.filter.FilterResult)4 IFile (org.eclipse.core.resources.IFile)4 IFolder (org.eclipse.core.resources.IFolder)4 Filter (org.apache.sling.ide.filter.Filter)3 RepositoryException (org.apache.sling.ide.transport.RepositoryException)3 JsonReader (com.google.gson.stream.JsonReader)2 JsonToken (com.google.gson.stream.JsonToken)2 File (java.io.File)2 InputStreamReader (java.io.InputStreamReader)2 HashSet (java.util.HashSet)2 LinkedList (java.util.LinkedList)2 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)2