public void tearDown() throws Exception { monitor.complete(); }
public void initialize(GeoServer geoServer) throws Exception { if (!monitor.isEnabled()) return; if (monitor.getDAO() instanceof HibernateMonitorDAO2) { sessionFactory = ((HibernateMonitorDAO2) monitor.getDAO()).getSessionFactory(); HibUtil.setUpSession(sessionFactory); Status.RUNNING, Status.WAITING, Status.CANCELLING), Comparison.IN); for (RequestData data : monitor.getDAO().getRequests(query)) { if (InternalHostname.get().equals(data.getInternalHost())) { monitor.getDAO().save(data);
@Before public void setUp() throws Exception { callback = new MonitorCallback(monitor, catalog); data = monitor.start(); }
@Before public void setUp() throws Exception { dao = new DummyMonitorDAO(); filter = new MonitorFilter(new Monitor(dao), new MonitorRequestFilter()); chain = new MockFilterChain( new HttpServlet() { @Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { req.getInputStream().read(new byte[LONG_BODY_SIZE]); res.getOutputStream().write(new byte[0]); } }); filter.monitor.config.props.put( "maxBodySize", Integer.toString( MAX_BODY_SIZE)); // Ensure the configured property is correct for the tests }
@Test public void testConfiguration() throws IOException { // store the properties into a temp folder and relaod assertTrue(monitor.getConfig().getFileLocations().isEmpty()); File tmpDir = createTempDir(); GeoServerResourceLoader resourceLoader = new GeoServerResourceLoader(tmpDir); monitor.getConfig().saveConfiguration(resourceLoader); Resource controlFlowProps = Files.asResource(resourceLoader.find("monitor.properties")); assertTrue(Resources.exists(controlFlowProps)); PropertyFileWatcher savedProps = new PropertyFileWatcher(controlFlowProps); assertEquals(savedProps.getProperties(), monitor.getConfig().getProperties()); }
@Before public void setUp() throws Exception { callback = new RESTMonitorCallback(monitor); data = monitor.start(); }
@Before public void setUp() throws Exception { dao = new DummyMonitorDAO(); filter = new MonitorFilter(new Monitor(dao), new MonitorRequestFilter()); chain = new MockFilterChain(); chain.setServlet(new HttpServlet() { @Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { req.getInputStream().read(new byte[LONG_BODY_SIZE]); res.getOutputStream().write(new byte[0]); } }); filter.monitor.config.props.put("maxBodySize", Integer.toString(MAX_BODY_SIZE)); // Ensure the configured property is correct for the tests }
@Before public void setUp() throws Exception { callback = new MonitorCallback(monitor, catalog); data = monitor.start(); }
@BeforeClass public static void setUpData() throws Exception { MonitorDAO dao = new MemoryMonitorDAO(); new MonitorTestData(dao).setup(); monitor = new Monitor(dao); }
public void tearDown() throws Exception { monitor.complete(); }
@Test public void testGetAllCSV() throws Exception { RequestResource.CSVFormat format = new RequestResource.CSVFormat( new String[]{"id", "path", "startTime"}, monitor); ByteArrayOutputStream out = new ByteArrayOutputStream(); format.toRepresentation(monitor.getDAO().getRequests()).write(out); BufferedReader in = new BufferedReader(new InputStreamReader( new ByteArrayInputStream(out.toByteArray()))); String line = in.readLine(); assertEquals("id,path,startTime", line); Iterator<RequestData> it = monitor.getDAO().getRequests().iterator(); while((line = in.readLine()) != null) { assertTrue(it.hasNext()); RequestData data = it.next(); String expected = data.getId() + "," + data.getPath() + "," + DateUtil.serializeDateTime(data.getStartTime()); assertEquals(expected, line); } assertFalse(it.hasNext()); }
@Test public void test() throws Exception { final RequestData data = monitor.start(); DispatcherCallback callback = new DispatcherCallback() {
@BeforeClass public static void setUpData() throws Exception { MonitorDAO dao = new MemoryMonitorDAO(); new MonitorTestData(dao).setup(); monitor = new Monitor(dao); }
public void tearDown() throws Exception { monitor.complete(); }