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);
}
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
}
}
}
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));
}
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);
}
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);
}
}
Aggregations