use of org.pentaho.di.job.JobMeta in project pentaho-kettle by pentaho.
the class JobEntryJobTest method testExportResources.
@Test
public void testExportResources() throws Exception {
JobEntryJob jobEntryJob = spy(getJobEntryJob());
JobMeta jobMeta = mock(JobMeta.class);
String testName = "test";
doReturn(jobMeta).when(jobEntryJob).getJobMeta(any(Repository.class), any(IMetaStore.class), any(VariableSpace.class));
when(jobMeta.exportResources(any(JobMeta.class), any(Map.class), any(ResourceNamingInterface.class), any(Repository.class), any(IMetaStore.class))).thenReturn(testName);
jobEntryJob.exportResources(null, null, null, null, null);
verify(jobMeta).setFilename("${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}/" + testName);
verify(jobEntryJob).setSpecificationMethod(ObjectLocationSpecificationMethod.FILENAME);
}
use of org.pentaho.di.job.JobMeta 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.JobMeta 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.JobMeta 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())));
}
use of org.pentaho.di.job.JobMeta in project pentaho-kettle by pentaho.
the class StartJobServletIT method testStartJobServletEscapesHtmlWhenTransFound.
@Test
public void testStartJobServletEscapesHtmlWhenTransFound() 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(StartJobServlet.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));
startJobServlet.doGet(mockHttpServletRequest, mockHttpServletResponse);
assertFalse(ServletTestUtils.hasBadText(ServletTestUtils.getInsideOfTag("H1", out.toString())));
}
Aggregations