@Test public void validateWithViolation() { when(diagramService.getRawContent(diagram)).thenReturn(getSerializedProcess(BPMN_VALIDATION_ISSUES)); bpmnValidador.validate(diagram, result -> { assertNotNull(result); assertEquals(10, result.size()); assertTrue(result.stream().map(DomainViolation::getViolationType).allMatch(t -> Violation.Type.WARNING.equals(t))); assertEquals(10, result.stream().map(DomainViolation::getUUID).filter(StringUtils::nonEmpty).count()); assertEquals(4, result.stream() .map(DomainViolation::getUUID) .filter("_426E32AD-E08B-4025-B201-9850EEC82254"::equals) .count()); assertEquals(3, result.stream() .map(DomainViolation::getUUID) .filter("_3E6C197E-FF8A-41F4-AEB6-710454E8529C"::equals) .count()); assertEquals(1, result.stream() .map(DomainViolation::getUUID) .filter("_0F455E77-669C-480F-A4A2-C5070EF1A83F"::equals) .count()); assertEquals(2, result.stream() .map(DomainViolation::getUUID) .filter("_5B1068ED-1260-41FD-B7C1-226CB909E569"::equals) .count()); }); }
@Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); }
BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } }
BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject  BPMNValidatorImpl(final @Default DiagramService diagramService); }
BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject  BPMNValidatorImpl(final @Default DiagramService diagramService); @Override void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer); @Override String getDefinitionSetId(); }
BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject  BPMNValidatorImpl(final @Default DiagramService diagramService); @Override void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer); @Override String getDefinitionSetId();  }