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);
}
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-metaverse by pentaho.
the class KettleAnalyzerUtilTest method tesBuildDocument.
@Test
public void tesBuildDocument() throws MetaverseException {
final IMetaverseBuilder builder = new BaseMetaverseBuilder(null);
final AbstractMeta transMeta = Mockito.mock(TransMeta.class);
final String transName = "MyTransMeta";
Mockito.doReturn(transName).when(transMeta).getName();
Mockito.doReturn("ktr").when(transMeta).getDefaultExtension();
final String id = "path.ktr";
final String namespaceId = "MyNamespace";
final INamespace namespace = new Namespace(namespaceId);
assertNull(KettleAnalyzerUtil.buildDocument(null, transMeta, id, namespace));
IDocument document = KettleAnalyzerUtil.buildDocument(builder, transMeta, id, namespace);
assertNotNull(document);
assertEquals(namespace, document.getNamespace());
assertEquals(transMeta, document.getContent());
assertEquals(id, document.getStringID());
assertEquals(transName, document.getName());
assertEquals("ktr", document.getExtension());
assertEquals(DictionaryConst.CONTEXT_RUNTIME, document.getContext().getContextName());
assertEquals(document.getName(), document.getProperty(DictionaryConst.PROPERTY_NAME));
assertEquals(KettleAnalyzerUtil.normalizeFilePath("path.ktr"), document.getProperty(DictionaryConst.PROPERTY_PATH));
assertEquals(namespaceId, document.getProperty(DictionaryConst.PROPERTY_NAMESPACE));
}
use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.
the class ConnectionDelegate method delete.
public void delete(String label) {
ConnectionDeleteDialog connectionDeleteDialog = new ConnectionDeleteDialog(spoonSupplier.get().getShell());
if (connectionDeleteDialog.open(label) == SWT.YES) {
ConnectionManager connectionManager = ConnectionManager.getInstance();
connectionManager.delete(label);
spoonSupplier.get().getShell().getDisplay().asyncExec(() -> spoonSupplier.get().refreshTree(ConnectionFolderProvider.STRING_VFS_CONNECTIONS));
EngineMetaInterface engineMetaInterface = spoonSupplier.get().getActiveMeta();
if (engineMetaInterface instanceof AbstractMeta) {
((AbstractMeta) engineMetaInterface).setChanged();
}
}
}
use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.
the class ConnectionTreeDelegateExtension method callExtensionPoint.
@Override
public void callExtensionPoint(LogChannelInterface log, Object extension) throws KettleException {
SpoonTreeDelegateExtension treeDelExt = (SpoonTreeDelegateExtension) extension;
int caseNumber = treeDelExt.getCaseNumber();
AbstractMeta meta = treeDelExt.getTransMeta();
String[] path = treeDelExt.getPath();
List<TreeSelection> objects = treeDelExt.getObjects();
TreeSelection object = null;
if (path[2].equals(ConnectionFolderProvider.STRING_VFS_CONNECTIONS)) {
switch(caseNumber) {
case 3:
object = new TreeSelection(path[2], VFSConnectionDetails.class, meta);
break;
case 4:
try {
final String name = path[3];
object = new TreeSelection(name, new ConnectionTreeItem(name), meta);
} catch (Exception e) {
// Do Nothing
}
break;
}
}
if (object != null) {
objects.add(object);
}
}
Aggregations