Class MockSchemaRegistryClient
java.lang.Object
io.confluent.kafka.schemaregistry.client.MockSchemaRegistryClient
- All Implemented Interfaces:
SchemaRegistryClient,SchemaVersionFetcher,Closeable,AutoCloseable
Mock implementation of SchemaRegistryClient that can be used for tests. This version is NOT
thread safe. Schema data is stored in memory and is not persistent or shared across instances.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteAssociations(String resourceId, String resourceType, List<String> associationTypes, boolean cascadeLifecycle) deleteSchemaVersion(String subject, String version, boolean isPermanent) deleteSchemaVersion(Map<String, String> requestProperties, String subject, String version, boolean isPermanent) deleteSubject(String subject, boolean isPermanent) deleteSubject(Map<String, String> requestProperties, String subject, boolean isPermanent) getAllSubjectsById(int id) getAllSubjectsByPrefix(String subjectPrefix) getAllVersions(String subject) getAllVersionsById(int id) getAssociationsByResourceId(String resourceId, String resourceType, List<String> associationTypes, String lifecycle, int offset, int limit) getAssociationsBySubject(String subject, String resourceType, List<String> associationTypes, String lifecycle, int offset, int limit) getByVersion(String subject, int version, boolean lookupDeletedSchema) getGuid(String subject, ParsedSchema schema) getGuid(String subject, ParsedSchema schema, boolean normalize) intgetId(String subject, ParsedSchema schema) intgetId(String subject, ParsedSchema schema, boolean normalize) getIdWithResponse(String subject, ParsedSchema schema, boolean normalize) getLatestSchemaMetadata(String subject) getLatestWithMetadata(String subject, Map<String, String> metadata, boolean lookupDeletedSchema) getMode()getSchemaByGuid(String guid, String format) getSchemaById(int id) getSchemaBySubjectAndId(String subject, int id) getSchemaMetadata(String subject, int version) getSchemaMetadata(String subject, int version, boolean lookupDeletedSchema) getSchemas(String subjectPrefix, boolean lookupDeletedSchema, boolean latestOnly) intgetVersion(String subject, ParsedSchema schema) intgetVersion(String subject, ParsedSchema schema, boolean normalize) parseSchema(Schema schema) parseSchema(String schemaType, String schemaString, List<SchemaReference> references) intregister(String subject, ParsedSchema schema) intregister(String subject, ParsedSchema schema, boolean normalize) intregister(String subject, ParsedSchema schema, int version, int id) registerWithResponse(String subject, ParsedSchema schema, boolean normalize, boolean propagateSchemaTags) voidreset()booleantestCompatibility(String subject, ParsedSchema newSchema) testCompatibilityVerbose(String subject, ParsedSchema newSchema) updateConfig(String subject, Config config) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.confluent.kafka.schemaregistry.client.SchemaRegistryClient
close, createAssociation, deleteCompatibility, deleteConfig, deleteMode, deleteSchemaVersion, deleteSchemaVersion, deleteSubject, deleteSubject, getAllSubjects, getAllVersions, getById, getByID, getBySubjectAndId, getBySubjectAndID, getCompatibility, getId, getSchemaRegistryServerVersion, getVersion, parseSchema, parseSchemaOrElseThrow, register, register, registerWithResponse, tenant, testCompatibility, testCompatibilityVerbose, ticker, updateCompatibility
-
Constructor Details
-
MockSchemaRegistryClient
public MockSchemaRegistryClient() -
MockSchemaRegistryClient
-
-
Method Details
-
parseSchema
public Optional<ParsedSchema> parseSchema(String schemaType, String schemaString, List<SchemaReference> references) - Specified by:
parseSchemain interfaceSchemaRegistryClient
-
parseSchema
- Specified by:
parseSchemain interfaceSchemaRegistryClient
-
register
- Specified by:
registerin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
register
public int register(String subject, ParsedSchema schema, boolean normalize) throws IOException, RestClientException - Specified by:
registerin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
register
public int register(String subject, ParsedSchema schema, int version, int id) throws IOException, RestClientException - Specified by:
registerin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
registerWithResponse
public RegisterSchemaResponse registerWithResponse(String subject, ParsedSchema schema, boolean normalize, boolean propagateSchemaTags) throws RestClientException - Specified by:
registerWithResponsein interfaceSchemaRegistryClient- Throws:
RestClientException
-
getSchemaById
- Specified by:
getSchemaByIdin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getSchemaBySubjectAndId
public ParsedSchema getSchemaBySubjectAndId(String subject, int id) throws IOException, RestClientException - Specified by:
getSchemaBySubjectAndIdin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getSchemaByGuid
public ParsedSchema getSchemaByGuid(String guid, String format) throws IOException, RestClientException - Specified by:
getSchemaByGuidin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getSchemas
public List<ParsedSchema> getSchemas(String subjectPrefix, boolean lookupDeletedSchema, boolean latestOnly) throws IOException, RestClientException - Specified by:
getSchemasin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getAllSubjectsById
- Specified by:
getAllSubjectsByIdin interfaceSchemaRegistryClient
-
getAllVersionsById
- Specified by:
getAllVersionsByIdin interfaceSchemaRegistryClient
-
getByVersion
- Specified by:
getByVersionin interfaceSchemaRegistryClient- Specified by:
getByVersionin interfaceSchemaVersionFetcher
-
getSchemaMetadata
public SchemaMetadata getSchemaMetadata(String subject, int version) throws IOException, RestClientException - Specified by:
getSchemaMetadatain interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getSchemaMetadata
public SchemaMetadata getSchemaMetadata(String subject, int version, boolean lookupDeletedSchema) throws RestClientException - Specified by:
getSchemaMetadatain interfaceSchemaRegistryClient- Throws:
RestClientException
-
getLatestSchemaMetadata
public SchemaMetadata getLatestSchemaMetadata(String subject) throws IOException, RestClientException - Specified by:
getLatestSchemaMetadatain interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getLatestWithMetadata
public SchemaMetadata getLatestWithMetadata(String subject, Map<String, String> metadata, boolean lookupDeletedSchema) throws IOException, RestClientException- Specified by:
getLatestWithMetadatain interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getVersion
- Specified by:
getVersionin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getVersion
public int getVersion(String subject, ParsedSchema schema, boolean normalize) throws IOException, RestClientException - Specified by:
getVersionin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getAllVersions
- Specified by:
getAllVersionsin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
testCompatibility
public boolean testCompatibility(String subject, ParsedSchema newSchema) throws IOException, RestClientException - Specified by:
testCompatibilityin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getId
- Specified by:
getIdin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getId
public int getId(String subject, ParsedSchema schema, boolean normalize) throws IOException, RestClientException - Specified by:
getIdin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getGuid
- Specified by:
getGuidin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getGuid
public String getGuid(String subject, ParsedSchema schema, boolean normalize) throws IOException, RestClientException - Specified by:
getGuidin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getIdWithResponse
public RegisterSchemaResponse getIdWithResponse(String subject, ParsedSchema schema, boolean normalize) throws IOException, RestClientException - Specified by:
getIdWithResponsein interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
deleteSubject
public List<Integer> deleteSubject(String subject, boolean isPermanent) throws IOException, RestClientException - Specified by:
deleteSubjectin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
deleteSubject
public List<Integer> deleteSubject(Map<String, String> requestProperties, String subject, boolean isPermanent) throws IOException, RestClientException- Specified by:
deleteSubjectin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
deleteSchemaVersion
public Integer deleteSchemaVersion(String subject, String version, boolean isPermanent) throws IOException, RestClientException - Specified by:
deleteSchemaVersionin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
deleteSchemaVersion
public Integer deleteSchemaVersion(Map<String, String> requestProperties, String subject, String version, boolean isPermanent) throws IOException, RestClientException- Specified by:
deleteSchemaVersionin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
testCompatibilityVerbose
public List<String> testCompatibilityVerbose(String subject, ParsedSchema newSchema) throws IOException, RestClientException - Specified by:
testCompatibilityVerbosein interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
updateConfig
- Specified by:
updateConfigin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getConfig
- Specified by:
getConfigin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
setMode
- Specified by:
setModein interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
setMode
- Specified by:
setModein interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
setMode
public String setMode(String mode, String subject, boolean force) throws IOException, RestClientException - Specified by:
setModein interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getMode
- Specified by:
getModein interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getMode
- Specified by:
getModein interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getAllContexts
- Specified by:
getAllContextsin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getSchemaRegistryDeployment
public SchemaRegistryDeployment getSchemaRegistryDeployment() throws IOException, RestClientException- Specified by:
getSchemaRegistryDeploymentin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getAllSubjects
- Specified by:
getAllSubjectsin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getAllSubjectsByPrefix
public Collection<String> getAllSubjectsByPrefix(String subjectPrefix) throws IOException, RestClientException - Specified by:
getAllSubjectsByPrefixin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
reset
public void reset()- Specified by:
resetin interfaceSchemaRegistryClient
-
createOrUpdateAssociation
public AssociationResponse createOrUpdateAssociation(AssociationCreateOrUpdateRequest request) throws IOException, RestClientException - Specified by:
createOrUpdateAssociationin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getAssociationsBySubject
public List<Association> getAssociationsBySubject(String subject, String resourceType, List<String> associationTypes, String lifecycle, int offset, int limit) throws IOException, RestClientException - Specified by:
getAssociationsBySubjectin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
getAssociationsByResourceId
public List<Association> getAssociationsByResourceId(String resourceId, String resourceType, List<String> associationTypes, String lifecycle, int offset, int limit) throws IOException, RestClientException - Specified by:
getAssociationsByResourceIdin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-
deleteAssociations
public void deleteAssociations(String resourceId, String resourceType, List<String> associationTypes, boolean cascadeLifecycle) throws IOException, RestClientException - Specified by:
deleteAssociationsin interfaceSchemaRegistryClient- Throws:
IOExceptionRestClientException
-