info.magnolia.objectfactory.Components.setComponentProvider()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中info.magnolia.objectfactory.Components.setComponentProvider()方法的一些代码示例,展示了Components.setComponentProvider()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Components.setComponentProvider()方法的具体详情如下:
包路径:info.magnolia.objectfactory.Components
类名称:Components
方法名:setComponentProvider

Components.setComponentProvider介绍

[英]Sets the current ComponentProvider.
[中]设置当前组件提供程序。

代码示例

代码示例来源:origin: info.magnolia/magnolia-core

public void unload() {
  // See comment in GuiceServletContextListener
  if (main != null) {
    Components.setComponentProvider(main.getParent());
    main.destroy();
  }
  Components.getComponent(RepositoryManager.class).shutdown();
}

代码示例来源:origin: info.magnolia/magnolia-core

@Override
@After
public void tearDown() throws Exception {
  super.tearDown();
  Components.setComponentProvider(null);
}

代码示例来源:origin: info.magnolia/magnolia-rendering

@Override
@After
public void tearDown() throws Exception {
  super.tearDown();
  Components.setComponentProvider(null);
}

代码示例来源:origin: info.magnolia/magnolia-rendering

@Override
@After
public void tearDown() throws Exception {
  super.tearDown();
  Components.setComponentProvider(null);
}

代码示例来源:origin: info.magnolia/magnolia-core

