Search in sources :

Example 1 with ApplicationRuntimeInfo

use of org.apache.archiva.web.model.ApplicationRuntimeInfo in project archiva by apache.

the class RuntimeInfoServiceTest method runtimeInfoService.

@Test
public void runtimeInfoService() throws Exception {
    RuntimeInfoService service = JAXRSClientFactory.create(getBaseUrl() + "/" + getRestServicesPath() + "/archivaUiServices/", RuntimeInfoService.class, Collections.singletonList(new JacksonJaxbJsonProvider()));
    WebClient.client(service).header("Referer", "http://localhost");
    ApplicationRuntimeInfo applicationRuntimeInfo = service.getApplicationRuntimeInfo("en");
    assertEquals(System.getProperty("expectedVersion"), applicationRuntimeInfo.getVersion());
    assertFalse(applicationRuntimeInfo.isJavascriptLog());
    assertTrue(applicationRuntimeInfo.isLogMissingI18n());
}
Also used : ApplicationRuntimeInfo(org.apache.archiva.web.model.ApplicationRuntimeInfo) RuntimeInfoService(org.apache.archiva.web.api.RuntimeInfoService) JacksonJaxbJsonProvider(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider) AbstractRestServicesTest(org.apache.archiva.redback.rest.services.AbstractRestServicesTest) Test(org.junit.Test)

Example 2 with ApplicationRuntimeInfo

use of org.apache.archiva.web.model.ApplicationRuntimeInfo in project archiva by apache.

the class DefaultRuntimeInfoService method getApplicationRuntimeInfo.

@Override
public ApplicationRuntimeInfo getApplicationRuntimeInfo(String locale) throws ArchivaRestServiceException {
    ApplicationRuntimeInfo applicationRuntimeInfo = new ApplicationRuntimeInfo();
    applicationRuntimeInfo.setBuildNumber(this.archivaRuntimeInfo.getBuildNumber());
    applicationRuntimeInfo.setTimestamp(this.archivaRuntimeInfo.getTimestamp());
    applicationRuntimeInfo.setVersion(this.archivaRuntimeInfo.getVersion());
    applicationRuntimeInfo.setBaseUrl(getBaseUrl(httpServletRequest));
    SimpleDateFormat sfd = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz", new Locale(StringUtils.isEmpty(locale) ? "en" : locale));
    applicationRuntimeInfo.setTimestampStr(sfd.format(new Date(archivaRuntimeInfo.getTimestamp())));
    CookieInformation cookieInformation = new CookieInformation();
    RedbackRuntimeConfiguration redbackRuntimeConfiguration = redbackRuntimeConfigurationService.getRedbackRuntimeConfiguration();
    cookieInformation.setDomain(redbackRuntimeConfiguration.getConfigurationProperties().get(UserConfigurationKeys.REMEMBER_ME_DOMAIN));
    cookieInformation.setPath(redbackRuntimeConfiguration.getConfigurationProperties().get(UserConfigurationKeys.REMEMBER_ME_PATH));
    cookieInformation.setSecure(redbackRuntimeConfiguration.getConfigurationProperties().get(UserConfigurationKeys.REMEMBER_ME_SECURE));
    cookieInformation.setTimeout(redbackRuntimeConfiguration.getConfigurationProperties().get(UserConfigurationKeys.REMEMBER_ME_TIMEOUT));
    cookieInformation.setRememberMeEnabled(BooleanUtils.toBoolean(redbackRuntimeConfiguration.getConfigurationProperties().get(UserConfigurationKeys.REMEMBER_ME_ENABLED)));
    applicationRuntimeInfo.setCookieInformation(cookieInformation);
    return applicationRuntimeInfo;
}
Also used : Locale(java.util.Locale) ApplicationRuntimeInfo(org.apache.archiva.web.model.ApplicationRuntimeInfo) CookieInformation(org.apache.archiva.web.model.CookieInformation) RedbackRuntimeConfiguration(org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Aggregations

ApplicationRuntimeInfo (org.apache.archiva.web.model.ApplicationRuntimeInfo)2 JacksonJaxbJsonProvider (com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 Locale (java.util.Locale)1 RedbackRuntimeConfiguration (org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration)1 AbstractRestServicesTest (org.apache.archiva.redback.rest.services.AbstractRestServicesTest)1 RuntimeInfoService (org.apache.archiva.web.api.RuntimeInfoService)1 CookieInformation (org.apache.archiva.web.model.CookieInformation)1 Test (org.junit.Test)1