StoredQueryHandler { public boolean hasStoredQuery( String id ) { return idToQuery.get( id ) != null; } 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 testInitManagedContainsFixedStoredQueries() { List<FeatureType> featureTypes = featureTypes(); StoredQueryHandler storedQueryHandler = new StoredQueryHandler( mockWFS( featureTypes ), new ArrayList<URL>(), managedStoredQueries ); assertThat( storedQueryHandler.hasStoredQuery( GET_FEATURE_BY_ID ), is( true ) ); assertThat( storedQueryHandler.hasStoredQuery( GET_FEATURE_BY_TYPE ), is( true ) ); }
@Test public void testInitManagedStoredQueries() throws Exception { List<FeatureType> featureTypes = featureTypes(); File managedStoredQueries = Files.createTempDirectory( "managedStoredQueries" ).toFile(); OutputStream output = new FileOutputStream( new File( managedStoredQueries, "storedQuery_byName.xml" ) ); InputStream resourceAsStream = StoredQueryHandlerTest.class.getResourceAsStream( "storedQuery_byName.xml" ); IOUtils.copy( resourceAsStream, output ); resourceAsStream.close(); output.close(); StoredQueryHandler storedQueryHandler = new StoredQueryHandler( mockWFS( featureTypes ), new ArrayList<URL>(), managedStoredQueries ); assertThat( storedQueryHandler.hasStoredQuery( GET_FEATURE_BY_ID ), is( true ) ); assertThat( storedQueryHandler.hasStoredQuery( GET_FEATURE_BY_TYPE ), is( true ) ); assertThat( storedQueryHandler.hasStoredQuery( "ByName" ), is( true ) ); }