@After
public void tearDown() throws Exception {
  SystemProperty.clear();
  Components.setComponentProvider(null);
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

@After
public void tearDown() throws Exception {
  ComponentsTestUtil.clear();
  Components.setComponentProvider(null);
  MgnlContext.setInstance(null);
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

@After
public void tearDown() throws Exception {
  ComponentsTestUtil.clear();
  Components.setComponentProvider(null);
  MgnlContext.setInstance(null);
}

代码示例来源:origin: info.magnolia/magnolia-core

@Before
public void setUp() {
  final WebContext webContext = new MockWebContext();
  final SystemContext systemContext = mock(SystemContext.class);
  final MockComponentProvider componentProvider = new MockComponentProvider();
  componentProvider.setInstance(WebContext.class, webContext);
  componentProvider.setInstance(RepositoryManager.class, mock(RepositoryManager.class));
  componentProvider.setInstance(SystemContext.class, systemContext);
  Components.setComponentProvider(componentProvider);
  MgnlContext.setInstance(webContext);
  filterManager = new FilterManagerImpl(mock(ModuleManager.class), systemContext, null, componentProvider);
}

代码示例来源:origin: info.magnolia/magnolia-core

@After
public void tearDown() throws Exception {
  ComponentsTestUtil.clear();
  SystemProperty.clear();
  MgnlContext.setInstance(null);
  Components.setComponentProvider(null);
}

代码示例来源:origin: info.magnolia/magnolia-core

@After
public void tearDown() throws Exception {
  resetCFP();
  SystemProperty.clear();
  Components.setComponentProvider(null);
  ComponentsTestUtil.clear();
  MgnlContext.setInstance(null);
}

代码示例来源:origin: info.magnolia/magnolia-core

@Test
public void testPushingAndPoppingComponentProvider() throws Exception {
  // GIVEN
  ComponentProvider previous = mock(ComponentProvider.class);
  Components.setComponentProvider(previous);
  assertSame(previous, Components.getComponentProvider());
  // WHEN
  ComponentProvider other = mock(ComponentProvider.class);
  Components.pushProvider(other);
  // THEN
  assertSame(other, Components.getComponentProvider());
  Components.popProvider();
  assertSame(previous, Components.getComponentProvider());
}

代码示例来源:origin: info.magnolia/magnolia-core

@After
  public void tearDown() throws Exception {
    SystemProperty.clear();
    SystemProperty.setMagnoliaConfigurationProperties(new TestMagnoliaConfigurationProperties());
    MgnlContext.setInstance(null);
    Components.setComponentProvider(null);
    ComponentsTestUtil.clear();
  }
}

代码示例来源:origin: info.magnolia/magnolia-rendering

@Test
public void testReturnsNodeDepthComparatorByDefault() throws Exception {
  Components.setComponentProvider(new MockComponentProvider());
  ConfiguredInheritance inheritance = new ConfiguredInheritance();
  inheritance.setEnabled(true);
  assertTrue(inheritance.getComponentComparator() instanceof ConfiguredInheritance.NodeDepthComparator);
}

代码示例来源:origin: info.magnolia/magnolia-core

@Before
public void setUp() throws Exception {
  SystemProperty.clear();
  SystemProperty.setMagnoliaConfigurationProperties(new TestMagnoliaConfigurationProperties());
  Components.setComponentProvider(new MockComponentProvider(SystemProperty.getProperties()));
  resetCFP();
}

代码示例来源:origin: info.magnolia/magnolia-rendering

@Test
public void testReturnsSetNodePredicate() throws Exception {
  Components.setComponentProvider(new MockComponentProvider());
  ConfiguredInheritance inheritance = new ConfiguredInheritance();
  inheritance.setEnabled(true);
  inheritance.setPredicateClass(TestNodePredicate.class);
  assertTrue(inheritance.getComponentPredicate() instanceof TestNodePredicate);
}

代码示例来源:origin: info.magnolia/magnolia-rendering

@Test
public void testReturnsIncludeNothingComponentPredicateWhenComponentsSetToBlank() throws Exception {
  Components.setComponentProvider(new MockComponentProvider());
  ConfiguredInheritance inheritance = new ConfiguredInheritance();
  inheritance.setEnabled(true);
  inheritance.setComponents("");
  assertTrue(inheritance.getComponentPredicate() instanceof ConfiguredInheritance.InheritNothingInheritancePredicate);
}

代码示例来源:origin: info.magnolia/magnolia-rendering

@Test
public void testReturnsSetNodeComparator() throws Exception {
  Components.setComponentProvider(new MockComponentProvider());
  ConfiguredInheritance inheritance = new ConfiguredInheritance();
  inheritance.setEnabled(true);
  inheritance.setNodeComparatorClass(TestNodeComparator.class);
  assertTrue(inheritance.getComponentComparator() instanceof TestNodeComparator);
}

代码示例来源:origin: info.magnolia/magnolia-rendering

@Test
public void testReturnsIncludeNothingComponentPredicateWhenComponentsSetToUnknownValue() throws Exception {
  Components.setComponentProvider(new MockComponentProvider());
  ConfiguredInheritance inheritance = new ConfiguredInheritance();
  inheritance.setEnabled(true);
  inheritance.setComponents("unknown-value");
  assertTrue(inheritance.getComponentPredicate() instanceof ConfiguredInheritance.InheritNothingInheritancePredicate);
}

代码示例来源:origin: info.magnolia/magnolia-rendering

@Test
public void testReturnsIncludeNothingComponentPredicateWhenComponentsSetToNone() throws Exception {
  Components.setComponentProvider(new MockComponentProvider());
  ConfiguredInheritance inheritance = new ConfiguredInheritance();
  inheritance.setEnabled(true);
  inheritance.setComponents(ConfiguredInheritance.COMPONENTS_NONE);
  assertTrue(inheritance.getComponentPredicate() instanceof ConfiguredInheritance.InheritNothingInheritancePredicate);
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework-compatibility

@Before
public void setUp() throws Exception {
  Components.setComponentProvider(new MockComponentProvider());
  MockWebContext webCtx = new MockWebContext();
  session = new MockSession(workspaceName);
  webCtx.addSession(workspaceName, session);
  webCtx.setContextPath("/foo");
  MgnlContext.setInstance(webCtx);
  ConfiguredImageProviderDefinition cipd = new ConfiguredImageProviderDefinition();
  cipd.setOriginalImageNodeName(IMAGE_NODE_NAME);
  contentConnector = mock(ContentConnector.class);
  imageProvider = new DefaultImageProvider(cipd, contentConnector);
}

相关文章