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

The following examples show how to use org.apache.nifi.web.api.dto.RemoteProcessGroupDTO#setTransportProtocol() . 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 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 2
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 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: 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 5
Source File: RemoteProcessGroupSchemaTest.java    From nifi-minifi with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    remoteInputPortSchemaTest.setup();

    dto = new RemoteProcessGroupDTO();
    dto.setId(testId);
    dto.setName(testName);
    dto.setTargetUri(testUrl);

    RemoteProcessGroupContentsDTO contents = new RemoteProcessGroupContentsDTO();
    contents.setInputPorts(Arrays.asList(remoteInputPortSchemaTest.dto).stream().collect(Collectors.toSet()));
    dto.setContents(contents);

    dto.setComments(testComment);
    dto.setCommunicationsTimeout(testTimeout);
    dto.setYieldDuration(testYieldPeriod);
    dto.setTransportProtocol(transportProtocol);

    map = new HashMap<>();

    map.put(CommonPropertyKeys.ID_KEY, testId);
    map.put(CommonPropertyKeys.NAME_KEY, testName);
    map.put(RemoteProcessGroupSchema.URL_KEY, testUrl);
    map.put(CommonPropertyKeys.INPUT_PORTS_KEY, new ArrayList<>(Arrays.asList(remoteInputPortSchemaTest.map)));
    map.put(CommonPropertyKeys.COMMENT_KEY, testComment);
    map.put(RemoteProcessGroupSchema.TIMEOUT_KEY, testTimeout);
    map.put(CommonPropertyKeys.YIELD_PERIOD_KEY, testYieldPeriod);
    map.put(RemoteProcessGroupSchema.TRANSPORT_PROTOCOL_KEY, transportProtocol);
}
 
Example 6
Source File: NiFiClientUtil.java    From nifi with Apache License 2.0 5 votes vote down vote up
public RemoteProcessGroupEntity createRPG(final String parentGroupId, final SiteToSiteTransportProtocol transportProtocol) throws NiFiClientException, IOException {
    final RemoteProcessGroupDTO component = new RemoteProcessGroupDTO();
    component.setTargetUri("http://localhost:5671");
    component.setName(component.getTargetUri());
    component.setTransportProtocol(transportProtocol.name());

    final RemoteProcessGroupEntity entity = new RemoteProcessGroupEntity();
    entity.setComponent(component);
    entity.setRevision(createNewRevision());

    return nifiClient.getRemoteProcessGroupClient().createRemoteProcessGroup(parentGroupId, entity);
}
 
Example 7
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 8
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;
}