@@ -94,42 +94,42 @@ class RecordSchemaResolverTest : public ::testing::Test {
9494 void SetUp () override {
9595 auto avro_schema_id = sr->create_schema (
9696 subject_schema{
97- subject{ " foo-value" } ,
97+ context_subject::unqualified ( " foo-value" ) ,
9898 schema_definition{
9999 avro_record_schema, schema_type::avro}})
100100 .get ();
101101 ASSERT_EQ (1 , avro_schema_id.id ());
102102 auto pb_schema_id = sr->create_schema (
103103 subject_schema{
104- subject{ " foo-value" } ,
104+ context_subject::unqualified ( " foo-value" ) ,
105105 schema_definition{
106106 pb_record_schema, schema_type::protobuf}})
107107 .get ();
108108 ASSERT_EQ (2 , pb_schema_id.id ());
109109 auto json_schema_id = sr->create_schema (
110110 subject_schema{
111- subject{ " foo-value" } ,
111+ context_subject::unqualified ( " foo-value" ) ,
112112 schema_definition{
113113 json_record_schema, schema_type::json}})
114114 .get ();
115115 ASSERT_EQ (3 , json_schema_id.id ());
116116 avro_schema_id = sr->create_schema (
117117 subject_schema{
118- subject{ " latest-avro" } ,
118+ context_subject::unqualified ( " latest-avro" ) ,
119119 schema_definition{
120120 avro_record_schema, schema_type::avro}})
121121 .get ();
122122 ASSERT_EQ (1 , avro_schema_id.id ());
123123 pb_schema_id = sr->create_schema (
124124 subject_schema{
125- subject{ " latest-proto" } ,
125+ context_subject::unqualified ( " latest-proto" ) ,
126126 schema_definition{
127127 pb_record_schema, schema_type::protobuf}})
128128 .get ();
129129 ASSERT_EQ (2 , pb_schema_id.id ());
130130 json_schema_id = sr->create_schema (
131131 subject_schema{
132- subject{ " latest-json" } ,
132+ context_subject::unqualified ( " latest-json" ) ,
133133 schema_definition{
134134 json_record_schema, schema_type::json}})
135135 .get ();
@@ -257,14 +257,14 @@ message NestedMessage {
257257)" ;
258258 auto pb_schema_id = sr->create_schema (
259259 subject_schema{
260- subject{ " simple_schema" } ,
260+ context_subject::unqualified ( " simple_schema" ) ,
261261 schema_definition{
262262 pb_simple_schema, schema_type::protobuf}})
263263 .get ();
264264 ASSERT_EQ (7 , pb_schema_id.id ());
265265 pb_schema_id = sr->create_schema (
266266 subject_schema{
267- subject{ " references_schema" } ,
267+ context_subject::unqualified ( " references_schema" ) ,
268268 schema_definition{
269269 pb_references_schema,
270270 schema_type::protobuf,
@@ -537,9 +537,8 @@ namespace {
537537struct counting_store : public pandaproxy ::schema_registry::schema_getter {
538538 counting_store (
539539 schema::fake_registry& registry,
540- absl::flat_hash_map<
541- pandaproxy::schema_registry::context_schema_id,
542- size_t >& counts)
540+ absl::flat_hash_map<pandaproxy::schema_registry::schema_id, size_t >&
541+ counts)
543542 : registry(registry)
544543 , counts(counts) {}
545544
@@ -554,22 +553,23 @@ struct counting_store : public pandaproxy::schema_registry::schema_getter {
554553 ss::future<pandaproxy::schema_registry::schema_definition>
555554 get_schema_definition (
556555 pandaproxy::schema_registry::context_schema_id id) final {
557- counts[id] += 1 ;
556+ vassert (id.ctx == default_context, " unexpected context {}" , id.ctx );
557+ counts[id.id ] += 1 ;
558558 auto * getter = co_await registry.getter ();
559559 co_return co_await getter->get_schema_definition (id);
560560 }
561561
562562 ss::future<std::optional<pandaproxy::schema_registry::schema_definition>>
563563 maybe_get_schema_definition (
564564 pandaproxy::schema_registry::context_schema_id id) final {
565- counts[id] += 1 ;
565+ vassert (id.ctx == default_context, " unexpected context {}" , id.ctx );
566+ counts[id.id ] += 1 ;
566567 auto * getter = co_await registry.getter ();
567568 co_return co_await getter->maybe_get_schema_definition (id);
568569 }
569570
570571 schema::fake_registry& registry;
571- absl::flat_hash_map<pandaproxy::schema_registry::context_schema_id, size_t >&
572- counts;
572+ absl::flat_hash_map<pandaproxy::schema_registry::schema_id, size_t >& counts;
573573};
574574
575575class counting_registry : public schema ::registry {
@@ -610,15 +610,15 @@ class counting_registry : public schema::registry {
610610 return _registry.get_all ();
611611 }
612612
613- size_t get_count (pandaproxy::schema_registry::context_schema_id id) {
613+ size_t get_count (pandaproxy::schema_registry::schema_id id) {
614614 return _counts[id];
615615 }
616616
617617 void reset_counts () { _counts.clear (); }
618618
619619private:
620620 schema::fake_registry _registry{};
621- absl::flat_hash_map<pandaproxy::schema_registry::context_schema_id , size_t >
621+ absl::flat_hash_map<pandaproxy::schema_registry::schema_id , size_t >
622622 _counts{};
623623 mutable counting_store _store{_registry, _counts};
624624};
@@ -632,14 +632,14 @@ std::unique_ptr<counting_registry> make_counting_sr() {
632632
633633 auto avro_schema_id = sr->create_schema (
634634 subject_schema{
635- subject{ " foo-value" } ,
635+ context_subject::unqualified ( " foo-value" ) ,
636636 schema_definition{
637637 avro_record_schema, schema_type::avro}})
638638 .get ();
639639 vassert (1 == avro_schema_id.id (), " failed to registry avro schema" );
640640 auto pb_schema_id = sr->create_schema (
641641 subject_schema{
642- subject{ " foo-value" } ,
642+ context_subject::unqualified ( " foo-value" ) ,
643643 schema_definition{
644644 pb_record_schema, schema_type::protobuf}})
645645 .get ();
@@ -656,7 +656,7 @@ std::unique_ptr<counting_registry> make_counting_sr() {
656656 for (auto i = 3 ; i < 10 ; i++) {
657657 auto pb_schema_id = sr->create_schema (
658658 subject_schema{
659- subject{ " foo-value" } ,
659+ context_subject::unqualified ( " foo-value" ) ,
660660 schema_definition{
661661 get_simple_schema (i),
662662 schema_type::protobuf}})
@@ -665,7 +665,7 @@ std::unique_ptr<counting_registry> make_counting_sr() {
665665 }
666666 auto json_schema_id = sr->create_schema (
667667 subject_schema{
668- subject{ " foo-value" } ,
668+ context_subject::unqualified ( " foo-value" ) ,
669669 schema_definition{
670670 json_record_schema, schema_type::json}})
671671 .get ();
0 commit comments