use of org.xwiki.component.util.DefaultParameterizedType in project xwiki-platform by xwiki.
the class DocumentTreeNodeTest method configure.
@Before
public void configure() throws Exception {
this.currentEntityReferenceResolver = this.mocker.getInstance(EntityReferenceResolver.TYPE_STRING, "current");
this.defaultEntityReferenceSerializer = this.mocker.getInstance(EntityReferenceSerializer.TYPE_STRING);
this.defaultEntityReferenceProvider = this.mocker.getInstance(EntityReferenceProvider.class);
this.authorization = this.mocker.getInstance(ContextualAuthorizationManager.class);
this.queryManager = this.mocker.getInstance(QueryManager.class);
when(this.defaultEntityReferenceProvider.getDefaultReference(EntityType.DOCUMENT)).thenReturn(new EntityReference("WebHome", EntityType.DOCUMENT));
when(this.currentEntityReferenceResolver.resolve("wiki:Path.To.Page.WebHome", EntityType.DOCUMENT)).thenReturn(documentReference);
when(this.defaultEntityReferenceSerializer.serialize(documentReference)).thenReturn("wiki:Path.To.Page.WebHome");
when(this.queryManager.getNamedQuery("nestedPagesOrderedByName")).thenReturn(this.nestedPagesOrderedByName);
when(this.nestedPagesOrderedByName.addFilter(any(QueryFilter.class))).thenReturn(this.nestedPagesOrderedByName);
this.contextComponentManagerProvider = this.mocker.registerMockComponent(new DefaultParameterizedType(null, Provider.class, ComponentManager.class), "context");
when(this.contextComponentManagerProvider.get()).thenReturn(this.mocker);
this.translationsTreeNode = this.mocker.registerMockComponent(TreeNode.class, "translations");
this.attachmentsTreeNode = this.mocker.registerMockComponent(TreeNode.class, "attachments");
this.classPropertiesTreeNode = this.mocker.registerMockComponent(TreeNode.class, "classProperties");
this.objectsTreeNode = this.mocker.registerMockComponent(TreeNode.class, "objects");
}
use of org.xwiki.component.util.DefaultParameterizedType in project xwiki-platform by xwiki.
the class ExportURLFactory method init.
/**
* Init the url factory.
*
* @param exportedPages the pages that will be exported.
* @param exportDir the directory where to copy exported objects (attachments).
* @param context the XWiki context.
* @deprecated starting with 8.4.5/9.0, use {@link #init(Collection, File, FilesystemExportContext, XWikiContext)}
*/
@Deprecated
public void init(Collection<String> exportedPages, File exportDir, XWikiContext context) {
Provider<FilesystemExportContext> exportContextProvider = Utils.getComponent(new DefaultParameterizedType(null, Provider.class, FilesystemExportContext.class));
DocumentReferenceResolver<String> resolver = Utils.getComponent(DocumentReferenceResolver.TYPE_STRING, "current");
List<DocumentReference> references = new ArrayList<>();
for (String exportedPage : exportedPages) {
references.add(resolver.resolve(exportedPage));
}
init(references, exportDir, exportContextProvider.get(), context);
}
use of org.xwiki.component.util.DefaultParameterizedType in project xwiki-platform by xwiki.
the class DBListClassPropertyValuesProviderTest method configure.
@Before
public void configure() throws Exception {
super.configure();
addProperty("category", this.dbListClass, true);
addProperty("date", new DateClass(), false);
when(this.xcontext.getWiki().getDocument(new ClassPropertyReference("status", this.classReference), this.xcontext)).thenReturn(this.classDocument);
this.entityReferenceSerializer = this.mocker.getInstance(EntityReferenceSerializer.TYPE_STRING);
this.authorExecutor = this.mocker.getInstance(AuthorExecutor.class);
DefaultParameterizedType listQueryBuilderType = new DefaultParameterizedType(null, QueryBuilder.class, ListClass.class);
}
use of org.xwiki.component.util.DefaultParameterizedType in project xwiki-platform by xwiki.
the class UIExtensionScriptServiceTest method setUp.
@Before
public void setUp() throws Exception {
contextComponentManager = mock(ComponentManager.class);
Provider<ComponentManager> componentManagerProvider = componentManager.registerMockComponent(new DefaultParameterizedType(null, Provider.class, ComponentManager.class), "context");
when(componentManagerProvider.get()).thenReturn(contextComponentManager);
this.uiExtensionManager = componentManager.getInstance(UIExtensionManager.class);
}
use of org.xwiki.component.util.DefaultParameterizedType in project xwiki-platform by xwiki.
the class StandardExtendedURLResourceReferenceSerializerTest method serialize.
@Test
public void serialize() throws Exception {
TestResourceReference resource = new TestResourceReference();
ResourceReferenceSerializer serializer = mock(ResourceReferenceSerializer.class);
ComponentManager componentManager = this.mocker.getInstance(ComponentManager.class, "context");
when(componentManager.getInstance(new DefaultParameterizedType(null, ResourceReferenceSerializer.class, TestResourceReference.class, ExtendedURL.class), "standard")).thenReturn(serializer);
this.mocker.getComponentUnderTest().serialize(resource);
// Verify the serializer is called and with the proper parameters
verify(serializer).serialize(same(resource));
}
Aggregations