use of com.adobe.acs.commons.http.headers.impl.AbstractDispatcherCacheHeaderFilter in project acs-aem-commons by Adobe-Consulting-Services.
the class AbstractDispatcherCacheHeaderFilterTest method setup.
@Before
@SuppressWarnings("rawtypes")
public void setup() throws Exception {
properties = new Hashtable<String, Object>();
String[] patterns = new String[] { pattern };
properties.put(AbstractDispatcherCacheHeaderFilter.PROP_FILTER_PATTERN, patterns);
params = new HashMap();
agents = new HashSet<String>();
filter = new AbstractDispatcherCacheHeaderFilter() {
@Override
protected String getHeaderName() {
return headerName;
}
@Override
protected String getHeaderValue() {
return headerValue;
}
@Override
protected void doActivate(ComponentContext context) throws Exception {
}
};
when(componentContext.getProperties()).thenReturn(properties);
when(componentContext.getBundleContext()).thenReturn(bundleContext);
when(bundleContext.registerService(anyString(), any(), (Dictionary) any())).thenReturn(serviceRegistration);
when(request.getMethod()).thenReturn("GET");
when(request.getParameterMap()).thenReturn(params);
final Map<String, Object> attributes = new HashMap<>();
doAnswer(i -> attributes.put(i.getArgumentAt(0, String.class), i.getArgumentAt(1, Object.class))).when(request).setAttribute(any(), any());
when(request.getAttribute(any())).thenAnswer(i -> attributes.get(i.getArgumentAt(0, String.class)));
}
Aggregations