org.apache.nifi.web.api.dto.RemoteProcessGroupDTO Java Examples

The following examples show how to use org.apache.nifi.web.api.dto.RemoteProcessGroupDTO. 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 testConfigureYieldDuration() throws Throwable {

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.getYieldDuration()).thenReturn("10 sec");

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setYieldDuration("11 sec");

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Yield Duration",
            existingRPG.getYieldDuration(), inputRPGDTO.getYieldDuration());

}
 
Example #2
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 #3
Source File: TestRemoteProcessGroupAuditor.java    From nifi with Apache License 2.0 6 votes vote down vote up
@Test
public void testConfigureTransportProtocol() throws Throwable {

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.getTransportProtocol()).thenReturn(SiteToSiteTransportProtocol.RAW);

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setTransportProtocol("HTTP");

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Transport Protocol",
            existingRPG.getTransportProtocol().name(), inputRPGDTO.getTransportProtocol());

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

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.getYieldDuration()).thenReturn("10 sec");

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setYieldDuration("11 sec");

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Yield Duration",
            existingRPG.getYieldDuration(), inputRPGDTO.getYieldDuration());

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

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.getCommunicationsTimeout()).thenReturn("30 sec");

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setCommunicationsTimeout("31 sec");

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Communications Timeout",
            existingRPG.getCommunicationsTimeout(), inputRPGDTO.getCommunicationsTimeout());

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

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.getProxyPort()).thenReturn(3128);

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setProxyPort(null);

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Proxy Port",
            existingRPG.getProxyPort(), inputRPGDTO.getProxyPort());

}
 
Example #7
Source File: StandardRemoteProcessGroupDAO.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a remote process group reference.
 *
 * @param remoteProcessGroupDTO The remote process group
 * @return The remote process group
 */
@Override
public RemoteProcessGroup createRemoteProcessGroup(String groupId, RemoteProcessGroupDTO remoteProcessGroupDTO) {
    ProcessGroup group = locateProcessGroup(flowController, groupId);

    if (remoteProcessGroupDTO.getParentGroupId() != null && !flowController.areGroupsSame(groupId, remoteProcessGroupDTO.getParentGroupId())) {
        throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the Remote Process Group is being added.");
    }

    final String targetUris = remoteProcessGroupDTO.getTargetUris();
    if (targetUris == null || targetUris.length() == 0) {
        throw new IllegalArgumentException("Cannot add a Remote Process Group without specifying the Target URI(s)");
    }

    // create the remote process group
    RemoteProcessGroup remoteProcessGroup = flowController.createRemoteProcessGroup(remoteProcessGroupDTO.getId(), targetUris);

    // set other properties
    updateRemoteProcessGroup(remoteProcessGroup, remoteProcessGroupDTO);

    // get the group to add the remote process group to
    group.addRemoteProcessGroup(remoteProcessGroup);

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

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setProxyUser("proxy-user");

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Proxy User",
            existingRPG.getProxyUser(), inputRPGDTO.getProxyUser());

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

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.getProxyUser()).thenReturn("proxy-user");

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setProxyUser(null);

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Proxy User",
            existingRPG.getProxyUser(), inputRPGDTO.getProxyUser());

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

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.getProxyPassword()).thenReturn("proxy-password");

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setProxyPassword(null);

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Proxy Password", SENSITIVE_VALUE_MASK, "");

}
 
Example #11
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 #12
Source File: StandardNiFiServiceFacade.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@Override
public RemoteProcessGroupEntity updateRemoteProcessGroup(final Revision revision, final RemoteProcessGroupDTO remoteProcessGroupDTO) {
    final RemoteProcessGroup remoteProcessGroupNode = remoteProcessGroupDAO.getRemoteProcessGroup(remoteProcessGroupDTO.getId());
    final RevisionUpdate<RemoteProcessGroupDTO> snapshot = updateComponent(
            revision,
            remoteProcessGroupNode,
            () -> remoteProcessGroupDAO.updateRemoteProcessGroup(remoteProcessGroupDTO),
            remoteProcessGroup -> dtoFactory.createRemoteProcessGroupDto(remoteProcessGroup));

    final PermissionsDTO permissions = dtoFactory.createPermissionsDto(remoteProcessGroupNode);
    final RevisionDTO updateRevision = dtoFactory.createRevisionDTO(snapshot.getLastModification());
    final RemoteProcessGroupStatusDTO status = dtoFactory.createRemoteProcessGroupStatusDto(controllerFacade.getRemoteProcessGroupStatus(remoteProcessGroupNode.getIdentifier()));
    final List<BulletinDTO> bulletins = dtoFactory.createBulletinDtos(bulletinRepository.findBulletinsForSource(remoteProcessGroupNode.getIdentifier()));
    final List<BulletinEntity> bulletinEntities = bulletins.stream().map(bulletin -> entityFactory.createBulletinEntity(bulletin, permissions.getCanRead())).collect(Collectors.toList());
    return entityFactory.createRemoteProcessGroupEntity(snapshot.getComponent(), updateRevision, permissions, status, bulletinEntities);
}
 
