Search in sources :

Example 26 with CloudLibrary

use of com.google.cloud.tools.libraries.json.CloudLibrary in project google-cloud-intellij by GoogleCloudPlatform.

the class GoogleCloudApiSelectorPanelTest method getSelectedLibraries_withOneSelected_returnsLibrary.

@Test
public void getSelectedLibraries_withOneSelected_returnsLibrary() {
    CloudLibrary library1 = LIBRARY_1.toCloudLibrary();
    CloudLibrary library2 = LIBRARY_2.toCloudLibrary();
    GoogleCloudApiSelectorPanel panel = new GoogleCloudApiSelectorPanel(ImmutableList.of(library1, library2), testFixture.getProject());
    JTable table = panel.getCloudLibrariesTable();
    checkAddLibraryCheckbox(table, 0);
    assertThat(panel.getSelectedLibraries()).containsExactly(library1);
}
Also used : JTable(javax.swing.JTable) TestCloudLibrary(com.google.cloud.tools.intellij.testing.apis.TestCloudLibrary) CloudLibrary(com.google.cloud.tools.libraries.json.CloudLibrary) Test(org.junit.Test)

Example 27 with CloudLibrary

use of com.google.cloud.tools.libraries.json.CloudLibrary in project google-cloud-intellij by GoogleCloudPlatform.

the class GoogleCloudApiSelectorPanelTest method getManagementUI_withLibraryAndProjectUnselected_isDisabled.

@Test
public void getManagementUI_withLibraryAndProjectUnselected_isDisabled() {
    CloudLibrary library = LIBRARY_1.toCloudLibrary();
    GoogleCloudApiSelectorPanel panel = new GoogleCloudApiSelectorPanel(ImmutableList.of(library), testFixture.getProject());
    panel.getDetailsPanel().setCloudLibrary(library, BOM_VERSION, panel.getApiManagementMap().get(library));
    assertThat(panel.getDetailsPanel().getEnableApiCheckbox().isEnabled()).isFalse();
    assertThat(panel.getDetailsPanel().getManagementInfoPanel().isVisible()).isTrue();
}
Also used : TestCloudLibrary(com.google.cloud.tools.intellij.testing.apis.TestCloudLibrary) CloudLibrary(com.google.cloud.tools.libraries.json.CloudLibrary) Test(org.junit.Test)

Example 28 with CloudLibrary

use of com.google.cloud.tools.libraries.json.CloudLibrary in project google-cloud-intellij by GoogleCloudPlatform.

the class GoogleCloudApiSelectorPanelTest method getPanel_withOneLibrary_focusedLibrary_hasUncheckedCheckboxAndPopulatedDetails.

@Test
public void getPanel_withOneLibrary_focusedLibrary_hasUncheckedCheckboxAndPopulatedDetails() {
    CloudLibrary library = LIBRARY_1.toCloudLibrary();
    GoogleCloudApiSelectorPanel panel = new GoogleCloudApiSelectorPanel(ImmutableList.of(library), testFixture.getProject());
    JTable table = panel.getCloudLibrariesTable();
    table.setRowSelectionInterval(0, 0);
    assertThat(table.getSelectionModel().isSelectedIndex(0)).isTrue();
    TableModel model = table.getModel();
    assertThat(model.getRowCount()).isEqualTo(1);
    assertThat(model.getValueAt(0, 0)).isEqualTo(library);
    assertThat((Boolean) model.getValueAt(0, 1)).isFalse();
    assertDetailsShownForLibrary(panel.getDetailsPanel(), LIBRARY_1, JAVA_CLIENT_1);
}
Also used : JTable(javax.swing.JTable) TestCloudLibrary(com.google.cloud.tools.intellij.testing.apis.TestCloudLibrary) CloudLibrary(com.google.cloud.tools.libraries.json.CloudLibrary) TableModel(javax.swing.table.TableModel) Test(org.junit.Test)

Example 29 with CloudLibrary

use of com.google.cloud.tools.libraries.json.CloudLibrary in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudApiManagementConfirmationDialogTest method serviceAccountUi_whenSomeRolesExist_isVisible.

@Test
public void serviceAccountUi_whenSomeRolesExist_isVisible() {
    Set<CloudLibrary> libraries = ImmutableSet.of(TestCloudLibrary.createEmpty().toCloudLibrary());
    Role role = new Role();
    role.setName("name");
    role.setTitle("title");
    Set<Role> roles = ImmutableSet.of(role);
    ApplicationManager.getApplication().invokeAndWait(() -> {
        CloudApiManagementConfirmationDialog dialog = new CloudApiManagementConfirmationDialog(module, cloudProject, libraries, ImmutableSet.of(), roles);
        assertThat(dialog.getRolePanel().isVisible()).isTrue();
    });
}
Also used : Role(com.google.api.services.iam.v1.model.Role) CloudLibrary(com.google.cloud.tools.libraries.json.CloudLibrary) TestCloudLibrary(com.google.cloud.tools.intellij.testing.apis.TestCloudLibrary) Test(org.junit.Test)

Aggregations

CloudLibrary (com.google.cloud.tools.libraries.json.CloudLibrary)29 TestCloudLibrary (com.google.cloud.tools.intellij.testing.apis.TestCloudLibrary)25 Test (org.junit.Test)24 JTable (javax.swing.JTable)13 TableModel (javax.swing.table.TableModel)7 Role (com.google.api.services.iam.v1.model.Role)3 Module (com.intellij.openapi.module.Module)3 MavenId (org.jetbrains.idea.maven.model.MavenId)3 CloudProject (com.google.cloud.tools.intellij.project.CloudProject)2 TestCloudLibraryClientMavenCoordinates (com.google.cloud.tools.intellij.testing.apis.TestCloudLibrary.TestCloudLibraryClientMavenCoordinates)2 GoogleCloudCoreIcons (com.google.cloud.tools.intellij.GoogleCloudCoreIcons)1 GctTracking (com.google.cloud.tools.intellij.analytics.GctTracking)1 UsageTrackerProvider (com.google.cloud.tools.intellij.analytics.UsageTrackerProvider)1 PropertiesFileFlagReader (com.google.cloud.tools.intellij.flags.PropertiesFileFlagReader)1 CredentialedUser (com.google.cloud.tools.intellij.login.CredentialedUser)1 ProjectSelector (com.google.cloud.tools.intellij.project.ProjectSelector)1 GctBundle (com.google.cloud.tools.intellij.util.GctBundle)1 Notification (com.intellij.notification.Notification)1 NotificationDisplayType (com.intellij.notification.NotificationDisplayType)1 NotificationGroup (com.intellij.notification.NotificationGroup)1