Search in sources :

Example 1 with TestCloudLibraryClientMavenCoordinates

use of com.google.cloud.tools.intellij.testing.apis.TestCloudLibrary.TestCloudLibraryClientMavenCoordinates in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudLibraryProjectStateTest method getCloudLibraries_withOnlyCloudDependencies_returnsValidCloudLibrary.

@Test
public void getCloudLibraries_withOnlyCloudDependencies_returnsValidCloudLibrary() {
    when(librariesService.getCloudLibraries()).thenReturn(ImmutableList.of(LIBRARY.toCloudLibrary()));
    ApplicationManager.getApplication().invokeAndWait(() -> {
        try {
            Module module = MavenTestUtils.getInstance().createNewMavenModule(moduleBuilder, testFixture.getProject());
            TestCloudLibraryClientMavenCoordinates mavenCoordinates = LIBRARY.clients().get(0).mavenCoordinates();
            String groupId = mavenCoordinates.groupId();
            String artifactId = mavenCoordinates.artifactId();
            MavenId managedDependency = new MavenId(groupId, artifactId, "1.0");
            writeDependenciesToPom(module, ImmutableList.of(managedDependency));
            state.syncManagedProjectLibraries();
            Set<CloudLibrary> libraries = state.getCloudLibraries(module);
            assertThat_cloudLibrariesContainsExactlyOne(libraries);
        } finally {
            MavenServerManager.getInstance().shutdown(true);
        }
    });
}
Also used : TestCloudLibraryClientMavenCoordinates(com.google.cloud.tools.intellij.testing.apis.TestCloudLibrary.TestCloudLibraryClientMavenCoordinates) MavenId(org.jetbrains.idea.maven.model.MavenId) TestCloudLibrary(com.google.cloud.tools.intellij.testing.apis.TestCloudLibrary) CloudLibrary(com.google.cloud.tools.libraries.json.CloudLibrary) Module(com.intellij.openapi.module.Module) Test(org.junit.Test)

Example 2 with TestCloudLibraryClientMavenCoordinates

use of com.google.cloud.tools.intellij.testing.apis.TestCloudLibrary.TestCloudLibraryClientMavenCoordinates in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudLibraryProjectStateTest method getCloudLibraries_withCloudAndNonCloudDependencies_returnsValidCloudLibrary.

@Test
public void getCloudLibraries_withCloudAndNonCloudDependencies_returnsValidCloudLibrary() {
    when(librariesService.getCloudLibraries()).thenReturn(ImmutableList.of(LIBRARY.toCloudLibrary()));
    ApplicationManager.getApplication().invokeAndWait(() -> {
        try {
            Module module = MavenTestUtils.getInstance().createNewMavenModule(moduleBuilder, testFixture.getProject());
            TestCloudLibraryClientMavenCoordinates mavenCoordinates = LIBRARY.clients().get(0).mavenCoordinates();
            String groupId = mavenCoordinates.groupId();
            String artifactId = mavenCoordinates.artifactId();
            MavenId cloudDependency = new MavenId(groupId, artifactId, "1.0");
            MavenId nonCloudDependency = new MavenId("my-group", "my-artifact", "1.0");
            writeDependenciesToPom(module, ImmutableList.of(cloudDependency, nonCloudDependency));
            state.syncManagedProjectLibraries();
            Set<CloudLibrary> libraries = state.getCloudLibraries(module);
            assertThat_cloudLibrariesContainsExactlyOne(libraries);
        } finally {
            MavenServerManager.getInstance().shutdown(true);
        }
    });
}
Also used : TestCloudLibraryClientMavenCoordinates(com.google.cloud.tools.intellij.testing.apis.TestCloudLibrary.TestCloudLibraryClientMavenCoordinates) MavenId(org.jetbrains.idea.maven.model.MavenId) TestCloudLibrary(com.google.cloud.tools.intellij.testing.apis.TestCloudLibrary) CloudLibrary(com.google.cloud.tools.libraries.json.CloudLibrary) Module(com.intellij.openapi.module.Module) Test(org.junit.Test)

Aggregations

TestCloudLibrary (com.google.cloud.tools.intellij.testing.apis.TestCloudLibrary)2 TestCloudLibraryClientMavenCoordinates (com.google.cloud.tools.intellij.testing.apis.TestCloudLibrary.TestCloudLibraryClientMavenCoordinates)2 CloudLibrary (com.google.cloud.tools.libraries.json.CloudLibrary)2 Module (com.intellij.openapi.module.Module)2 MavenId (org.jetbrains.idea.maven.model.MavenId)2 Test (org.junit.Test)2