use of com.hortonworks.registries.schemaregistry.SchemaMetadata in project registry by hortonworks.
the class SchemaBranchLifeCycleTest method deleteBranchWithRootVersionOfAnotherBranch.
@Test(expected = InvalidSchemaBranchDeletionException.class)
public void deleteBranchWithRootVersionOfAnotherBranch() throws InvalidSchemaException, SchemaNotFoundException, IncompatibleSchemaException, IOException, SchemaBranchAlreadyExistsException, SchemaLifecycleException, InvalidSchemaBranchDeletionException {
SchemaMetadata schemaMetadata = addSchemaMetadata(testNameRule.getMethodName(), SchemaCompatibility.NONE);
SchemaIdVersion masterSchemaIdVersion1 = addSchemaVersion(SchemaBranch.MASTER_BRANCH, schemaMetadata, "/device.avsc");
SchemaBranch schemaBranch1 = addSchemaBranch("BRANCH1", schemaMetadata, masterSchemaIdVersion1.getSchemaVersionId());
SchemaIdVersion schemaBranch1Version1 = addSchemaVersion(schemaBranch1.getName(), schemaMetadata, "/device-incompat.avsc");
addSchemaBranch("CHILD-BRANCH", schemaMetadata, schemaBranch1Version1.getSchemaVersionId());
schemaRegistryClient.enableSchemaVersion(schemaBranch1Version1.getSchemaVersionId());
schemaRegistryClient.archiveSchemaVersion(schemaBranch1Version1.getSchemaVersionId());
schemaRegistryClient.deleteSchemaBranch(schemaBranch1.getId());
}
use of com.hortonworks.registries.schemaregistry.SchemaMetadata in project registry by hortonworks.
the class SchemaBranchLifeCycleTest method addSchemaMetadata.
private SchemaMetadata addSchemaMetadata(String schemaDesc, SchemaCompatibility compatibility) {
SchemaMetadata schemaMetadata = buildSchemaMetadata(schemaDesc, compatibility);
schemaRegistryClient.addSchemaMetadata(schemaMetadata);
return schemaMetadata;
}
use of com.hortonworks.registries.schemaregistry.SchemaMetadata in project registry by hortonworks.
the class SchemaBranchLifeCycleTest method createBranchWithInvalidSchemaId.
@Test(expected = SchemaNotFoundException.class)
public void createBranchWithInvalidSchemaId() throws SchemaNotFoundException, SchemaBranchAlreadyExistsException {
SchemaMetadata schemaMetadata = addSchemaMetadata(testNameRule.getMethodName(), SchemaCompatibility.NONE);
addSchemaBranch("BRANCH1", schemaMetadata, 1l);
}
use of com.hortonworks.registries.schemaregistry.SchemaMetadata in project registry by hortonworks.
the class SchemaBranchLifeCycleTest method mergeSchemaWithInvalidSchemaVersion.
@Test(expected = SchemaNotFoundException.class)
public void mergeSchemaWithInvalidSchemaVersion() throws IOException, SchemaBranchNotFoundException, InvalidSchemaException, SchemaNotFoundException, IncompatibleSchemaException, SchemaBranchAlreadyExistsException {
SchemaMetadata schemaMetadata = addSchemaMetadata(testNameRule.getMethodName(), SchemaCompatibility.NONE);
SchemaIdVersion masterSchemaIdVersion1 = addSchemaVersion(SchemaBranch.MASTER_BRANCH, schemaMetadata, "/device.avsc");
SchemaBranch schemaBranch1 = addSchemaBranch("BRANCH1", schemaMetadata, masterSchemaIdVersion1.getSchemaVersionId());
SchemaIdVersion schemaBranch1Version1 = addSchemaVersion(schemaBranch1.getName(), schemaMetadata, "/device-incompat.avsc");
schemaRegistryClient.mergeSchemaVersion(schemaBranch1Version1.getSchemaVersionId() + 1);
}
use of com.hortonworks.registries.schemaregistry.SchemaMetadata in project registry by hortonworks.
the class SchemaBranchLifeCycleTest method deleteSchemaBranch.
@Test
public void deleteSchemaBranch() throws SchemaNotFoundException, SchemaBranchAlreadyExistsException, IOException, InvalidSchemaException, IncompatibleSchemaException, SchemaBranchNotFoundException, InvalidSchemaBranchDeletionException {
SchemaMetadata schemaMetadata = addSchemaMetadata(testNameRule.getMethodName(), SchemaCompatibility.NONE);
SchemaIdVersion masterSchemaIdVersion1 = addSchemaVersion(SchemaBranch.MASTER_BRANCH, schemaMetadata, "/device.avsc");
SchemaBranch schemaBranch1 = addSchemaBranch("BRANCH1", schemaMetadata, masterSchemaIdVersion1.getSchemaVersionId());
addSchemaVersion(schemaBranch1.getName(), schemaMetadata, "/device-incompat.avsc");
addSchemaVersion(schemaBranch1.getName(), schemaMetadata, "/device-compat.avsc");
Assert.assertTrue(schemaRegistryClient.getSchemaBranches(schemaMetadata.getName()).size() == 2);
schemaRegistryClient.deleteSchemaBranch(schemaBranch1.getId());
Collection<SchemaVersionInfo> masterSchemaVersionInfos = schemaRegistryClient.getAllVersions(schemaMetadata.getName());
Assert.assertTrue(masterSchemaVersionInfos.size() == 1);
Assert.assertTrue(schemaRegistryClient.getSchemaBranches(schemaMetadata.getName()).size() == 1);
}
Aggregations