private ConnectionBulletinBoard getBoardInitialize() { return ConnectionOverview.super.getBoard(); }
private Map<String, String> getConfiguredPropertiesInitialize() { return ConnectionOverview.super.getConfiguredProperties(); }
private Map<String, String> getMetadataInitialize() { return ConnectionOverview.super.getMetadata(); }
@Test @SuppressWarnings("unchecked") public void overviewListShouldAugmentWithConnectionUsageNoIntegrations() { ListResult<Connection> connectionResult = new ListResult.Builder<Connection>().addItem(c1, c2, c3).build(); when(dataManager.fetchAll(eq(Connection.class), any())).thenReturn(connectionResult); when(dataManager.fetchAll(Integration.class)).thenReturn(new ListResult.Builder<Integration>().build()); UriInfo uriInfo = mock(UriInfo.class); MultivaluedMap<String, String> params = mock(MultivaluedMap.class); when(uriInfo.getQueryParameters()).thenReturn(params); ListResult<ConnectionOverview> overviewResult = handler.list(uriInfo); assertNotNull(overviewResult); assertThat(overviewResult.getTotalCount()).isPositive(); List<ConnectionOverview> items = overviewResult.getItems(); for (int i = 0; i < items.size(); ++i) { ConnectionOverview overview = items.get(i); OptionalInt uses = overview.getUses(); assertThat(uses.isPresent()).isTrue(); assertThat(uses.getAsInt()).isZero(); } }
@Test public void connectionsUsedInDeletedIntegrationsShouldNotBeCountedAsUsed() { final Integration integration1 = testIntegration().withFlowConnections(c1).isDeleted(true).build(); final Integration integration2 = testIntegration().withFlowStepsUsingConnections(c1).isDeleted(true).build(); final Integration integration3 = testIntegration().addConnection(c1).isDeleted(true).build(); when(dataManager.fetchAll(Integration.class)).thenReturn(ListResult.of(integration1, integration2, integration3)); when(dataManager.fetch(Connection.class, "c1")).thenReturn(c1); final ConnectionOverview overview = handler.get("c1"); assertThat(overview).isNotNull(); assertThat(overview.getUses()).isPresent(); assertThat(overview.getUses()).hasValue(0); }
@Test public void overviewGetShouldAugmentWithConnectionUsage() { final Step stepWithoutConnection = new Step.Builder().build(); final Integration usesC1 = testIntegration().withFlowConnections(c1).build(); final Integration usesC1andC2 = testIntegration().withFlowConnections(c1, c2).build(); final Integration usesC1andC2andC3 = testIntegration().withFlowConnections(c1, c2).withFlowStepsUsingConnections(c1, c3).addFlow(new Flow.Builder().addStep(stepWithoutConnection).build()).build(); when(dataManager.fetchAll(Integration.class)).thenReturn(ListResult.of(usesC1, usesC1andC2, usesC1andC2andC3)); when(dataManager.fetch(Connection.class, "c1")).thenReturn(c1); final ConnectionOverview overview = handler.get("c1"); assertThat(overview).isNotNull(); assertThat(overview.getUses()).isPresent(); assertThat(overview.getUses()).hasValue(4); }
board(instance.getBoard());