@Test public void testCreateResources() throws Exception { Resource.Type type = Resource.Type.Task; 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(TaskResourceProvider.TASK_REQUEST_ID_PROPERTY_ID, 100); properties.put(TaskResourceProvider.TASK_ID_PROPERTY_ID, 100); propertySet.add(properties); Request request = PropertyHelper.getCreateRequest(propertySet, null); try { provider.createResources(request); Assert.fail("Expected an UnsupportedOperationException"); } catch (UnsupportedOperationException e) { } verify(managementController, response); }
@Override public RequestStatus createResources(Request request) { throw new UnsupportedOperationException("Not currently supported."); }
TaskResourceProvider extends AbstractControllerResourceProvider { @Override public RequestStatus createResources(Request request) { throw new UnsupportedOperationException("Not currently supported."); } }
TaskResourceProvider extends AbstractControllerResourceProvider { @Override public RequestStatus createResources(Request request) { throw new UnsupportedOperationException("Not currently supported."); } TaskResourceProvider(Set<String> propertyIds,
                       Map<Resource.Type, String> keyPropertyIds,
                       AmbariManagementController managementController); }
TaskResourceProvider extends AbstractControllerResourceProvider { @Override public RequestStatus createResources(Request request) { throw new UnsupportedOperationException("Not currently supported."); } TaskResourceProvider(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 request, Predicate predicate); @Override RequestStatus deleteResources(Request request, Predicate predicate); }
TaskResourceProvider extends AbstractControllerResourceProvider { @Override public RequestStatus createResources(Request request) { throw new UnsupportedOperationException("Not currently supported."); } TaskResourceProvider(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 request, Predicate predicate); @Override RequestStatus deleteResources(Request request, Predicate predicate); static final String TASK_CLUSTER_NAME_PROPERTY_ID; static final String TASK_REQUEST_ID_PROPERTY_ID; static final String TASK_ID_PROPERTY_ID; static final String TASK_STAGE_ID_PROPERTY_ID; static final String TASK_HOST_NAME_PROPERTY_ID; static final String TASK_ROLE_PROPERTY_ID; static final String TASK_COMMAND_PROPERTY_ID; static final String TASK_STATUS_PROPERTY_ID; static final String TASK_EXIT_CODE_PROPERTY_ID; static final String TASK_STDERR_PROPERTY_ID; static final String TASK_STOUT_PROPERTY_ID; static final String TASK_OUTPUTLOG_PROPERTY_ID; static final String TASK_ERRORLOG_PROPERTY_ID; static final String TASK_STRUCT_OUT_PROPERTY_ID; static final String TASK_START_TIME_PROPERTY_ID; static final String TASK_END_TIME_PROPERTY_ID; static final String TASK_ATTEMPT_CNT_PROPERTY_ID; static final String TASK_COMMAND_DET_PROPERTY_ID; static final String TASK_CUST_CMD_NAME_PROPERTY_ID; }