Java Code Examples for org.apache.nifi.web.api.dto.RemoteProcessGroupDTO#setTransmitting()

The following examples show how to use org.apache.nifi.web.api.dto.RemoteProcessGroupDTO#setTransmitting() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestRemoteProcessGroupAuditor.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@Test
public void testEnableTransmission() throws Throwable {

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.isTransmitting()).thenReturn(false);

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setTransmitting(true);

    final Collection<Action> actions = updateProcessGroupConfiguration(inputRPGDTO, existingRPG);

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Start, action.getOperation());
    assertNull(action.getActionDetails());

}
 
Example 2
Source File: TestRemoteProcessGroupAuditor.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@Test
public void testDisableTransmission() throws Throwable {

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.isTransmitting()).thenReturn(true);

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setTransmitting(false);

    final Collection<Action> actions = updateProcessGroupConfiguration(inputRPGDTO, existingRPG);

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Stop, action.getOperation());
    assertNull(action.getActionDetails());

}
 
Example 3
Source File: FlowFromDOMFactory.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
public static RemoteProcessGroupDTO getRemoteProcessGroup(final Element element, final StringEncryptor encryptor) {
    final RemoteProcessGroupDTO dto = new RemoteProcessGroupDTO();
    dto.setId(getString(element, "id"));
    dto.setName(getString(element, "name"));
    dto.setTargetUri(getString(element, "url"));
    dto.setTargetUris(getString(element, "urls"));
    dto.setTransmitting(getBoolean(element, "transmitting"));
    dto.setPosition(getPosition(DomUtils.getChild(element, "position")));
    dto.setCommunicationsTimeout(getString(element, "timeout"));
    dto.setComments(getString(element, "comment"));
    dto.setYieldDuration(getString(element, "yieldPeriod"));
    dto.setTransportProtocol(getString(element, "transportProtocol"));
    dto.setProxyHost(getString(element, "proxyHost"));
    dto.setProxyPort(getOptionalInt(element, "proxyPort"));
    dto.setProxyUser(getString(element, "proxyUser"));
    dto.setLocalNetworkInterface(getString(element, "networkInterface"));

    final String rawPassword = getString(element, "proxyPassword");
    final String proxyPassword = encryptor == null ? rawPassword : decrypt(rawPassword, encryptor);
    dto.setProxyPassword(proxyPassword);

    return dto;
}
 
Example 4
Source File: TemplateUtils.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
/**
 * Remove unnecessary fields in remote groups prior to saving.
 *
 * @param remoteGroups groups
 */
private static void scrubRemoteProcessGroups(final Set<RemoteProcessGroupDTO> remoteGroups) {
    // go through each remote process group
    for (final RemoteProcessGroupDTO remoteProcessGroupDTO : remoteGroups) {
        remoteProcessGroupDTO.setFlowRefreshed(null);
        remoteProcessGroupDTO.setInputPortCount(null);
        remoteProcessGroupDTO.setOutputPortCount(null);
        remoteProcessGroupDTO.setTransmitting(null);
        remoteProcessGroupDTO.setProxyPassword(null);
        remoteProcessGroupDTO.setActiveRemoteInputPortCount(null);
        remoteProcessGroupDTO.setInactiveRemoteInputPortCount(null);
        remoteProcessGroupDTO.setActiveRemoteOutputPortCount(null);
        remoteProcessGroupDTO.setInactiveRemoteOutputPortCount(null);
        remoteProcessGroupDTO.setAuthorizationIssues(null);
        remoteProcessGroupDTO.setFlowRefreshed(null);
        remoteProcessGroupDTO.setName(null);
        remoteProcessGroupDTO.setTargetSecure(null);
        remoteProcessGroupDTO.setTransmitting(null);
    }
}
 
Example 5
Source File: TestRemoteProcessGroupAuditor.java    From nifi with Apache License 2.0 6 votes vote down vote up
@Test
public void testEnableTransmission() throws Throwable {

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.isTransmitting()).thenReturn(false);

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setTransmitting(true);

    final Collection<Action> actions = updateProcessGroupConfiguration(inputRPGDTO, existingRPG);

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Start, action.getOperation());
    assertNull(action.getActionDetails());

}
 
Example 6
Source File: TestRemoteProcessGroupAuditor.java    From nifi with Apache License 2.0 6 votes vote down vote up
@Test
public void testDisableTransmission() throws Throwable {

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.isTransmitting()).thenReturn(true);

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setTransmitting(false);

    final Collection<Action> actions = updateProcessGroupConfiguration(inputRPGDTO, existingRPG);

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Stop, action.getOperation());
    assertNull(action.getActionDetails());

}
 
