use of org.apache.commons.collections.collection.CompositeCollection in project heritrix3 by internetarchive.
the class BdbCookieStore method cookieStoreFor.
/**
* Returns a {@link LimitedCookieStoreFacade} whose
* {@link LimitedCookieStoreFacade#getCookies()} method returns only cookies
* from {@code host} and its parent domains, if applicable.
*/
public CookieStore cookieStoreFor(String host) {
CompositeCollection cookieCollection = new CompositeCollection();
if (InternetDomainName.isValid(host)) {
InternetDomainName domain = InternetDomainName.from(host);
while (domain != null) {
Collection<Cookie> subset = hostSubset(domain.toString());
cookieCollection.addComposited(subset);
if (domain.hasParent()) {
domain = domain.parent();
} else {
domain = null;
}
}
} else {
Collection<Cookie> subset = hostSubset(host.toString());
cookieCollection.addComposited(subset);
}
@SuppressWarnings("unchecked") List<Cookie> cookieList = new RestrictedCollectionWrappedList<Cookie>(cookieCollection);
LimitedCookieStoreFacade store = new LimitedCookieStoreFacade(cookieList);
return store;
}
use of org.apache.commons.collections.collection.CompositeCollection in project DKSR-Open-UrbanPulse by DKSR-Data-Competence-for-Cities-Regions.
the class UPSecurityRealmTest method testReturnNullWhenFromRealmResultIsEmpty.
@Test
public void testReturnNullWhenFromRealmResultIsEmpty() {
when(principalCollectionMock.fromRealm(anyString())).thenReturn(new CompositeCollection());
assertNull(uPSecurityRealm.doGetAuthorizationInfo(principalCollectionMock));
}
Aggregations