@Test public void testGetResourceProvider() throws Exception { Set<String> propertyIds = new HashSet<String>(); propertyIds.add("foo"); propertyIds.add("cat1/foo"); propertyIds.add("cat2/bar"); propertyIds.add("cat2/baz"); propertyIds.add("cat3/sub1/bam"); propertyIds.add("cat4/sub2/sub3/bat"); propertyIds.add("cat5/subcat5/map"); Map<Resource.Type, String> keyPropertyIds = new HashMap<Resource.Type, String>(); IvoryService ivoryService = createMock(IvoryService.class); AbstractResourceProvider provider = (AbstractResourceProvider) AbstractDRResourceProvider.getResourceProvider( Resource.Type.DRFeed, propertyIds, keyPropertyIds, ivoryService); Assert.assertTrue(provider instanceof FeedResourceProvider); }
public static ResourceProvider getResourceProvider(Resource.Type type, Set<String> propertyIds, Map<Resource.Type, String> keyPropertyIds, IvoryService service) { switch (type.getInternalType()) { case DRFeed: return new FeedResourceProvider(service, propertyIds, keyPropertyIds); case DRTargetCluster: return new TargetClusterResourceProvider(service, propertyIds, keyPropertyIds); case DRInstance: return new InstanceResourceProvider(service, propertyIds, keyPropertyIds); default: throw new IllegalArgumentException("Unknown type " + type); } }
AbstractDRResourceProvider extends AbstractResourceProvider { public static ResourceProvider getResourceProvider(Resource.Type type, Set<String> propertyIds, Map<Resource.Type, String> keyPropertyIds, IvoryService service) { switch (type.getInternalType()) { case DRFeed: return new FeedResourceProvider(service, propertyIds, keyPropertyIds); case DRTargetCluster: return new TargetClusterResourceProvider(service, propertyIds, keyPropertyIds); case DRInstance: return new InstanceResourceProvider(service, propertyIds, keyPropertyIds); default: throw new IllegalArgumentException("Unknown type " + type); } } }
AbstractDRResourceProvider extends AbstractResourceProvider { public static ResourceProvider getResourceProvider(Resource.Type type, Set<String> propertyIds, Map<Resource.Type, String> keyPropertyIds, IvoryService service) { switch (type.getInternalType()) { case DRFeed: return new FeedResourceProvider(service, propertyIds, keyPropertyIds); case DRTargetCluster: return new TargetClusterResourceProvider(service, propertyIds, keyPropertyIds); case DRInstance: return new InstanceResourceProvider(service, propertyIds, keyPropertyIds); default: throw new IllegalArgumentException("Unknown type " + type); } } protected  AbstractDRResourceProvider(Set<String> propertyIds,
                                       Map<Resource.Type, String> keyPropertyIds,
                                       IvoryService ivoryService); }
AbstractDRResourceProvider extends AbstractResourceProvider { public static ResourceProvider getResourceProvider(Resource.Type type, Set<String> propertyIds, Map<Resource.Type, String> keyPropertyIds, IvoryService service) { switch (type.getInternalType()) { case DRFeed: return new FeedResourceProvider(service, propertyIds, keyPropertyIds); case DRTargetCluster: return new TargetClusterResourceProvider(service, propertyIds, keyPropertyIds); case DRInstance: return new InstanceResourceProvider(service, propertyIds, keyPropertyIds); default: throw new IllegalArgumentException("Unknown type " + type); } } protected  AbstractDRResourceProvider(Set<String> propertyIds,
                                       Map<Resource.Type, String> keyPropertyIds,
                                       IvoryService ivoryService); static ResourceProvider getResourceProvider(Resource.Type type,
                                                     Set<String> propertyIds,
                                                     Map<Resource.Type, String> keyPropertyIds,
                                                     IvoryService service); }
AbstractDRResourceProvider extends AbstractResourceProvider { public static ResourceProvider getResourceProvider(Resource.Type type, Set<String> propertyIds, Map<Resource.Type, String> keyPropertyIds, IvoryService service) { switch (type.getInternalType()) { case DRFeed: return new FeedResourceProvider(service, propertyIds, keyPropertyIds); case DRTargetCluster: return new TargetClusterResourceProvider(service, propertyIds, keyPropertyIds); case DRInstance: return new InstanceResourceProvider(service, propertyIds, keyPropertyIds); default: throw new IllegalArgumentException("Unknown type " + type); } } protected  AbstractDRResourceProvider(Set<String> propertyIds,
                                       Map<Resource.Type, String> keyPropertyIds,
                                       IvoryService ivoryService); static ResourceProvider getResourceProvider(Resource.Type type,
                                                     Set<String> propertyIds,
                                                     Map<Resource.Type, String> keyPropertyIds,
                                                     IvoryService service);  }