@@ -4,50 +4,10 @@ Library Collections
4
4
Library String
5
5
6
6
Suite Setup Starting Test
7
- Suite Teardown Stop Thread
8
7
9
8
10
9
*** Test Cases ***
11
- Avro Producer With Schemas As String Argument
12
- [Setup] Clear Messages From Thread ${MAIN_THREAD }
13
- ${value_schema } = Set Variable {"namespace": "example.avro","type": "record","name": "User","fields": [{"name": "name","type": "string"},{"name": "number","type": ["int","null"]}]}
14
- ${key_schema } = Set Variable {"namespace": "example.avro","type": "record","name": "User","fields": [{"name": "name","type": "string"}]}
15
- ${producer_id } = Create Producer schema_registry_url=http://127.0.0.1:8081
16
- ... value_schema=${value_schema } key_schema=${key_schema }
17
- ${value } = Create Dictionary name=Robot number=${10 }
18
- Produce group_id=${producer_id } topic=avro_testing1 partition=${0 } value=${value } key=${KEY_FOR_SCHEMA }
19
- Wait Until Keyword Succeeds 10x 0.5s All Messages Are Delivered ${producer_id }
20
- Sleep 1s
21
-
22
- ${consumer_group_id } = Create Consumer auto_offset_reset=earliest schema_registry_url=http://127.0.0.1:8081
23
- Subscribe Topic group_id=${consumer_group_id } topics=avro_testing1
24
- ${messages } = Poll group_id=${consumer_group_id }
25
- Should Be Equal ${TEST_DATA } ${messages }
26
- ${thread_messages } = Get Messages From Thread ${MAIN_THREAD }
27
- Should Be Equal ${TEST_DATA } ${thread_messages }
28
- [Teardown] Basic Teardown ${consumer_group_id }
29
-
30
- Avro Producer With Path To Schemas
31
- [Setup] Clear Messages From Thread ${MAIN_THREAD }
32
- ${value_schema_file_path } = Set Variable examples/schema/avro/ValueSchema.avsc
33
- ${key_schema_file_path } = Set Variable examples/schema/avro/KeySchema.avsc
34
- ${producer_id } = Create Producer schema_registry_url=http://127.0.0.1:8081
35
- ... value_schema=${value_schema_file_path } key_schema=${key_schema_file_path }
36
- ${value } = Create Dictionary name=Robot number=${10 }
37
- Produce group_id=${producer_id } topic=avro_testing2 partition=${0 } value=${value } key=${KEY_FOR_SCHEMA }
38
- Wait Until Keyword Succeeds 10x 0.5s All Messages Are Delivered ${producer_id }
39
- Sleep 1s
40
-
41
- ${consumer_group_id } = Create Consumer auto_offset_reset=earliest schema_registry_url=http://127.0.0.1:8081
42
- Subscribe Topic group_id=${consumer_group_id } topics=avro_testing2
43
- ${messages } = Poll group_id=${consumer_group_id }
44
- Should Be Equal ${TEST_DATA } ${messages }
45
- ${thread_messages } = Get Messages From Thread ${MAIN_THREAD }
46
- Should Be Equal ${TEST_DATA } ${thread_messages }
47
- [Teardown] Basic Teardown ${consumer_group_id }
48
-
49
10
Avro Producer Consumer With Serializers
50
- [Setup] Clear Messages From Thread ${MAIN_THREAD }
51
11
${schema_registry_conf } = Create Dictionary url=http://127.0.0.1:8081
52
12
${schema_registry_client } = Get Schema Registry Client ${schema_registry_conf }
53
13
${schema_str } = Set Variable {"namespace": "example.avro","type": "record","name": "User","fields": [{"name": "name","type": "string"},{"name": "number","type": ["int","null"]}]}
@@ -56,16 +16,16 @@ Avro Producer Consumer With Serializers
56
16
${string_serializer } = Get String Serializer
57
17
${string_deserializer } = Get String Deserializer
58
18
59
- ${producer_id } = Create Producer key_serializer=${string_serializer } value_serializer=${avro_serializer } legacy =${False }
19
+ ${producer_id } = Create Producer key_serializer=${string_serializer } value_serializer=${avro_serializer } serializing =${True }
60
20
${value } = Create Dictionary name=Robot number=${10 }
61
- Produce group_id=${producer_id } topic=avro_testing3 partition=${0 } value=${value } key=568a68fd-2785-44cc-8997-1295c3755d28
21
+ Produce group_id=${producer_id } topic=avro_testing1 partition=${0 } value=${value } key=${ KEY }
62
22
Wait Until Keyword Succeeds 10x 0.5s All Messages Are Delivered ${producer_id }
63
23
64
- ${consumer_group_id } = Create Consumer auto_offset_reset=latest key_deserializer=${string_deserializer } value_deserializer=${avro_deserializer } legacy =${False }
65
- Subscribe Topic group_id=${consumer_group_id } topics=avro_testing3
24
+ ${consumer_group_id } = Create Consumer auto_offset_reset=latest key_deserializer=${string_deserializer } value_deserializer=${avro_deserializer } deserializing =${True }
25
+ Subscribe Topic group_id=${consumer_group_id } topics=avro_testing1
66
26
Poll group_id=${consumer_group_id } # Dummy poll when using offset reset 'latest'
67
27
68
- Produce group_id=${producer_id } topic=avro_testing3 value=${value } partition=${0 } key=568a68fd-2785-44cc-8997-1295c3755d28
28
+ Produce group_id=${producer_id } topic=avro_testing1 value=${value } partition=${0 } key=${ KEY }
69
29
Wait Until Keyword Succeeds 10x 0.5s All Messages Are Delivered ${producer_id }
70
30
${messages } = Poll group_id=${consumer_group_id }
71
31
Should Be Equal ${messages } ${TEST_DATA }
@@ -74,28 +34,13 @@ Avro Producer Consumer With Serializers
74
34
75
35
*** Keywords ***
76
36
Starting Test
77
- Set Suite Variable @{TEST_TOPIC } avro_testing1 avro_testing2 avro_testing3
37
+ Set Suite Variable @{TEST_TOPIC } avro_testing1
78
38
Set Suite Variable ${KEY } 568a68fd-2785-44cc-8997-1295c3755d28
79
- Set Suite Variable &{KEY_FOR_SCHEMA } name=testkey
80
39
81
40
${value } = Create Dictionary name=Robot number=${10 }
82
41
${data } = Create List ${value }
83
42
Set Suite Variable ${TEST_DATA } ${data }
84
43
85
- # Rewrite to support topic creation via AdminClient
86
- ${value_schema } = Set Variable {"namespace": "example.avro","type": "record","name": "User","fields": [{"name": "name","type": "string"},{"name": "number","type": ["int","null"]}]}
87
- ${key_schema } = Set Variable {"namespace": "example.avro","type": "record","name": "User","fields": [{"name": "name","type": "string"}]}
88
- ${producer_id } = Create Producer schema_registry_url=http://127.0.0.1:8081
89
- ... value_schema=${value_schema } key_schema=${key_schema }
90
-
91
- Produce group_id=${producer_id } topic=avro_testing1 partition=${0 } value=${value } key=${KEY_FOR_SCHEMA }
92
- Wait Until Keyword Succeeds 10x 0.5s All Messages Are Delivered ${producer_id }
93
- Produce group_id=${producer_id } topic=avro_testing2 partition=${0 } value=${value } key=${KEY_FOR_SCHEMA }
94
- Wait Until Keyword Succeeds 10x 0.5s All Messages Are Delivered ${producer_id }
95
-
96
- ${thread } = Start Consumer Threaded topics=${TEST_TOPIC } schema_registry_url=http://127.0.0.1:8081 auto_offset_reset=latest
97
- Set Suite Variable ${MAIN_THREAD } ${thread }
98
-
99
44
All Messages Are Delivered
100
45
[Arguments] ${producer_id }
101
46
${count } = Flush ${producer_id }
@@ -109,8 +54,4 @@ Basic Teardown
109
54
${groups } = Create List ${group_id }
110
55
${admin_client_id } = Create Admin Client
111
56
${resp } = Delete Groups ${admin_client_id } group_ids=${groups }
112
- Log ${resp }
113
-
114
- Stop Thread
115
- ${resp } = Stop Consumer Threaded ${MAIN_THREAD }
116
57
Log ${resp }
0 commit comments