use of com.spotify.protoman.validation.ValidationViolation in project protoman by spotify.
the class MethodServerStreamingCompatibilityRuleTest method testServerStreamingToServerUnary.
@Test
public void testServerStreamingToServerUnary() throws Exception {
final DescriptorSet current = DescriptorSetUtils.buildDescriptorSet("a.proto", "syntax = 'proto3';\n" + "service Derp {\n" + " rpc GetDerp (Empty) returns (stream Empty);\n" + "}\n" + "message Empty {}\n");
final DescriptorSet candidate = DescriptorSetUtils.buildDescriptorSet("a.proto", "syntax = 'proto3';\n" + "service Derp {\n" + " rpc GetDerp (Empty) returns (Empty);\n" + "}\n" + "message Empty {}\n");
final ImmutableList<ValidationViolation> violations = schemaValidator.validate(current, candidate);
assertThat(violations, contains(validationViolation().description(equalTo("changed to/from server streaming")).type(equalTo(ViolationType.WIRE_INCOMPATIBILITY_VIOLATION))));
}
use of com.spotify.protoman.validation.ValidationViolation in project protoman by spotify.
the class OneofNamingRuleTest method testAllowedName_new.
@Parameters(method = "allowedNames")
@Test
public void testAllowedName_new(final String name) throws Exception {
final DescriptorSet current = DescriptorSet.empty();
final DescriptorSet candidate = DescriptorSetUtils.buildDescriptorSet("a.proto", String.format(TEMPLATE, name));
final ImmutableList<ValidationViolation> violations = schemaValidator.validate(current, candidate);
assertThat(violations, is(empty()));
}
use of com.spotify.protoman.validation.ValidationViolation in project protoman by spotify.
the class OneofNamingRuleTest method testAllowedName_existing.
@Parameters(method = "allowedNames")
@Test
public void testAllowedName_existing(final String name) throws Exception {
final DescriptorSet candidate = DescriptorSetUtils.buildDescriptorSet("a.proto", String.format(TEMPLATE, name));
final ImmutableList<ValidationViolation> violations = schemaValidator.validate(candidate, candidate);
assertThat(violations, is(empty()));
}
use of com.spotify.protoman.validation.ValidationViolation in project protoman by spotify.
the class PackageNamingRuleTest method testAllowedName.
@Parameters(method = "allowedNames")
@Test
public void testAllowedName(final String name) throws Exception {
final DescriptorSet current = DescriptorSet.empty();
final DescriptorSet candidate = DescriptorSetUtils.buildDescriptorSet("a.proto", String.format(TEMPLATE, name));
final ImmutableList<ValidationViolation> violations = schemaValidator.validate(current, candidate);
assertThat(violations, is(empty()));
}
use of com.spotify.protoman.validation.ValidationViolation in project protoman by spotify.
the class ServiceNamingRuleTest method testDisallowedName_existing.
@Parameters(method = "disallowedNames")
@Test
public void testDisallowedName_existing(final String name) throws Exception {
final DescriptorSet candidate = DescriptorSetUtils.buildDescriptorSet("a.proto", "syntax = 'proto3';\n" + String.format("service %s {\n", name) + "}");
final ImmutableList<ValidationViolation> violations = schemaValidator.validate(candidate, candidate);
assertThat(violations, is(empty()));
}
Aggregations