1 package org.apache.archiva.webapp.ui.services.api;
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
21 import org.apache.archiva.webapp.ui.services.model.ApplicationRuntimeInfo;
22 import org.apache.commons.io.FileUtils;
23 import org.apache.commons.lang.StringUtils;
24 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
25 import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
26 import org.apache.archiva.redback.rest.services.AbstractRestServicesTest;
27 import org.junit.Before;
28 import org.junit.Test;
31 import java.util.Collections;
32 import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
33 import org.junit.runner.RunWith;
36 * @author Olivier Lamy
38 @RunWith( ArchivaBlockJUnit4ClassRunner.class )
39 public class RuntimeInfoServiceTest
40 extends AbstractRestServicesTest
44 public void startServer()
47 File appServerBase = new File( System.getProperty( "appserver.base" ) );
49 File jcrDirectory = new File( appServerBase, "jcr" );
51 if ( jcrDirectory.exists() )
53 FileUtils.deleteDirectory( jcrDirectory );
60 protected String getSpringConfigLocation()
62 return "classpath*:META-INF/spring-context.xml,classpath*:META-INF/spring-context-test.xml";
65 protected String getRestServicesPath()
67 return "restServices";
70 protected String getBaseUrl()
72 String baseUrlSysProps = System.getProperty( "archiva.baseRestUrl" );
73 return StringUtils.isBlank( baseUrlSysProps ) ? "http://localhost:" + port : baseUrlSysProps;
77 public void runtimeInfoService()
80 RuntimeInfoService service =
81 JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaUiServices/",
82 RuntimeInfoService.class,
83 Collections.singletonList( new JacksonJaxbJsonProvider() ) );
85 ApplicationRuntimeInfo applicationRuntimeInfo = service.getApplicationRuntimeInfo( "en" );
87 assertEquals( System.getProperty( "expectedVersion" ), applicationRuntimeInfo.getVersion() );
88 assertFalse( applicationRuntimeInfo.isJavascriptLog() );
89 assertTrue( applicationRuntimeInfo.isLogMissingI18n() );