use of org.apereo.cas.services.RegexRegisteredService in project cas by apereo.
the class ServiceThemeResolverTests method verifyGetServiceThemeDoesNotExist.
@Test
public void verifyGetServiceThemeDoesNotExist() {
val r = new RegexRegisteredService();
r.setTheme("myTheme");
r.setId(1000);
r.setName("Test Service");
r.setServiceId("myServiceId");
this.servicesManager.save(r);
val request = new MockHttpServletRequest();
val ctx = mock(RequestContext.class);
val scope = new LocalAttributeMap<>();
scope.put(CasProtocolConstants.PARAMETER_SERVICE, RegisteredServiceTestUtils.getService(r.getServiceId()));
when(ctx.getFlowScope()).thenReturn(scope);
RequestContextHolder.setRequestContext(ctx);
request.addHeader(HttpRequestUtils.USER_AGENT_HEADER, MOZILLA);
assertEquals(DEFAULT_THEME_NAME, this.themeResolver.resolveThemeName(request));
}
use of org.apereo.cas.services.RegexRegisteredService in project cas by apereo.
the class ServiceAuthorizationCheckMockitoActionTests method getAction.
private Action getAction() {
val authorizedRegisteredService = new RegexRegisteredService();
val unauthorizedRegisteredService = new RegexRegisteredService();
unauthorizedRegisteredService.setAccessStrategy(new DefaultRegisteredServiceAccessStrategy(false, false));
val list = new ArrayList<RegisteredService>();
list.add(authorizedRegisteredService);
list.add(unauthorizedRegisteredService);
when(this.servicesManager.findServiceBy(this.authorizedService)).thenReturn(authorizedRegisteredService);
when(this.servicesManager.findServiceBy(this.unauthorizedService)).thenReturn(unauthorizedRegisteredService);
when(this.servicesManager.findServiceBy(this.undefinedService)).thenReturn(null);
when(this.servicesManager.getAllServices()).thenReturn(list);
return new ServiceAuthorizationCheckAction(this.servicesManager, new DefaultAuthenticationServiceSelectionPlan(new DefaultAuthenticationServiceSelectionStrategy()));
}
Aggregations