StoredQueryHandler { public void doDropStoredQuery( DropStoredQuery request, HttpResponseBuffer response ) throws OWSException, URISyntaxException, XMLStreamException, IOException { checkIdOfDropStoredQueryRequest( request ); handleDropStoredQuery( request ); writeDropStoredQueryResponse( response ); } StoredQueryHandler( WebFeatureService wfs, List<URL> storedQueryTemplates,
                               File managedStoredQueryDirectory ); void doCreateStoredQuery( CreateStoredQuery request, HttpResponseBuffer response ); void doDescribeStoredQueries( DescribeStoredQueries request, HttpResponseBuffer response ); void doDropStoredQuery( DropStoredQuery request, HttpResponseBuffer response ); void doListStoredQueries( ListStoredQueries request, HttpResponseBuffer response ); boolean hasStoredQuery( String id ); URL getStoredQueryTemplate( String id ); static final String LANGUAGE_WFS_QUERY_EXPRESSION; static final String GET_FEATURE_BY_ID; static final String GET_FEATURE_BY_TYPE; }
@Test public void testDoDropStoredQuery() throws Exception { List<FeatureType> featureTypes = featureTypes(); StoredQueryHandler storedQueryHandler = new StoredQueryHandler( mockWFS( featureTypes ), new ArrayList<URL>(), managedStoredQueries ); String id = "mangedStoredQuery"; insertStoredQuery( storedQueryHandler, id ); ByteArrayOutputStream outStream = new ByteArrayOutputStream(); XMLStreamWriter xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter( outStream ); storedQueryHandler.doDropStoredQuery( dropStoredQuery( id ), mockHttpResponseBuffer( xmlStreamWriter ) ); xmlStreamWriter.close(); assertThat( storedQueryHandler.hasStoredQuery( id ), is( false ) ); assertThat( xml( outStream.toString() ), hasXPath( "/wfs:DropStoredQueryResponse[@status='OK']", NS_CONTEXT ) ); }