@Test(expected = WpsProcessorNotFoundException.class) public void canThrowExceptionWhenProcessorIsNull() throws Exception { ProcessorNameConverter mockProcessorNameConverter = mock(ProcessorNameConverter.class); PowerMockito.whenNew(CalvalusFacade.class).withArguments(any(WpsRequestContext.class)).thenReturn(mockCalvalusFacade); PowerMockito.whenNew(ProcessorNameConverter.class).withAnyArguments().thenReturn(mockProcessorNameConverter); when(mockCalvalusFacade.getProcessor(any(ProcessorNameConverter.class))).thenReturn(null); describeProcessOperation = new CalvalusDescribeProcessOperation(mockRequestContext); describeProcessOperation.getProcesses("process1"); }
public List<ProcessDescriptionType> getProcesses(String processorId) throws WpsProcessorNotFoundException { CalvalusLogger.getLogger().info("Getting processors " + processorId + " for user " + this.calvalusFacade.getRemoteUserName()); try { String[] processorIdArray = processorId.split(","); List<ProcessDescriptionType> processDescriptionTypeList = new ArrayList<>(); List<WpsProcess> processors = new ArrayList<>(); if (processorId.equalsIgnoreCase("all")) { processors.addAll(calvalusFacade.getProcessors()); processors.addAll(localFacade.getProcessors()); processDescriptionTypeList.addAll(getMultipleProcessType(processors)); } else if (processorIdArray.length > 1) { processors.addAll(getMultipleCalvalusProcessors(calvalusFacade, processorIdArray)); processors.addAll(getMultipleLocalProcessors(processorIdArray)); processDescriptionTypeList.addAll(getMultipleProcessType(processors)); } else { ProcessorNameConverter parser = new ProcessorNameConverter(processorId); WpsProcess processor = localFacade.getProcessor(parser); if (processor == null) { processor = calvalusFacade.getProcessor(parser); } if (processor == null) { throw new WpsProcessorNotFoundException("Unable to retrieve processor '" + parser.getProcessorIdentifier() + "'"); } processDescriptionTypeList.add(getSingleProcess(processor)); } return processDescriptionTypeList; } catch (IOException | ProductSetsNotAvailableException | InvalidProcessorIdException exception) { throw new WpsProcessorNotFoundException("Unable to retrieve the selected process(es)", exception); } }
CalvalusDescribeProcessOperation extends WpsOperation { public List<ProcessDescriptionType> getProcesses(String processorId) throws WpsProcessorNotFoundException { CalvalusLogger.getLogger().info("Getting processors " + processorId + " for user " + this.calvalusFacade.getRemoteUserName()); try { String[] processorIdArray = processorId.split(","); List<ProcessDescriptionType> processDescriptionTypeList = new ArrayList<>(); List<WpsProcess> processors = new ArrayList<>(); if (processorId.equalsIgnoreCase("all")) { processors.addAll(calvalusFacade.getProcessors()); processors.addAll(localFacade.getProcessors()); processDescriptionTypeList.addAll(getMultipleProcessType(processors)); } else if (processorIdArray.length > 1) { processors.addAll(getMultipleCalvalusProcessors(calvalusFacade, processorIdArray)); processors.addAll(getMultipleLocalProcessors(processorIdArray)); processDescriptionTypeList.addAll(getMultipleProcessType(processors)); } else { ProcessorNameConverter parser = new ProcessorNameConverter(processorId); WpsProcess processor = localFacade.getProcessor(parser); if (processor == null) { processor = calvalusFacade.getProcessor(parser); } if (processor == null) { throw new WpsProcessorNotFoundException("Unable to retrieve processor '" + parser.getProcessorIdentifier() + "'"); } processDescriptionTypeList.add(getSingleProcess(processor)); } return processDescriptionTypeList; } catch (IOException | ProductSetsNotAvailableException | InvalidProcessorIdException exception) { throw new WpsProcessorNotFoundException("Unable to retrieve the selected process(es)", exception); } } }
CalvalusDescribeProcessOperation extends WpsOperation { public List<ProcessDescriptionType> getProcesses(String processorId) throws WpsProcessorNotFoundException { CalvalusLogger.getLogger().info("Getting processors " + processorId + " for user " + this.calvalusFacade.getRemoteUserName()); try { String[] processorIdArray = processorId.split(","); List<ProcessDescriptionType> processDescriptionTypeList = new ArrayList<>(); List<WpsProcess> processors = new ArrayList<>(); if (processorId.equalsIgnoreCase("all")) { processors.addAll(calvalusFacade.getProcessors()); processors.addAll(localFacade.getProcessors()); processDescriptionTypeList.addAll(getMultipleProcessType(processors)); } else if (processorIdArray.length > 1) { processors.addAll(getMultipleCalvalusProcessors(calvalusFacade, processorIdArray)); processors.addAll(getMultipleLocalProcessors(processorIdArray)); processDescriptionTypeList.addAll(getMultipleProcessType(processors)); } else { ProcessorNameConverter parser = new ProcessorNameConverter(processorId); WpsProcess processor = localFacade.getProcessor(parser); if (processor == null) { processor = calvalusFacade.getProcessor(parser); } if (processor == null) { throw new WpsProcessorNotFoundException("Unable to retrieve processor '" + parser.getProcessorIdentifier() + "'"); } processDescriptionTypeList.add(getSingleProcess(processor)); } return processDescriptionTypeList; } catch (IOException | ProductSetsNotAvailableException | InvalidProcessorIdException exception) { throw new WpsProcessorNotFoundException("Unable to retrieve the selected process(es)", exception); } } CalvalusDescribeProcessOperation(WpsRequestContext context); }
CalvalusDescribeProcessOperation extends WpsOperation { public List<ProcessDescriptionType> getProcesses(String processorId) throws WpsProcessorNotFoundException { CalvalusLogger.getLogger().info("Getting processors " + processorId + " for user " + this.calvalusFacade.getRemoteUserName()); try { String[] processorIdArray = processorId.split(","); List<ProcessDescriptionType> processDescriptionTypeList = new ArrayList<>(); List<WpsProcess> processors = new ArrayList<>(); if (processorId.equalsIgnoreCase("all")) { processors.addAll(calvalusFacade.getProcessors()); processors.addAll(localFacade.getProcessors()); processDescriptionTypeList.addAll(getMultipleProcessType(processors)); } else if (processorIdArray.length > 1) { processors.addAll(getMultipleCalvalusProcessors(calvalusFacade, processorIdArray)); processors.addAll(getMultipleLocalProcessors(processorIdArray)); processDescriptionTypeList.addAll(getMultipleProcessType(processors)); } else { ProcessorNameConverter parser = new ProcessorNameConverter(processorId); WpsProcess processor = localFacade.getProcessor(parser); if (processor == null) { processor = calvalusFacade.getProcessor(parser); } if (processor == null) { throw new WpsProcessorNotFoundException("Unable to retrieve processor '" + parser.getProcessorIdentifier() + "'"); } processDescriptionTypeList.add(getSingleProcess(processor)); } return processDescriptionTypeList; } catch (IOException | ProductSetsNotAvailableException | InvalidProcessorIdException exception) { throw new WpsProcessorNotFoundException("Unable to retrieve the selected process(es)", exception); } } CalvalusDescribeProcessOperation(WpsRequestContext context); List<ProcessDescriptionType> getProcesses(String processorId); }
CalvalusDescribeProcessOperation extends WpsOperation { public List<ProcessDescriptionType> getProcesses(String processorId) throws WpsProcessorNotFoundException { CalvalusLogger.getLogger().info("Getting processors " + processorId + " for user " + this.calvalusFacade.getRemoteUserName()); try { String[] processorIdArray = processorId.split(","); List<ProcessDescriptionType> processDescriptionTypeList = new ArrayList<>(); List<WpsProcess> processors = new ArrayList<>(); if (processorId.equalsIgnoreCase("all")) { processors.addAll(calvalusFacade.getProcessors()); processors.addAll(localFacade.getProcessors()); processDescriptionTypeList.addAll(getMultipleProcessType(processors)); } else if (processorIdArray.length > 1) { processors.addAll(getMultipleCalvalusProcessors(calvalusFacade, processorIdArray)); processors.addAll(getMultipleLocalProcessors(processorIdArray)); processDescriptionTypeList.addAll(getMultipleProcessType(processors)); } else { ProcessorNameConverter parser = new ProcessorNameConverter(processorId); WpsProcess processor = localFacade.getProcessor(parser); if (processor == null) { processor = calvalusFacade.getProcessor(parser); } if (processor == null) { throw new WpsProcessorNotFoundException("Unable to retrieve processor '" + parser.getProcessorIdentifier() + "'"); } processDescriptionTypeList.add(getSingleProcess(processor)); } return processDescriptionTypeList; } catch (IOException | ProductSetsNotAvailableException | InvalidProcessorIdException exception) { throw new WpsProcessorNotFoundException("Unable to retrieve the selected process(es)", exception); } } CalvalusDescribeProcessOperation(WpsRequestContext context); List<ProcessDescriptionType> getProcesses(String processorId);  }