Example #13
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 #14
Source File: TestRemoteProcessGroupAuditor.java    From nifi with Apache License 2.0 6 votes vote down vote up
@Test
public void testConfigureProxyPort() throws Throwable {

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setProxyPort(3128);

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Proxy Port",
            existingRPG.getProxyPort(), inputRPGDTO.getProxyPort());

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

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.getCommunicationsTimeout()).thenReturn("30 sec");

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setCommunicationsTimeout("31 sec");

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Communications Timeout",
            existingRPG.getCommunicationsTimeout(), inputRPGDTO.getCommunicationsTimeout());

}
 
Example #16
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 #17
Source File: TestRemoteProcessGroupAuditor.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@Test
public void testConfigureTransportProtocol() throws Throwable {

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.getTransportProtocol()).thenReturn(SiteToSiteTransportProtocol.RAW);

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setTransportProtocol("HTTP");

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Transport Protocol",
            existingRPG.getTransportProtocol().name(), inputRPGDTO.getTransportProtocol());

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

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setProxyHost("proxy.example.com");

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Proxy Host",
            existingRPG.getProxyHost(), inputRPGDTO.getProxyHost());

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

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.getProxyHost()).thenReturn("proxy1.example.com");

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setProxyHost("proxy2.example.com");

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Proxy Host",
            existingRPG.getProxyHost(), inputRPGDTO.getProxyHost());

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

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.getProxyHost()).thenReturn("proxy.example.com");

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setProxyHost("");

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Proxy Host",
            existingRPG.getProxyHost(), inputRPGDTO.getProxyHost());

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

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setProxyPort(3128);

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Proxy Port",
            existingRPG.getProxyPort(), inputRPGDTO.getProxyPort());

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

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.getProxyPort()).thenReturn(3128);

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setProxyPort(null);

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Proxy Port",
            existingRPG.getProxyPort(), inputRPGDTO.getProxyPort());

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

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setProxyUser("proxy-user");

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Proxy User",
            existingRPG.getProxyUser(), inputRPGDTO.getProxyUser());

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

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.getProxyUser()).thenReturn("proxy-user");

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setProxyUser(null);

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Proxy User",
            existingRPG.getProxyUser(), inputRPGDTO.getProxyUser());

}
 
Example #25
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 #26
Source File: TestRemoteProcessGroupAuditor.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@Test
public void testConfigureProxyPasswordClear() throws Throwable {

    final RemoteProcessGroup existingRPG = defaultRemoteProcessGroup();
    when(existingRPG.getProxyPassword()).thenReturn("proxy-password");

    final RemoteProcessGroupDTO inputRPGDTO = defaultInput();
    inputRPGDTO.setProxyPassword(null);

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

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "Proxy Password", SENSITIVE_VALUE_MASK, "");

}
 
Example #27
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 #28
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 #29
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 #30
Source File: StandardRemoteProcessGroupDAO.java    From nifi with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a remote process group reference.
 *
 * @param remoteProcessGroupDTO The remote process group
 * @return The remote process group
 */
@Override
public RemoteProcessGroup createRemoteProcessGroup(String groupId, RemoteProcessGroupDTO remoteProcessGroupDTO) {
    ProcessGroup group = locateProcessGroup(flowController, groupId);

    if (remoteProcessGroupDTO.getParentGroupId() != null && !flowController.getFlowManager().areGroupsSame(groupId, remoteProcessGroupDTO.getParentGroupId())) {
        throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the Remote Process Group is being added.");
    }

    final String targetUris = remoteProcessGroupDTO.getTargetUris();
    if (targetUris == null || targetUris.length() == 0) {
        throw new IllegalArgumentException("Cannot add a Remote Process Group without specifying the Target URI(s)");
    }

    // create the remote process group
    RemoteProcessGroup remoteProcessGroup = flowController.getFlowManager().createRemoteProcessGroup(remoteProcessGroupDTO.getId(), targetUris);
    remoteProcessGroup.initialize();

    // set other properties
    updateRemoteProcessGroup(remoteProcessGroup, remoteProcessGroupDTO);

    // get the group to add the remote process group to
    group.addRemoteProcessGroup(remoteProcessGroup);

    return remoteProcessGroup;
}