Search in sources :

Example 86 with TransMeta

use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.

the class StreamToNodeConvertersPrivateDatabasesTest method getData.

@Parameterized.Parameters
public static List<Object[]> getData() throws Exception {
    RepositoryFile repositoryFile = new RepositoryFile.Builder("test file").build();
    IUnifiedRepository pur = mock(IUnifiedRepository.class);
    when(pur.getFileById(FILE_ID)).thenReturn(repositoryFile);
    TransMeta transMeta = new TransMeta();
    JobMeta jobMeta = new JobMeta();
    Repository repository = mock(Repository.class);
    when(repository.loadTransformation(any(StringObjectId.class), anyString())).thenReturn(transMeta);
    when(repository.loadJob(any(StringObjectId.class), anyString())).thenReturn(jobMeta);
    StreamToTransNodeConverter transNodeConverter = new StreamToTransNodeConverter(pur);
    transNodeConverter = spy(transNodeConverter);
    doReturn(repository).when(transNodeConverter).connectToRepository();
    StreamToJobNodeConverter jobNodeConverter = new StreamToJobNodeConverter(pur);
    jobNodeConverter = spy(jobNodeConverter);
    doReturn(repository).when(jobNodeConverter).connectToRepository();
    Object[] trans = { transNodeConverter, TransMeta.XML_TAG, transMeta };
    Object[] job = { jobNodeConverter, JobMeta.XML_TAG, jobMeta };
    return asList(trans, job);
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) Repository(org.pentaho.di.repository.Repository) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository) TransMeta(org.pentaho.di.trans.TransMeta) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) StringObjectId(org.pentaho.di.repository.StringObjectId) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository)

Example 87 with TransMeta

use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.

the class RepositoryPerformanceApp method createContent.

private void createContent(int loadMax, RepositoryDirectoryInterface createHere) throws Exception {
    for (int ix = 0; ix < loadMax; ix++) {
        TransMeta transMeta = createTransMeta(createHere.getName().concat(EXP_DBMETA_NAME.concat(String.valueOf(ix))));
        transMeta.setRepositoryDirectory(createHere);
        try {
            repository.save(transMeta, VERSION_COMMENT_V1.concat(String.valueOf(ix)), null);
        } catch (Exception e) {
        // nothing to do
        }
        JobMeta jobMeta = createJobMeta("JOB_".concat(createHere.getName()).concat(EXP_DBMETA_NAME.concat(String.valueOf(ix))));
        jobMeta.setRepositoryDirectory(createHere);
        try {
            repository.save(jobMeta, VERSION_COMMENT_V1.concat(String.valueOf(ix)), null);
        } catch (Exception e) {
        // nothing to do
        }
    }
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) TransMeta(org.pentaho.di.trans.TransMeta)

Example 88 with TransMeta

use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.

the class RepositoryTestBase method testRenameAndUndelete.

@Ignore
@Test
public void testRenameAndUndelete() throws Exception {
    RepositoryDirectoryInterface rootDir = initRepo();
    JobMeta jobMeta = createJobMeta(EXP_JOB_NAME);
    RepositoryDirectoryInterface jobsDir = rootDir.findDirectory(DIR_JOBS);
    repository.save(jobMeta, VERSION_COMMENT_V1, null);
    deleteStack.push(jobMeta);
    repository.deleteJob(jobMeta.getObjectId());
    assertFalse(repository.exists(EXP_JOB_NAME, jobsDir, RepositoryObjectType.JOB));
    RepositoryObject robj = new RepositoryObject(jobMeta.getObjectId(), jobMeta.getName(), jobMeta.getRepositoryDirectory(), null, null, jobMeta.getRepositoryElementType(), null, false);
    repository.undeleteObject(robj);
    assertTrue(repository.exists(EXP_JOB_NAME, jobsDir, RepositoryObjectType.JOB));
    repository.renameJob(jobMeta.getObjectId(), jobsDir, EXP_JOB_NAME_NEW);
    assertFalse(repository.exists(EXP_JOB_NAME, jobsDir, RepositoryObjectType.JOB));
    assertTrue(repository.exists(EXP_JOB_NAME_NEW, jobsDir, RepositoryObjectType.JOB));
    TransMeta transMeta = createTransMeta(EXP_DBMETA_NAME);
    RepositoryDirectoryInterface transDir = rootDir.findDirectory(DIR_TRANSFORMATIONS);
    repository.save(transMeta, VERSION_COMMENT_V1, null);
    deleteStack.push(transMeta);
    repository.renameTransformation(transMeta.getObjectId(), transDir, EXP_TRANS_NAME_NEW);
    assertFalse(repository.exists(EXP_TRANS_NAME.concat(EXP_DBMETA_NAME), transDir, RepositoryObjectType.TRANSFORMATION));
    assertTrue(repository.exists(EXP_TRANS_NAME_NEW, transDir, RepositoryObjectType.TRANSFORMATION));
    DatabaseMeta dbMeta = createDatabaseMeta(EXP_DBMETA2_NAME);
    repository.save(dbMeta, VERSION_COMMENT_V1, null);
    deleteStack.push(dbMeta);
    dbMeta.setName(EXP_DBMETA_NAME_NEW);
    repository.save(dbMeta, VERSION_COMMENT_V2, null);
    assertFalse(repository.exists(EXP_DBMETA2_NAME, null, RepositoryObjectType.DATABASE));
    assertTrue(repository.exists(EXP_DBMETA_NAME_NEW, null, RepositoryObjectType.DATABASE));
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) TransMeta(org.pentaho.di.trans.TransMeta) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 89 with TransMeta

