Search in sources :

Example 21 with RemoteProcessGroup

use of org.apache.nifi.groups.RemoteProcessGroup in project nifi by apache.

the class StandardRemoteProcessGroupDAO method verifyDelete.

@Override
public void verifyDelete(String remoteProcessGroupId) {
    RemoteProcessGroup remoteProcessGroup = locateRemoteProcessGroup(remoteProcessGroupId);
    remoteProcessGroup.verifyCanDelete();
}
Also used : RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup)

Example 22 with RemoteProcessGroup

use of org.apache.nifi.groups.RemoteProcessGroup in project nifi by apache.

the class StandardRemoteProcessGroupDAO method updateRemoteProcessGroupInputPort.

@Override
public RemoteGroupPort updateRemoteProcessGroupInputPort(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()));
    }
    // verify the update
    verifyUpdatePort(port, remoteProcessGroupPortDto);
    // perform the update
    updatePort(port, remoteProcessGroupPortDto, remoteProcessGroup);
    remoteProcessGroup.getProcessGroup().onComponentModified();
    return port;
}
Also used : RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup) RemoteGroupPort(org.apache.nifi.remote.RemoteGroupPort) ResourceNotFoundException(org.apache.nifi.web.ResourceNotFoundException)

Example 23 with RemoteProcessGroup

use of org.apache.nifi.groups.RemoteProcessGroup in project nifi by apache.

the class StandardRemoteProcessGroupDAO method deleteRemoteProcessGroup.

@Override
public void deleteRemoteProcessGroup(String remoteProcessGroupId) {
    RemoteProcessGroup remoteProcessGroup = locateRemoteProcessGroup(remoteProcessGroupId);
    remoteProcessGroup.getProcessGroup().removeRemoteProcessGroup(remoteProcessGroup);
}
Also used : RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup)

Example 24 with RemoteProcessGroup

use of org.apache.nifi.groups.RemoteProcessGroup in project nifi by apache.

the class FingerprintFactoryTest method testRemoteProcessGroupFingerprintWithProxy.

@Test
public void testRemoteProcessGroupFingerprintWithProxy() throws Exception {
    // Fill out every configuration.
    final RemoteProcessGroup component = mock(RemoteProcessGroup.class);
    when(component.getName()).thenReturn("name");
    when(component.getIdentifier()).thenReturn("id");
    when(component.getPosition()).thenReturn(new Position(10.5, 20.3));
    when(component.getTargetUri()).thenReturn("http://node1:8080/nifi");
    when(component.getTargetUris()).thenReturn("http://node1:8080/nifi, http://node2:8080/nifi");
    when(component.getComments()).thenReturn("comment");
    when(component.getCommunicationsTimeout()).thenReturn("10 sec");
    when(component.getYieldDuration()).thenReturn("30 sec");
    when(component.getTransportProtocol()).thenReturn(SiteToSiteTransportProtocol.HTTP);
    when(component.getProxyHost()).thenReturn("proxy-host");
    when(component.getProxyPort()).thenReturn(3128);
    when(component.getProxyUser()).thenReturn("proxy-user");
    when(component.getProxyPassword()).thenReturn("proxy-pass");
    when(component.getVersionedComponentId()).thenReturn(Optional.empty());
    // Assert fingerprints with expected one.
    final String expected = "id" + "NO_VALUE" + "http://node1:8080/nifi, http://node2:8080/nifi" + "NO_VALUE" + "10 sec" + "30 sec" + "HTTP" + "proxy-host" + "3128" + "proxy-user" + "proxy-pass";
    final Element rootElement = serializeElement(encryptor, RemoteProcessGroup.class, component, "addRemoteProcessGroup", IDENTITY_LOOKUP);
    final Element componentElement = (Element) rootElement.getElementsByTagName("remoteProcessGroup").item(0);
    assertEquals(expected.toString(), fingerprint("addRemoteProcessGroupFingerprint", Element.class, componentElement));
}
Also used : RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup) Position(org.apache.nifi.connectable.Position) Element(org.w3c.dom.Element) Test(org.junit.Test)

