use of org.xwiki.model.reference.ObjectReference in project xwiki-platform by xwiki.
the class WikiObjectComponentManagerEventListenerProxyTest method testWithWikiObjectComponentBuilder.
private void testWithWikiObjectComponentBuilder(WikiObjectComponentBuilder buider, BaseObjectReference objectReference, XWikiDocument source) throws Exception {
BaseObject baseObject = mock(BaseObject.class);
when(source.getXObject(any(ObjectReference.class))).thenReturn(baseObject);
this.mocker.getComponentUnderTest().registerObjectComponents(objectReference, baseObject, buider);
}
use of org.xwiki.model.reference.ObjectReference in project xwiki-platform by xwiki.
the class WikiObjectComponentManagerEventListenerProxyTest method testWikiObjectListCollection.
@Test
public void testWikiObjectListCollection() throws Exception {
WikiObjectComponentBuilder builder1 = mock(WikiObjectComponentBuilder.class);
WikiObjectComponentBuilder builder2 = mock(WikiObjectComponentBuilder.class);
ObjectReference builder1Reference = new ObjectReference("builder1", mock(DocumentReference.class));
ObjectReference builder2Reference = new ObjectReference("builder2", mock(DocumentReference.class));
when(builder1.getClassReference()).thenReturn(builder1Reference);
when(builder2.getClassReference()).thenReturn(builder2Reference);
when(this.componentManager.getInstanceList(WikiObjectComponentBuilder.class)).thenReturn(Arrays.asList(builder1, builder2));
assertEquals(2, this.mocker.getComponentUnderTest().getWikiObjectsList().size());
}
use of org.xwiki.model.reference.ObjectReference in project xwiki-platform by xwiki.
the class LESSObjectPropertyResourceReferenceTest method serialize.
@Test
public void serialize() throws Exception {
ObjectPropertyReference objectPropertyReference = new ObjectPropertyReference("property", new ObjectReference("class", new DocumentReference("wiki", "Space", "Document")));
LESSObjectPropertyResourceReference lessObjectPropertyResourceReference = new LESSObjectPropertyResourceReference(objectPropertyReference, entityReferenceSerializer, bridge);
// Mock
when(entityReferenceSerializer.serialize(eq(objectPropertyReference))).thenReturn("objPropertyRef");
// Test
assertEquals("LessXObjectProperty[objPropertyRef]", lessObjectPropertyResourceReference.serialize());
}
use of org.xwiki.model.reference.ObjectReference in project xwiki-platform by xwiki.
the class SolrEntityReferenceResolverTest method resolve.
@Test
public void resolve() throws Exception {
WikiReference wikiReference = new WikiReference("chess");
assertReference(wikiReference);
assertReference(new SpaceReference("Success", new SpaceReference("To", new SpaceReference("Path", wikiReference))));
DocumentReference documentReference = new DocumentReference("chess", Arrays.asList("Path", "To", "Success"), "WebHome", Locale.FRENCH);
assertReference(documentReference);
assertReference(new AttachmentReference("image.png", documentReference));
ObjectReference objectReference = new ObjectReference("App.Code.PlayerClass[13]", documentReference);
assertReference(objectReference);
assertReference(new ObjectPropertyReference("age", objectReference));
}
use of org.xwiki.model.reference.ObjectReference in project xwiki-platform by xwiki.
the class DefaultMessageStream method postDirectMessageToUser.
@Override
public void postDirectMessageToUser(String message, DocumentReference user) {
if (!this.bridge.exists(user)) {
throw new IllegalArgumentException("Target user does not exist");
}
Event e = createMessageEvent(message, "directMessage");
e.setRelatedEntity(new ObjectReference("XWiki.XWikiUsers", user));
e.setStream(this.serializer.serialize(user));
e.setImportance(Importance.CRITICAL);
this.stream.addEvent(e);
}
Aggregations