@Test(expected = IllegalArgumentException.class) public void testCreateWithInvalidTransportProtocol() { final String flowId = flow.getFlowMetadata().getIdentifier(); when(flowManager.getFlow(flowId)).thenReturn(Optional.of(flow)); final VersionedRemoteProcessGroup requestConfig = new VersionedRemoteProcessGroup(); requestConfig.setTargetUris("uri-1,uri-2"); requestConfig.setTransportProtocol("INVALID"); service.create(flowId, group1.getIdentifier(), requestConfig); }
@Override public FDRemoteProcessGroup create(final String flowId, final String processGroupId, final VersionedRemoteProcessGroup requestComponentConfig) { final String targetUris = requestComponentConfig.getTargetUris(); if (StringUtils.isBlank(targetUris)) { throw new IllegalArgumentException("Cannot add a Remote Process Group without specifying the Target URI(s)"); } validateRequestValues(requestComponentConfig); return createComponent( flowId, processGroupId, null, requestComponentConfig, () -> { final VersionedRemoteProcessGroup componentConfig = new VersionedRemoteProcessGroup(); componentConfig.setTransportProtocol(DEFAULT_TRANSPORT_PROTOCOL); componentConfig.setCommunicationsTimeout(DEFAULT_COMMUNICATION_TIMEOUT); componentConfig.setYieldDuration(DEFAULT_YIELD_DURATION); componentConfig.setLocalNetworkInterface(""); componentConfig.setProxyHost(""); componentConfig.setInputPorts(new HashSet<>()); componentConfig.setOutputPorts(new HashSet<>()); final FDRemoteProcessGroup component = new FDRemoteProcessGroup(); component.setComponentConfiguration(componentConfig); return component; }, VersionedProcessGroup::getRemoteProcessGroups, null); }
StandardFDRemoteProcessGroupService extends BaseComponentService<VersionedRemoteProcessGroup,FDRemoteProcessGroup> implements FDRemoteProcessGroupService { @Override public FDRemoteProcessGroup create(final String flowId, final String processGroupId, final VersionedRemoteProcessGroup requestComponentConfig) { final String targetUris = requestComponentConfig.getTargetUris(); if (StringUtils.isBlank(targetUris)) { throw new IllegalArgumentException("Cannot add a Remote Process Group without specifying the Target URI(s)"); } validateRequestValues(requestComponentConfig); return createComponent( flowId, processGroupId, null, requestComponentConfig, () -> { final VersionedRemoteProcessGroup componentConfig = new VersionedRemoteProcessGroup(); componentConfig.setTransportProtocol(DEFAULT_TRANSPORT_PROTOCOL); componentConfig.setCommunicationsTimeout(DEFAULT_COMMUNICATION_TIMEOUT); componentConfig.setYieldDuration(DEFAULT_YIELD_DURATION); componentConfig.setLocalNetworkInterface(""); componentConfig.setProxyHost(""); componentConfig.setInputPorts(new HashSet<>()); componentConfig.setOutputPorts(new HashSet<>()); final FDRemoteProcessGroup component = new FDRemoteProcessGroup(); component.setComponentConfiguration(componentConfig); return component; }, VersionedProcessGroup::getRemoteProcessGroups, null); } }
StandardFDRemoteProcessGroupService extends BaseComponentService<VersionedRemoteProcessGroup,FDRemoteProcessGroup> implements FDRemoteProcessGroupService { @Override public FDRemoteProcessGroup create(final String flowId, final String processGroupId, final VersionedRemoteProcessGroup requestComponentConfig) { final String targetUris = requestComponentConfig.getTargetUris(); if (StringUtils.isBlank(targetUris)) { throw new IllegalArgumentException("Cannot add a Remote Process Group without specifying the Target URI(s)"); } validateRequestValues(requestComponentConfig); return createComponent( flowId, processGroupId, null, requestComponentConfig, () -> { final VersionedRemoteProcessGroup componentConfig = new VersionedRemoteProcessGroup(); componentConfig.setTransportProtocol(DEFAULT_TRANSPORT_PROTOCOL); componentConfig.setCommunicationsTimeout(DEFAULT_COMMUNICATION_TIMEOUT); componentConfig.setYieldDuration(DEFAULT_YIELD_DURATION); componentConfig.setLocalNetworkInterface(""); componentConfig.setProxyHost(""); componentConfig.setInputPorts(new HashSet<>()); componentConfig.setOutputPorts(new HashSet<>()); final FDRemoteProcessGroup component = new FDRemoteProcessGroup(); component.setComponentConfiguration(componentConfig); return component; }, VersionedProcessGroup::getRemoteProcessGroups, null); } StandardFDRemoteProcessGroupService(final FDFlowManager flowManager, final ValidationService validationService); }
StandardFDRemoteProcessGroupService extends BaseComponentService<VersionedRemoteProcessGroup,FDRemoteProcessGroup> implements FDRemoteProcessGroupService { @Override public FDRemoteProcessGroup create(final String flowId, final String processGroupId, final VersionedRemoteProcessGroup requestComponentConfig) { final String targetUris = requestComponentConfig.getTargetUris(); if (StringUtils.isBlank(targetUris)) { throw new IllegalArgumentException("Cannot add a Remote Process Group without specifying the Target URI(s)"); } validateRequestValues(requestComponentConfig); return createComponent( flowId, processGroupId, null, requestComponentConfig, () -> { final VersionedRemoteProcessGroup componentConfig = new VersionedRemoteProcessGroup(); componentConfig.setTransportProtocol(DEFAULT_TRANSPORT_PROTOCOL); componentConfig.setCommunicationsTimeout(DEFAULT_COMMUNICATION_TIMEOUT); componentConfig.setYieldDuration(DEFAULT_YIELD_DURATION); componentConfig.setLocalNetworkInterface(""); componentConfig.setProxyHost(""); componentConfig.setInputPorts(new HashSet<>()); componentConfig.setOutputPorts(new HashSet<>()); final FDRemoteProcessGroup component = new FDRemoteProcessGroup(); component.setComponentConfiguration(componentConfig); return component; }, VersionedProcessGroup::getRemoteProcessGroups, null); } StandardFDRemoteProcessGroupService(final FDFlowManager flowManager, final ValidationService validationService); @Override FDRemoteProcessGroup create(final String flowId, final String processGroupId, final VersionedRemoteProcessGroup requestComponentConfig); @Override FDRemoteProcessGroup get(final String flowId, final String componentId); @Override FDRemoteProcessGroup update(final String flowId, final VersionedRemoteProcessGroup requestComponentConfig); @Override void delete(final String flowId, final String componentId); }
StandardFDRemoteProcessGroupService extends BaseComponentService<VersionedRemoteProcessGroup,FDRemoteProcessGroup> implements FDRemoteProcessGroupService { @Override public FDRemoteProcessGroup create(final String flowId, final String processGroupId, final VersionedRemoteProcessGroup requestComponentConfig) { final String targetUris = requestComponentConfig.getTargetUris(); if (StringUtils.isBlank(targetUris)) { throw new IllegalArgumentException("Cannot add a Remote Process Group without specifying the Target URI(s)"); } validateRequestValues(requestComponentConfig); return createComponent( flowId, processGroupId, null, requestComponentConfig, () -> { final VersionedRemoteProcessGroup componentConfig = new VersionedRemoteProcessGroup(); componentConfig.setTransportProtocol(DEFAULT_TRANSPORT_PROTOCOL); componentConfig.setCommunicationsTimeout(DEFAULT_COMMUNICATION_TIMEOUT); componentConfig.setYieldDuration(DEFAULT_YIELD_DURATION); componentConfig.setLocalNetworkInterface(""); componentConfig.setProxyHost(""); componentConfig.setInputPorts(new HashSet<>()); componentConfig.setOutputPorts(new HashSet<>()); final FDRemoteProcessGroup component = new FDRemoteProcessGroup(); component.setComponentConfiguration(componentConfig); return component; }, VersionedProcessGroup::getRemoteProcessGroups, null); } StandardFDRemoteProcessGroupService(final FDFlowManager flowManager, final ValidationService validationService); @Override FDRemoteProcessGroup create(final String flowId, final String processGroupId, final VersionedRemoteProcessGroup requestComponentConfig); @Override FDRemoteProcessGroup get(final String flowId, final String componentId); @Override FDRemoteProcessGroup update(final String flowId, final VersionedRemoteProcessGroup requestComponentConfig); @Override void delete(final String flowId, final String componentId);  }