use of org.xwiki.url.URLConfiguration in project xwiki-platform by xwiki.
the class IntegrationTest method setUpComponents.
@BeforeComponent
public void setUpComponents() throws Exception {
// Isolate from xwiki configuration file
URLConfiguration urlConfiguration = this.componentManager.registerMockComponent(URLConfiguration.class);
when(urlConfiguration.getURLFormatId()).thenReturn("standard");
// Isolate from xwiki configuration file
StandardURLConfiguration standardURLConfiguration = this.componentManager.registerMockComponent(StandardURLConfiguration.class);
when(standardURLConfiguration.getEntityPathPrefix()).thenReturn("bin");
when(standardURLConfiguration.getWikiPathPrefix()).thenReturn("wiki");
when(standardURLConfiguration.isViewActionHidden()).thenReturn(false);
// Isolate from xwiki configuration file
ModelConfiguration modelConfiguration = this.componentManager.registerMockComponent(ModelConfiguration.class);
when(modelConfiguration.getDefaultReferenceValue(EntityType.WIKI)).thenReturn("xwiki");
// Isolate from xwiki's model
WikiDescriptorManager wikiDescriptorManager = this.componentManager.registerMockComponent(WikiDescriptorManager.class);
when(wikiDescriptorManager.getMainWikiId()).thenReturn("xwiki");
// Isolate from Environment
EntityResourceActionLister actionLister = this.componentManager.registerMockComponent(EntityResourceActionLister.class);
when(actionLister.listActions()).thenReturn(Arrays.asList("view"));
// Simulate a configured Execution Context
Execution execution = this.componentManager.registerMockComponent(Execution.class);
when(execution.getContext()).thenReturn(new ExecutionContext());
// For test simplicity consider that Context CM == CM
this.componentManager.registerComponent(ComponentManager.class, "context", this.componentManager);
}
Aggregations