Example 7
Source File: FlowFromDOMFactory.java    From nifi with Apache License 2.0 6 votes vote down vote up
public static RemoteProcessGroupDTO getRemoteProcessGroup(final Element element, final StringEncryptor encryptor) {
    final RemoteProcessGroupDTO dto = new RemoteProcessGroupDTO();
    dto.setId(getString(element, "id"));
    dto.setVersionedComponentId(getString(element, "versionedComponentId"));
    dto.setName(getString(element, "name"));
    dto.setTargetUri(getString(element, "url"));
    dto.setTargetUris(getString(element, "urls"));
    dto.setTransmitting(getBoolean(element, "transmitting"));
    dto.setPosition(getPosition(DomUtils.getChild(element, "position")));
    dto.setCommunicationsTimeout(getString(element, "timeout"));
    dto.setComments(getString(element, "comment"));
    dto.setYieldDuration(getString(element, "yieldPeriod"));
    dto.setTransportProtocol(getString(element, "transportProtocol"));
    dto.setProxyHost(getString(element, "proxyHost"));
    dto.setProxyPort(getOptionalInt(element, "proxyPort"));
    dto.setProxyUser(getString(element, "proxyUser"));
    dto.setLocalNetworkInterface(getString(element, "networkInterface"));

    final String rawPassword = getString(element, "proxyPassword");
    final String proxyPassword = encryptor == null ? rawPassword : decrypt(rawPassword, encryptor);
    dto.setProxyPassword(proxyPassword);

    return dto;
}
 
Example 8
Source File: TemplateUtils.java    From nifi with Apache License 2.0 6 votes vote down vote up
/**
 * Remove unnecessary fields in remote groups prior to saving.
 *
 * @param remoteGroups groups
 */
private static void scrubRemoteProcessGroups(final Set<RemoteProcessGroupDTO> remoteGroups) {
    // go through each remote process group
    for (final RemoteProcessGroupDTO remoteProcessGroupDTO : remoteGroups) {
        remoteProcessGroupDTO.setFlowRefreshed(null);
        remoteProcessGroupDTO.setInputPortCount(null);
        remoteProcessGroupDTO.setOutputPortCount(null);
        remoteProcessGroupDTO.setTransmitting(null);
        remoteProcessGroupDTO.setProxyPassword(null);
        remoteProcessGroupDTO.setActiveRemoteInputPortCount(null);
        remoteProcessGroupDTO.setInactiveRemoteInputPortCount(null);
        remoteProcessGroupDTO.setActiveRemoteOutputPortCount(null);
        remoteProcessGroupDTO.setInactiveRemoteOutputPortCount(null);
        remoteProcessGroupDTO.setAuthorizationIssues(null);
        remoteProcessGroupDTO.setFlowRefreshed(null);
        remoteProcessGroupDTO.setName(null);
        remoteProcessGroupDTO.setTargetSecure(null);
        remoteProcessGroupDTO.setTransmitting(null);
    }
}
 
Example 9
Source File: JerseyRemoteProcessGroupClient.java    From nifi with Apache License 2.0 5 votes vote down vote up
private RemoteProcessGroupEntity updateTransmitting(final RemoteProcessGroupEntity entity, final boolean transmitting) throws NiFiClientException, IOException {
    final RemoteProcessGroupDTO component = new RemoteProcessGroupDTO();
    component.setId(entity.getComponent().getId());
    component.setParentGroupId(entity.getComponent().getParentGroupId());
    component.setTransmitting(transmitting);

    final RemoteProcessGroupEntity transmittingEntity = new RemoteProcessGroupEntity();
    transmittingEntity.setId(entity.getId());
    transmittingEntity.setRevision(entity.getRevision());
    transmittingEntity.setComponent(component);

    return updateRemoteProcessGroup(transmittingEntity);
}
 
Example 10
Source File: TestRemoteProcessGroupAuditor.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
private RemoteProcessGroupDTO defaultInput() {
    final RemoteProcessGroupDTO inputRPGDTO = new RemoteProcessGroupDTO();
    inputRPGDTO.setTransportProtocol("RAW");
    inputRPGDTO.setTransmitting(false);
    return inputRPGDTO;
}
 
Example 11
Source File: RemoteProcessGroupResource.java    From nifi with Apache License 2.0 4 votes vote down vote up
private RemoteProcessGroupDTO createDTOWithDesiredRunStatus(final String id, final RemotePortRunStatusEntity entity) {
    final RemoteProcessGroupDTO dto = new RemoteProcessGroupDTO();
    dto.setId(id);
    dto.setTransmitting(shouldTransmit(entity));
    return dto;
}
 
Example 12
Source File: TestRemoteProcessGroupAuditor.java    From nifi with Apache License 2.0 4 votes vote down vote up
private RemoteProcessGroupDTO defaultInput() {
    final RemoteProcessGroupDTO inputRPGDTO = new RemoteProcessGroupDTO();
    inputRPGDTO.setTransportProtocol("RAW");
    inputRPGDTO.setTransmitting(false);
    return inputRPGDTO;
}