Search in sources :

Example 6 with SpyCommand

use of org.apache.sling.ide.test.impl.helpers.SpyCommand in project sling by apache.

the class ResourceChangeCommandFactoryTest method commandForAddedOrUpdatedNtFolder.

@Test
public void commandForAddedOrUpdatedNtFolder() throws CoreException {
    // create a sling:Folder at /content/test-root/nested
    InputStream childContentXml = getClass().getResourceAsStream("sling-folder-nodetype.xml");
    project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/nested/.content.xml"), childContentXml);
    SpyCommand<?> command = (SpyCommand<?>) factory.newCommandForAddedOrUpdated(spyRepo, contentProject.findMember("jcr_root/content/test-root"));
    assertThat("command.path", command.getPath(), nullValue());
    assertThat("command.resource.path", command.getResourceProxy().getPath(), equalTo("/content/test-root"));
    assertThat("command.resource.properties", command.getResourceProxy().getProperties(), equalTo(singletonMap("jcr:primaryType", (Object) "nt:folder")));
    assertThat("command.fileinfo", command.getFileInfo(), nullValue());
    assertThat("command.kind", command.getSpyKind(), equalTo(SpyCommand.Kind.ADD_OR_UPDATE));
}
Also used : SpyCommand(org.apache.sling.ide.test.impl.helpers.SpyCommand) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) Test(org.junit.Test)

Aggregations

SpyCommand (org.apache.sling.ide.test.impl.helpers.SpyCommand)6 Test (org.junit.Test)6 ByteArrayInputStream (java.io.ByteArrayInputStream)4 InputStream (java.io.InputStream)4 ResourceProxy (org.apache.sling.ide.transport.ResourceProxy)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 HashMap (java.util.HashMap)1