11
11
12
12
#include " pandaproxy/schema_registry/error.h"
13
13
#include " pandaproxy/schema_registry/test/compatibility_avro.h"
14
+ #include " pandaproxy/schema_registry/types.h"
14
15
#include " pandaproxy/schema_registry/util.h"
15
16
16
17
#include < absl/algorithm/container.h>
@@ -21,13 +22,13 @@ namespace pps = pandaproxy::schema_registry;
21
22
constexpr std::string_view sv_string_def0{R"( {"type":"string"})" };
22
23
constexpr std::string_view sv_string_def1{R"( {"type": "string"})" };
23
24
constexpr std::string_view sv_int_def0{R"( {"type": "int"})" };
24
- const pps::canonical_schema_definition string_def0{
25
+ const pps::unparsed_schema_definition string_def0{
25
26
pps::make_schema_definition<json::UTF8<>>(sv_string_def0).value (),
26
27
pps::schema_type::avro};
27
- const pps::canonical_schema_definition string_def1{
28
+ const pps::unparsed_schema_definition string_def1{
28
29
pps::make_schema_definition<json::UTF8<>>(sv_string_def1).value (),
29
30
pps::schema_type::avro};
30
- const pps::canonical_schema_definition int_def0{
31
+ const pps::unparsed_schema_definition int_def0{
31
32
pps::make_schema_definition<json::UTF8<>>(sv_int_def0).value (),
32
33
pps::schema_type::avro};
33
34
const pps::subject subject0{" subject0" };
@@ -72,7 +73,7 @@ BOOST_AUTO_TEST_CASE(test_store_insert) {
72
73
bool upsert (
73
74
pps::store& store,
74
75
pps::subject sub,
75
- pps::canonical_schema_definition def,
76
+ pps::unparsed_schema_definition def,
76
77
pps::schema_type,
77
78
pps::schema_id id,
78
79
pps::schema_version version,
@@ -207,8 +208,7 @@ BOOST_AUTO_TEST_CASE(test_store_get_schema_subject_versions) {
207
208
pps::seq_marker dummy_marker;
208
209
209
210
// First insert, expect id{1}
210
- auto ins_res = s.insert (
211
- {subject0, pps::canonical_schema_definition (schema1.share ())});
211
+ auto ins_res = s.insert (pps::to_unparsed ({subject0, schema1.share ()}));
212
212
BOOST_REQUIRE (ins_res.inserted );
213
213
BOOST_REQUIRE_EQUAL (ins_res.id , pps::schema_id{1 });
214
214
BOOST_REQUIRE_EQUAL (ins_res.version , pps::schema_version{1 });
@@ -222,8 +222,7 @@ BOOST_AUTO_TEST_CASE(test_store_get_schema_subject_versions) {
222
222
BOOST_REQUIRE (versions.empty ());
223
223
224
224
// Second insert, expect id{2}
225
- ins_res = s.insert (
226
- {subject0, pps::canonical_schema_definition (schema2.share ())});
225
+ ins_res = s.insert (pps::to_unparsed ({subject0, schema2.share ()}));
227
226
BOOST_REQUIRE (ins_res.inserted );
228
227
BOOST_REQUIRE_EQUAL (ins_res.id , pps::schema_id{2 });
229
228
BOOST_REQUIRE_EQUAL (ins_res.version , pps::schema_version{2 });
@@ -259,8 +258,7 @@ BOOST_AUTO_TEST_CASE(test_store_get_schema_subjects) {
259
258
pps::seq_marker dummy_marker;
260
259
261
260
// First insert, expect id{1}
262
- auto ins_res = s.insert (
263
- {subject0, pps::canonical_schema_definition (schema1.share ())});
261
+ auto ins_res = s.insert (pps::to_unparsed ({subject0, schema1.share ()}));
264
262
BOOST_REQUIRE (ins_res.inserted );
265
263
BOOST_REQUIRE_EQUAL (ins_res.id , pps::schema_id{1 });
266
264
BOOST_REQUIRE_EQUAL (ins_res.version , pps::schema_version{1 });
@@ -271,15 +269,13 @@ BOOST_AUTO_TEST_CASE(test_store_get_schema_subjects) {
271
269
BOOST_REQUIRE_EQUAL (absl::c_count_if (subjects, is_equal (subject0)), 1 );
272
270
273
271
// Second insert, same schema, expect id{1}
274
- ins_res = s.insert (
275
- {subject1, pps::canonical_schema_definition (schema1.share ())});
272
+ ins_res = s.insert (pps::to_unparsed ({subject1, schema1.share ()}));
276
273
BOOST_REQUIRE (ins_res.inserted );
277
274
BOOST_REQUIRE_EQUAL (ins_res.id , pps::schema_id{1 });
278
275
BOOST_REQUIRE_EQUAL (ins_res.version , pps::schema_version{1 });
279
276
280
277
// Insert yet another schema associated with a different subject
281
- ins_res = s.insert (
282
- {subject2, pps::canonical_schema_definition (schema2.share ())});
278
+ ins_res = s.insert (pps::to_unparsed ({subject2, schema2.share ()}));
283
279
BOOST_REQUIRE (ins_res.inserted );
284
280
BOOST_REQUIRE_EQUAL (ins_res.id , pps::schema_id{2 });
285
281
BOOST_REQUIRE_EQUAL (ins_res.version , pps::schema_version{1 });
0 commit comments