@Test public void testWithTopologyNameButNoServices() { GatewayTopologyV4Request gatewayTopologyJson = new GatewayTopologyV4Request(); gatewayTopologyJson.setTopologyName("topology"); ValidationResult result = underTest.validate(gatewayTopologyJson); assertEquals(State.VALID, result.getState()); }
@Override public ValidationResult validate(GatewayTopologyV4Request subject) { ValidationResult topologyNameResult = ValidationResult.builder() .ifError(() -> StringUtils.isBlank(subject.getTopologyName()), "topologyName must be set in gateway topology.") .build(); return Optional.ofNullable(subject.getExposedServices()) .map(exposedServiceListValidator::validate) .map(vr -> vr.merge(topologyNameResult)) .orElse(topologyNameResult); }
GatewayTopologyV4RequestValidator implements Validator<GatewayTopologyV4Request> { @Override public ValidationResult validate(GatewayTopologyV4Request subject) { ValidationResult topologyNameResult = ValidationResult.builder() .ifError(() -> StringUtils.isBlank(subject.getTopologyName()), "topologyName must be set in gateway topology.") .build(); return Optional.ofNullable(subject.getExposedServices()) .map(exposedServiceListValidator::validate) .map(vr -> vr.merge(topologyNameResult)) .orElse(topologyNameResult); } }
GatewayTopologyV4RequestValidator implements Validator<GatewayTopologyV4Request> { @Override public ValidationResult validate(GatewayTopologyV4Request subject) { ValidationResult topologyNameResult = ValidationResult.builder() .ifError(() -> StringUtils.isBlank(subject.getTopologyName()), "topologyName must be set in gateway topology.") .build(); return Optional.ofNullable(subject.getExposedServices()) .map(exposedServiceListValidator::validate) .map(vr -> vr.merge(topologyNameResult)) .orElse(topologyNameResult); } GatewayTopologyV4RequestValidator(ExposedServiceListValidator exposedServiceListValidator); }
GatewayTopologyV4RequestValidator implements Validator<GatewayTopologyV4Request> { @Override public ValidationResult validate(GatewayTopologyV4Request subject) { ValidationResult topologyNameResult = ValidationResult.builder() .ifError(() -> StringUtils.isBlank(subject.getTopologyName()), "topologyName must be set in gateway topology.") .build(); return Optional.ofNullable(subject.getExposedServices()) .map(exposedServiceListValidator::validate) .map(vr -> vr.merge(topologyNameResult)) .orElse(topologyNameResult); } GatewayTopologyV4RequestValidator(ExposedServiceListValidator exposedServiceListValidator); @Override ValidationResult validate(GatewayTopologyV4Request subject); }
GatewayTopologyV4RequestValidator implements Validator<GatewayTopologyV4Request> { @Override public ValidationResult validate(GatewayTopologyV4Request subject) { ValidationResult topologyNameResult = ValidationResult.builder() .ifError(() -> StringUtils.isBlank(subject.getTopologyName()), "topologyName must be set in gateway topology.") .build(); return Optional.ofNullable(subject.getExposedServices()) .map(exposedServiceListValidator::validate) .map(vr -> vr.merge(topologyNameResult)) .orElse(topologyNameResult); } GatewayTopologyV4RequestValidator(ExposedServiceListValidator exposedServiceListValidator); @Override ValidationResult validate(GatewayTopologyV4Request subject);  }