@Test public void testVerifyUpdateInputPort() { final StandardRemoteProcessGroupDAO dao = new StandardRemoteProcessGroupDAO(); final String remoteProcessGroupId = "remote-process-group-id"; final String remoteProcessGroupInputPortId = "remote-process-group-input-port-id"; final FlowController flowController = mock(FlowController.class); final ProcessGroup processGroup = mock(ProcessGroup.class); final RemoteProcessGroup remoteProcessGroup = mock(RemoteProcessGroup.class); final RemoteGroupPort remoteGroupPort = mock(RemoteGroupPort.class); dao.setFlowController(flowController); when(flowController.getGroup(any())).thenReturn(processGroup); when(processGroup.findRemoteProcessGroup(eq(remoteProcessGroupId))).thenReturn(remoteProcessGroup); when(remoteProcessGroup.getInputPort(remoteProcessGroupInputPortId)).thenReturn(remoteGroupPort); when(remoteGroupPort.getName()).thenReturn("remote-group-port"); final RemoteProcessGroupPortDTO dto = new RemoteProcessGroupPortDTO(); dto.setGroupId(remoteProcessGroupId); dto.setId(remoteProcessGroupInputPortId); dto.setTargetId(remoteProcessGroupInputPortId); final BatchSettingsDTO batchSettings = new BatchSettingsDTO(); dto.setBatchSettings(batchSettings); dao.verifyUpdateInputPort(remoteProcessGroupId, dto); dto.setConcurrentlySchedulableTaskCount(0); validate(dao, dto, "Concurrent tasks", "positive integer"); dto.setConcurrentlySchedulableTaskCount(2); validate(dao, dto); batchSettings.setCount(-1); validate(dao, dto, "Batch count", "positive integer"); batchSettings.setCount(0); validate(dao, dto); batchSettings.setCount(1000); validate(dao, dto); batchSettings.setSize("AB"); validate(dao, dto, "Batch size", "Data Size"); batchSettings.setSize("10 days"); validate(dao, dto, "Batch size", "Data Size"); batchSettings.setSize("300MB"); validate(dao, dto); batchSettings.setDuration("AB"); validate(dao, dto, "Batch duration", "Time Unit"); batchSettings.setDuration("10 KB"); validate(dao, dto, "Batch duration", "Time Unit"); batchSettings.setDuration("10 secs"); validate(dao, dto); }
@Override public void verifyUpdateInputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPortDto) { final RemoteProcessGroup remoteProcessGroup = locateRemoteProcessGroup(remoteProcessGroupId); final RemoteGroupPort port = remoteProcessGroup.getInputPort(remoteProcessGroupPortDto.getId()); if (port == null) { throw new ResourceNotFoundException( String.format("Unable to find remote process group input port with id '%s'.", remoteProcessGroupPortDto.getId())); } verifyUpdatePort(port, remoteProcessGroupPortDto); }
StandardRemoteProcessGroupDAO extends ComponentDAO implements RemoteProcessGroupDAO { @Override public void verifyUpdateInputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPortDto) { final RemoteProcessGroup remoteProcessGroup = locateRemoteProcessGroup(remoteProcessGroupId); final RemoteGroupPort port = remoteProcessGroup.getInputPort(remoteProcessGroupPortDto.getId()); if (port == null) { throw new ResourceNotFoundException( String.format("Unable to find remote process group input port with id '%s'.", remoteProcessGroupPortDto.getId())); } verifyUpdatePort(port, remoteProcessGroupPortDto); } }
StandardRemoteProcessGroupDAO extends ComponentDAO implements RemoteProcessGroupDAO { @Override public void verifyUpdateInputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPortDto) { final RemoteProcessGroup remoteProcessGroup = locateRemoteProcessGroup(remoteProcessGroupId); final RemoteGroupPort port = remoteProcessGroup.getInputPort(remoteProcessGroupPortDto.getId()); if (port == null) { throw new ResourceNotFoundException( String.format("Unable to find remote process group input port with id '%s'.", remoteProcessGroupPortDto.getId())); } verifyUpdatePort(port, remoteProcessGroupPortDto); }  }
StandardRemoteProcessGroupDAO extends ComponentDAO implements RemoteProcessGroupDAO { @Override public void verifyUpdateInputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPortDto) { final RemoteProcessGroup remoteProcessGroup = locateRemoteProcessGroup(remoteProcessGroupId); final RemoteGroupPort port = remoteProcessGroup.getInputPort(remoteProcessGroupPortDto.getId()); if (port == null) { throw new ResourceNotFoundException( String.format("Unable to find remote process group input port with id '%s'.", remoteProcessGroupPortDto.getId())); } verifyUpdatePort(port, remoteProcessGroupPortDto); }  @Override boolean hasRemoteProcessGroup(String remoteProcessGroupId); @Override RemoteProcessGroup createRemoteProcessGroup(String groupId, RemoteProcessGroupDTO remoteProcessGroupDTO); @Override RemoteProcessGroup getRemoteProcessGroup(String remoteProcessGroupId); @Override Set<RemoteProcessGroup> getRemoteProcessGroups(String groupId); @Override void verifyUpdate(RemoteProcessGroupDTO remoteProcessGroup); @Override void verifyUpdateInputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPortDto); @Override void verifyUpdateOutputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPortDto); @Override RemoteGroupPort updateRemoteProcessGroupInputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPortDto); @Override RemoteGroupPort updateRemoteProcessGroupOutputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPortDto); @Override RemoteProcessGroup updateRemoteProcessGroup(RemoteProcessGroupDTO remoteProcessGroupDTO); @Override void verifyDelete(String remoteProcessGroupId); @Override void deleteRemoteProcessGroup(String remoteProcessGroupId); void setFlowController(FlowController flowController); }
StandardRemoteProcessGroupDAO extends ComponentDAO implements RemoteProcessGroupDAO { @Override public void verifyUpdateInputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPortDto) { final RemoteProcessGroup remoteProcessGroup = locateRemoteProcessGroup(remoteProcessGroupId); final RemoteGroupPort port = remoteProcessGroup.getInputPort(remoteProcessGroupPortDto.getId()); if (port == null) { throw new ResourceNotFoundException( String.format("Unable to find remote process group input port with id '%s'.", remoteProcessGroupPortDto.getId())); } verifyUpdatePort(port, remoteProcessGroupPortDto); }  @Override boolean hasRemoteProcessGroup(String remoteProcessGroupId); @Override RemoteProcessGroup createRemoteProcessGroup(String groupId, RemoteProcessGroupDTO remoteProcessGroupDTO); @Override RemoteProcessGroup getRemoteProcessGroup(String remoteProcessGroupId); @Override Set<RemoteProcessGroup> getRemoteProcessGroups(String groupId); @Override void verifyUpdate(RemoteProcessGroupDTO remoteProcessGroup); @Override void verifyUpdateInputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPortDto); @Override void verifyUpdateOutputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPortDto); @Override RemoteGroupPort updateRemoteProcessGroupInputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPortDto); @Override RemoteGroupPort updateRemoteProcessGroupOutputPort(String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPortDto); @Override RemoteProcessGroup updateRemoteProcessGroup(RemoteProcessGroupDTO remoteProcessGroupDTO); @Override void verifyDelete(String remoteProcessGroupId); @Override void deleteRemoteProcessGroup(String remoteProcessGroupId); void setFlowController(FlowController flowController);  }