File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed
protobuf/src/test/java/com/fasterxml/jackson/dataformat/protobuf Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ public class ReadSimpleTest extends ProtobufTestBase
23
23
+" repeated string values = 2 [packed=true];\n "
24
24
+"}\n "
25
25
;
26
-
26
+
27
27
final protected static String PROTOC_NAMED_STRINGS =
28
28
"message NamedStrings {\n "
29
29
+" required string name = 2;\n "
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .dataformat .protobuf .failing ;
2
+
3
+ import java .util .List ;
4
+
5
+ import com .fasterxml .jackson .dataformat .protobuf .ProtobufTestBase ;
6
+ import com .fasterxml .jackson .dataformat .protobuf .schema .*;
7
+
8
+ public class ReadCyclicSchema140Test extends ProtobufTestBase
9
+ {
10
+ final protected static String PROTOC_CYCLIC =
11
+ "message Front {\n "
12
+ +" optional string id = 1;\n "
13
+ +" optional Back id = 2;\n "
14
+ +"}\n "
15
+ +"message Back {\n "
16
+ +" optional string id = 1;\n "
17
+ +" optional string extra = 2;\n "
18
+ +" optional Front id = 3;\n "
19
+ +"}\n "
20
+ ;
21
+
22
+ public void testCyclicDefinition () throws Exception
23
+ {
24
+ ProtobufSchema schema = ProtobufSchemaLoader .std .parse (PROTOC_CYCLIC );
25
+ assertNotNull (schema );
26
+ List <String > all = schema .getMessageTypes ();
27
+ assertEquals (2 , all .size ());
28
+ assertEquals ("Front" , all .get (0 ));
29
+ assertEquals ("Back" , all .get (0 ));
30
+ ProtobufMessage msg = schema .getRootType ();
31
+ assertEquals (3 , msg .getFieldCount ());
32
+ ProtobufField f = msg .field ("id" );
33
+ assertNotNull (f );
34
+ assertEquals ("id" , f .name );
35
+
36
+ _verifyMessageFieldLinking (schema .getRootType ());
37
+ }
38
+
39
+ }
You can’t perform that action at this time.
0 commit comments