Search in sources :

Example 21 with SyncMessage

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.

the class LayoutRenderingIssueValidationStrategyTest method testFixAndReportFoundIssues.

// See https://code.google.com/p/android/issues/detail?id=170841
public void testFixAndReportFoundIssues() {
    SyncMessagesStub syncMessages = SyncMessagesStub.replaceSyncMessagesService(getProject());
    myStrategy.setModelVersion(GradleVersion.parse("1.2.0"));
    myStrategy.fixAndReportFoundIssues();
    SyncMessage message = syncMessages.getFirstReportedMessage();
    assertNotNull(message);
    String[] text = message.getText();
    assertThat(text).isNotEmpty();
    assertThat(text[0]).startsWith("Using an obsolete version of the Gradle plugin (1.2.0)");
}
Also used : SyncMessage(com.android.tools.idea.gradle.project.sync.messages.SyncMessage) SyncMessagesStub(com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub)

Example 22 with SyncMessage

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.

the class LayoutRenderingIssueValidationStrategyTest method testFixAndReportFoundIssuesWithNoIssues.

public void testFixAndReportFoundIssuesWithNoIssues() {
    SyncMessagesStub syncMessages = SyncMessagesStub.replaceSyncMessagesService(getProject());
    myStrategy.setModelVersion(null);
    myStrategy.fixAndReportFoundIssues();
    SyncMessage message = syncMessages.getFirstReportedMessage();
    assertNull(message);
}
Also used : SyncMessage(com.android.tools.idea.gradle.project.sync.messages.SyncMessage) SyncMessagesStub(com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub)

Example 23 with SyncMessage

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.

the class BuildTools23Rc1ValidationStrategyTest method testFixAndReportFoundIssues.

public void testFixAndReportFoundIssues() {
    Project project = getProject();
    SyncMessagesStub syncMessages = SyncMessagesStub.replaceSyncMessagesService(project);
    myStrategy.getModules().add("app");
    myStrategy.fixAndReportFoundIssues();
    SyncMessage message = syncMessages.getFirstReportedMessage();
    assertNotNull(message);
    String[] text = message.getText();
    assertThat(text).isNotEmpty();
    assertThat(text[0]).startsWith("Build Tools 23.0.0 rc1 is <b>deprecated</b>");
}
Also used : SyncMessage(com.android.tools.idea.gradle.project.sync.messages.SyncMessage) AndroidProject(com.android.builder.model.AndroidProject) Project(com.intellij.openapi.project.Project) SyncMessagesStub(com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub)

Example 24 with SyncMessage

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.

the class BuildTools23Rc1ValidationStrategyTest method testFixAndReportFoundIssuesWithNoIssues.

public void testFixAndReportFoundIssuesWithNoIssues() {
    Project project = getProject();
    SyncMessagesStub syncMessages = SyncMessagesStub.replaceSyncMessagesService(project);
    myStrategy.getModules().clear();
    myStrategy.fixAndReportFoundIssues();
    SyncMessage message = syncMessages.getFirstReportedMessage();
    assertNull(message);
}
Also used : SyncMessage(com.android.tools.idea.gradle.project.sync.messages.SyncMessage) AndroidProject(com.android.builder.model.AndroidProject) Project(com.intellij.openapi.project.Project) SyncMessagesStub(com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub)

Example 25 with SyncMessage

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage in project android by JetBrains.

the class UniquePathModuleValidatorStrategyTest method testFixAndReportFoundIssuesWithUniquePaths.

public void testFixAndReportFoundIssuesWithUniquePaths() throws Exception {
    Project project = getProject();
    SyncMessagesStub syncMessages = SyncMessagesStub.replaceSyncMessagesService(project);
    ProjectSubset projectSubset = IdeComponents.replaceServiceWithMock(project, ProjectSubset.class);
    when(projectSubset.isFeatureEnabled()).thenReturn(false);
    Multimap<String, Module> modulesByPath = myStrategy.getModulesByPath();
    modulesByPath.putAll("path1", Lists.newArrayList(myModule1));
    modulesByPath.putAll("path2", Lists.newArrayList(myModule2));
    myStrategy.fixAndReportFoundIssues();
    SyncMessage message = syncMessages.getFirstReportedMessage();
    assertNull(message);
}
Also used : SyncMessage(com.android.tools.idea.gradle.project.sync.messages.SyncMessage) Project(com.intellij.openapi.project.Project) SyncMessagesStub(com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub) ProjectSubset(com.android.tools.idea.gradle.project.subset.ProjectSubset) Module(com.intellij.openapi.module.Module)

Aggregations

SyncMessage (com.android.tools.idea.gradle.project.sync.messages.SyncMessage)55 Module (com.intellij.openapi.module.Module)18 Project (com.intellij.openapi.project.Project)14 SyncMessagesStub (com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub)12 NotificationHyperlink (com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)11 PositionInFile (com.android.tools.idea.gradle.util.PositionInFile)9 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 AndroidProject (com.android.builder.model.AndroidProject)5 MessageType (com.android.tools.idea.gradle.project.sync.messages.MessageType)5 SyncMessages (com.android.tools.idea.gradle.project.sync.messages.SyncMessages)5 Sdk (com.intellij.openapi.projectRoots.Sdk)5 GradleVersion (com.android.ide.common.repository.GradleVersion)3 ProjectSubset (com.android.tools.idea.gradle.project.subset.ProjectSubset)3 ComponentVersionReader (com.android.tools.idea.gradle.project.sync.compatibility.version.ComponentVersionReader)3 ArrayList (java.util.ArrayList)3 NotNull (org.jetbrains.annotations.NotNull)3 Message (com.android.ide.common.blame.Message)2 AndroidVersion (com.android.sdklib.AndroidVersion)2 AndroidPluginVersionUpdater (com.android.tools.idea.gradle.plugin.AndroidPluginVersionUpdater)2 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)2