use of org.apache.servicecomb.foundation.protobuf.internal.parser.ProtoParser in project incubator-servicecomb-java-chassis by apache.
the class TestProtoToStringGenerator method protoToString.
@Test
public void protoToString() {
ProtoParser protoParser = new ProtoParser();
Proto proto = protoParser.parseFromContent(content);
String newContent = new ProtoToStringGenerator(proto).protoToString();
Assert.assertEquals(content, newContent);
}
use of org.apache.servicecomb.foundation.protobuf.internal.parser.ProtoParser in project java-chassis by ServiceComb.
the class SwaggerToProtoGenerator method createProto.
protected Proto createProto() {
StringBuilder sb = new StringBuilder();
appendLine(sb, "syntax = \"proto3\";");
for (String importMsg : imports) {
appendLine(sb, "import \"%s\";", importMsg);
}
if (StringUtils.isNotEmpty(protoPackage)) {
sb.append("package ").append(protoPackage).append(";\n");
}
sb.append(msgStringBuilder);
sb.append(serviceBuilder);
ProtoParser protoParser = new ProtoParser();
return protoParser.parseFromContent(sb.toString());
}
use of org.apache.servicecomb.foundation.protobuf.internal.parser.ProtoParser in project java-chassis by ServiceComb.
the class TestProtoToStringGenerator method protoToString.
@Test
public void protoToString() {
ProtoParser protoParser = new ProtoParser();
Proto proto = protoParser.parseFromContent(content);
String newContent = new ProtoToStringGenerator(proto).protoToString();
Assert.assertEquals(content, newContent);
}
use of org.apache.servicecomb.foundation.protobuf.internal.parser.ProtoParser in project incubator-servicecomb-java-chassis by apache.
the class SwaggerToProtoGenerator method createProto.
protected Proto createProto() {
StringBuilder sb = new StringBuilder();
appendLine(sb, "syntax = \"proto3\";");
for (String importMsg : imports) {
appendLine(sb, "import \"%s\";", importMsg);
}
if (StringUtils.isNotEmpty(protoPackage)) {
sb.append("package ").append(protoPackage).append(";\n");
}
sb.append(msgStringBuilder);
sb.append(serviceBuilder);
ProtoParser protoParser = new ProtoParser();
return protoParser.parseFromContent(sb.toString());
}
Aggregations