use of org.pentaho.di.job.Job in project pentaho-kettle by pentaho.
the class JobEntryFolderIsEmptyTest method setUp.
@Before
public void setUp() throws Exception {
job = new Job(null, new JobMeta());
entry = new JobEntryFolderIsEmpty();
job.getJobMeta().addJobEntry(new JobEntryCopy(entry));
entry.setParentJob(job);
JobMeta mockJobMeta = mock(JobMeta.class);
entry.setParentJobMeta(mockJobMeta);
job.setStopped(false);
File dir = Files.createTempDirectory("dir", new FileAttribute<?>[0]).toFile();
dir.deleteOnExit();
emptyDir = dir.getPath();
dir = Files.createTempDirectory("dir", new FileAttribute<?>[0]).toFile();
dir.deleteOnExit();
nonEmptyDir = dir.getPath();
File file = File.createTempFile("existingFile", "ext", dir);
file.deleteOnExit();
}
use of org.pentaho.di.job.Job in project pentaho-kettle by pentaho.
the class JobEntryFTPTest method setUp.
@Before
public void setUp() throws Exception {
job = new Job(null, new JobMeta());
entry = new MockedJobEntryFTP();
job.getJobMeta().addJobEntry(new JobEntryCopy(entry));
entry.setParentJob(job);
job.setStopped(false);
entry.setServerName("some.server");
entry.setUserName("anonymous");
entry.setFtpDirectory(".");
entry.setWildcard("robots.txt");
entry.setBinaryMode(false);
entry.setSuccessCondition("success_if_no_errors");
existingDir = TestUtils.createTempDir();
}
use of org.pentaho.di.job.Job in project pentaho-kettle by pentaho.
the class KitchenTest method testConfigureParameters.
@Test
public void testConfigureParameters() throws Exception {
JobMeta jobMeta = new JobMeta();
jobMeta.addParameterDefinition(TEST_PARAM_NAME, DEFAULT_PARAM_VALUE, "This tests a default parameter");
assertEquals("Default parameter was not set correctly on JobMeta", DEFAULT_PARAM_VALUE, jobMeta.getParameterDefault(TEST_PARAM_NAME));
assertEquals("Parameter value should be blank in JobMeta", "", jobMeta.getParameterValue(TEST_PARAM_NAME));
Job job = new Job(null, jobMeta);
job.copyParametersFrom(jobMeta);
assertEquals("Default parameter was not set correctly on Job", DEFAULT_PARAM_VALUE, job.getParameterDefault(TEST_PARAM_NAME));
assertEquals("Parameter value should be blank in Job", "", job.getParameterValue(TEST_PARAM_NAME));
}
use of org.pentaho.di.job.Job in project pentaho-kettle by pentaho.
the class JobEntryColumnsExistTest method setUp.
@Before
public void setUp() {
Job parentJob = new Job(null, new JobMeta());
jobEntry = spy(new JobEntryColumnsExist(""));
parentJob.getJobMeta().addJobEntry(new JobEntryCopy(jobEntry));
parentJob.setStopped(false);
jobEntry.setParentJob(parentJob);
parentJob.setLogLevel(LogLevel.NOTHING);
DatabaseMeta dbMeta = mock(DatabaseMeta.class);
jobEntry.setDatabase(dbMeta);
db = spy(new Database(jobEntry, dbMeta));
jobEntry.setParentJob(parentJob);
jobEntry.setTablename(TABLENAME);
jobEntry.setArguments(COLUMNS);
jobEntry.setSchemaname(SCHEMANAME);
}
use of org.pentaho.di.job.Job in project pentaho-kettle by pentaho.
the class RemoveJobServletIT method testRemoveJobServletEscapesHtmlWhenTransFound.
@Test
public void testRemoveJobServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
KettleLogStore.init();
HttpServletRequest mockHttpServletRequest = mock(HttpServletRequest.class);
HttpServletResponse mockHttpServletResponse = mock(HttpServletResponse.class);
Job mockJob = mock(Job.class);
JobMeta mockJobMeta = mock(JobMeta.class);
LogChannelInterface mockLogChannelInterface = mock(LogChannelInterface.class);
mockJob.setName(ServletTestUtils.BAD_STRING);
StringWriter out = new StringWriter();
PrintWriter printWriter = new PrintWriter(out);
when(mockHttpServletRequest.getContextPath()).thenReturn(RemoveJobServlet.CONTEXT_PATH);
when(mockHttpServletRequest.getParameter(anyString())).thenReturn(ServletTestUtils.BAD_STRING);
when(mockHttpServletResponse.getWriter()).thenReturn(printWriter);
when(mockJobMap.getJob(any(CarteObjectEntry.class))).thenReturn(mockJob);
when(mockJob.getLogChannelId()).thenReturn(ServletTestUtils.BAD_STRING);
when(mockJob.getLogChannel()).thenReturn(mockLogChannelInterface);
when(mockJob.getJobMeta()).thenReturn(mockJobMeta);
when(mockJobMeta.getMaximum()).thenReturn(new Point(10, 10));
removeJobServlet.doGet(mockHttpServletRequest, mockHttpServletResponse);
assertFalse(ServletTestUtils.hasBadText(ServletTestUtils.getInsideOfTag("H3", out.toString())));
}
Aggregations