@Test public void testCreateResources() throws Exception { IvoryService service = createMock(IvoryService.class); Set<Map<String, Object>> propertySet = new HashSet<Map<String, Object>>(); Map<String, Object> properties = new HashMap<String, Object>(); properties.put(FeedResourceProvider.FEED_NAME_PROPERTY_ID, "Feed1"); properties.put(FeedResourceProvider.FEED_DESCRIPTION_PROPERTY_ID, "desc"); properties.put(FeedResourceProvider.FEED_SCHEDULE_PROPERTY_ID, "sched"); properties.put(FeedResourceProvider.FEED_STATUS_PROPERTY_ID, "SUBMITTED"); properties.put(FeedResourceProvider.FEED_SOURCE_CLUSTER_NAME_PROPERTY_ID, "source"); properties.put(FeedResourceProvider.FEED_TARGET_CLUSTER_NAME_PROPERTY_ID, "target"); service.submitFeed(FeedResourceProvider.getFeed("Feed1", properties)); replay(service); propertySet.add(properties); Request request = PropertyHelper.getCreateRequest(propertySet, Collections.<String,String>emptyMap()); FeedResourceProvider provider = new FeedResourceProvider(service, PropertyHelper.getPropertyIds(Resource.Type.DRFeed), PropertyHelper.getKeyPropertyIds(Resource.Type.DRFeed)); provider.createResources(request); verify(service); }
@Override public RequestStatus createResources(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { IvoryService service = getService(); Set<Map<String, Object>> propertiesSet = request.getProperties(); for(Map<String, Object> propertyMap : propertiesSet) { service.submitFeed(getFeed((String) propertyMap.get(FEED_NAME_PROPERTY_ID), propertyMap)); } return new RequestStatusImpl(null); }
FeedResourceProvider extends AbstractDRResourceProvider { @Override public RequestStatus createResources(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { IvoryService service = getService(); Set<Map<String, Object>> propertiesSet = request.getProperties(); for(Map<String, Object> propertyMap : propertiesSet) { service.submitFeed(getFeed((String) propertyMap.get(FEED_NAME_PROPERTY_ID), propertyMap)); } return new RequestStatusImpl(null); } }
FeedResourceProvider extends AbstractDRResourceProvider { @Override public RequestStatus createResources(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { IvoryService service = getService(); Set<Map<String, Object>> propertiesSet = request.getProperties(); for(Map<String, Object> propertyMap : propertiesSet) { service.submitFeed(getFeed((String) propertyMap.get(FEED_NAME_PROPERTY_ID), propertyMap)); } return new RequestStatusImpl(null); } FeedResourceProvider(IvoryService ivoryService,
                              Set<String> propertyIds,
                              Map<Resource.Type, String> keyPropertyIds); }
FeedResourceProvider extends AbstractDRResourceProvider { @Override public RequestStatus createResources(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { IvoryService service = getService(); Set<Map<String, Object>> propertiesSet = request.getProperties(); for(Map<String, Object> propertyMap : propertiesSet) { service.submitFeed(getFeed((String) propertyMap.get(FEED_NAME_PROPERTY_ID), propertyMap)); } return new RequestStatusImpl(null); } FeedResourceProvider(IvoryService ivoryService,
                              Set<String> propertyIds,
                              Map<Resource.Type, String> keyPropertyIds); @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); }
FeedResourceProvider extends AbstractDRResourceProvider { @Override public RequestStatus createResources(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { IvoryService service = getService(); Set<Map<String, Object>> propertiesSet = request.getProperties(); for(Map<String, Object> propertyMap : propertiesSet) { service.submitFeed(getFeed((String) propertyMap.get(FEED_NAME_PROPERTY_ID), propertyMap)); } return new RequestStatusImpl(null); } FeedResourceProvider(IvoryService ivoryService,
                              Set<String> propertyIds,
                              Map<Resource.Type, String> keyPropertyIds); @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);  }