@Test public void testCaptureImage() throws IOException { String deviceId = "000000000001"; final DawgVideoOutput mockDVO = EasyMock .createMock(DawgVideoOutput.class); EasyMock.expect(mockDVO.captureScreen()).andReturn(PC_IMG); VideoSnap videoSnap = new VideoSnap() { @Override protected DawgVideoOutput createDawgVideoOutput(MetaStb stb) { return mockDVO; } }; MetaStbCache stbCache = new MetaStbCache(); MetaStb stb = new MetaStb(); stbCache.putMetaStb(deviceId, stb); MockHttpSession session = new MockHttpSession(); EasyMock.replay(mockDVO); String iid = videoSnap.captureImage(deviceId, session, stbCache); Assert.assertNotNull(iid); ByteArrayOutputStream bao = new ByteArrayOutputStream(); ImageIO.write(PC_IMG, "jpg", bao); EasyMock.verify(mockDVO); UniqueIndexedCache<BufferedImage> imgCache = ClientCache .getClientCache(session).getImgCache(); Assert.assertSame(imgCache.getItem(iid), PC_IMG, "Captured image is not matching with expected image"); }
public String captureImage(String deviceId, HttpSession session, MetaStbCache metaStbCache) { LOGGER.debug("Snapping external video frame - BEGIN"); DawgVideoOutput dawgVideoOutput = createDawgVideoOutput(metaStbCache .getMetaStb(deviceId)); BufferedImage img = dawgVideoOutput.captureScreen(); LOGGER.debug("Snapping external video frame - COMPLETE"); return (null == img) ? null : getClientCache(session).getImgCache().storeItem(img); }
VideoSnap { public String captureImage(String deviceId, HttpSession session, MetaStbCache metaStbCache) { LOGGER.debug("Snapping external video frame - BEGIN"); DawgVideoOutput dawgVideoOutput = createDawgVideoOutput(metaStbCache .getMetaStb(deviceId)); BufferedImage img = dawgVideoOutput.captureScreen(); LOGGER.debug("Snapping external video frame - COMPLETE"); return (null == img) ? null : getClientCache(session).getImgCache().storeItem(img); } }
VideoSnap { public String captureImage(String deviceId, HttpSession session, MetaStbCache metaStbCache) { LOGGER.debug("Snapping external video frame - BEGIN"); DawgVideoOutput dawgVideoOutput = createDawgVideoOutput(metaStbCache .getMetaStb(deviceId)); BufferedImage img = dawgVideoOutput.captureScreen(); LOGGER.debug("Snapping external video frame - COMPLETE"); return (null == img) ? null : getClientCache(session).getImgCache().storeItem(img); }  }
VideoSnap { public String captureImage(String deviceId, HttpSession session, MetaStbCache metaStbCache) { LOGGER.debug("Snapping external video frame - BEGIN"); DawgVideoOutput dawgVideoOutput = createDawgVideoOutput(metaStbCache .getMetaStb(deviceId)); BufferedImage img = dawgVideoOutput.captureScreen(); LOGGER.debug("Snapping external video frame - COMPLETE"); return (null == img) ? null : getClientCache(session).getImgCache().storeItem(img); }  void addImagesToZipFile(String[] capturedImageIds, String[] deviceMacs, HttpServletResponse response, HttpSession session); void saveSnappedImage(String imgId, String deviceId,
            HttpServletResponse response, HttpSession session); String captureImage(String deviceId, HttpSession session,
            MetaStbCache metaStbCache); Map<String, String> getCaptureImageIds(String[] deviceIds, HttpSession session, MetaStbCache metaStbCache); }
VideoSnap { public String captureImage(String deviceId, HttpSession session, MetaStbCache metaStbCache) { LOGGER.debug("Snapping external video frame - BEGIN"); DawgVideoOutput dawgVideoOutput = createDawgVideoOutput(metaStbCache .getMetaStb(deviceId)); BufferedImage img = dawgVideoOutput.captureScreen(); LOGGER.debug("Snapping external video frame - COMPLETE"); return (null == img) ? null : getClientCache(session).getImgCache().storeItem(img); }  void addImagesToZipFile(String[] capturedImageIds, String[] deviceMacs, HttpServletResponse response, HttpSession session); void saveSnappedImage(String imgId, String deviceId,
            HttpServletResponse response, HttpSession session); String captureImage(String deviceId, HttpSession session,
            MetaStbCache metaStbCache); Map<String, String> getCaptureImageIds(String[] deviceIds, HttpSession session, MetaStbCache metaStbCache);  }