Class MockDekRegistryClientFactory
Logically independent "instances" of mocked DEK Registry are created or retrieved
via named scopes getClientForScope(String, Map).
Each named scope is an independent registry.
Each named-scope registry is statically defined and visible to the entire JVM.
Scopes can be cleaned up when no longer needed via
dropScope(String).
Reusing a scope name after cleanup results in a completely new mocked Schema Registry instance.
This repository can be used to manage scoped clients directly, but scopes can also be
registered and used as schema.registry.url with the special pseudo-protocol 'mock://'
in serde configurations, so that testing code doesn't have to run an actual instance of
Schema Registry listening on a local port. For example,
schema.registry.url: 'mock://my-scope-name' corresponds to
MockDekRegistryClientFactory.getClientForScope("my-scope-name", configs).
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidclear()static voidDestroy the mocked registry corresponding to the scope.static DekRegistryClientgetClientForScope(String scope, Map<String, ?> configs) Get a client for a mocked Schema Registry.static String
-
Method Details
-
getClientForScope
Get a client for a mocked Schema Registry. Thescoperepresents a particular registry, so operations on one scope will never affect another.- Parameters:
scope- Identifies a logically independent Schema Registry instance. It's similar to a schema registry URL, in that two different Schema Registry deployments have two different URLs, except that these registries are only mocked, so they have no actual URL.- Returns:
- A client for the specified scope.
-
dropScope
Destroy the mocked registry corresponding to the scope. Subsequent clients for the same scope will have a completely blank slate.- Parameters:
scope- Identifies a logically independent Schema Registry instance. It's similar to a schema registry URL, in that two different Schema Registry deployments have two different URLs, except that these registries are only mocked, so they have no actual URL.
-
clear
public static void clear() -
validateAndMaybeGetMockScope
-