Search in sources :

Example 16 with Preferences

use of org.orcid.jaxb.model.record_v2.Preferences in project uPortal by Jasig.

the class SoffitRendererController method render.

@RequestMapping(value = "/{module}", method = RequestMethod.GET)
public ModelAndView render(final HttpServletRequest req, final HttpServletResponse res, @PathVariable final String module) {
    logger.debug("Rendering for request URI '{}'", req.getRequestURI());
    // Soffit Object Model
    final PortalRequest portalRequest = getPortalRequest(req);
    final Bearer bearer = getBearer(req);
    final Preferences preferences = getPreferences(req);
    final Definition definition = getDefinition(req);
    // Select a view
    final String viewName = selectView(req, module, portalRequest);
    final Map<String, Object> model = modelAttributeService.gatherModelAttributes(viewName, req, res, portalRequest, bearer, preferences, definition);
    model.put(PORTAL_REQUEST_MODEL_NAME, portalRequest);
    model.put(BEARER_MODEL_NAME, bearer);
    model.put(PREFERENCES_MODEL_NAME, preferences);
    model.put(DEFINITION_MODEL_NAME, definition);
    // Set up cache headers appropriately
    configureCacheHeaders(res, module);
    return new ModelAndView(viewName, model);
}
Also used : Definition(org.apereo.portal.soffit.model.v1_0.Definition) ModelAndView(org.springframework.web.servlet.ModelAndView) Preferences(org.apereo.portal.soffit.model.v1_0.Preferences) Bearer(org.apereo.portal.soffit.model.v1_0.Bearer) PortalRequest(org.apereo.portal.soffit.model.v1_0.PortalRequest) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 17 with Preferences

use of org.orcid.jaxb.model.record_v2.Preferences in project uPortal by Jasig.

the class ModelAttributeServiceTest method testGetModelAttributeFromMethod.

@Test
public void testGetModelAttributeFromMethod() {
    final ModelAttributeService modelAttributeService = new ModelAttributeService();
    final Class[] parameterClasses = new Class[] { HttpServletRequest.class, PortalRequest.class, Bearer.class };
    final Method method;
    try {
        method = getClass().getMethod("soffitModelAttributeMethod", parameterClasses);
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e);
    }
    // Object Model
    final HttpServletRequest req = Mockito.mock(HttpServletRequest.class);
    final HttpServletResponse res = Mockito.mock(HttpServletResponse.class);
    final PortalRequest portalRequest = Mockito.mock(PortalRequest.class);
    final Bearer bearer = Mockito.mock(Bearer.class);
    final Preferences preferences = Mockito.mock(Preferences.class);
    final Definition definition = Mockito.mock(Definition.class);
    final Object modelAttribute = modelAttributeService.getModelAttributeFromMethod(this, method, req, res, portalRequest, bearer, preferences, definition);
    assertEquals("Incorrect modelAttribute", modelAttribute, returnValue);
    final Method brokenMethod;
    try {
        brokenMethod = getClass().getMethod("brokenSoffitModelAttributeMethod", parameterClasses);
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e);
    }
    try {
        modelAttributeService.getModelAttributeFromMethod(this, brokenMethod, req, res, portalRequest, bearer, preferences, definition);
        fail("Expected IllegalStateException for void-declaring method");
    } catch (IllegalStateException e) {
    // Expected;  fall through...
    }
}
Also used : Definition(org.apereo.portal.soffit.model.v1_0.Definition) HttpServletResponse(javax.servlet.http.HttpServletResponse) Method(java.lang.reflect.Method) PortalRequest(org.apereo.portal.soffit.model.v1_0.PortalRequest) HttpServletRequest(javax.servlet.http.HttpServletRequest) Preferences(org.apereo.portal.soffit.model.v1_0.Preferences) Bearer(org.apereo.portal.soffit.model.v1_0.Bearer) Test(org.junit.Test)

Example 18 with Preferences

use of org.orcid.jaxb.model.record_v2.Preferences in project ORCID-Source by ORCID.

the class ValidateV2RC3SamplesTest method testUnmarshallPreferences.

@Test
public void testUnmarshallPreferences() throws SAXException, URISyntaxException {
    Preferences preferences = (Preferences) unmarshallFromPath("/record_2.0_rc3/samples/preferences-2.0_rc3.xml", Preferences.class, "/record_2.0_rc3/preferences-2.0_rc3.xsd");
    assertNotNull(preferences);
    assertNotNull(preferences.getLocale());
    assertEquals(Locale.EN, preferences.getLocale());
}
Also used : Preferences(org.orcid.jaxb.model.record_rc3.Preferences) Test(org.junit.Test)

Example 19 with Preferences

use of org.orcid.jaxb.model.record_v2.Preferences in project ORCID-Source by ORCID.

the class ValidateV2RC3SamplesTest method testMarshallPreferences.

@Test
public void testMarshallPreferences() throws JAXBException, SAXException, URISyntaxException {
    Preferences object = (Preferences) unmarshallFromPath("/record_2.0_rc3/samples/preferences-2.0_rc3.xml", Preferences.class);
    marshall(object, "/record_2.0_rc3/preferences-2.0_rc3.xsd");
}
Also used : Preferences(org.orcid.jaxb.model.record_rc3.Preferences) Test(org.junit.Test)

Example 20 with Preferences

use of org.orcid.jaxb.model.record_v2.Preferences in project ORCID-Source by ORCID.

the class ValidateV2RC2SamplesTest method testMarshallPreferences.

@Test
public void testMarshallPreferences() throws JAXBException, SAXException, URISyntaxException {
    Preferences object = (Preferences) unmarshallFromPath("/record_2.0_rc2/samples/preferences-2.0_rc2.xml", Preferences.class);
    marshall(object, "/record_2.0_rc2/preferences-2.0_rc2.xsd");
}
Also used : Preferences(org.orcid.jaxb.model.record_rc2.Preferences) Test(org.junit.Test)

Aggregations

Preferences (com.fsck.k9.Preferences)17 Account (com.fsck.k9.Account)13 Test (org.junit.Test)12 IOException (java.io.IOException)5 Preferences (org.apereo.portal.soffit.model.v1_0.Preferences)5 Preferences (org.orcid.jaxb.model.record_v2.Preferences)5 StorageEditor (com.fsck.k9.preferences.StorageEditor)4 SearchAccount (com.fsck.k9.search.SearchAccount)4 InvalidSettingValueException (com.fsck.k9.preferences.Settings.InvalidSettingValueException)3 Storage (com.fsck.k9.preferences.Storage)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Bearer (org.apereo.portal.soffit.model.v1_0.Bearer)3 Definition (org.apereo.portal.soffit.model.v1_0.Definition)3 PortalRequest (org.apereo.portal.soffit.model.v1_0.PortalRequest)3 Intent (android.content.Intent)2 SharedPreferences (android.content.SharedPreferences)2 Uri (android.net.Uri)2 UnavailableStorageException (com.fsck.k9.mailstore.UnavailableStorageException)2 InputStreamReader (java.io.InputStreamReader)2