MicroPipelineValidator { protected MicroPipelineValidationResult validateQueue(final StreamingMessageQueueConfiguration queueCfg, final Set<String> queueIdentifiers) { if(queueCfg == null) return MicroPipelineValidationResult.MISSING_QUEUE_CONFIGURATION; if(StringUtils.isBlank(queueCfg.getId())) return MicroPipelineValidationResult.MISSING_QUEUE_ID; String tempId = StringUtils.lowerCase(StringUtils.trim(queueCfg.getId())); if(queueIdentifiers.contains(tempId)) return MicroPipelineValidationResult.NON_UNIQUE_QUEUE_ID; return MicroPipelineValidationResult.OK; }  MicroPipelineValidationResult validate(final MicroPipelineConfiguration configuration);  }
@Test public void testValidateQueue_withNullInput() { Assert.assertEquals("Missing queue configuration", MicroPipelineValidationResult.MISSING_QUEUE_CONFIGURATION, new MicroPipelineValidator().validateQueue(null, Collections.<String>emptySet())); }
@Test public void testValidateQueue_withMissingQueueId() { Assert.assertEquals("Missing queue configuration", MicroPipelineValidationResult.MISSING_QUEUE_ID, new MicroPipelineValidator().validateQueue(new StreamingMessageQueueConfiguration(""), Collections.<String>emptySet())); }
@Test public void testValidateQueue_withDuplicateQueueId() { Set<String> queueIdentifiers = new HashSet<String>(); queueIdentifiers.add("test-id"); Assert.assertEquals("Missing queue configuration", MicroPipelineValidationResult.NON_UNIQUE_QUEUE_ID, new MicroPipelineValidator().validateQueue(new StreamingMessageQueueConfiguration("test-id"), queueIdentifiers)); }