byte[] sampleCache = SampleCredentialsCacheResource.getCacheContent();
ByteArrayInputStream bais = new ByteArrayInputStream(sampleCache);
try
{
CredentialsCache cc = CredentialsCache.load(bais);
PrincipalName principal = cc.getPrimaryPrincipalName();
assertTrue( principal.getNameString().equals( SampleCredentialsCacheResource.getSamplePrincipal() ) );
assertTrue( principal.getRealm().equals( SampleCredentialsCacheResource.getSampleRealm() ) );
assertTrue( cc.getCredsList().size() == SampleCredentialsCacheResource.getSampleTicketsCount() );
Set<String> servers = new HashSet<String>();
for (String server : SampleCredentialsCacheResource.getSampleServers())
{
servers.add( server );
}
String tktServer;
for (Credentials cred : cc.getCredsList()) {
tktServer = cred.getTicket().getSName().getNameString();
assertTrue( servers.contains( tktServer ) );
}
}
catch ( Exception ike )