@Test public void shouldOrderActionsBasedOnTags() { final ConnectorAction a = new ConnectorAction.Builder().addTag("a").build(); final ConnectorAction b = new ConnectorAction.Builder().addTag("b").build(); final ConnectorAction c = new ConnectorAction.Builder().addTag("c").build(); final ConnectorAction noTags = new ConnectorAction.Builder().build(); final List<ConnectorAction> actions = new ArrayList<>(Arrays.asList(c, noTags, a, b)); Collections.shuffle(actions); actions.sort(ActionComparator.INSTANCE); assertThat(actions).containsExactly(a, b, c, noTags); }
@Test public void shouldOrderActionsBasedOnTagsAndName() { final ConnectorAction a = new ConnectorAction.Builder().name("a").addTag("a").build(); final ConnectorAction b = new ConnectorAction.Builder().name("b").addTag("b").build(); final ConnectorAction c = new ConnectorAction.Builder().name("c").addTag("b").build(); final ConnectorAction noTagsA = new ConnectorAction.Builder().name("a").build(); final ConnectorAction noTagsB = new ConnectorAction.Builder().name("b").build(); final ConnectorAction noTagsNoName = new ConnectorAction.Builder().build(); final List<ConnectorAction> actions = new ArrayList<>(Arrays.asList(c, noTagsA, a, noTagsB, b, noTagsNoName)); Collections.shuffle(actions); actions.sort(ActionComparator.INSTANCE); assertThat(actions).containsExactly(a, b, c, noTagsA, noTagsB, noTagsNoName); } }
@Test public void testConnectorSummary() { ConnectorSummary summary = new ConnectorSummary.Builder().createFrom( new Connector.Builder().addAction( new ConnectorAction.Builder().addTag("1", "2", "3").build(), new ConnectorAction.Builder().addTag("2", "3", "4").build(), new ConnectorAction.Builder().addTag("2").build(), new ConnectorAction.Builder().build() ).build() ).build(); Assertions.assertThat(summary.getActionsSummary().getTotalActions()).isEqualTo(4); Map<String, Integer> actionCountByTags = summary.getActionsSummary().getActionCountByTags(); Assertions.assertThat(actionCountByTags).containsEntry("1", 1); Assertions.assertThat(actionCountByTags).containsEntry("2", 3); Assertions.assertThat(actionCountByTags).containsEntry("3", 2); Assertions.assertThat(actionCountByTags).containsEntry("4", 1); }
.addAction(new ConnectorAction.Builder() .id(SALESFORCE_CREATE_OR_UPDATE) .addTag("dynamic") .descriptor(createOrUpdateSalesforceObjectDescriptor) .build())
.addAction(new ConnectorAction.Builder() .id(SALESFORCE_CREATE_OR_UPDATE) .addTag("dynamic") .descriptor(createOrUpdateSalesforceObjectDescriptor) .build())