use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.

the class DelegatesPrivateDatabasesTest method getData.

@Parameterized.Parameters
public static List<Object[]> getData() {
    Repository repository = mock(Repository.class);
    IUnifiedRepository pur = mock(IUnifiedRepository.class);
    Object[] trans = { new TransDelegate(repository, pur), new TransMeta(), TransDelegate.NODE_TRANS_PRIVATE_DATABASES, TransDelegate.PROP_TRANS_PRIVATE_DATABASE_NAMES };
    Object[] job = { new JobDelegate(repository, pur), new JobMeta(), JobDelegate.NODE_JOB_PRIVATE_DATABASES, JobDelegate.PROP_JOB_PRIVATE_DATABASE_NAMES };
    return Arrays.asList(trans, job);
}
Also used : Repository(org.pentaho.di.repository.Repository) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository) JobMeta(org.pentaho.di.job.JobMeta) TransMeta(org.pentaho.di.trans.TransMeta) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository)

Example 90 with TransMeta

use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.

the class XMLInputSaxDialog method preview.

// Preview the data
private void preview() {
    try {
        // Create the XML input step
        XMLInputSaxMeta oneMeta = new XMLInputSaxMeta();
        getInfo(oneMeta);
        TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
        EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "XMLInputSaxDialog.Dialog.EnterPreviewSize.Title"), BaseMessages.getString(PKG, "XMLInputSaxDialog.Dialog.EnterPreviewSize.Message"));
        int previewSize = numberDialog.open();
        if (previewSize > 0) {
            TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
            progressDialog.open();
            if (!progressDialog.isCancelled()) {
                PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()));
                prd.open();
            }
        }
    } catch (KettleException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "XMLInputSaxDialog.Dialog.ErrorDisplayingPreviewData.Title"), BaseMessages.getString(PKG, "XMLInputSaxDialog.Dialog.ErrorDisplayingPreviewData.Message"), e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) TransPreviewProgressDialog(org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog) TransMeta(org.pentaho.di.trans.TransMeta) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) XMLInputSaxMeta(org.pentaho.di.trans.steps.xmlinputsax.XMLInputSaxMeta) EnterNumberDialog(org.pentaho.di.ui.core.dialog.EnterNumberDialog)

Aggregations

TransMeta (org.pentaho.di.trans.TransMeta)710 Test (org.junit.Test)289 StepMeta (org.pentaho.di.trans.step.StepMeta)234 Trans (org.pentaho.di.trans.Trans)214 KettleException (org.pentaho.di.core.exception.KettleException)150 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)136 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)117 TransHopMeta (org.pentaho.di.trans.TransHopMeta)115 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)109 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)106 StepInterface (org.pentaho.di.trans.step.StepInterface)76 RowStepCollector (org.pentaho.di.trans.RowStepCollector)73 JobMeta (org.pentaho.di.job.JobMeta)69 ArrayList (java.util.ArrayList)57 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)54 PreviewRowsDialog (org.pentaho.di.ui.core.dialog.PreviewRowsDialog)51 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)50 InjectorMeta (org.pentaho.di.trans.steps.injector.InjectorMeta)49 EnterTextDialog (org.pentaho.di.ui.core.dialog.EnterTextDialog)49 TransPreviewProgressDialog (org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog)49