| Index: third_party/protobuf/conformance/ConformanceJavaLite.java
|
| diff --git a/third_party/protobuf/conformance/ConformanceJava.java b/third_party/protobuf/conformance/ConformanceJavaLite.java
|
| similarity index 71%
|
| copy from third_party/protobuf/conformance/ConformanceJava.java
|
| copy to third_party/protobuf/conformance/ConformanceJavaLite.java
|
| index a983ba3c8a6b1f37978daa84730b85e04eda8dc9..121dc7d1b6a1757b22537d00a2abcb485a081f91 100644
|
| --- a/third_party/protobuf/conformance/ConformanceJava.java
|
| +++ b/third_party/protobuf/conformance/ConformanceJavaLite.java
|
| @@ -1,12 +1,9 @@
|
|
|
| import com.google.protobuf.conformance.Conformance;
|
| -import com.google.protobuf.util.JsonFormat;
|
| -import com.google.protobuf.util.JsonFormat.TypeRegistry;
|
| import com.google.protobuf.InvalidProtocolBufferException;
|
|
|
| -class ConformanceJava {
|
| +class ConformanceJavaLite {
|
| private int testCount = 0;
|
| - private TypeRegistry typeRegistry;
|
|
|
| private boolean readFromStdin(byte[] buf, int len) throws Exception {
|
| int ofs = 0;
|
| @@ -60,15 +57,8 @@ class ConformanceJava {
|
| break;
|
| }
|
| case JSON_PAYLOAD: {
|
| - try {
|
| - Conformance.TestAllTypes.Builder builder = Conformance.TestAllTypes.newBuilder();
|
| - JsonFormat.parser().usingTypeRegistry(typeRegistry)
|
| - .merge(request.getJsonPayload(), builder);
|
| - testMessage = builder.build();
|
| - } catch (InvalidProtocolBufferException e) {
|
| - return Conformance.ConformanceResponse.newBuilder().setParseError(e.getMessage()).build();
|
| - }
|
| - break;
|
| + return Conformance.ConformanceResponse.newBuilder().setSkipped(
|
| + "Lite runtime does not suport Json Formant.").build();
|
| }
|
| case PAYLOAD_NOT_SET: {
|
| throw new RuntimeException("Request didn't have payload.");
|
| @@ -87,13 +77,8 @@ class ConformanceJava {
|
| return Conformance.ConformanceResponse.newBuilder().setProtobufPayload(testMessage.toByteString()).build();
|
|
|
| case JSON:
|
| - try {
|
| - return Conformance.ConformanceResponse.newBuilder().setJsonPayload(
|
| - JsonFormat.printer().usingTypeRegistry(typeRegistry).print(testMessage)).build();
|
| - } catch (InvalidProtocolBufferException | IllegalArgumentException e) {
|
| - return Conformance.ConformanceResponse.newBuilder().setSerializeError(
|
| - e.getMessage()).build();
|
| - }
|
| + return Conformance.ConformanceResponse.newBuilder().setSkipped(
|
| + "Lite runtime does not suport Json Formant.").build();
|
|
|
| default: {
|
| throw new RuntimeException("Unexpected request output.");
|
| @@ -126,17 +111,15 @@ class ConformanceJava {
|
| }
|
|
|
| public void run() throws Exception {
|
| - typeRegistry = TypeRegistry.newBuilder().add(
|
| - Conformance.TestAllTypes.getDescriptor()).build();
|
| while (doTestIo()) {
|
| - // Empty.
|
| + this.testCount++;
|
| }
|
|
|
| - System.err.println("ConformanceJava: received EOF from test runner after " +
|
| + System.err.println("ConformanceJavaLite: received EOF from test runner after " +
|
| this.testCount + " tests");
|
| }
|
|
|
| public static void main(String[] args) throws Exception {
|
| - new ConformanceJava().run();
|
| + new ConformanceJavaLite().run();
|
| }
|
| }
|
|
|