@Test public void testCreateResources() throws Exception { Resource.Type type = Resource.Type.ClientConfig; AmbariManagementController managementController = createMock(AmbariManagementController.class); RequestStatusResponse response = createNiceMock(RequestStatusResponse.class); replay(managementController, response); ResourceProvider provider = AbstractControllerResourceProvider.getResourceProvider( type, PropertyHelper.getPropertyIds(type), PropertyHelper.getKeyPropertyIds(type), managementController); Set<Map<String, Object>> propertySet = new LinkedHashSet<Map<String, Object>>(); Map<String, Object> properties = new LinkedHashMap<String, Object>(); properties.put(ClientConfigResourceProvider.COMPONENT_CLUSTER_NAME_PROPERTY_ID, "c1"); properties.put(ClientConfigResourceProvider.COMPONENT_COMPONENT_NAME_PROPERTY_ID, "HDFS_CLIENT"); properties.put(ClientConfigResourceProvider.COMPONENT_SERVICE_NAME_PROPERTY_ID, "HDFS"); propertySet.add(properties); Request request = PropertyHelper.getCreateRequest(propertySet, null); try { provider.createResources(request); Assert.fail("Expected an UnsupportedOperationException"); } catch (SystemException e) { } verify(managementController, response); }
@Override public RequestStatus createResources(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { throw new SystemException("The request is not supported"); }
ClientConfigResourceProvider extends AbstractControllerResourceProvider { @Override public RequestStatus createResources(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { throw new SystemException("The request is not supported"); } }
ClientConfigResourceProvider extends AbstractControllerResourceProvider { @Override public RequestStatus createResources(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { throw new SystemException("The request is not supported"); } @AssistedInject  ClientConfigResourceProvider(@Assisted Set<String> propertyIds,
                               @Assisted Map<Resource.Type, String> keyPropertyIds,
                               @Assisted AmbariManagementController managementController); }
ClientConfigResourceProvider extends AbstractControllerResourceProvider { @Override public RequestStatus createResources(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { throw new SystemException("The request is not supported"); } @AssistedInject  ClientConfigResourceProvider(@Assisted Set<String> propertyIds,
                               @Assisted Map<Resource.Type, String> keyPropertyIds,
                               @Assisted AmbariManagementController managementController); @Override RequestStatus createResources(Request request); @Override @Transactional Set<Resource> getResources(Request request, Predicate predicate); @Override RequestStatus updateResources(final Request request, Predicate predicate); @Override RequestStatus deleteResources(Request request, Predicate predicate); }
ClientConfigResourceProvider extends AbstractControllerResourceProvider { @Override public RequestStatus createResources(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { throw new SystemException("The request is not supported"); } @AssistedInject  ClientConfigResourceProvider(@Assisted Set<String> propertyIds,
                               @Assisted Map<Resource.Type, String> keyPropertyIds,
                               @Assisted AmbariManagementController managementController); @Override RequestStatus createResources(Request request); @Override @Transactional Set<Resource> getResources(Request request, Predicate predicate); @Override RequestStatus updateResources(final Request request, Predicate predicate); @Override RequestStatus deleteResources(Request request, Predicate predicate);  }