Skip to content

Commit c4b9d90

Browse files
committed
Merge branch '2.9' into 2.10
2 parents 6cf970c + d7633f2 commit c4b9d90

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

protobuf/src/test/java/com/fasterxml/jackson/dataformat/protobuf/ReadSimpleTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class ReadSimpleTest extends ProtobufTestBase
2323
+" repeated string values = 2 [packed=true];\n"
2424
+"}\n"
2525
;
26-
26+
2727
final protected static String PROTOC_NAMED_STRINGS =
2828
"message NamedStrings {\n"
2929
+" required string name = 2;\n"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
}

0 commit comments

Comments
 (0)