@Test void testGetOperation() { String processId = FINISHED_PROCESS; ResponseEntity<Operation> response = testedClass.getOperation(SPACE_GUID, processId, null); Operation operation = response.getBody(); assertEquals(processId, operation.getProcessId()); assertEquals(Operation.State.FINISHED, operation.getState()); }
@Override public ResponseEntity<Operation> getOperation(String spaceGuid, String operationId, String embed) { Operation operation = getOperation(operationId); if (!operation.getSpaceId() .equals(spaceGuid)) { LOGGER.info(MessageFormat.format(org.cloudfoundry.multiapps.controller.core.Messages.OPERATION_SPACE_MISMATCH, operationId, operation.getSpaceId(), spaceGuid)); throw new NotFoundException(org.cloudfoundry.multiapps.controller.persistence.Messages.OPERATION_NOT_FOUND, operationId); } if ("messages".equals(embed)) { operation = ImmutableOperation.copyOf(operation) .withMessages(getOperationMessages(operation)); if (operation.getState() == Operation.State.ERROR && !hasErrorMessage(operation)) { LOGGER.error("MTA operation \"{}\" is in error state, but has no error messages.", operation.getProcessId()); } } return ResponseEntity.ok() .body(operation); }
OperationsApiServiceImpl implements OperationsApiService { @Override public ResponseEntity<Operation> getOperation(String spaceGuid, String operationId, String embed) { Operation operation = getOperation(operationId); if (!operation.getSpaceId() .equals(spaceGuid)) { LOGGER.info(MessageFormat.format(org.cloudfoundry.multiapps.controller.core.Messages.OPERATION_SPACE_MISMATCH, operationId, operation.getSpaceId(), spaceGuid)); throw new NotFoundException(org.cloudfoundry.multiapps.controller.persistence.Messages.OPERATION_NOT_FOUND, operationId); } if ("messages".equals(embed)) { operation = ImmutableOperation.copyOf(operation) .withMessages(getOperationMessages(operation)); if (operation.getState() == Operation.State.ERROR && !hasErrorMessage(operation)) { LOGGER.error("MTA operation \"{}\" is in error state, but has no error messages.", operation.getProcessId()); } } return ResponseEntity.ok() .body(operation); } }
OperationsApiServiceImpl implements OperationsApiService { @Override public ResponseEntity<Operation> getOperation(String spaceGuid, String operationId, String embed) { Operation operation = getOperation(operationId); if (!operation.getSpaceId() .equals(spaceGuid)) { LOGGER.info(MessageFormat.format(org.cloudfoundry.multiapps.controller.core.Messages.OPERATION_SPACE_MISMATCH, operationId, operation.getSpaceId(), spaceGuid)); throw new NotFoundException(org.cloudfoundry.multiapps.controller.persistence.Messages.OPERATION_NOT_FOUND, operationId); } if ("messages".equals(embed)) { operation = ImmutableOperation.copyOf(operation) .withMessages(getOperationMessages(operation)); if (operation.getState() == Operation.State.ERROR && !hasErrorMessage(operation)) { LOGGER.error("MTA operation \"{}\" is in error state, but has no error messages.", operation.getProcessId()); } } return ResponseEntity.ok() .body(operation); }  }
OperationsApiServiceImpl implements OperationsApiService { @Override public ResponseEntity<Operation> getOperation(String spaceGuid, String operationId, String embed) { Operation operation = getOperation(operationId); if (!operation.getSpaceId() .equals(spaceGuid)) { LOGGER.info(MessageFormat.format(org.cloudfoundry.multiapps.controller.core.Messages.OPERATION_SPACE_MISMATCH, operationId, operation.getSpaceId(), spaceGuid)); throw new NotFoundException(org.cloudfoundry.multiapps.controller.persistence.Messages.OPERATION_NOT_FOUND, operationId); } if ("messages".equals(embed)) { operation = ImmutableOperation.copyOf(operation) .withMessages(getOperationMessages(operation)); if (operation.getState() == Operation.State.ERROR && !hasErrorMessage(operation)) { LOGGER.error("MTA operation \"{}\" is in error state, but has no error messages.", operation.getProcessId()); } } return ResponseEntity.ok() .body(operation); }  @Override ResponseEntity<List<Operation>> getOperations(String spaceGuid, String mtaId, List<String> stateStrings, Integer last); @Override ResponseEntity<Void> executeOperationAction(HttpServletRequest request, String spaceGuid, String operationId, String actionId); @Override ResponseEntity<List<Log>> getOperationLogs(String spaceGuid, String operationId); @Override ResponseEntity<String> getOperationLogContent(String spaceGuid, String operationId, String logId); @Override ResponseEntity<Operation> startOperation(HttpServletRequest request, String spaceGuid, Operation operation); @Override ResponseEntity<Operation> getOperation(String spaceGuid, String operationId, String embed); @Override ResponseEntity<List<String>> getOperationActions(String spaceGuid, String operationId); }
OperationsApiServiceImpl implements OperationsApiService { @Override public ResponseEntity<Operation> getOperation(String spaceGuid, String operationId, String embed) { Operation operation = getOperation(operationId); if (!operation.getSpaceId() .equals(spaceGuid)) { LOGGER.info(MessageFormat.format(org.cloudfoundry.multiapps.controller.core.Messages.OPERATION_SPACE_MISMATCH, operationId, operation.getSpaceId(), spaceGuid)); throw new NotFoundException(org.cloudfoundry.multiapps.controller.persistence.Messages.OPERATION_NOT_FOUND, operationId); } if ("messages".equals(embed)) { operation = ImmutableOperation.copyOf(operation) .withMessages(getOperationMessages(operation)); if (operation.getState() == Operation.State.ERROR && !hasErrorMessage(operation)) { LOGGER.error("MTA operation \"{}\" is in error state, but has no error messages.", operation.getProcessId()); } } return ResponseEntity.ok() .body(operation); }  @Override ResponseEntity<List<Operation>> getOperations(String spaceGuid, String mtaId, List<String> stateStrings, Integer last); @Override ResponseEntity<Void> executeOperationAction(HttpServletRequest request, String spaceGuid, String operationId, String actionId); @Override ResponseEntity<List<Log>> getOperationLogs(String spaceGuid, String operationId); @Override ResponseEntity<String> getOperationLogContent(String spaceGuid, String operationId, String logId); @Override ResponseEntity<Operation> startOperation(HttpServletRequest request, String spaceGuid, Operation operation); @Override ResponseEntity<Operation> getOperation(String spaceGuid, String operationId, String embed); @Override ResponseEntity<List<String>> getOperationActions(String spaceGuid, String operationId);  }