use of org.pentaho.di.repository.RepositoryElementInterface in project pentaho-kettle by pentaho.
the class PurRepository_SharedObjects_IT method loadAllShared.
@Test
public void loadAllShared() throws Exception {
ClusterSchema cluster = cluster();
DatabaseMeta database = database();
SlaveServer slaveServer = slaveServer();
PartitionSchema partition = partition();
purRepository.save(cluster, null, null);
purRepository.save(database, null, null);
purRepository.save(slaveServer, null, null);
purRepository.save(partition, null, null);
Map<RepositoryObjectType, List<? extends SharedObjectInterface>> map = map();
purRepository.readSharedObjects(map, RepositoryObjectType.CLUSTER_SCHEMA, RepositoryObjectType.DATABASE, RepositoryObjectType.SLAVE_SERVER, RepositoryObjectType.PARTITION_SCHEMA);
RepositoryElementInterface[] saved = new RepositoryElementInterface[] { cluster, database, slaveServer, partition };
assertEquals(saved.length, map.size());
for (RepositoryElementInterface sharedObject : saved) {
List<? extends SharedObjectInterface> list = map.get(sharedObject.getRepositoryElementType());
assertEquals(1, list.size());
assertEquals(sharedObject, list.get(0));
}
}
use of org.pentaho.di.repository.RepositoryElementInterface in project pentaho-kettle by pentaho.
the class PurRepositoryIT method doesNotChangeFileWhenFailsToRename_slaves.
@Test
public void doesNotChangeFileWhenFailsToRename_slaves() throws Exception {
final SlaveServer server1 = new SlaveServer();
final SlaveServer server2 = new SlaveServer();
try {
testDoesNotChangeFileWhenFailsToRename(server1, server2, new Callable<RepositoryElementInterface>() {
@Override
public RepositoryElementInterface call() throws Exception {
return repository.loadSlaveServer(server2.getObjectId(), null);
}
});
} finally {
repository.deleteSlave(server1.getObjectId());
repository.deleteSlave(server2.getObjectId());
}
}
use of org.pentaho.di.repository.RepositoryElementInterface in project pentaho-kettle by pentaho.
the class PurRepositoryIT method testDoesNotChangeFileWhenFailsToRename.
private void testDoesNotChangeFileWhenFailsToRename(RepositoryElementInterface element1, RepositoryElementInterface element2, Callable<RepositoryElementInterface> loader) throws Exception {
final String name1 = "name1";
final String name2 = "name2";
element1.setName(name1);
element2.setName(name2);
repository.save(element1, "", null);
repository.save(element2, "", null);
element2.setName(name1);
try {
repository.save(element2, "", null, true);
fail("A naming conflict should occur");
} catch (KettleException e) {
// expected to be thrown
element2.setName(name2);
}
RepositoryElementInterface loaded = loader.call();
assertEquals(element2, loaded);
}
use of org.pentaho.di.repository.RepositoryElementInterface in project pentaho-kettle by pentaho.
the class PurRepositoryIT method doesNotChangeFileWhenFailsToRename_partitions.
@Test
public void doesNotChangeFileWhenFailsToRename_partitions() throws Exception {
final PartitionSchema schema1 = new PartitionSchema();
final PartitionSchema schema2 = new PartitionSchema();
try {
testDoesNotChangeFileWhenFailsToRename(schema1, schema2, new Callable<RepositoryElementInterface>() {
@Override
public RepositoryElementInterface call() throws Exception {
return repository.loadPartitionSchema(schema2.getObjectId(), null);
}
});
} finally {
repository.deletePartitionSchema(schema1.getObjectId());
repository.deletePartitionSchema(schema2.getObjectId());
}
}
use of org.pentaho.di.repository.RepositoryElementInterface in project pentaho-kettle by pentaho.
the class PurRepositoryIT method doesNotChangeFileWhenFailsToRename_clusters.
@Test
public void doesNotChangeFileWhenFailsToRename_clusters() throws Exception {
final ClusterSchema schema1 = new ClusterSchema();
final ClusterSchema schema2 = new ClusterSchema();
try {
testDoesNotChangeFileWhenFailsToRename(schema1, schema2, new Callable<RepositoryElementInterface>() {
@Override
public RepositoryElementInterface call() throws Exception {
return repository.loadClusterSchema(schema2.getObjectId(), null, null);
}
});
} finally {
repository.deleteClusterSchema(schema1.getObjectId());
repository.deleteClusterSchema(schema2.getObjectId());
}
}
Aggregations