ConfigurationResourceProvider extends
    AbstractControllerResourceProvider { @Override public RequestStatus deleteResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { throw new UnsupportedOperationException("Cannot delete a Configuration resource."); } ConfigurationResourceProvider(AmbariManagementController managementController); @Override RequestStatus createResources(Request request); @Override Set<Resource> getResourcesAuthorized(Request request, Predicate predicate); @Override RequestStatus updateResources(Request request, Predicate predicate); @Override RequestStatus deleteResources(Request request, Predicate predicate); @Override Set<String> checkPropertyIds(Set<String> propertyIds); static final String CONFIGURATION_CONFIG_TYPE_PROPERTY_ID; static final String CONFIGURATION_CONFIG_TAG_PROPERTY_ID; static final String CONFIGURATION_CONFIG_VERSION_PROPERTY_ID; }
@Test public void testDeleteResources() throws Exception { Resource.Type type = Resource.Type.Configuration; AmbariManagementController managementController = createMock(AmbariManagementController.class); replay(managementController); ResourceProvider provider = AbstractControllerResourceProvider.getResourceProvider( type, PropertyHelper.getPropertyIds(type), PropertyHelper.getKeyPropertyIds(type), managementController); Predicate predicate = new PredicateBuilder().property( ConfigurationResourceProvider.CONFIGURATION_CONFIG_TAG_PROPERTY_ID).equals("Configuration100").toPredicate(); try { provider.deleteResources(new RequestImpl(null, null, null, null), predicate); Assert.fail("Expected an UnsupportedOperationException"); } catch (UnsupportedOperationException e) { } verify(managementController); }