Search in sources :

Example 16 with SneakyThrows

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");
}
Also used : LDAPConnection(com.unboundid.ldap.sdk.LDAPConnection) ClassPathResource(org.springframework.core.io.ClassPathResource) BeforeClass(org.junit.BeforeClass) SneakyThrows(lombok.SneakyThrows)

Example 17 with SneakyThrows

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;
}
Also used : DocumentDbMappingContext(com.microsoft.azure.spring.data.documentdb.core.mapping.DocumentDbMappingContext) Persistent(org.springframework.data.annotation.Persistent) EntityScanner(org.springframework.boot.autoconfigure.domain.EntityScanner) SneakyThrows(lombok.SneakyThrows)

Example 18 with SneakyThrows

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));
}
Also used : MappingJackson2HttpMessageConverter(org.springframework.http.converter.json.MappingJackson2HttpMessageConverter) MediaType(org.springframework.http.MediaType) ServletServerHttpResponse(org.springframework.http.server.ServletServerHttpResponse) SneakyThrows(lombok.SneakyThrows)

Example 19 with SneakyThrows

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);
        }
    }
}
Also used : List(java.util.List) Properties(java.util.Properties) Semver(com.vdurmont.semver4j.Semver) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) URL(java.net.URL) SneakyThrows(lombok.SneakyThrows)

Example 20 with SneakyThrows

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);
    }
}
Also used : Resource(org.springframework.core.io.Resource) SneakyThrows(lombok.SneakyThrows)

Aggregations

SneakyThrows (lombok.SneakyThrows)592 lombok.val (lombok.val)292 Test (org.junit.Test)66 ArrayList (java.util.ArrayList)59 HashMap (java.util.HashMap)51 List (java.util.List)42 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)33 LinkedHashMap (java.util.LinkedHashMap)29 File (java.io.File)27 Collectors (java.util.stream.Collectors)25 Path (java.nio.file.Path)24 IOException (java.io.IOException)23 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)22 URL (java.net.URL)20 Slf4j (lombok.extern.slf4j.Slf4j)20 InputStream (java.io.InputStream)19 Map (java.util.Map)19 Cleanup (lombok.Cleanup)17 FishingActivityQuery (eu.europa.ec.fisheries.ers.service.search.FishingActivityQuery)16 SearchFilter (eu.europa.ec.fisheries.uvms.activity.model.schemas.SearchFilter)16