Search in sources :

Example 1 with BlazeProjectDataManager

use of com.google.idea.blaze.base.sync.data.BlazeProjectDataManager in project intellij by bazelbuild.

the class BlazeCommandRunConfigurationRunManagerImplTest method doSetup.

@Before
public final void doSetup() {
    runManager = RunManagerImpl.getInstanceImpl(getProject());
    // Without BlazeProjectData, the configuration editor is always disabled.
    BlazeProjectDataManager mockProjectDataManager = new MockBlazeProjectDataManager(MockBlazeProjectDataBuilder.builder(workspaceRoot).build());
    registerProjectService(BlazeProjectDataManager.class, mockProjectDataManager);
    type = BlazeCommandRunConfigurationType.getInstance();
    RunnerAndConfigurationSettings runnerAndConfigurationSettings = runManager.createConfiguration("Blaze Configuration", type.getFactory());
    runManager.addConfiguration(runnerAndConfigurationSettings, false);
    configuration = (BlazeCommandRunConfiguration) runnerAndConfigurationSettings.getConfiguration();
}
Also used : MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) BlazeProjectDataManager(com.google.idea.blaze.base.sync.data.BlazeProjectDataManager) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) Before(org.junit.Before)

Example 2 with BlazeProjectDataManager

use of com.google.idea.blaze.base.sync.data.BlazeProjectDataManager in project intellij by bazelbuild.

the class BlazeCommandRunConfigurationSettingsEditorTest method doSetup.

@Before
public final void doSetup() throws Exception {
    // Without BlazeProjectData, the configuration editor is always disabled.
    BlazeProjectDataManager mockProjectDataManager = new MockBlazeProjectDataManager(MockBlazeProjectDataBuilder.builder(workspaceRoot).build());
    registerProjectService(BlazeProjectDataManager.class, mockProjectDataManager);
    type = BlazeCommandRunConfigurationType.getInstance();
    configuration = type.getFactory().createTemplateConfiguration(getProject());
}
Also used : MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) BlazeProjectDataManager(com.google.idea.blaze.base.sync.data.BlazeProjectDataManager) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) Before(org.junit.Before)

Example 3 with BlazeProjectDataManager

use of com.google.idea.blaze.base.sync.data.BlazeProjectDataManager in project intellij by bazelbuild.

the class RunConfigurationSerializerTest method doSetup.

@Before
public final void doSetup() {
    runManager = RunManagerImpl.getInstanceImpl(getProject());
    // Without BlazeProjectData, the configuration editor is always disabled.
    BlazeProjectDataManager mockProjectDataManager = new MockBlazeProjectDataManager(MockBlazeProjectDataBuilder.builder(workspaceRoot).build());
    registerProjectService(BlazeProjectDataManager.class, mockProjectDataManager);
    RunnerAndConfigurationSettings runnerAndConfigurationSettings = runManager.createConfiguration("Blaze Configuration", BlazeCommandRunConfigurationType.getInstance().getFactory());
    runManager.addConfiguration(runnerAndConfigurationSettings, false);
    configuration = (BlazeCommandRunConfiguration) runnerAndConfigurationSettings.getConfiguration();
}
Also used : MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) BlazeProjectDataManager(com.google.idea.blaze.base.sync.data.BlazeProjectDataManager) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) Before(org.junit.Before)

Example 4 with BlazeProjectDataManager

use of com.google.idea.blaze.base.sync.data.BlazeProjectDataManager in project intellij by bazelbuild.

the class FastBuildCompilerFactoryImplTest method configureTestForTargetMap.