Example 25 with RemoteProcessGroup

use of org.apache.nifi.groups.RemoteProcessGroup in project nifi by apache.

the class FingerprintFactoryTest method testRemotePortFingerprint.

@Test
public void testRemotePortFingerprint() throws Exception {
    // Fill out every configuration.
    final RemoteProcessGroup groupComponent = mock(RemoteProcessGroup.class);
    when(groupComponent.getName()).thenReturn("name");
    when(groupComponent.getIdentifier()).thenReturn("id");
    when(groupComponent.getPosition()).thenReturn(new Position(10.5, 20.3));
    when(groupComponent.getTargetUri()).thenReturn("http://node1:8080/nifi");
    when(groupComponent.getTransportProtocol()).thenReturn(SiteToSiteTransportProtocol.RAW);
    when(groupComponent.getVersionedComponentId()).thenReturn(Optional.empty());
    final RemoteGroupPort portComponent = mock(RemoteGroupPort.class);
    when(groupComponent.getInputPorts()).thenReturn(Collections.singleton(portComponent));
    when(portComponent.getName()).thenReturn("portName");
    when(portComponent.getIdentifier()).thenReturn("portId");
    when(portComponent.getPosition()).thenReturn(new Position(10.5, 20.3));
    when(portComponent.getComments()).thenReturn("portComment");
    when(portComponent.getScheduledState()).thenReturn(ScheduledState.RUNNING);
    when(portComponent.getMaxConcurrentTasks()).thenReturn(3);
    when(portComponent.isUseCompression()).thenReturn(true);
    when(portComponent.getBatchCount()).thenReturn(1234);
    when(portComponent.getBatchSize()).thenReturn("64KB");
    when(portComponent.getBatchDuration()).thenReturn("10sec");
    // Serializer doesn't serialize if a port doesn't have any connection.
    when(portComponent.hasIncomingConnection()).thenReturn(true);
    when(portComponent.getVersionedComponentId()).thenReturn(Optional.empty());
    // Assert fingerprints with expected one.
    final String expected = "portId" + "NO_VALUE" + "NO_VALUE" + "3" + "true" + "1234" + "64KB" + "10sec";
    final Element rootElement = serializeElement(encryptor, RemoteProcessGroup.class, groupComponent, "addRemoteProcessGroup", IDENTITY_LOOKUP);
    final Element componentElement = (Element) rootElement.getElementsByTagName("inputPort").item(0);
    assertEquals(expected, fingerprint("addRemoteGroupPortFingerprint", Element.class, componentElement));
}
Also used : RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup) Position(org.apache.nifi.connectable.Position) RemoteGroupPort(org.apache.nifi.remote.RemoteGroupPort) Element(org.w3c.dom.Element) Test(org.junit.Test)

Aggregations

RemoteProcessGroup (org.apache.nifi.groups.RemoteProcessGroup)74 ProcessGroup (org.apache.nifi.groups.ProcessGroup)32 RemoteGroupPort (org.apache.nifi.remote.RemoteGroupPort)31 Action (org.apache.nifi.action.Action)27 RemoteProcessGroupDTO (org.apache.nifi.web.api.dto.RemoteProcessGroupDTO)26 ArrayList (java.util.ArrayList)20 Connection (org.apache.nifi.connectable.Connection)20 Port (org.apache.nifi.connectable.Port)19 Test (org.junit.Test)18 HashSet (java.util.HashSet)16 RootGroupPort (org.apache.nifi.remote.RootGroupPort)16 Funnel (org.apache.nifi.connectable.Funnel)15 Connectable (org.apache.nifi.connectable.Connectable)14 ProcessorNode (org.apache.nifi.controller.ProcessorNode)14 Label (org.apache.nifi.controller.label.Label)13 ControllerServiceNode (org.apache.nifi.controller.service.ControllerServiceNode)13 Collection (java.util.Collection)11 HashMap (java.util.HashMap)10 Snippet (org.apache.nifi.controller.Snippet)10 ProcessGroupStatus (org.apache.nifi.controller.status.ProcessGroupStatus)10