use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.
the class PurRepository_SharedObjects_Links_IT method testReadSharedObjects.
@SuppressWarnings("unchecked")
private void testReadSharedObjects(GenericMeta gMeta) throws Exception {
PurRepository pur = (PurRepository) repository;
RepositoryDirectoryInterface rootDir = initRepo();
SlaveServer slave1 = createSlaveServer("slave1");
SlaveServer slave2 = createSlaveServer("slave2");
pur.save(slave1, VERSION_COMMENT_V1, null);
pur.save(slave2, VERSION_COMMENT_V1, null);
AbstractMeta meta = gMeta.createFilled();
meta.getSlaveServers().add(slave1);
meta.getSlaveServers().add(slave2);
rootDir.findDirectory(DIR_TRANSFORMATIONS);
pur.save(meta, VERSION_COMMENT_V1, null);
String xmlText = meta.getXML();
try {
// import transformation from file
meta = gMeta.createEmpty();
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(IOUtils.toInputStream(xmlText));
gMeta.loadFromXml(doc.getParentNode());
List<SharedObjectInterface> sharedObjects = (List<SharedObjectInterface>) pur.loadAndCacheSharedObjects(false).get(RepositoryObjectType.SLAVE_SERVER);
for (int i = 0; i < meta.getSlaveServers().size(); i++) {
for (int j = 0; j < sharedObjects.size(); j++) {
SlaveServer s1 = meta.getSlaveServers().get(i);
SlaveServer s2 = (SlaveServer) sharedObjects.get(j);
if (s1 == s2) {
fail("Trans/job has direct links on slave servers from cache");
}
}
}
} finally {
pur.deleteSlave(slave1.getObjectId());
pur.deleteSlave(slave2.getObjectId());
pur.clearSharedObjectCache();
}
}
use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.
the class PurRepository_MoveAndRename_IT method move_DoesNotCreateRevision.
private void move_DoesNotCreateRevision(Assistant assistant) throws Exception {
final String fileName = "move_DoesNotCreateRevision";
AbstractMeta meta = assistant.createNew();
assistant.save(meta, fileName, getPublicDir());
List<VersionSummary> historyBefore = unifiedRepository.getVersionSummaries(meta.getObjectId().getId());
purRepository.renameTransformation(meta.getObjectId(), getDirInsidePublic(fileName), null);
List<VersionSummary> historyAfter = unifiedRepository.getVersionSummaries(meta.getObjectId().getId());
assertEquals(historyBefore.size(), historyAfter.size());
}
use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.
the class PurRepository_MoveAndRename_IT method rename_Successfully.
private void rename_Successfully(Assistant assistant) throws Exception {
final String initial = "rename_Successfully";
final String renamed = initial + "_renamed";
AbstractMeta meta = assistant.createNew();
RepositoryDirectoryInterface directory = getPublicDir();
assistant.save(meta, initial, directory);
assistant.rename(meta, renamed);
}
use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.
the class PurRepository_MoveAndRename_IT method move_Successfully.
private void move_Successfully(Assistant assistant) throws Exception {
final String filename = "move_Successfully";
AbstractMeta meta = assistant.createNew();
assistant.save(meta, filename, getPublicDir());
RepositoryDirectoryInterface destFolder = getDirInsidePublic(filename);
assertNotNull(destFolder);
assistant.move(meta, destFolder);
}
use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.
the class PurRepository_MoveAndRename_IT method move_FailsIfANameConflictOccurs.
private void move_FailsIfANameConflictOccurs(Assistant assistant) throws Exception {
final String fileName = "move_FailsIfANameConflictOccurs";
AbstractMeta meta = assistant.createNew();
AbstractMeta anotherMeta = assistant.createNew();
RepositoryDirectoryInterface directory = getPublicDir();
assistant.save(meta, fileName, directory);
RepositoryDirectoryInterface destFolder = getDirInsidePublic(fileName);
assistant.save(anotherMeta, fileName, destFolder);
assistant.move(meta, destFolder);
}
Aggregations