Search in sources :

Example 11 with ProcessGroupFlowEntity

use of org.apache.nifi.web.api.entity.ProcessGroupFlowEntity in project nifi by apache.

the class ITInputPortAccessControl method getRandomInputPort.

private PortEntity getRandomInputPort(final NiFiTestUser user) throws Exception {
    final String url = helper.getBaseUrl() + "/flow/process-groups/root";
    // get the input ports
    final Response response = user.testGet(url);
    // ensure the response was successful
    assertEquals(200, response.getStatus());
    // unmarshal
    final ProcessGroupFlowEntity flowEntity = response.readEntity(ProcessGroupFlowEntity.class);
    final FlowDTO flowDto = flowEntity.getProcessGroupFlow().getFlow();
    final Set<PortEntity> inputPorts = flowDto.getInputPorts();
    // ensure the correct number of input ports
    assertFalse(inputPorts.isEmpty());
    // use the first input port as the target
    Iterator<PortEntity> inputPortIter = inputPorts.iterator();
    assertTrue(inputPortIter.hasNext());
    return inputPortIter.next();
}
Also used : Response(javax.ws.rs.core.Response) FlowDTO(org.apache.nifi.web.api.dto.flow.FlowDTO) ProcessGroupFlowEntity(org.apache.nifi.web.api.entity.ProcessGroupFlowEntity) PortEntity(org.apache.nifi.web.api.entity.PortEntity)

Example 12 with ProcessGroupFlowEntity

use of org.apache.nifi.web.api.entity.ProcessGroupFlowEntity in project nifi by apache.

the class ITProcessorAccessControl method getRandomProcessor.

private ProcessorEntity getRandomProcessor(final NiFiTestUser user) throws Exception {
    final String url = helper.getBaseUrl() + "/flow/process-groups/root";
    // get the processors
    final Response response = user.testGet(url);
    // ensure the response was successful
    assertEquals(200, response.getStatus());
    // unmarshal
    final ProcessGroupFlowEntity flowEntity = response.readEntity(ProcessGroupFlowEntity.class);
    final FlowDTO flowDto = flowEntity.getProcessGroupFlow().getFlow();
    final Set<ProcessorEntity> processors = flowDto.getProcessors();
    // ensure the correct number of processors
    assertFalse(processors.isEmpty());
    // use the first processor as the target
    Iterator<ProcessorEntity> processorIter = processors.iterator();
    assertTrue(processorIter.hasNext());
    return processorIter.next();
}
Also used : Response(javax.ws.rs.core.Response) FlowDTO(org.apache.nifi.web.api.dto.flow.FlowDTO) ProcessGroupFlowEntity(org.apache.nifi.web.api.entity.ProcessGroupFlowEntity) ProcessorEntity(org.apache.nifi.web.api.entity.ProcessorEntity)

Aggregations

ProcessGroupFlowEntity (org.apache.nifi.web.api.entity.ProcessGroupFlowEntity)12 FlowDTO (org.apache.nifi.web.api.dto.flow.FlowDTO)10 Response (javax.ws.rs.core.Response)8 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 PortEntity (org.apache.nifi.web.api.entity.PortEntity)3 Collections (java.util.Collections)2 Map (java.util.Map)2 Objects (java.util.Objects)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 StringUtils (org.apache.commons.lang3.StringUtils)2 ProcessGroupDTO (org.apache.nifi.web.api.dto.ProcessGroupDTO)2 FunnelEntity (org.apache.nifi.web.api.entity.FunnelEntity)2 LabelEntity (org.apache.nifi.web.api.entity.LabelEntity)2 ProcessGroupEntity (org.apache.nifi.web.api.entity.ProcessGroupEntity)2 Sets (com.google.common.collect.Sets)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1