public void init(Request request, Response response) { RequestData data = monitor.current(); if (data == null) { // will happen in cases where the filter is not active return; } data.setCategory(Category.REST); if (request.getResourceRef() != null) { String resource = request.getResourceRef().getLastSegment(); resource = FilenameUtils.getBaseName(resource); data.getResources().add(resource); } monitor.update(); }
@BeforeClass public static void setUpData() throws Exception { MonitorDAO dao = new MemoryMonitorDAO(); new MonitorTestData(dao).setup(); MonitorConfig mc = new MonitorConfig() { @Override public MonitorDAO createDAO() { MonitorDAO dao = new MemoryMonitorDAO(); try { new MonitorTestData(dao).setup(); return dao; } catch (java.text.ParseException e) { throw new RuntimeException(e); } } @Override public BboxMode getBboxMode() { return BboxMode.FULL; } }; GeoServer gs = createMock(GeoServer.class); monitor = new Monitor(mc); monitor.setServer(gs); catalog = new CatalogImpl(); expect(gs.getCatalog()).andStubReturn(catalog); replay(gs); NamespaceInfo ns = catalog.getFactory().createNamespace(); ns.setPrefix("acme"); ns.setURI("http://acme.org"); catalog.add(ns); DataStoreInfo ds = catalog.getFactory().createDataStore(); FeatureTypeInfo ftFoo = catalog.getFactory().createFeatureType(); ftFoo.setName("foo"); ftFoo.setSRS("EPSG:4326"); ftFoo.setNamespace(ns); ftFoo.setStore(ds); catalog.add(ftFoo); FeatureTypeInfo ftBar = catalog.getFactory().createFeatureType(); ftBar.setName("bar"); ftBar.setSRS("EPSG:3348"); ftBar.setNamespace(ns); ftBar.setStore(ds); catalog.add(ftBar); }
public void dispatched(Request request, Response response, Restlet restlet) { RequestData data = monitor.current(); if (data == null) { // will happen in cases where the filter is not active return; } if (restlet instanceof Route) { restlet = ((Route) restlet).getNext(); } if (restlet instanceof BeanDelegatingRestlet) { restlet = ((BeanDelegatingRestlet) restlet).getBean(); } if (restlet != null) { if (restlet.getClass().getPackage().getName().startsWith("org.geoserver.catalog.rest")) { data.setService("RESTConfig"); } } monitor.update(); }
public void tearDown() throws Exception { monitor.complete(); }
@Before public void setUp() throws Exception { callback = new MonitorCallback(monitor, catalog); data = monitor.start(); }