@Test
public void testGetResources() 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>();
  List<String> targetClusterNames = new LinkedList<String>();
  targetClusterNames.add("Cluster1");
  targetClusterNames.add("Cluster2");
  targetClusterNames.add("Cluster3");
  Cluster.Interface interface1 = new Cluster.Interface("type", "endpoint", "version");
  Cluster.Location  location1  = new Cluster.Location("name", "path");
  Cluster targetCluster1 = new Cluster("Cluster1", "Colo", Collections.singleton(interface1),
      Collections.singleton(location1), Collections.singletonMap("P1", "V1"));
  Cluster targetCluster2 = new Cluster("Cluster2", "Colo", Collections.singleton(interface1),
      Collections.singleton(location1), Collections.singletonMap("P1", "V1"));
  Cluster targetCluster3 = new Cluster("Cluster3", "Colo", Collections.singleton(interface1),
      Collections.singleton(location1), Collections.singletonMap("P1", "V1"));
  // set expectations
  expect(service.getClusterNames()).andReturn(targetClusterNames);
  expect(service.getCluster("Cluster1")).andReturn(targetCluster1);
  expect(service.getCluster("Cluster2")).andReturn(targetCluster2);
  expect(service.getCluster("Cluster3")).andReturn(targetCluster3);
  // replay
  replay(service);
  propertySet.add(properties);
  Request request = PropertyHelper.getCreateRequest(propertySet, Collections.<String,String>emptyMap());
  TargetClusterResourceProvider provider = new TargetClusterResourceProvider(service,
      PropertyHelper.getPropertyIds(Resource.Type.DRTargetCluster),
      PropertyHelper.getKeyPropertyIds(Resource.Type.DRTargetCluster));
  Set<Resource> resources = provider.getResources(request, null);
  Assert.assertEquals(3, resources.size());
  // verify
  verify(service);
}