Search in sources :

Example 1 with MutablePicoContainer

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();
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer) DatabaseProperties(org.sonar.api.database.DatabaseProperties) Properties(java.util.Properties) CoreProperties(org.sonar.api.CoreProperties) ProcessProperties(org.sonar.process.ProcessProperties) Props(org.sonar.process.Props) File(java.io.File) Date(java.util.Date) Test(org.junit.Test)

Example 2 with MutablePicoContainer

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();
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer)

Example 3 with MutablePicoContainer

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);
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer)

Example 4 with MutablePicoContainer

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);
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer)

Example 5 with MutablePicoContainer

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());
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer)

Aggregations

MutablePicoContainer (org.picocontainer.MutablePicoContainer)35 Test (org.junit.Test)6 MostUsefulConfiguration (org.jbehave.core.configuration.MostUsefulConfiguration)3 NotNull (org.jetbrains.annotations.NotNull)3 CloudSdkInternals (com.google.cloud.tools.intellij.appengine.sdk.CloudSdkInternals)2 CloudSdkService (com.google.cloud.tools.intellij.appengine.sdk.CloudSdkService)2 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)2 TemplateDataLanguageMappings (com.intellij.psi.templateLanguages.TemplateDataLanguageMappings)2 TemplateDataLanguagePatterns (com.intellij.psi.templateLanguages.TemplateDataLanguagePatterns)2 CandidateSteps (org.jbehave.core.steps.CandidateSteps)2 Before (org.junit.Before)2 DefaultPicoContainer (org.picocontainer.defaults.DefaultPicoContainer)2 PropertiesComponentStub (com.dmarcotte.handlebars.config.PropertiesComponentStub)1 AppEngineStandardMavenLibrary (com.google.cloud.tools.intellij.appengine.facet.standard.AppEngineStandardMavenLibrary)1 AppEngineSupportConfigurable (com.google.cloud.tools.intellij.appengine.facet.standard.AppEngineStandardSupportProvider.AppEngineSupportConfigurable)1 MavenRepositoryLibraryDownloader (com.google.cloud.tools.intellij.appengine.facet.standard.MavenRepositoryLibraryDownloader)1 AppEngineAssetProvider (com.google.cloud.tools.intellij.appengine.project.AppEngineAssetProvider)1 CloudSdkServiceManager (com.google.cloud.tools.intellij.appengine.sdk.CloudSdkServiceManager)1 WorkspacePathResolverProvider (com.google.idea.blaze.base.sync.workspace.WorkspacePathResolverProvider)1 CoreASTFactory (com.intellij.core.CoreASTFactory)1