use of org.xwiki.model.reference.EntityReferenceProvider in project xwiki-platform by xwiki.
the class RefactoringScriptServiceTest method configure.
@Before
public void configure() throws Exception {
this.jobExecutor = this.mocker.getInstance(JobExecutor.class);
Execution execution = this.mocker.getInstance(Execution.class);
when(execution.getContext()).thenReturn(executionContext);
DocumentAccessBridge documentAccessBridge = this.mocker.getInstance(DocumentAccessBridge.class);
when(documentAccessBridge.getCurrentUserReference()).thenReturn(this.userReference);
EntityReferenceProvider defaultEntityReferenceProvider = this.mocker.getInstance(EntityReferenceProvider.class);
when(defaultEntityReferenceProvider.getDefaultReference(EntityType.DOCUMENT)).thenReturn(new EntityReference("WebHome", EntityType.DOCUMENT, null));
}
use of org.xwiki.model.reference.EntityReferenceProvider in project xwiki-platform by xwiki.
the class EntityJobTest method initialize.
private void initialize(NoopEntityJob job, EntityRequest request) {
ReflectionUtils.setFieldValue(job, "jobContext", mock(JobContext.class));
ReflectionUtils.setFieldValue(job, "progressManager", mock(JobProgressManager.class));
ReflectionUtils.setFieldValue(job, "authorization", this.authorization);
ReflectionUtils.setFieldValue(job, "modelBridge", this.modelBridge);
EntityReferenceProvider defaultEntityReferenceProvider = mock(EntityReferenceProvider.class);
ReflectionUtils.setFieldValue(job, "defaultEntityReferenceProvider", defaultEntityReferenceProvider);
when(defaultEntityReferenceProvider.getDefaultReference(EntityType.DOCUMENT)).thenReturn(new EntityReference("WebHome", EntityType.DOCUMENT, null));
job.initialize(request);
}
use of org.xwiki.model.reference.EntityReferenceProvider in project xwiki-platform by xwiki.
the class DefaultStringEntityReferenceResolverTest method setUp.
@Before
public void setUp() throws Exception {
this.resolver = this.mocker.getComponentUnderTest();
EntityReferenceProvider referenceProvider = mock(EntityReferenceProvider.class);
ReflectionUtils.setFieldValue(this.resolver, "provider", referenceProvider);
when(referenceProvider.getDefaultReference(EntityType.WIKI)).thenReturn(DEFAULT_WIKI_REFERENCE);
when(referenceProvider.getDefaultReference(EntityType.SPACE)).thenReturn(DEFAULT_SPACE_REFERENCE);
when(referenceProvider.getDefaultReference(EntityType.DOCUMENT)).thenReturn(DEFAULT_PAGE_REFERENCE);
when(referenceProvider.getDefaultReference(EntityType.ATTACHMENT)).thenReturn(DEFAULT_ATTACHMENT_REFERENCE);
when(referenceProvider.getDefaultReference(EntityType.OBJECT)).thenReturn(DEFAULT_OBJECT_REFERENCE);
when(referenceProvider.getDefaultReference(EntityType.OBJECT_PROPERTY)).thenReturn(DEFAULT_OBJECT_PROPERTY_REFERENCE);
when(referenceProvider.getDefaultReference(EntityType.CLASS_PROPERTY)).thenReturn(DEFAULT_CLASS_PROPERTY_REFERENCE);
}
use of org.xwiki.model.reference.EntityReferenceProvider in project xwiki-platform by xwiki.
the class DefaultStringEntityReferenceSerializerTest method setUp.
@Before
public void setUp() throws Exception {
this.serializer = this.mocker.getComponentUnderTest();
this.resolver = this.resolverMocker.getComponentUnderTest();
EntityReferenceProvider referenceProvider = this.resolverMocker.getInstance(EntityReferenceProvider.class);
when(referenceProvider.getDefaultReference(EntityType.WIKI)).thenReturn(DEFAULT_WIKI_REFERENCE);
when(referenceProvider.getDefaultReference(EntityType.SPACE)).thenReturn(DEFAULT_SPACE_REFERENCE);
when(referenceProvider.getDefaultReference(EntityType.DOCUMENT)).thenReturn(DEFAULT_PAGE_REFERENCE);
when(referenceProvider.getDefaultReference(EntityType.ATTACHMENT)).thenReturn(DEFAULT_ATTACHMENT_REFERENCE);
when(referenceProvider.getDefaultReference(EntityType.OBJECT)).thenReturn(DEFAULT_OBJECT_REFERENCE);
when(referenceProvider.getDefaultReference(EntityType.OBJECT_PROPERTY)).thenReturn(DEFAULT_OBJECT_PROPERTY_REFERENCE);
when(referenceProvider.getDefaultReference(EntityType.CLASS_PROPERTY)).thenReturn(DEFAULT_CLASS_PROPERTY_REFERENCE);
}
use of org.xwiki.model.reference.EntityReferenceProvider in project xwiki-platform by xwiki.
the class UserAndGroupDocumentReferenceResolverTest method afterComponent.
@AfterComponent
public void afterComponent() throws Exception {
EntityReferenceProvider provider = this.mocker.registerMockComponent(EntityReferenceProvider.class);
when(provider.getDefaultReference(EntityType.WIKI)).thenReturn(new WikiReference("defaultwiki"));
}
Aggregations