use of org.pentaho.di.core.gui.Point in project pentaho-kettle by pentaho.
the class AbstractGraph method getOffset.
protected Point getOffset(Point thumb, Point area) {
Point p = new Point(0, 0);
Point sel = new Point(hori.getSelection(), vert.getSelection());
if (thumb.x == 0 || thumb.y == 0) {
return p;
}
p.x = Math.round(-sel.x * area.x / thumb.x / magnification);
p.y = Math.round(-sel.y * area.y / thumb.y / magnification);
return p;
}
use of org.pentaho.di.core.gui.Point in project pentaho-kettle by pentaho.
the class AbstractGraph method getArea.
protected Point getArea() {
org.eclipse.swt.graphics.Rectangle rect = canvas.getClientArea();
Point area = new Point(rect.width, rect.height);
return area;
}
use of org.pentaho.di.core.gui.Point in project pentaho-kettle by pentaho.
the class PrepareExecutionTransServletTest method testPauseTransServletEscapesHtmlWhenTransFound.
@Test
@PrepareForTest({ Encode.class })
public void testPauseTransServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
KettleLogStore.init();
HttpServletRequest mockHttpServletRequest = mock(HttpServletRequest.class);
HttpServletResponse mockHttpServletResponse = mock(HttpServletResponse.class);
Trans mockTrans = mock(Trans.class);
TransConfiguration mockTransConf = mock(TransConfiguration.class);
TransMeta mockTransMeta = mock(TransMeta.class);
TransExecutionConfiguration mockTransExecutionConf = mock(TransExecutionConfiguration.class);
LogChannelInterface mockChannelInterface = mock(LogChannelInterface.class);
StringWriter out = new StringWriter();
PrintWriter printWriter = new PrintWriter(out);
PowerMockito.spy(Encode.class);
when(mockHttpServletRequest.getContextPath()).thenReturn(PrepareExecutionTransServlet.CONTEXT_PATH);
when(mockHttpServletRequest.getParameter(anyString())).thenReturn(ServletTestUtils.BAD_STRING_TO_TEST);
when(mockHttpServletResponse.getWriter()).thenReturn(printWriter);
when(mockTransformationMap.getTransformation(any(CarteObjectEntry.class))).thenReturn(mockTrans);
when(mockTransformationMap.getConfiguration(any(CarteObjectEntry.class))).thenReturn(mockTransConf);
when(mockTransConf.getTransExecutionConfiguration()).thenReturn(mockTransExecutionConf);
when(mockTrans.getLogChannel()).thenReturn(mockChannelInterface);
when(mockTrans.getTransMeta()).thenReturn(mockTransMeta);
when(mockTransMeta.getMaximum()).thenReturn(new Point(10, 10));
prepareExecutionTransServlet.doGet(mockHttpServletRequest, mockHttpServletResponse);
assertFalse(ServletTestUtils.hasBadText(ServletTestUtils.getInsideOfTag("H1", out.toString())));
PowerMockito.verifyStatic(atLeastOnce());
Encode.forHtml(anyString());
}
use of org.pentaho.di.core.gui.Point in project pentaho-kettle by pentaho.
the class PauseTransServletIT method testPauseTransServletEscapesHtmlWhenTransFound.
@Test
public void testPauseTransServletEscapesHtmlWhenTransFound() 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(PauseTransServlet.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.getTransMeta()).thenReturn(mockTransMeta);
when(mockTransMeta.getMaximum()).thenReturn(new Point(10, 10));
pauseTransServlet.doGet(mockHttpServletRequest, mockHttpServletResponse);
assertFalse(out.toString().contains(ServletTestUtils.BAD_STRING));
}
use of org.pentaho.di.core.gui.Point 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