Search in sources :

Example 1 with ProjectViewManager

use of com.google.idea.blaze.base.projectview.ProjectViewManager in project intellij by bazelbuild.

the class BlazeBuildServiceTest method initTest.

@Override
protected void initTest(Container applicationServices, Container projectServices) {
    BlazeImportSettingsManager importSettingsManager = new BlazeImportSettingsManager();
    importSettingsManager.setImportSettings(new BlazeImportSettings("", "", "", "", Blaze.BuildSystem.Blaze));
    projectServices.register(BlazeImportSettingsManager.class, importSettingsManager);
    applicationServices.register(ExperimentService.class, new MockExperimentService());
    ProjectView view = ProjectView.builder().add(ListSection.builder(TargetSection.KEY).add(TargetExpression.fromStringSafe("//view/target:one")).add(TargetExpression.fromStringSafe("//view/target:two"))).build();
    viewSet = ProjectViewSet.builder().add(new File("view/target/.blazeproject"), view).build();
    ProjectViewManager viewManager = new MockProjectViewManager(viewSet);
    projectServices.register(ProjectViewManager.class, viewManager);
    BlazeProjectData blazeProjectData = MockBlazeProjectDataBuilder.builder(workspaceRoot).build();
    projectServices.register(BlazeProjectDataManager.class, new MockBlazeProjectDataManager(blazeProjectData));
    applicationServices.register(BlazeBuildService.class, spy(new BlazeBuildService()));
    service = BlazeBuildService.getInstance();
    assertThat(service).isNotNull();
    // Can't mock BlazeExecutor.submitTask.
    doNothing().when(service).buildTargetExpressions(any(), any(), any(), any());
}
Also used : BlazeImportSettingsManager(com.google.idea.blaze.base.settings.BlazeImportSettingsManager) MockExperimentService(com.google.idea.common.experiments.MockExperimentService) BlazeImportSettings(com.google.idea.blaze.base.settings.BlazeImportSettings) BlazeProjectData(com.google.idea.blaze.base.model.BlazeProjectData) ProjectView(com.google.idea.blaze.base.projectview.ProjectView) File(java.io.File) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) ProjectViewManager(com.google.idea.blaze.base.projectview.ProjectViewManager)

Example 2 with ProjectViewManager

use of com.google.idea.blaze.base.projectview.ProjectViewManager in project intellij by bazelbuild.

the class BlazeIssueParserTest method initTest.

@Override
protected void initTest(Container applicationServices, Container projectServices) {
    super.initTest(applicationServices, projectServices);
    applicationServices.register(ExperimentService.class, new MockExperimentService());
    projectViewManager = mock(ProjectViewManager.class);
    projectServices.register(ProjectViewManager.class, projectViewManager);
    ProjectViewSet projectViewSet = ProjectViewSet.builder().add(new File(".blazeproject"), ProjectView.builder().add(ListSection.builder(TargetSection.KEY).add(TargetExpression.fromStringSafe("//tests/com/google/a/b/c/d/baz:baz")).add(TargetExpression.fromStringSafe("//package/path:hello4"))).build()).build();
    when(projectViewManager.getProjectViewSet()).thenReturn(projectViewSet);
    workspaceRoot = new WorkspaceRoot(new File("/root"));
    parsers = ImmutableList.of(new BlazeIssueParser.CompileParser(workspaceRoot), new BlazeIssueParser.TracebackParser(), new BlazeIssueParser.BuildParser(), new BlazeIssueParser.SkylarkErrorParser(), new BlazeIssueParser.LinelessBuildParser(), new BlazeIssueParser.ProjectViewLabelParser(projectViewSet), new BlazeIssueParser.InvalidTargetProjectViewPackageParser(projectViewSet, "no such package '(.*)': BUILD file not found on package path"), new BlazeIssueParser.InvalidTargetProjectViewPackageParser(projectViewSet, "no targets found beneath '(.*)'"), new BlazeIssueParser.InvalidTargetProjectViewPackageParser(projectViewSet, "ERROR: invalid target format '(.*)'"), new BlazeIssueParser.FileNotFoundBuildParser(workspaceRoot), BlazeIssueParser.GenericErrorParser.INSTANCE);
}
Also used : MockExperimentService(com.google.idea.common.experiments.MockExperimentService) ProjectViewSet(com.google.idea.blaze.base.projectview.ProjectViewSet) WorkspaceRoot(com.google.idea.blaze.base.model.primitives.WorkspaceRoot) ProjectViewManager(com.google.idea.blaze.base.projectview.ProjectViewManager) File(java.io.File)

Aggregations

ProjectViewManager (com.google.idea.blaze.base.projectview.ProjectViewManager)2 MockExperimentService (com.google.idea.common.experiments.MockExperimentService)2 File (java.io.File)2 BlazeProjectData (com.google.idea.blaze.base.model.BlazeProjectData)1 MockBlazeProjectDataManager (com.google.idea.blaze.base.model.MockBlazeProjectDataManager)1 WorkspaceRoot (com.google.idea.blaze.base.model.primitives.WorkspaceRoot)1 ProjectView (com.google.idea.blaze.base.projectview.ProjectView)1 ProjectViewSet (com.google.idea.blaze.base.projectview.ProjectViewSet)1 BlazeImportSettings (com.google.idea.blaze.base.settings.BlazeImportSettings)1 BlazeImportSettingsManager (com.google.idea.blaze.base.settings.BlazeImportSettingsManager)1