use of org.apache.sling.ide.transport.ResourceProxy in project sling by apache.
the class ContentXmlHandlerTest method emptyMultivaluedProperties.
@Test
public void emptyMultivaluedProperties() throws Exception {
ResourceProxy root = parseContentXmlFile("empty-multivalued-property.xml", "/");
assertThat("properties[labels]", (String[]) root.getProperties().get("labels"), Matchers.arrayWithSize(0));
assertThat("properties[values]", (Long[]) root.getProperties().get("values"), Matchers.arrayWithSize(0));
}
use of org.apache.sling.ide.transport.ResourceProxy in project sling by apache.
the class ContentXmlHandlerTest method escapedCommaInMultiValuedProperty.
@Test
public void escapedCommaInMultiValuedProperty() throws Exception {
ResourceProxy root = parseContentXmlFile("escaped-comma-in-multi-valued-property.xml", "/");
assertThat("properties[someProp]", (String[]) root.getProperties().get("someProp"), Matchers.is(new String[] { "first,first", "second" }));
}
use of org.apache.sling.ide.transport.ResourceProxy in project sling by apache.
the class DefaultBatcherTest method identicalAddOrUpdatesAreCompacted.
@Test
public void identicalAddOrUpdatesAreCompacted() {
AddOrUpdateNodeCommand first = new AddOrUpdateNodeCommand(mockRepo, credentials, null, null, new ResourceProxy("/content"), null);
AddOrUpdateNodeCommand second = new AddOrUpdateNodeCommand(mockRepo, credentials, null, null, 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(AddOrUpdateNodeCommand.class));
assertThat(command.getPath(), equalTo("/content"));
}
use of org.apache.sling.ide.transport.ResourceProxy in project sling by apache.
the class AddOrUpdateNodeCommandTest method nodeNotPresentButOutsideOfFilterIsNotRemoved.
@Test
public void nodeNotPresentButOutsideOfFilterIsNotRemoved() throws Exception {
final CommandContext context = new CommandContext(new Filter() {
@Override
public FilterResult filter(String repositoryPath) {
if (repositoryPath.equals("/content/not-included-child")) {
return FilterResult.DENY;
}
return FilterResult.ALLOW;
}
});
doWithTransientRepository(new CallableWithSession() {
@Override
public Void call() throws Exception {
Node content = session().getRootNode().addNode("content", "nt:unstructured");
content.addNode("included-child");
content.addNode("not-included-child");
session().save();
ResourceProxy resource = newResource("/content", "nt:unstructured");
resource.addChild(newResource("/content/included-child", "nt:unstructured"));
AddOrUpdateNodeCommand cmd = new AddOrUpdateNodeCommand(repo(), credentials(), context, null, resource, logger);
cmd.execute().get();
session().refresh(false);
content = session().getRootNode().getNode("content");
content.getNode("included-child");
content.getNode("not-included-child");
return null;
}
});
}
use of org.apache.sling.ide.transport.ResourceProxy in project sling by apache.
the class ContentXmlHandlerTest method encodedChildContentXml.
@Test
public void encodedChildContentXml() throws ParserConfigurationException, SAXException, IOException {
ResourceProxy root = parseContentXmlFile("encoded-child-content.xml", "/ROOT");
assertThat("/ROOT contains /_jcr_content", root.getChildren(), hasChildPath("/ROOT/_jcr_content"));
}
Aggregations