Search in sources :

Example 46 with JobMeta

use of org.pentaho.di.job.JobMeta in project pentaho-kettle by pentaho.

the class JobHasDescriptionImportRule method verifyRule.

@Override
public List<ImportValidationFeedback> verifyRule(Object subject) {
    List<ImportValidationFeedback> feedback = new ArrayList<ImportValidationFeedback>();
    if (!isEnabled()) {
        return feedback;
    }
    if (!(subject instanceof JobMeta)) {
        return feedback;
    }
    JobMeta transMeta = (JobMeta) subject;
    String description = transMeta.getDescription();
    if (description != null && description.length() > minLength) {
        feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.APPROVAL, "A description is present"));
    } else {
        feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.ERROR, "A description is not present or too short"));
    }
    return feedback;
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) ImportValidationFeedback(org.pentaho.di.imp.rule.ImportValidationFeedback) ArrayList(java.util.ArrayList)

Example 47 with JobMeta

use of org.pentaho.di.job.JobMeta in project pentaho-kettle by pentaho.

the class JobHasJobLogConfiguredImportRule method verifyRule.

@Override
public List<ImportValidationFeedback> verifyRule(Object subject) {
    List<ImportValidationFeedback> feedback = new ArrayList<ImportValidationFeedback>();
    if (!isEnabled()) {
        return feedback;
    }
    if (!(subject instanceof JobMeta)) {
        return feedback;
    }
    JobMeta jobMeta = (JobMeta) subject;
    JobLogTable jobLogTable = jobMeta.getJobLogTable();
    if (!jobLogTable.isDefined()) {
        feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.ERROR, "The logging table is not defined"));
    } else {
        if (!Utils.isEmpty(schemaName)) {
            if (schemaName.equals(jobLogTable.getSchemaName())) {
                feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.APPROVAL, "The schema name is set to: " + schemaName));
            } else {
                feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.ERROR, "The schema name is not set to: " + schemaName));
            }
        }
        if (!Utils.isEmpty(tableName)) {
            if (tableName.equals(jobLogTable.getTableName())) {
                feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.APPROVAL, "The table name is set to: " + tableName));
            } else {
                feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.ERROR, "The table name is not set to: " + tableName));
            }
        }
        if (!Utils.isEmpty(connectionName)) {
            if (connectionName.equals(jobLogTable.getDatabaseMeta().getName())) {
                feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.APPROVAL, "The database connection used for logging is: " + connectionName));
            } else {
                feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.ERROR, "The database connection used for logging is not: " + connectionName));
            }
        }
        if (feedback.isEmpty()) {
            feedback.add(new ImportValidationFeedback(this, ImportValidationResultType.APPROVAL, "The logging table is correctly defined"));
        }
    }
    return feedback;
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) JobLogTable(org.pentaho.di.core.logging.JobLogTable) ImportValidationFeedback(org.pentaho.di.imp.rule.ImportValidationFeedback) ArrayList(java.util.ArrayList)

Example 48 with JobMeta

use of org.pentaho.di.job.JobMeta 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 49 with JobMeta

use of org.pentaho.di.job.JobMeta 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 50 with JobMeta

use of org.pentaho.di.job.JobMeta in project pentaho-kettle by pentaho.

the class RepositoryTestBase method testGetAcl.

@Test
@Ignore
public void testGetAcl() 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);
    assertNotNull(jobMeta.getObjectId());
    ObjectRevision version = jobMeta.getObjectRevision();
    assertNotNull(version);
    assertTrue(hasVersionWithComment(jobMeta, VERSION_COMMENT_V1));
    assertTrue(repository.exists(EXP_JOB_NAME, jobsDir, RepositoryObjectType.JOB));
    ObjectAcl acl = ((IAclService) repository).getAcl(jobMeta.getObjectId(), false);
    assertNotNull(acl);
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) ObjectAcl(org.pentaho.di.repository.pur.model.ObjectAcl) IAclService(org.pentaho.di.ui.repository.pur.services.IAclService) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

JobMeta (org.pentaho.di.job.JobMeta)254 Test (org.junit.Test)88 TransMeta (org.pentaho.di.trans.TransMeta)69 KettleException (org.pentaho.di.core.exception.KettleException)62 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)48 Job (org.pentaho.di.job.Job)45 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)27 Repository (org.pentaho.di.repository.Repository)25 RepositoryDirectoryInterface (org.pentaho.di.repository.RepositoryDirectoryInterface)25 Point (org.pentaho.di.core.gui.Point)24 ArrayList (java.util.ArrayList)23 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)22 SlaveServer (org.pentaho.di.cluster.SlaveServer)17 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)17 FileObject (org.apache.commons.vfs2.FileObject)16 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)16 LogChannelInterface (org.pentaho.di.core.logging.LogChannelInterface)15 SimpleLoggingObject (org.pentaho.di.core.logging.SimpleLoggingObject)15 PrintWriter (java.io.PrintWriter)12 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)12