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