@Test public void shouldProvideActionDefinition() { @SuppressWarnings({"unchecked", "rawtypes"}) final Class<Entity<Map<String, Object>>> entityType = (Class) Entity.class; final ArgumentCaptor<Entity<Map<String, Object>>> entity = ArgumentCaptor.forClass(entityType); final DynamicActionMetadata suggestions = new DynamicActionMetadata.Builder().putProperty("sObjectName", Arrays.asList(DynamicActionMetadata.ActionPropertySuggestion.Builder.of("Account", "Account"), DynamicActionMetadata.ActionPropertySuggestion.Builder.of("Contact", "Contact"))) .build(); when(invocationBuilder.post(entity.capture(), eq(DynamicActionMetadata.class))).thenReturn(suggestions); final ConnectorDescriptor definition = handler.enrichWithMetadata(SALESFORCE_CREATE_OR_UPDATE, Collections.emptyMap()); final ConnectorDescriptor enrichedDefinitioin = new ConnectorDescriptor.Builder() .createFrom(createOrUpdateSalesforceObjectDescriptor) .replaceConfigurationProperty("sObjectName", c -> c.addEnum(ConfigurationProperty.PropertyValue.Builder.of("Account", "Account"), ConfigurationProperty.PropertyValue.Builder.of("Contact", "Contact"))) .build(); assertThat(definition).isEqualTo(enrichedDefinitioin); } }
@Test public void shouldProvideActionDefinition() { @SuppressWarnings({"unchecked", "rawtypes"}) final Class<Entity<Map<String, Object>>> entityType = (Class) Entity.class; final ArgumentCaptor<Entity<Map<String, Object>>> entity = ArgumentCaptor.forClass(entityType); final DynamicActionMetadata suggestions = new DynamicActionMetadata.Builder().putProperty("sObjectName", Arrays.asList(DynamicActionMetadata.ActionPropertySuggestion.Builder.of("Account", "Account"), DynamicActionMetadata.ActionPropertySuggestion.Builder.of("Contact", "Contact"))) .build(); when(invocationBuilder.post(entity.capture(), eq(DynamicActionMetadata.class))).thenReturn(suggestions); final ConnectorDescriptor definition = handler.enrichWithMetadata(SALESFORCE_CREATE_OR_UPDATE, Collections.emptyMap()); final ConnectorDescriptor enrichedDefinitioin = new ConnectorDescriptor.Builder() .createFrom(createOrUpdateSalesforceObjectDescriptor) .replaceConfigurationProperty("sObjectName", c -> c.addEnum(ConfigurationProperty.PropertyValue.Builder.of("Account", "Account"), ConfigurationProperty.PropertyValue.Builder.of("Contact", "Contact"))) .build(); assertThat(definition).isEqualTo(enrichedDefinitioin); } }
.putProperty("sObjectName", Collections .singletonList(DynamicActionMetadata.ActionPropertySuggestion.Builder.of("Contact", "Contact"))) .putProperty("sObjectIdName", Arrays.asList(DynamicActionMetadata.ActionPropertySuggestion.Builder.of("ID", "Contact ID"), DynamicActionMetadata.ActionPropertySuggestion.Builder.of("Email", "Email"),
.putProperty("sObjectName", Collections .singletonList(DynamicActionMetadata.ActionPropertySuggestion.Builder.of("Contact", "Contact"))) .putProperty("sObjectIdName", Arrays.asList(DynamicActionMetadata.ActionPropertySuggestion.Builder.of("ID", "Contact ID"), DynamicActionMetadata.ActionPropertySuggestion.Builder.of("Email", "Email"),