use of org.xwiki.model.reference.EntityReference in project xwiki-platform by xwiki.
the class LocalUidStringEntityReferenceSerializerTest method serializeReferenceWithChild.
@Test
public void serializeReferenceWithChild() {
EntityReference reference = resolver.resolve("wiki:Space.Page", EntityType.DOCUMENT);
Assert.assertEquals("5:Space", serializer.serialize(reference.getParent()));
Assert.assertEquals("", serializer.serialize(reference.getParent().getParent()));
}
use of org.xwiki.model.reference.EntityReference in project xwiki-platform by xwiki.
the class LocalUidStringEntityReferenceSerializerTest method serializeDocumentReference.
@Test
public void serializeDocumentReference() throws Exception {
EntityReference reference = resolver.resolve("wiki:space.page", EntityType.DOCUMENT);
Assert.assertEquals("5:space4:page", serializer.serialize(reference));
reference = resolver.resolve("wiki1.wiki2:wiki3:some.space.page", EntityType.DOCUMENT);
Assert.assertEquals("4:some5:space4:page", serializer.serialize(reference));
// Verify that passing null doesn't throw a NPE
Assert.assertNull(serializer.serialize(null));
}
use of org.xwiki.model.reference.EntityReference in project xwiki-platform by xwiki.
the class LocalUidStringEntityReferenceSerializerTest method serializeRelativeReference.
@Test
public void serializeRelativeReference() {
EntityReference reference = new EntityReference("page", EntityType.DOCUMENT);
Assert.assertEquals("4:page", serializer.serialize(reference));
reference = new EntityReference("page", EntityType.DOCUMENT, new EntityReference("space", EntityType.SPACE));
Assert.assertEquals("5:space4:page", serializer.serialize(reference));
}
use of org.xwiki.model.reference.EntityReference in project xwiki-platform by xwiki.
the class LocalUidStringEntityReferenceSerializerTest method serializeSpaceReference.
@Test
public void serializeSpaceReference() throws Exception {
EntityReference reference = resolver.resolve("wiki:space1.space2", EntityType.SPACE);
Assert.assertEquals("6:space16:space2", serializer.serialize(reference));
}
use of org.xwiki.model.reference.EntityReference in project xwiki-platform by xwiki.
the class LocalUidStringEntityReferenceSerializerTest method serializeAttachmentReference.
@Test
public void serializeAttachmentReference() throws Exception {
EntityReference reference = resolver.resolve("wiki:space.page@filename", EntityType.ATTACHMENT);
Assert.assertEquals("5:space4:page8:filename", serializer.serialize(reference));
}
Aggregations