@Test
public void testGetAllExpand() throws Throwable {
String rp1Link = createRp().documentSelfLink;
String rp2Link = createRp().documentSelfLink;
String epzLink = createEpz(rp2Link, "tag1").documentSelfLink;
URI serviceUri = UriUtils.buildUri(host, ElasticPlacementZoneConfigurationService.SELF_LINK);
ServiceDocumentQueryResult queryResult = doOperation(null,
UriUtils.buildExpandLinksQueryUri(serviceUri),
ServiceDocumentQueryResult.class, false, Action.GET);
assertNotNull(queryResult);
assertNotNull(queryResult.documents);
assertTrue(queryResult.documentCount >= 2);
Map<String, ElasticPlacementZoneConfigurationState> states = QueryUtil.extractQueryResult(
queryResult, ElasticPlacementZoneConfigurationState.class);
ElasticPlacementZoneConfigurationState state1 = states.get(rp1Link);
assertNotNull(state1);
assertNotNull(state1.resourcePoolState);
assertNull(state1.epzState);
assertEquals(rp1Link, state1.documentSelfLink);
assertEquals(rp1Link, state1.resourcePoolState.documentSelfLink);
ElasticPlacementZoneConfigurationState state2 = states.get(rp2Link);
assertNotNull(state2);
assertNotNull(state2.resourcePoolState);
assertNotNull(state2.epzState);
assertEquals(rp2Link, state2.documentSelfLink);
assertEquals(rp2Link, state2.resourcePoolState.documentSelfLink);
assertEquals(epzLink, state2.epzState.documentSelfLink);
assertEquals(state2.resourcePoolState.documentSelfLink, state2.epzState.resourcePoolLink);
assertEquals(tagSet("tag1"), state2.epzState.tagLinksToMatch);
}