use of org.pentaho.di.core.gui.Point in project pentaho-kettle by pentaho.
the class RemoveTransServletIT method testRemoveTransServletEscapesHtmlWhenTransFound.
@Test
public void testRemoveTransServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
KettleLogStore.init();
HttpServletRequest mockHttpServletRequest = mock(HttpServletRequest.class);
HttpServletResponse mockHttpServletResponse = mock(HttpServletResponse.class);
Trans mockTrans = mock(Trans.class);
TransMeta mockTransMeta = mock(TransMeta.class);
LogChannelInterface mockChannelInterface = mock(LogChannelInterface.class);
StringWriter out = new StringWriter();
PrintWriter printWriter = new PrintWriter(out);
when(mockHttpServletRequest.getContextPath()).thenReturn(RemoveTransServlet.CONTEXT_PATH);
when(mockHttpServletRequest.getParameter(anyString())).thenReturn(ServletTestUtils.BAD_STRING);
when(mockHttpServletResponse.getWriter()).thenReturn(printWriter);
when(mockTransformationMap.getTransformation(any(CarteObjectEntry.class))).thenReturn(mockTrans);
when(mockTrans.getLogChannel()).thenReturn(mockChannelInterface);
when(mockTrans.getLogChannelId()).thenReturn("test");
when(mockTrans.getTransMeta()).thenReturn(mockTransMeta);
when(mockTransMeta.getMaximum()).thenReturn(new Point(10, 10));
removeTransServlet.doGet(mockHttpServletRequest, mockHttpServletResponse);
assertFalse(ServletTestUtils.hasBadText(ServletTestUtils.getInsideOfTag("H3", out.toString())));
}
use of org.pentaho.di.core.gui.Point in project pentaho-kettle by pentaho.
the class StartExecutionTransServletIT method testStartExecutionTransServletEscapesHtmlWhenTransFound.
@Test
public void testStartExecutionTransServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
KettleLogStore.init();
HttpServletRequest mockHttpServletRequest = mock(HttpServletRequest.class);
HttpServletResponse mockHttpServletResponse = mock(HttpServletResponse.class);
Trans mockTrans = mock(Trans.class);
TransMeta mockTransMeta = mock(TransMeta.class);
LogChannelInterface mockChannelInterface = mock(LogChannelInterface.class);
StringWriter out = new StringWriter();
PrintWriter printWriter = new PrintWriter(out);
when(mockHttpServletRequest.getContextPath()).thenReturn(StartExecutionTransServlet.CONTEXT_PATH);
when(mockHttpServletRequest.getParameter(anyString())).thenReturn(ServletTestUtils.BAD_STRING);
when(mockHttpServletResponse.getWriter()).thenReturn(printWriter);
when(mockTransformationMap.getTransformation(any(CarteObjectEntry.class))).thenReturn(mockTrans);
when(mockTrans.getLogChannel()).thenReturn(mockChannelInterface);
when(mockTrans.isReadyToStart()).thenReturn(true);
when(mockTrans.getLogChannelId()).thenReturn("test");
when(mockTrans.getTransMeta()).thenReturn(mockTransMeta);
when(mockTransMeta.getMaximum()).thenReturn(new Point(10, 10));
startExecutionTransServlet.doGet(mockHttpServletRequest, mockHttpServletResponse);
System.out.println(out);
assertFalse(ServletTestUtils.hasBadText(ServletTestUtils.getInsideOfTag("H1", out.toString())));
}
use of org.pentaho.di.core.gui.Point 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())));
}
use of org.pentaho.di.core.gui.Point in project pentaho-kettle by pentaho.
the class StartTransServletIT method testStartTransServletEscapesHtmlWhenTransFound.
@Test
public void testStartTransServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
KettleLogStore.init();
HttpServletRequest mockHttpServletRequest = mock(HttpServletRequest.class);
HttpServletResponse mockHttpServletResponse = mock(HttpServletResponse.class);
Trans mockTrans = mock(Trans.class);
TransMeta mockTransMeta = mock(TransMeta.class);
LogChannelInterface mockChannelInterface = mock(LogChannelInterface.class);
StringWriter out = new StringWriter();
PrintWriter printWriter = new PrintWriter(out);
when(mockHttpServletRequest.getContextPath()).thenReturn(StartTransServlet.CONTEXT_PATH);
when(mockHttpServletRequest.getParameter(anyString())).thenReturn(ServletTestUtils.BAD_STRING);
when(mockHttpServletResponse.getWriter()).thenReturn(printWriter);
when(mockTransformationMap.getTransformation(any(CarteObjectEntry.class))).thenReturn(mockTrans);
when(mockTrans.getLogChannel()).thenReturn(mockChannelInterface);
when(mockTrans.getLogChannelId()).thenReturn("test");
when(mockTrans.getTransMeta()).thenReturn(mockTransMeta);
when(mockTransMeta.getMaximum()).thenReturn(new Point(10, 10));
startTransServlet.doGet(mockHttpServletRequest, mockHttpServletResponse);
assertFalse(ServletTestUtils.hasBadText(ServletTestUtils.getInsideOfTag("H1", out.toString())));
}
use of org.pentaho.di.core.gui.Point in project pentaho-kettle by pentaho.
the class StartJobServletTest method testStartJobServletEscapesHtmlWhenTransFound.
@Test
@PrepareForTest({ Encode.class })
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_TO_TEST);
StringWriter out = new StringWriter();
PrintWriter printWriter = new PrintWriter(out);
PowerMockito.spy(Encode.class);
when(mockHttpServletRequest.getContextPath()).thenReturn(StartJobServlet.CONTEXT_PATH);
when(mockHttpServletRequest.getParameter(anyString())).thenReturn(ServletTestUtils.BAD_STRING_TO_TEST);
when(mockHttpServletResponse.getWriter()).thenReturn(printWriter);
when(mockJobMap.getJob(any(CarteObjectEntry.class))).thenReturn(mockJob);
when(mockJob.getLogChannelId()).thenReturn(ServletTestUtils.BAD_STRING_TO_TEST);
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())));
PowerMockito.verifyStatic(atLeastOnce());
Encode.forHtml(anyString());
}
Aggregations