Search in sources :

Example 36 with AbstractMeta

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();
    }
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) DocumentBuilder(javax.xml.parsers.DocumentBuilder) AbstractMeta(org.pentaho.di.base.AbstractMeta) SharedObjectInterface(org.pentaho.di.shared.SharedObjectInterface) List(java.util.List) SlaveServer(org.pentaho.di.cluster.SlaveServer) Document(org.w3c.dom.Document)

Example 37 with AbstractMeta

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());
}
Also used : AbstractMeta(org.pentaho.di.base.AbstractMeta) VersionSummary(org.pentaho.platform.api.repository2.unified.VersionSummary)

Example 38 with AbstractMeta

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);
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) AbstractMeta(org.pentaho.di.base.AbstractMeta)

Example 39 with AbstractMeta

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);
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) AbstractMeta(org.pentaho.di.base.AbstractMeta)

Example 40 with AbstractMeta

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);
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) AbstractMeta(org.pentaho.di.base.AbstractMeta)

Aggregations

AbstractMeta (org.pentaho.di.base.AbstractMeta)50 Test (org.junit.Test)18 KettleException (org.pentaho.di.core.exception.KettleException)10 RepositoryDirectoryInterface (org.pentaho.di.repository.RepositoryDirectoryInterface)7 LogChannelInterface (org.pentaho.di.core.logging.LogChannelInterface)6 JobMeta (org.pentaho.di.job.JobMeta)6 TransMeta (org.pentaho.di.trans.TransMeta)6 FileObject (org.apache.commons.vfs2.FileObject)5 ExtensionPointWrapper (org.pentaho.di.ui.core.events.dialog.extension.ExtensionPointWrapper)5 SlaveServer (org.pentaho.di.cluster.SlaveServer)4 EngineMetaInterface (org.pentaho.di.core.EngineMetaInterface)4 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)4 RunConfiguration (org.pentaho.di.engine.configuration.api.RunConfiguration)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 EmbeddedMetaStore (org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore)3 ExtensionPoint (org.pentaho.di.core.extension.ExtensionPoint)3 SimpleLoggingObject (org.pentaho.di.core.logging.SimpleLoggingObject)3 EmbeddedRunConfigurationManager (org.pentaho.di.engine.configuration.impl.EmbeddedRunConfigurationManager)3 RunConfigurationManager (org.pentaho.di.engine.configuration.impl.RunConfigurationManager)3 RepositoryObject (org.pentaho.di.repository.RepositoryObject)3