Search in sources :

Example 16 with MockExperimentService

use of com.google.idea.common.experiments.MockExperimentService in project intellij by bazelbuild.

the class BlazeGoGotoDeclarationHandlerTest method init.

@Before
public void init() {
    MockExperimentService experimentService = new MockExperimentService();
    experimentService.setExperiment(BlazeGoSupport.blazeGoSupportEnabled, true);
    registerApplicationComponent(ExperimentService.class, experimentService);
    registerApplicationService(FileOperationProvider.class, new MockFileOperationProvider());
}
Also used : MockExperimentService(com.google.idea.common.experiments.MockExperimentService) Before(org.junit.Before)

Example 17 with MockExperimentService

use of com.google.idea.common.experiments.MockExperimentService in project intellij by bazelbuild.

the class BlazeJavaWorkspaceImporterTest method initTest.

@Override
// False positive on getDeclaredPackageOfJavaFile.
@SuppressWarnings("FunctionalInterfaceClash")
protected void initTest(Container applicationServices, Container projectServices) {
    applicationServices.register(ExperimentService.class, new MockExperimentService());
    BlazeExecutor blazeExecutor = new MockBlazeExecutor();
    applicationServices.register(BlazeExecutor.class, blazeExecutor);
    projectServices.register(BlazeImportSettingsManager.class, new BlazeImportSettingsManager());
    BlazeImportSettingsManager.getInstance(getProject()).setImportSettings(DUMMY_IMPORT_SETTINGS);
    // will silently fall back to FilePathJavaPackageReader
    applicationServices.register(JavaSourcePackageReader.class, new JavaSourcePackageReader() {

        @Nullable
        @Override
        public String getDeclaredPackageOfJavaFile(BlazeContext context, ArtifactLocationDecoder artifactLocationDecoder, SourceArtifact sourceArtifact) {
            return null;
        }
    });
    applicationServices.register(PackageManifestReader.class, new PackageManifestReader());
    applicationServices.register(PrefetchService.class, new MockPrefetchService());
    context = new BlazeContext();
    context.addOutputSink(IssueOutput.class, errorCollector);
    augmenters = registerExtensionPoint(BlazeJavaSyncAugmenter.EP_NAME, BlazeJavaSyncAugmenter.class);
    registerExtensionPoint(JavaLikeLanguage.EP_NAME, JavaLikeLanguage.class).registerExtension(new JavaLikeLanguage.Java());
}
Also used : MockExperimentService(com.google.idea.common.experiments.MockExperimentService) BlazeImportSettingsManager(com.google.idea.blaze.base.settings.BlazeImportSettingsManager) JavaLikeLanguage(com.google.idea.blaze.java.sync.source.JavaLikeLanguage) PackageManifestReader(com.google.idea.blaze.java.sync.source.PackageManifestReader) MockBlazeExecutor(com.google.idea.blaze.base.async.executor.MockBlazeExecutor) SourceArtifact(com.google.idea.blaze.java.sync.source.SourceArtifact) BlazeContext(com.google.idea.blaze.base.scope.BlazeContext) MockPrefetchService(com.google.idea.blaze.base.prefetch.MockPrefetchService) BlazeJavaSyncAugmenter(com.google.idea.blaze.java.sync.BlazeJavaSyncAugmenter) MockBlazeExecutor(com.google.idea.blaze.base.async.executor.MockBlazeExecutor) BlazeExecutor(com.google.idea.blaze.base.async.executor.BlazeExecutor) ArtifactLocationDecoder(com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder) JavaSourcePackageReader(com.google.idea.blaze.java.sync.source.JavaSourcePackageReader) Nullable(javax.annotation.Nullable)

Example 18 with MockExperimentService

use of com.google.idea.common.experiments.MockExperimentService in project intellij by bazelbuild.

the class SourceDirectoryCalculatorTest method initTest.

@Override
protected void initTest(Container applicationServices, Container projectServices) {
    super.initTest(applicationServices, projectServices);
    mockInputStreamProvider = new MockInputStreamProvider();
    applicationServices.register(InputStreamProvider.class, mockInputStreamProvider);
    applicationServices.register(JavaSourcePackageReader.class, new JavaSourcePackageReader());
    applicationServices.register(PackageManifestReader.class, new PackageManifestReader());
    applicationServices.register(FileOperationProvider.class, new MockFileOperationProvider());
    context.addOutputSink(IssueOutput.class, issues);
    sourceDirectoryCalculator = new SourceDirectoryCalculator();
    BlazeExecutor blazeExecutor = new MockBlazeExecutor();
    applicationServices.register(BlazeExecutor.class, blazeExecutor);
    experimentService = new MockExperimentService();
    applicationServices.register(ExperimentService.class, experimentService);
    applicationServices.register(PrefetchService.class, new MockPrefetchService());
    registerExtensionPoint(JavaLikeLanguage.EP_NAME, JavaLikeLanguage.class).registerExtension(new JavaLikeLanguage.Java());
}
Also used : MockExperimentService(com.google.idea.common.experiments.MockExperimentService) MockPrefetchService(com.google.idea.blaze.base.prefetch.MockPrefetchService) MockInputStreamProvider(com.google.idea.blaze.base.io.MockInputStreamProvider) MockBlazeExecutor(com.google.idea.blaze.base.async.executor.MockBlazeExecutor) BlazeExecutor(com.google.idea.blaze.base.async.executor.BlazeExecutor) MockBlazeExecutor(com.google.idea.blaze.base.async.executor.MockBlazeExecutor)

