@Test public void detectsWhenEventSourceIsUnexpected() { ServiceTrait trait = ServiceTrait.builder() .sdkId("Foo") .arnNamespace("foo") .cloudTrailEventSource("REPLACE_ME_LATER") .cloudFormationName("AWS::Foo") .build(); ServiceShape service = ServiceShape.builder() .id("smithy.example#Foo") .version("123") .addTrait(trait) .build(); Model model = Model.builder().addShape(service).build(); EventSourceValidator validator = new EventSourceValidator(); List<ValidationEvent> events = validator.validate(model); ValidationEvent event = getMatchingEvent(events, validator.getName()); assertThat(event.getSeverity(), is(Severity.WARNING)); assertThat(event.getShapeId().get(), equalTo(service.getId())); assertThat(event.getMessage(), containsString("must not use placeholders")); }
@Override public List<ValidationEvent> validate(Model model) { return model.shapes(ServiceShape.class) .flatMap(service -> Trait.flatMapStream(service, ServiceTrait.class)) .flatMap(pair -> OptionalUtils.stream(validateService(pair.getLeft(), pair.getRight()))) .collect(toList()); }
EventSourceValidator extends AbstractValidator { @Override public List<ValidationEvent> validate(Model model) { return model.shapes(ServiceShape.class) .flatMap(service -> Trait.flatMapStream(service, ServiceTrait.class)) .flatMap(pair -> OptionalUtils.stream(validateService(pair.getLeft(), pair.getRight()))) .collect(toList()); } }
EventSourceValidator extends AbstractValidator { @Override public List<ValidationEvent> validate(Model model) { return model.shapes(ServiceShape.class) .flatMap(service -> Trait.flatMapStream(service, ServiceTrait.class)) .flatMap(pair -> OptionalUtils.stream(validateService(pair.getLeft(), pair.getRight()))) .collect(toList()); }  }
EventSourceValidator extends AbstractValidator { @Override public List<ValidationEvent> validate(Model model) { return model.shapes(ServiceShape.class) .flatMap(service -> Trait.flatMapStream(service, ServiceTrait.class)) .flatMap(pair -> OptionalUtils.stream(validateService(pair.getLeft(), pair.getRight()))) .collect(toList()); }  @Override List<ValidationEvent> validate(Model model); }
EventSourceValidator extends AbstractValidator { @Override public List<ValidationEvent> validate(Model model) { return model.shapes(ServiceShape.class) .flatMap(service -> Trait.flatMapStream(service, ServiceTrait.class)) .flatMap(pair -> OptionalUtils.stream(validateService(pair.getLeft(), pair.getRight()))) .collect(toList()); }  @Override List<ValidationEvent> validate(Model model);  }