private void configureTestForTargetMap(Map<TargetKey, TargetIdeInfo> targetMap) {
    BlazeProjectData projectData = new BlazeProjectData(0, new TargetMap(ImmutableMap.copyOf(targetMap)), null, null, null, artifact -> new File(artifact.relativePath), null, null, null);
    BlazeProjectDataManager projectDataManager = new MockBlazeProjectDataManager(projectData);
    compilerFactory = new FastBuildCompilerFactoryImpl(projectDataManager);
}
Also used : MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) BlazeProjectDataManager(com.google.idea.blaze.base.sync.data.BlazeProjectDataManager) BlazeProjectData(com.google.idea.blaze.base.model.BlazeProjectData) File(java.io.File) TargetMap(com.google.idea.blaze.base.ideinfo.TargetMap) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager)

Example 5 with BlazeProjectDataManager

use of com.google.idea.blaze.base.sync.data.BlazeProjectDataManager in project intellij by bazelbuild.

the class BlazeRunConfigurationProducerTestCase method doSetup.

@Before
public final void doSetup() {
    BlazeProjectDataManager mockProjectDataManager = new MockBlazeProjectDataManager(MockBlazeProjectDataBuilder.builder(workspaceRoot).build());
    registerProjectService(BlazeProjectDataManager.class, mockProjectDataManager);
    editorTest = new EditorTestHelper(getProject(), testFixture);
    // IntelliJ replaces the normal DataManager with a mock version in headless environments.
    // We rely on a functional DataManager in run configuration tests to recognize when multiple
    // psi elements are selected.
    DataManager dataManager = new MyDataManagerImpl() {

        DataContext dataContext;

        @Override
        public <T> void saveInDataContext(DataContext dataContext, Key<T> dataKey, @Nullable T data) {
            this.dataContext = dataContext;
            super.saveInDataContext(dataContext, dataKey, data);
        }

        @Override
        public DataContext getDataContext() {
            return dataContext != null ? dataContext : super.getDataContext();
        }
    };
    registerApplicationComponent(DataManager.class, dataManager);
}
Also used : EditorTestHelper(com.google.idea.blaze.base.EditorTestHelper) MyDataManagerImpl(com.intellij.idea.CommandLineApplication.MyDataManagerImpl) DataContext(com.intellij.openapi.actionSystem.DataContext) MapDataContext(com.intellij.testFramework.MapDataContext) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) BlazeProjectDataManager(com.google.idea.blaze.base.sync.data.BlazeProjectDataManager) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) DataManager(com.intellij.ide.DataManager) BlazeProjectDataManager(com.google.idea.blaze.base.sync.data.BlazeProjectDataManager) MockBlazeProjectDataManager(com.google.idea.blaze.base.model.MockBlazeProjectDataManager) Key(com.intellij.openapi.util.Key) Nullable(javax.annotation.Nullable) Before(org.junit.Before)

Aggregations

MockBlazeProjectDataManager (com.google.idea.blaze.base.model.MockBlazeProjectDataManager)12 BlazeProjectDataManager (com.google.idea.blaze.base.sync.data.BlazeProjectDataManager)12 Before (org.junit.Before)11 EditorTestHelper (com.google.idea.blaze.base.EditorTestHelper)4 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)2 TargetMap (com.google.idea.blaze.base.ideinfo.TargetMap)1 BlazeProjectData (com.google.idea.blaze.base.model.BlazeProjectData)1 MockBlazeProjectDataBuilder (com.google.idea.blaze.base.model.MockBlazeProjectDataBuilder)1 WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)1 BlazeCommandRunConfigurationHandlerProvider (com.google.idea.blaze.base.run.confighandler.BlazeCommandRunConfigurationHandlerProvider)1 DataManager (com.intellij.ide.DataManager)1 MyDataManagerImpl (com.intellij.idea.CommandLineApplication.MyDataManagerImpl)1 DataContext (com.intellij.openapi.actionSystem.DataContext)1 ContentEntry (com.intellij.openapi.roots.ContentEntry)1 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)1 Key (com.intellij.openapi.util.Key)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 MapDataContext (com.intellij.testFramework.MapDataContext)1 File (java.io.File)1 Nullable (javax.annotation.Nullable)1