Example 19 with MockExperimentService

use of com.google.idea.common.experiments.MockExperimentService in project intellij by bazelbuild.

the class TargetExpressionTest method initTest.

@Override
protected void initTest(Container applicationServices, Container projectServices) {
    super.initTest(applicationServices, projectServices);
    experimentService = new MockExperimentService();
    applicationServices.register(ExperimentService.class, experimentService);
}
Also used : MockExperimentService(com.google.idea.common.experiments.MockExperimentService)

Example 20 with MockExperimentService

use of com.google.idea.common.experiments.MockExperimentService in project intellij by bazelbuild.

the class BlazeCommandRunConfigurationTest method initTest.

@Override
protected void initTest(Container applicationServices, Container projectServices) {
    super.initTest(applicationServices, projectServices);
    applicationServices.register(UISettings.class, new UISettings());
    projectServices.register(BlazeImportSettingsManager.class, new BlazeImportSettingsManager());
    BlazeImportSettingsManager.getInstance(getProject()).setImportSettings(DUMMY_IMPORT_SETTINGS);
    applicationServices.register(ExperimentService.class, new MockExperimentService());
    ExtensionPointImpl<TargetFinder> targetFinderEp = registerExtensionPoint(TargetFinder.EP_NAME, TargetFinder.class);
    targetFinderEp.registerExtension(new MockTargetFinder());
    ExtensionPointImpl<BlazeCommandRunConfigurationHandlerProvider> handlerProviderEp = registerExtensionPoint(BlazeCommandRunConfigurationHandlerProvider.EP_NAME, BlazeCommandRunConfigurationHandlerProvider.class);
    handlerProviderEp.registerExtension(new MockBlazeCommandRunConfigurationHandlerProvider());
    this.configuration = this.type.getFactory().createTemplateConfiguration(project);
}
Also used : BlazeImportSettingsManager(com.google.idea.blaze.base.settings.BlazeImportSettingsManager) MockExperimentService(com.google.idea.common.experiments.MockExperimentService) TargetFinder(com.google.idea.blaze.base.run.targetfinder.TargetFinder) UISettings(com.intellij.ide.ui.UISettings) BlazeCommandRunConfigurationHandlerProvider(com.google.idea.blaze.base.run.confighandler.BlazeCommandRunConfigurationHandlerProvider)

Aggregations

MockExperimentService (com.google.idea.common.experiments.MockExperimentService)25 BlazeImportSettingsManager (com.google.idea.blaze.base.settings.BlazeImportSettingsManager)8 MockBlazeExecutor (com.google.idea.blaze.base.async.executor.MockBlazeExecutor)6 Before (org.junit.Before)5 BuildSystemProvider (com.google.idea.blaze.base.bazel.BuildSystemProvider)4 BlazeExecutor (com.google.idea.blaze.base.async.executor.BlazeExecutor)3 BazelBuildSystemProvider (com.google.idea.blaze.base.bazel.BazelBuildSystemProvider)3 MockPrefetchService (com.google.idea.blaze.base.prefetch.MockPrefetchService)3 BlazeContext (com.google.idea.blaze.base.scope.BlazeContext)3 BlazeImportSettings (com.google.idea.blaze.base.settings.BlazeImportSettings)3 BlazeUserSettings (com.google.idea.blaze.base.settings.BlazeUserSettings)3 JavaLikeLanguage (com.google.idea.blaze.java.sync.source.JavaLikeLanguage)3 ExperimentService (com.google.idea.common.experiments.ExperimentService)3 VirtualFileSystemProvider (com.google.idea.blaze.base.io.VirtualFileSystemProvider)2 ProjectViewManager (com.google.idea.blaze.base.projectview.ProjectViewManager)2 BlazeCommandRunConfigurationHandlerProvider (com.google.idea.blaze.base.run.confighandler.BlazeCommandRunConfigurationHandlerProvider)2 TargetFinder (com.google.idea.blaze.base.run.targetfinder.TargetFinder)2 ArtifactLocationDecoder (com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder)2 JavaSourcePackageReader (com.google.idea.blaze.java.sync.source.JavaSourcePackageReader)2 PackageManifestReader (com.google.idea.blaze.java.sync.source.PackageManifestReader)2