Java Code Examples for org.apache.nifi.web.api.dto.RemoteProcessGroupPortDTO#setConcurrentlySchedulableTaskCount()

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

    final RemoteGroupPort existingRPGPort = defaultRemoteGroupPort();
    when(existingRPGPort.getName()).thenReturn("input-port-1");

    final RemoteProcessGroupPortDTO inputRPGPortDTO = defaultRemoteProcessGroupPortDTO();
    inputRPGPortDTO.setConcurrentlySchedulableTaskCount(2);

    final Collection<Action> actions = updateProcessGroupInputPortConfiguration(inputRPGPortDTO, existingRPGPort);

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "input-port-1.Concurrent Tasks", "1", "2");

}
 
Example 2
Source File: RemoteInputPortSchemaTest.java    From nifi-minifi with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() {
    dto = new RemoteProcessGroupPortDTO();
    dto.setId(testId);
    dto.setName(testName);
    dto.setComments(testComment);
    dto.setConcurrentlySchedulableTaskCount(testMaxConcurrentTasks);
    dto.setUseCompression(testUseCompression);

    map = new HashMap<>();
    map.put(CommonPropertyKeys.ID_KEY, testId);
    map.put(CommonPropertyKeys.NAME_KEY, testName);
    map.put(CommonPropertyKeys.COMMENT_KEY, testComment);
    map.put(CommonPropertyKeys.MAX_CONCURRENT_TASKS_KEY, testMaxConcurrentTasks);
    map.put(CommonPropertyKeys.USE_COMPRESSION_KEY, testUseCompression);
}
 
Example 3
Source File: TestRemoteProcessGroupAuditor.java    From nifi with Apache License 2.0 6 votes vote down vote up
@Test
public void testConfigurePortConcurrency() throws Throwable {

    final RemoteGroupPort existingRPGPort = defaultRemoteGroupPort();
    when(existingRPGPort.getName()).thenReturn("input-port-1");

    final RemoteProcessGroupPortDTO inputRPGPortDTO = defaultRemoteProcessGroupPortDTO();
    inputRPGPortDTO.setConcurrentlySchedulableTaskCount(2);

    final Collection<Action> actions = updateProcessGroupInputPortConfiguration(inputRPGPortDTO, existingRPGPort);

    assertEquals(1, actions.size());
    final Action action = actions.iterator().next();
    assertEquals(Operation.Configure, action.getOperation());
    assertConfigureDetails(action.getActionDetails(), "input-port-1.Concurrent Tasks", "1", "2");

}
 
Example 4
Source File: TestRemoteProcessGroupAuditor.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
private RemoteProcessGroupPortDTO defaultRemoteProcessGroupPortDTO() {
    final RemoteProcessGroupPortDTO inputRPGPortDTO = new RemoteProcessGroupPortDTO();
    inputRPGPortDTO.setConcurrentlySchedulableTaskCount(1);
    inputRPGPortDTO.setUseCompression(false);
    return inputRPGPortDTO;
}
 
Example 5
Source File: TestStandardRemoteProcessGroupDAO.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Test
public void testVerifyUpdateInputPort() {
    final StandardRemoteProcessGroupDAO dao = new StandardRemoteProcessGroupDAO();

    final String remoteProcessGroupId = "remote-process-group-id";
    final String remoteProcessGroupInputPortId = "remote-process-group-input-port-id";

    final FlowController flowController = mock(FlowController.class);
    final FlowManager flowManager = mock(FlowManager.class);
    when(flowController.getFlowManager()).thenReturn(flowManager);

    final ProcessGroup processGroup = mock(ProcessGroup.class);
    final RemoteProcessGroup remoteProcessGroup = mock(RemoteProcessGroup.class);
    final RemoteGroupPort remoteGroupPort = mock(RemoteGroupPort.class);

    dao.setFlowController(flowController);
    when(flowManager.getRootGroup()).thenReturn(processGroup);
    when(flowManager.getGroup(any())).thenReturn(processGroup);
    when(processGroup.findRemoteProcessGroup(eq(remoteProcessGroupId))).thenReturn(remoteProcessGroup);
    when(remoteProcessGroup.getInputPort(remoteProcessGroupInputPortId)).thenReturn(remoteGroupPort);
    when(remoteGroupPort.getName()).thenReturn("remote-group-port");

    final RemoteProcessGroupPortDTO dto = new RemoteProcessGroupPortDTO();
    dto.setGroupId(remoteProcessGroupId);
    dto.setId(remoteProcessGroupInputPortId);
    dto.setTargetId(remoteProcessGroupInputPortId);
    final BatchSettingsDTO batchSettings = new BatchSettingsDTO();
    dto.setBatchSettings(batchSettings);

    // Empty input values should pass validation.
    dao.verifyUpdateInputPort(remoteProcessGroupId, dto);

    // Concurrent tasks
    dto.setConcurrentlySchedulableTaskCount(0);
    validate(dao, dto, "Concurrent tasks", "positive integer");

    dto.setConcurrentlySchedulableTaskCount(2);
    validate(dao, dto);

    // Batch count
    batchSettings.setCount(-1);
    validate(dao, dto, "Batch count", "positive integer");

    batchSettings.setCount(0);
    validate(dao, dto);

    batchSettings.setCount(1000);
    validate(dao, dto);

    // Batch size
    batchSettings.setSize("AB");
    validate(dao, dto, "Batch size", "Data Size");

    batchSettings.setSize("10 days");
    validate(dao, dto, "Batch size", "Data Size");

    batchSettings.setSize("300MB");
    validate(dao, dto);

    // Batch duration
    batchSettings.setDuration("AB");
    validate(dao, dto, "Batch duration", "Time Unit");

    batchSettings.setDuration("10 KB");
    validate(dao, dto, "Batch duration", "Time Unit");

    batchSettings.setDuration("10 secs");
    validate(dao, dto);

}
 
Example 6
Source File: TestRemoteProcessGroupAuditor.java    From nifi with Apache License 2.0 4 votes vote down vote up
private RemoteProcessGroupPortDTO defaultRemoteProcessGroupPortDTO() {
    final RemoteProcessGroupPortDTO inputRPGPortDTO = new RemoteProcessGroupPortDTO();
    inputRPGPortDTO.setConcurrentlySchedulableTaskCount(1);
    inputRPGPortDTO.setUseCompression(false);
    return inputRPGPortDTO;
}