RequestResourceProvider extends AbstractControllerResourceProvider { @Override public RequestStatus deleteResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { throw new UnsupportedOperationException("Not currently supported."); } RequestResourceProvider(Set<String> propertyIds,
                          Map<Resource.Type, String> keyPropertyIds,
                          AmbariManagementController managementController); @Override RequestStatus createResources(Request request); @Override Set<Resource> getResources(Request request, Predicate predicate); @Override RequestStatus updateResources(Request requestInfo, Predicate predicate); @Override RequestStatus deleteResources(Request request, Predicate predicate); static final String REQUEST_CLUSTER_NAME_PROPERTY_ID; static final String REQUEST_CLUSTER_ID_PROPERTY_ID; static final String REQUEST_ID_PROPERTY_ID; static final String REQUEST_SOURCE_SCHEDULE; static final String REQUEST_SOURCE_SCHEDULE_ID; static final String REQUEST_SOURCE_SCHEDULE_HREF; }
@Test public void testDeleteResources() throws Exception { Resource.Type type = Resource.Type.Request; AmbariManagementController managementController = createMock(AmbariManagementController.class); replay(managementController); ResourceProvider provider = AbstractControllerResourceProvider.getResourceProvider( type, PropertyHelper.getPropertyIds(type), PropertyHelper.getKeyPropertyIds(type), managementController); Predicate predicate = new PredicateBuilder().property(RequestResourceProvider.REQUEST_ID_PROPERTY_ID). equals("Request100").toPredicate(); try { provider.deleteResources(new RequestImpl(null, null, null, null), predicate); Assert.fail("Expected an UnsupportedOperationException"); } catch (UnsupportedOperationException e) { } verify(managementController); }