use of org.jetbrains.plugins.gradle.settings.GradleSettings in project android by JetBrains.
the class GradleSyncTest method syncDuringOfflineMode.
@Test
public void syncDuringOfflineMode() throws IOException {
String hyperlinkText = "Disable offline mode and sync project";
guiTest.importSimpleApplication();
IdeFrameFixture ideFrame = guiTest.ideFrame();
File buildFile = new File(ideFrame.getProjectPath(), join("app", FN_BUILD_GRADLE));
assertAbout(file()).that(buildFile).isFile();
appendToFile(buildFile, "dependencies { compile 'something:not:exists' }");
GradleSettings gradleSettings = GradleSettings.getInstance(ideFrame.getProject());
gradleSettings.setOfflineWork(true);
ideFrame.requestProjectSync().waitForGradleProjectSyncToFinish();
MessagesToolWindowFixture messagesToolWindow = ideFrame.getMessagesToolWindow();
MessageFixture message = messagesToolWindow.getGradleSyncContent().findMessage(ERROR, firstLineStartingWith("Failed to resolve:"));
HyperlinkFixture hyperlink = message.findHyperlink(hyperlinkText);
hyperlink.click();
assertFalse(gradleSettings.isOfflineWork());
ideFrame.waitForGradleProjectSyncToFinish();
messagesToolWindow = ideFrame.getMessagesToolWindow();
message = messagesToolWindow.getGradleSyncContent().findMessage(ERROR, firstLineStartingWith("Failed to resolve:"));
try {
message.findHyperlink(hyperlinkText);
fail(hyperlinkText + " link still present");
} catch (AssertionError e) {
// After offline mode is disable, the previous hyperlink will disappear after next sync
assertThat(e.getMessage()).contains("Failed to find URL");
assertThat(e.getMessage()).contains(hyperlinkText);
}
}
use of org.jetbrains.plugins.gradle.settings.GradleSettings in project android by JetBrains.
the class IdeFrameFixture method setGradleJvmArgs.
@NotNull
public IdeFrameFixture setGradleJvmArgs(@NotNull String jvmArgs) {
Project project = getProject();
GradleSettings settings = GradleSettings.getInstance(project);
settings.setGradleVmOptions(jvmArgs);
Wait.seconds(1).expecting("Gradle settings to be set").until(() -> jvmArgs.equals(settings.getGradleVmOptions()));
return this;
}
Aggregations