use of lombok.SneakyThrows in project cas by apereo.
the class LdapContinuousIntegrationConsentRepositoryTests method bootstrap.
@BeforeClass
@SneakyThrows
public static void bootstrap() {
final LDAPConnection localhost = new LDAPConnection("localhost", LDAP_PORT, "cn=Directory Manager", "password");
LdapIntegrationTestsOperations.populateEntries(localhost, new ClassPathResource("ldif/ldap-consent.ldif").getInputStream(), "ou=people,dc=example,dc=org");
}
use of lombok.SneakyThrows in project cas by apereo.
the class CosmosDbObjectFactory method createDocumentDbMappingContext.
/**
* Create document db mapping context.
*
* @return the document db mapping context
*/
@SneakyThrows
public DocumentDbMappingContext createDocumentDbMappingContext() {
final DocumentDbMappingContext documentDbMappingContext = new DocumentDbMappingContext();
documentDbMappingContext.setInitialEntitySet(new EntityScanner(applicationContext).scan(Persistent.class));
return documentDbMappingContext;
}
use of lombok.SneakyThrows in project cas by apereo.
the class JsonUtils method render.
/**
* Render model and view.
*
* @param model the model
* @param response the response
*/
@SneakyThrows
public static void render(final Object model, final HttpServletResponse response) {
final MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
jsonConverter.setPrettyPrint(true);
final MediaType jsonMimeType = MediaType.APPLICATION_JSON;
jsonConverter.write(model, jsonMimeType, new ServletServerHttpResponse(response));
}
use of lombok.SneakyThrows in project cas by apereo.
the class SystemUtils method injectUpdateInfoIntoBannerIfNeeded.
@SneakyThrows
private static void injectUpdateInfoIntoBannerIfNeeded(final Map<String, Object> info) {
final Properties properties = System.getProperties();
if (!properties.containsKey("CAS_UPDATE_CHECK_ENABLED")) {
return;
}
final URL url = new URL(UPDATE_CHECK_MAVEN_URL);
final Map results = MAPPER.readValue(url, Map.class);
if (!results.containsKey("response")) {
return;
}
final Map response = (Map) results.get("response");
if (!response.containsKey("numFound") && (int) response.get("numFound") != 1) {
return;
}
final List docs = (List) response.get("docs");
if (docs.isEmpty()) {
return;
}
final Map entry = (Map) docs.get(0);
final String latestVersion = (String) entry.get("latestVersion");
if (StringUtils.isNotBlank(latestVersion)) {
final String currentVersion = CasVersion.getVersion();
final Semver latestSem = new Semver(latestVersion);
final Semver currentSem = new Semver(currentVersion);
if (currentSem.isLowerThan(latestSem)) {
final String updateString = String.format("[Latest Version: %s / Stable: %s]", latestVersion, StringUtils.capitalize(BooleanUtils.toStringYesNo(latestSem.isStable())));
info.put("Update Availability", updateString);
}
}
}
use of lombok.SneakyThrows in project cas by apereo.
the class GroovyRegisteredServiceMultifactorPolicy method buildGroovyMultifactorPolicyInstanceIfNeeded.
@SneakyThrows
private void buildGroovyMultifactorPolicyInstanceIfNeeded() {
if (this.groovyPolicyInstance == null) {
final Resource groovyResource = ResourceUtils.getResourceFrom(this.groovyScript);
this.groovyPolicyInstance = ScriptingUtils.getObjectInstanceFromGroovyResource(groovyResource, RegisteredServiceMultifactorPolicy.class);
}
}
Aggregations