@Override protected void onSetUp(SystemTestData testData) throws Exception { super.onSetUp(testData); }
@Override protected void setUpTestData(SystemTestData testData) throws Exception { super.setUpTestData(testData); testData.setUpDefaultRasterLayers(); }
@Override protected void populateDataDirectory(MockData dataDirectory) throws Exception { super.populateDataDirectory(dataDirectory); //add a new user with only admin privileges to a single workspace File security = new File(dataDirectory.getDataDirectoryRoot(), "security"); security.mkdir(); File users = new File(security, "users.properties"); Properties props = new Properties(); props.put("admin", "geoserver,ROLE_ADMINISTRATOR"); props.put("cite", "cite,ROLE_CITE_ADMIN"); props.put("sf", "sf,ROLE_SF_ADMIN"); props.store(new FileOutputStream(users), ""); File layers = new File(security, "layers.properties"); props.put("*.*.r", "*"); props.put("*.*.w", "*"); props.put("*.*.a", "ROLE_ADMINISTRATOR"); props.put("cite.*.a", "ROLE_CITE_ADMIN"); props.put("sf.*.a", "ROLE_SF_ADMIN"); props.store(new FileOutputStream(layers), ""); }
@Before public void loginBefore() { super.login(); }
@Override protected void setUpInternal() throws Exception { super.setUpInternal(); Catalog cat = getCatalog(); //add two workspace specific styles StyleInfo s = cat.getFactory().createStyle(); s.setName("sf_style"); s.setWorkspace(cat.getWorkspaceByName("sf")); s.setFilename("sf.sld"); cat.add(s); s = cat.getFactory().createStyle(); s.setName("cite_style"); s.setWorkspace(cat.getWorkspaceByName("cite")); s.setFilename("cite.sld"); cat.add(s); }
@Override protected void onSetUp(SystemTestData testData) throws Exception { super.onSetUp(testData); // get the beans we use for testing configurer = (GeoFencePropertyPlaceholderConfigurer) applicationContext.getBean("geofence-configurer"); configurer.setLocation( new UrlResource(this.getClass().getResource("/test-config.properties"))); }
@Override protected void setUpTestData(SystemTestData testData) throws Exception { super.setUpTestData(testData); testData.setUpDefaultRasterLayers(); }
/** * Populates a mock data directory with standard data */ @Override protected void populateDataDirectory(MockData dataDirectory) throws Exception { super.populateDataDirectory(dataDirectory); dataDirectory.addWellKnownCoverageTypes(); this.dataRoot = dataDirectory.getDataDirectoryRoot(); }
@Override protected void onSetUp(SystemTestData testData) throws Exception { super.onSetUp(testData); // get the beans we use for testing configurer = (GeoFencePropertyPlaceholderConfigurer) applicationContext.getBean("geofence-configurer"); configurer.setLocation( new UrlResource(this.getClass().getResource("/test-config.properties"))); }
@Override protected void setUpTestData(SystemTestData testData) throws Exception { super.setUpTestData(testData); testData.setUpRasterLayer( SAMPLE_GRIB, "test-data/sampleGrib.grb2", null, null, GribDataTest.class); }
@Override protected void onSetUp(SystemTestData testData) throws Exception { super.onSetUp(testData); // addUser("admin", "geoxserver", null, Arrays.asList("ROLE_ADMINISTRATOR")); addLayerAccessRule("*", "*", AccessMode.READ, "*"); addLayerAccessRule("*", "*", AccessMode.WRITE, "*"); catalog = getCatalog(); // init xmlunit Map<String, String> namespaces = new HashMap<String, String>(); namespaces.put("ows", "http://www.opengis.net/ows/1.1"); namespaces.put("gml", "http://www.opengis.net/gml"); namespaces.put("wfs", "http://www.opengis.net/wfs"); namespaces.put("xlink", "http://www.w3.org/1999/xlink"); namespaces.put("xsi", "http://www.w3.org/2001/XMLSchema-instance"); namespaces.put("feature", "http://geoserver.sf.net"); testData.registerNamespaces(namespaces); XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(namespaces)); xp = XMLUnit.newXpathEngine(); addWcs11Coverages(testData); }
protected void setUpTestData(SystemTestData testData) throws Exception { super.setUpTestData(testData); System.out.println("setUpTestData()"); Date t0 = new Date(1483228800000L); // Midnight Jan 1, 2017 UTC List<String> testStyleNames = Arrays.asList( oldCssStyle, oldCssStyleWithFormatSLD, oldCssStyleWithSLDManuallyEdited); for (String styleName : testStyleNames) { for (String ext : Arrays.asList(".css", ".sld", ".xml")) { testData.copyTo( this.getClass().getResourceAsStream(styleName + ext), "styles/" + styleName + ext); File f = Paths.get( testData.getDataDirectoryRoot().getAbsolutePath(), "styles/" + styleName + ext) .toFile(); f.setLastModified(t0.getTime()); } } // Make this SLD file appear as if it was edited after being generated from CSS. File manuallyEditedSld = Paths.get( testData.getDataDirectoryRoot().getAbsolutePath(), "styles/" + oldCssStyleWithSLDManuallyEdited + ".sld") .toFile(); manuallyEditedSld.setLastModified(t0.getTime() + 1000000L); }
/** Add the users */ @Override protected void onSetUp(SystemTestData testData) throws Exception { super.onSetUp(testData); addUser("cite", "cite", null, Collections.singletonList("ROLE_DUMMY")); addUser("cite_mixed", "cite", null, Collections.singletonList("ROLE_DUMMY")); // populate the access manager TestResourceAccessManager tam = (TestResourceAccessManager) applicationContext.getBean("testResourceAccessManager"); Catalog catalog = getCatalog(); FeatureTypeInfo buildings = catalog.getFeatureTypeByName(getLayerId(SystemTestData.BUILDINGS)); // user in mixed mode tam.putLimits( "cite_mixed", buildings, new VectorAccessLimits( CatalogMode.MIXED, null, Filter.EXCLUDE, null, Filter.EXCLUDE)); }
@Override protected void onSetUp(SystemTestData testData) throws Exception { super.onSetUp(testData); OSEOTestSupport.setupBasicOpenSearch(testData, getCatalog(), getGeoServer(), false); OSEOInfo service = getGeoServer().getService(OSEOInfo.class); openSearchAccessStoreId = service.getOpenSearchAccessStoreId(); } }
@Override protected void onSetUp(SystemTestData testData) throws Exception { super.onSetUp(testData); GeoServerSecurityManager manager = getSecurityManager(); GitHubOAuth2FilterConfig filterConfig = new GitHubOAuth2FilterConfig(); filterConfig.setName("github"); filterConfig.setClassName(GitHubOAuthAuthenticationFilter.class.getName()); filterConfig.setCliendId("foo"); filterConfig.setClientSecret("bar"); manager.saveFilter(filterConfig); SecurityManagerConfig config = manager.getSecurityConfig(); GeoServerSecurityFilterChain chain = config.getFilterChain(); RequestFilterChain www = chain.getRequestChainByName("web"); www.setFilterNames("github", "anonymous"); manager.saveSecurityConfig(config); }
@Override protected void onSetUp(SystemTestData testData) throws Exception { super.onSetUp(testData); GeoServerSecurityManager manager = getSecurityManager(); GoogleOAuth2FilterConfig filterConfig = new GoogleOAuth2FilterConfig(); filterConfig.setName("google"); filterConfig.setClassName(GoogleOAuthAuthenticationFilter.class.getName()); filterConfig.setCliendId("foo"); filterConfig.setClientSecret("bar"); manager.saveFilter(filterConfig); SecurityManagerConfig config = manager.getSecurityConfig(); GeoServerSecurityFilterChain chain = config.getFilterChain(); RequestFilterChain www = chain.getRequestChainByName("web"); www.setFilterNames("google", "anonymous"); manager.saveSecurityConfig(config); }
@Override protected void onSetUp(SystemTestData testData) throws Exception { super.onSetUp(testData); GeoServerSecurityManager manager = getSecurityManager(); OpenIdConnectFilterConfig filterConfig = new OpenIdConnectFilterConfig(); filterConfig.setName("openIdConnect"); filterConfig.setClassName(OpenIdConnectAuthenticationFilter.class.getName()); filterConfig.setCliendId("foo"); filterConfig.setClientSecret("bar"); filterConfig.setAccessTokenUri("https://www.connectid/fake/test"); filterConfig.setUserAuthorizationUri("https://www.connectid/fake/test"); filterConfig.setCheckTokenEndpointUrl("https://www.connectid/fake/test"); manager.saveFilter(filterConfig); SecurityManagerConfig config = manager.getSecurityConfig(); GeoServerSecurityFilterChain chain = config.getFilterChain(); RequestFilterChain www = chain.getRequestChainByName("web"); www.setFilterNames("openIdConnect", "anonymous"); manager.saveSecurityConfig(config); }