Skip to content

Commit

Permalink
Merge pull request #3243 from confluentinc/mock-contexts5
Browse files Browse the repository at this point in the history
DGS-16357 Include default ctx in mock getContexts() (#33)
  • Loading branch information
rayokota authored Aug 20, 2024
2 parents 4c4ce16 + 62fe8b2 commit 30f6bf4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package io.confluent.kafka.schemaregistry.client;

import static io.confluent.kafka.schemaregistry.utils.QualifiedSubject.DEFAULT_CONTEXT;
import static io.confluent.kafka.schemaregistry.utils.QualifiedSubject.DEFAULT_TENANT;

import com.google.common.collect.Lists;
Expand Down Expand Up @@ -716,8 +715,8 @@ public String getMode(String subject) throws IOException, RestClientException {
public Collection<String> getAllContexts() throws IOException, RestClientException {
List<String> results = new ArrayList<>(schemaToIdCache.keySet()).stream()
.map(s -> QualifiedSubject.create(DEFAULT_TENANT, s).getContext())
.filter(s -> !s.isEmpty() && !s.equals(DEFAULT_CONTEXT))
.sorted()
.distinct()
.collect(Collectors.toList());
return results;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,16 @@ public void testGetAllContexts() throws Exception {
id = client.register(":.context1:test-value", avroSchema);
assertEquals(1, id);

id = client.register(":.context1:test-value2", avroSchema);
assertEquals(1, id);

id = client.register("test-value", avroSchema);
id = client.register("test-value", avroSchema);
assertEquals(1, id);

Collection<String> contexts = client.getAllContexts();
Iterator<String> iter = contexts.iterator();
assertEquals(".", iter.next());
assertEquals(".context1", iter.next());
assertEquals(".context2", iter.next());
}
Expand Down

0 comments on commit 30f6bf4

Please sign in to comment.