assertEquals(user.getIdentifier(), info.getClaimedIdentifier().toString());
assertEquals("12345", info.getDelegateIdentifier());
}
public void testFindOpEndpointsForUser_throughSiteXrds() throws Exception {
UrlIdentifier user = new UrlIdentifier("http://balfanz.net/openid?id=12345");
URI siteXrdsUri = URI.create("http://example.com/xrds");
FetchRequest httpRequest = FetchRequest.createGetRequest(siteXrdsUri);
expect(verifier.verify(isA(byte[].class), (String) isNull()))
.andStubThrow(new XmlSimpleSignException("no signature"));
expect(fetcher.fetch(httpRequest)).andReturn(new FakeResponse(SITE_XRD));
String userXrdsUri = "https://www.google.com/accounts/o8/user-xrds?uri="
+ URLEncoder.encode(user.getIdentifier(), "UTF-8");
FetchRequest nextRequest = FetchRequest.createGetRequest(URI.create(userXrdsUri));
expect(fetcher.fetch(nextRequest)).andReturn(new FakeResponse(USER_XRD));
control.replay();
List<SecureDiscoveryInformation> result =
xrdResolver.findOpEndpointsForUserThroughSiteXrd(user, siteXrdsUri);
control.verify();
assertEquals(1, result.size());
SecureDiscoveryInformation info = result.get(0);
assertEquals("https://www.google.com/a/balfanz.net/o8/ud?be=o8",
info.getOPEndpoint().toString());
assertFalse(info.isSecure());
assertEquals(user.getIdentifier(), info.getClaimedIdentifier().toString());
assertNull(info.getDelegateIdentifier());
}