@Override public void createSchema(T featureType) throws IOException { throw notifyUnsupportedOperation(); }
@Test public void testDontChallenge() throws Exception { ReadOnlyDataAccess ro = new ReadOnlyDataAccess(da, WrapperPolicy.hide(null)); SecuredFeatureSource fs = (SecuredFeatureSource) ro.getFeatureSource(name); assertTrue(fs.policy.isHide()); // check the easy ones, those that are not implemented in a read only // collection try { ro.createSchema(null); fail("Should have failed with an unsupported operation exception"); } catch (UnsupportedOperationException e) { } try { ro.updateSchema(null, null); fail("Should have failed with an unsupported operation exception"); } catch (UnsupportedOperationException e) { } }
return new ReadOnlyDataStore((DataStore) object, policy); } else if (DataAccess.class.isAssignableFrom(clazz)) { return new ReadOnlyDataAccess((DataAccess) object, policy);
@Test public void testChallenge() throws Exception { ReadOnlyDataAccess ro = new ReadOnlyDataAccess(da, WrapperPolicy.readOnlyChallenge(null)); SecuredFeatureSource fs = (SecuredFeatureSource) ro.getFeatureSource(name); assertTrue(fs.policy.isReadOnlyChallenge()); // check the easy ones, those that are not implemented in a read only // collection try { ro.createSchema(null); fail("Should have failed with a security exception"); } catch (Throwable e) { if (SecurityUtils.isSecurityException(e) == false) fail("Should have thrown a security exception..."); } try { ro.updateSchema(null, null); fail("Should have failed with a security exception"); } catch (Throwable e) { if (SecurityUtils.isSecurityException(e) == false) fail("Should have thrown a security exception..."); } } }
@Override public void removeSchema(Name typeName) throws IOException { throw notifyUnsupportedOperation(); } /**
@Override public void updateSchema(Name typeName, T featureType) throws IOException { throw notifyUnsupportedOperation(); }