new Service( "directCallService", serviceBean,
protected void setUp() throws Exception { super.setUp(); HelloWorld helloWorld = new HelloWorld(); Service service = new Service( "hello", helloWorld, new Version("1.0.0"), Collections.singletonList("hello")); request = new MockHttpServletRequest() { public int getServerPort() { return 8080; } }; request.setScheme("http"); request.setServerName("localhost"); request.setContextPath("geoserver"); response = new MockHttpServletResponse(); handler = new DefaultServiceExceptionHandler(); requestInfo = new Request(); requestInfo.setHttpRequest(request); requestInfo.setHttpResponse(response); requestInfo.setService("hello"); requestInfo.setVersion("1.0.0"); }
@Override public Service serviceDispatched(Request request, Service service) throws ServiceException { Object req = request.getKvp().get("REQUEST"); if ("wfs".equals(service.getId().toLowerCase()) && PAGE_RESULTS.equals(req)) { // allow the request to be successfully parsed as a GetFeature (needs at least a // typename or a featureId) request.getKvp().put("featureId", Collections.singletonList("dummy")); // replace the service return new Service( service.getId(), this.service, service.getVersion(), service.getOperations()); } return service; }
Operation op(String name, String service, String version, Object request) { return new Operation( name, new Service(service, null, new Version(version), null), null, new Object[] {request}); }
Operation op(String name, String service, String version, Object request) { return new Operation(name, new Service(service, null, new Version(version), null), null, new Object[]{request}); }
protected void setUp() throws Exception { geoServerImpl = new GeoServerImpl(); List<String> operations = new ArrayList<String>(); csw = new Service("csw", new DefaultWebCatalogService(geoServerImpl), new Version("2.0.2"), operations); params = new HashMap<String, String>(); }
private void invokeQualifyRequest() { TransactionType transactionType = Wfs20Factory.eINSTANCE.createTransactionType(); ReplaceType replaceType = Wfs20Factory.eINSTANCE.createReplaceType(); EList<AbstractTransactionActionType> action = transactionType.getAbstractTransactionAction(); action.add(replaceType); replaceType.getAny().add(mockFeature); Version version = new Version("2.0.0"); Service service = new Service("id", "service", version, Collections.singletonList("Transaction")); Operation operation = new Operation("id", service, null, new Object[] {transactionType}); replay( mockCatalog, mockFeature, mockFeatureType, mockName, mockNamespaceInfo, mockWorkspaceInfo); sut.qualifyRequest(mockWorkspaceInfo, null, operation, null); } }
@Test public void test() { Foo foo = new Foo(); Service srv = new Service("test", null, new Version("1.0.0"), ImmutableList.of("foo")); Operation op = new Operation("foo", srv, null, new Object[] {foo}); JSONObject obj = JSONObject.fromObject(new SimulateCallback().toJSON(op, Collections.emptyMap())); System.out.println(obj.toString(2)); }
Service serviceDesc = new Service("wms", null, null, Collections.EMPTY_LIST); Operation opDescriptor = new Operation("", serviceDesc, null, new Object[] {gfreq}); outputFormat.write(features, out, opDescriptor);
Service serviceDesc = new Service("wms", null, null); Operation opDescriptor = new Operation("",serviceDesc,null, new Object[] { gfreq });
Service serviceDesc = new Service("wms", null, null, Collections.EMPTY_LIST); Operation opDescriptor = new Operation("", serviceDesc, null, new Object[] {gfreq});
new Operation("foo", new Service("bar", null, null, null), null, null));
new Operation( "DescribeFeatureType", new Service("WFS", null, null, null), null, new Object[] {request.getAdaptee()});
callback.operationDispatched( new Request(), new Operation("foo", new Service("bar", null, null, null), null, null));
@Test public void testFilterAsCQL() throws Exception { Foo foo = new Foo(); FilterFactory ff = CommonFactoryFinder.getFilterFactory(null); foo.filter = ff.equals( ff.function("in", ff.literal("prop1"), ff.literal(1), ff.literal(2)), ff.literal(true)); Service srv = new Service("test", null, new Version("1.0.0"), ImmutableList.of("foo")); Operation op = new Operation("foo", srv, null, new Object[] {foo}); JSONObject obj = JSONObject.fromObject(new SimulateCallback().toJSON(op, Collections.emptyMap())); obj.getJSONObject("operation").getJSONObject("request").getString("filter"); }
@Override protected void setUp() throws Exception { // the data source we'll use for the tests dataStore = new PropertyDataStore(new File("./src/test/java/org/geoserver/wfs/response")); // the output format (and let's add a few output formats to play with ogr = new Ogr2OgrOutputFormat(new GeoServerImpl()); ogr.addFormat(new OgrFormat("KML", "OGR-KML", ".kml", true, "application/vnd.google-earth.kml")); ogr.addFormat(new OgrFormat("KML", "OGR-KML-ZIP", ".kml", false, "application/vnd.google-earth.kml")); ogr.addFormat(new OgrFormat("CSV", "OGR-CSV", ".csv", true, "text/csv")); ogr.addFormat(new OgrFormat("SHP", "OGR-SHP", ".shp", false, null)); ogr.addFormat(new OgrFormat("MapInfo File", "OGR-MIF", ".mif", false, null, "-dsco", "FORMAT=MIF")); ogr.setOgrExecutable(Ogr2OgrTestUtil.getOgr2Ogr()); ogr.setGdalData(Ogr2OgrTestUtil.getGdalData()); // the EMF objects used to talk with the output format gft = WfsFactory.eINSTANCE.createGetFeatureType(); fct = WfsFactory.eINSTANCE.createFeatureCollectionType(); op = new Operation("GetFeature", new Service("WFS", null, new Version("1.0.0"), Arrays.asList("GetFeature")), null, new Object[] { gft }); }
@Before public void setUp() throws Exception { // check if we can run the tests Assume.assumeTrue(Ogr2OgrTestUtil.isOgrAvailable()); // the data source we'll use for the tests dataStore = new PropertyDataStore(new File("./src/test/java/org/geoserver/wfs/response")); // the output format (and let's add a few output formats to play with ogr = new Ogr2OgrOutputFormat(new GeoServerImpl(), new OGRWrapperFactory()); ogr.addFormat( new OgrFormat("KML", "OGR-KML", ".kml", true, "application/vnd.google-earth.kml")); ogr.addFormat( new OgrFormat( "KML", "OGR-KML-ZIP", ".kml", false, "application/vnd.google-earth.kml")); ogr.addFormat(new OgrFormat("CSV", "OGR-CSV", ".csv", true, "text/csv")); ogr.addFormat(new OgrFormat("SHP", "OGR-SHP", ".shp", false, null)); ogr.addFormat( new OgrFormat( "MapInfo File", "OGR-MIF", ".mif", false, null, "-dsco", "FORMAT=MIF")); ogr.setExecutable(Ogr2OgrTestUtil.getOgr2Ogr()); ogr.setEnvironment(Collections.singletonMap("GDAL_DATA", Ogr2OgrTestUtil.getGdalData())); // the EMF objects used to talk with the output format gft = WfsFactory.eINSTANCE.createGetFeatureType(); fct = WfsFactory.eINSTANCE.createFeatureCollectionType(); op = new Operation( "GetFeature", new Service("WFS", null, new Version("1.0.0"), Arrays.asList("GetFeature")), null, new Object[] {gft}); }