Search in sources :

Example 11 with IncompatibleUpdateException

use of co.cask.cdap.api.dataset.IncompatibleUpdateException in project cdap by caskdata.

the class DatasetDefinitionRegistryWithDefaultModules method testFileSetReconfigure.

private void testFileSetReconfigure(boolean expectSuccess, DatasetDefinition def, Boolean wasExternal, String path, Boolean newExternal, String newPath, DatasetProperties extraProps) throws IncompatibleUpdateException {
    Assert.assertTrue(def instanceof Reconfigurable);
    DatasetProperties props = buildFileSetProps(extraProps, wasExternal, path);
    DatasetProperties newProps = buildFileSetProps(extraProps, newExternal, newPath);
    DatasetSpecification spec = def.configure("fs", props);
    if (expectSuccess) {
        ((Reconfigurable) def).reconfigure("fs", newProps, spec);
    } else {
        try {
            ((Reconfigurable) def).reconfigure("fs", newProps, spec);
            Assert.fail("reconfigure should have thrown exception");
        } catch (IncompatibleUpdateException e) {
        // expected
        }
    }
}
Also used : DatasetProperties(co.cask.cdap.api.dataset.DatasetProperties) DatasetSpecification(co.cask.cdap.api.dataset.DatasetSpecification) Reconfigurable(co.cask.cdap.api.dataset.Reconfigurable) IncompatibleUpdateException(co.cask.cdap.api.dataset.IncompatibleUpdateException)

Aggregations

IncompatibleUpdateException (co.cask.cdap.api.dataset.IncompatibleUpdateException)11 DatasetSpecification (co.cask.cdap.api.dataset.DatasetSpecification)10 DatasetProperties (co.cask.cdap.api.dataset.DatasetProperties)6 Reconfigurable (co.cask.cdap.api.dataset.Reconfigurable)4 DatasetAdmin (co.cask.cdap.api.dataset.DatasetAdmin)3 DatasetDefinition (co.cask.cdap.api.dataset.DatasetDefinition)3 Updatable (co.cask.cdap.api.dataset.Updatable)3 Test (org.junit.Test)3 DatasetContext (co.cask.cdap.api.dataset.DatasetContext)2 DatasetManagementException (co.cask.cdap.api.dataset.DatasetManagementException)2 BadRequestException (co.cask.cdap.common.BadRequestException)2 NotFoundException (co.cask.cdap.common.NotFoundException)2 DatasetType (co.cask.cdap.data2.datafabric.dataset.DatasetType)2 DatasetId (co.cask.cdap.proto.id.DatasetId)2 Map (java.util.Map)2 InstanceConflictException (co.cask.cdap.api.dataset.InstanceConflictException)1 InstanceNotFoundException (co.cask.cdap.api.dataset.InstanceNotFoundException)1 AbstractDatasetDefinition (co.cask.cdap.api.dataset.lib.AbstractDatasetDefinition)1 Partitioning (co.cask.cdap.api.dataset.lib.Partitioning)1 ConflictException (co.cask.cdap.common.ConflictException)1