use of org.picocontainer.MutablePicoContainer in project sonarqube by SonarSource.
the class ComputeEngineContainerImplTest method real_start.
@Test
public void real_start() throws IOException {
Properties properties = ProcessProperties.defaults();
File homeDir = tempFolder.newFolder();
File dataDir = new File(homeDir, "data");
File tmpDir = new File(homeDir, "tmp");
properties.setProperty(PATH_HOME, homeDir.getAbsolutePath());
properties.setProperty(PATH_DATA, dataDir.getAbsolutePath());
properties.setProperty(PATH_TEMP, tmpDir.getAbsolutePath());
properties.setProperty(PROPERTY_PROCESS_INDEX, valueOf(ProcessId.COMPUTE_ENGINE.getIpcIndex()));
properties.setProperty(PROPERTY_SHARED_PATH, tmpDir.getAbsolutePath());
properties.setProperty(DatabaseProperties.PROP_URL, ((BasicDataSource) dbTester.database().getDataSource()).getUrl());
properties.setProperty(DatabaseProperties.PROP_USER, "sonar");
properties.setProperty(DatabaseProperties.PROP_PASSWORD, "sonar");
// required persisted properties
insertProperty(CoreProperties.SERVER_ID, "a_startup_id");
insertProperty(CoreProperties.SERVER_STARTTIME, DateUtils.formatDateTime(new Date()));
underTest.start(new Props(properties));
MutablePicoContainer picoContainer = underTest.getComponentContainer().getPicoContainer();
assertThat(picoContainer.getComponentAdapters()).hasSize(CONTAINER_ITSELF + // level 4
75 + // content of CeConfigurationModule
4 + // content of CeQueueModule
5 + // content of CeHttpModule
3 + // content of CeTaskCommonsModule
3 + // content of ProjectAnalysisTaskModule
4 + // content of CeTaskProcessorModule
4);
assertThat(picoContainer.getParent().getComponentAdapters()).hasSize(CONTAINER_ITSELF + // level 3
5);
assertThat(picoContainer.getParent().getParent().getComponentAdapters()).hasSize(CONTAINER_ITSELF + // MigrationConfigurationModule
10 + // level 2
17);
assertThat(picoContainer.getParent().getParent().getParent().getComponentAdapters()).hasSize(COMPONENTS_IN_LEVEL_1_AT_CONSTRUCTION + // level 1
23 + // content of DaoModule
47 + // content of EsSearchModule
3 + // content of CorePropertyDefinitions
57 + // content of CePropertyDefinitions
1);
assertThat(picoContainer.getParent().getParent().getParent().getParent()).isNull();
underTest.stop();
assertThat(picoContainer.getLifecycleState().isStarted()).isFalse();
assertThat(picoContainer.getLifecycleState().isStopped()).isFalse();
assertThat(picoContainer.getLifecycleState().isDisposed()).isTrue();
}
use of org.picocontainer.MutablePicoContainer in project intellij-community by JetBrains.
the class VcsIntegrationEnablerTest method setUp.
public void setUp() throws Exception {
super.setUp();
MutablePicoContainer picoContainer = (MutablePicoContainer) myProject.getPicoContainer();
String vcsNotifierKey = VcsNotifier.class.getName();
picoContainer.unregisterComponent(vcsNotifierKey);
picoContainer.registerComponentImplementation(vcsNotifierKey, TestVcsNotifier.class);
myTestRoot = myProjectRoot.getParent();
}
use of org.picocontainer.MutablePicoContainer in project intellij-community by JetBrains.
the class ReformatFilesWithFiltersTest method registerCodeStyleManager.
private static void registerCodeStyleManager(@NotNull CodeStyleManager manager) {
String componentKey = CodeStyleManager.class.getName();
MutablePicoContainer container = (MutablePicoContainer) getProject().getPicoContainer();
container.unregisterComponent(componentKey);
container.registerComponentInstance(componentKey, manager);
}
use of org.picocontainer.MutablePicoContainer in project intellij-community by JetBrains.
the class ReformatOnlyVcsChangedTextTest method registerVcsContextFactory.
private static void registerVcsContextFactory(@NotNull VcsContextFactory factory) {
String key = VcsContextFactory.class.getName();
MutablePicoContainer container = (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer();
container.unregisterComponent(key);
container.registerComponentInstance(key, factory);
}
use of org.picocontainer.MutablePicoContainer in project intellij-plugins by JetBrains.
the class JabberIdeaUITest method testInitialize.
public void testInitialize() throws Exception {
myLog = new StringBuffer();
JabberIdeaUI jabberIdeaUI = new JabberIdeaUI(null, null);
MutablePicoContainer projectLevelContainer = Pico.getInstance().makeChildContainer();
// register StatusToolbar
projectLevelContainer.registerComponentInstance(this);
jabberIdeaUI.initPerProject(projectLevelContainer);
assertEquals("Should register the command", JabberConnectionCommand.class.getName(), myLog.toString());
}
Aggregations