You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ma...@apache.org on 2020/11/05 13:10:21 UTC
[archiva] 01/02: Reverting result object changes for v1 API
This is an automated email from the ASF dual-hosted git repository.
martin_s pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/archiva.git
commit 4ccd40b23e66ef4a9255e07a8fd37e064f648ad6
Author: Martin Stockhammer <ma...@apache.org>
AuthorDate: Thu Nov 5 14:09:57 2020 +0100
Reverting result object changes for v1 API
---
.../archiva/rest/api/model/MemoryStatus.java | 48 ----------------------
.../apache/archiva/rest/api/model/PingResult.java | 48 ----------------------
.../apache/archiva/rest/api/model/PomSnippet.java | 48 ----------------------
.../apache/archiva/rest/api/model/Timestamp.java | 48 ----------------------
.../archiva/rest/api/services/CommonServices.java | 9 ++--
.../api/services/ManagedRepositoriesService.java | 5 +--
.../archiva/rest/api/services/PingService.java | 5 +--
.../rest/api/services/SystemStatusService.java | 10 ++---
.../rest/services/DefaultCommonServices.java | 30 ++++----------
.../DefaultManagedRepositoriesService.java | 5 +--
.../archiva/rest/services/DefaultPingService.java | 7 ++--
.../rest/services/DefaultSystemStatusService.java | 10 ++---
.../archiva/rest/services/PingServiceTest.java | 15 ++++---
13 files changed, 37 insertions(+), 251 deletions(-)
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/MemoryStatus.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/MemoryStatus.java
deleted file mode 100644
index 1bf1528..0000000
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/MemoryStatus.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.apache.archiva.rest.api.model;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * @author Martin Stockhammer <ma...@apache.org>
- */
-@XmlRootElement(name="memoryStatus")
-public class MemoryStatus
-{
- String statusText;
-
- public MemoryStatus() {
-
- }
-
- public MemoryStatus(String statusText) {
- this.statusText = statusText;
- }
-
- public String getStatusText( )
- {
- return statusText;
- }
-
- public void setStatusText( String statusText )
- {
- this.statusText = statusText;
- }
-}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/PingResult.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/PingResult.java
deleted file mode 100644
index 566b291..0000000
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/PingResult.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.apache.archiva.rest.api.model;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * @author Martin Stockhammer <ma...@apache.org>
- */
-@XmlRootElement(name="pingResult")
-public class PingResult
-{
- String output;
-
- public PingResult() {
-
- }
-
- public PingResult(String output) {
- this.output = output;
- }
-
- public String getOutput( )
- {
- return output;
- }
-
- public void setOutput( String output )
- {
- this.output = output;
- }
-}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/PomSnippet.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/PomSnippet.java
deleted file mode 100644
index 80a89d3..0000000
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/PomSnippet.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.apache.archiva.rest.api.model;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * @author Martin Stockhammer <ma...@apache.org>
- */
-@XmlRootElement(name="pomSnippet")
-public class PomSnippet
-{
- String text;
-
- public PomSnippet() {
-
- }
-
- public PomSnippet(String text) {
- this.text = text;
- }
-
- public String getText( )
- {
- return text;
- }
-
- public void setText( String text )
- {
- this.text = text;
- }
-}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Timestamp.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Timestamp.java
deleted file mode 100644
index 19adfb3..0000000
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Timestamp.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.apache.archiva.rest.api.model;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * @author Martin Stockhammer <ma...@apache.org>
- */
-@XmlRootElement(name="timestamp")
-public class Timestamp
-{
- String value;
-
- public Timestamp() {
-
- }
-
- public Timestamp( String value) {
- this.value = value;
- }
-
- public String getValue( )
- {
- return value;
- }
-
- public void setValue( String value )
- {
- this.value = value;
- }
-}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/CommonServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/CommonServices.java
index 09d8646..68d827f 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/CommonServices.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/CommonServices.java
@@ -28,7 +28,6 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import java.util.Map;
/**
* contains some "free" services (i18n)
@@ -48,9 +47,9 @@ public interface CommonServices
*/
@Path( "getI18nResources" )
@GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+ @Produces( { MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = true )
- Map<String,String> getI18nResources( @QueryParam( "locale" ) String locale )
+ String getI18nResources( @QueryParam( "locale" ) String locale )
throws ArchivaRestServiceException;
/**
@@ -61,9 +60,9 @@ public interface CommonServices
*/
@Path( "getAllI18nResources" )
@GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+ @Produces( { MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = true )
- Map<String,String> getAllI18nResources( @QueryParam( "locale" ) String locale )
+ String getAllI18nResources( @QueryParam( "locale" ) String locale )
throws ArchivaRestServiceException;
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ManagedRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ManagedRepositoriesService.java
index 5a61d07..208f24f 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ManagedRepositoriesService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ManagedRepositoriesService.java
@@ -26,7 +26,6 @@ import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.ArchivaRepositoryStatistics;
import org.apache.archiva.rest.api.model.FileStatus;
-import org.apache.archiva.rest.api.model.PomSnippet;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import javax.ws.rs.Consumes;
@@ -117,9 +116,9 @@ public interface ManagedRepositoriesService
*/
@Path( "getPomSnippet/{repositoryId}" )
@GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+ @Produces( { MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
- PomSnippet getPomSnippet( @PathParam( "repositoryId" ) String repositoryId )
+ String getPomSnippet( @PathParam( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/PingService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/PingService.java
index ab53f3d..b1016b8 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/PingService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/PingService.java
@@ -21,7 +21,6 @@ package org.apache.archiva.rest.api.services;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
-import org.apache.archiva.rest.api.model.PingResult;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -46,7 +45,7 @@ public interface PingService
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = true )
- PingResult ping();
+ String ping();
/**
* same as #ping but check authz
@@ -57,6 +56,6 @@ public interface PingService
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( noRestriction = false, noPermission = true )
- PingResult pingWithAuthz();
+ String pingWithAuthz();
}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SystemStatusService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SystemStatusService.java
index c8d509f..c6b4332 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SystemStatusService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SystemStatusService.java
@@ -22,8 +22,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.CacheEntry;
-import org.apache.archiva.rest.api.model.Timestamp;
-import org.apache.archiva.rest.api.model.MemoryStatus;
import org.apache.archiva.rest.api.model.QueueEntry;
import org.apache.archiva.rest.api.model.RepositoryScannerStatistics;
import org.apache.archiva.security.common.ArchivaRoleConstants;
@@ -45,16 +43,16 @@ public interface SystemStatusService
{
@Path( "memoryStatus" )
@GET
- @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+ @Produces( MediaType.TEXT_PLAIN )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
- MemoryStatus getMemoryStatus()
+ String getMemoryStatus()
throws ArchivaRestServiceException;
@Path( "currentServerTime/{locale}" )
@GET
- @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
+ @Produces( MediaType.TEXT_PLAIN )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
- Timestamp getCurrentServerTime( @PathParam( "locale" ) String locale )
+ String getCurrentServerTime( @PathParam( "locale" ) String locale )
throws ArchivaRestServiceException;
@Path( "queueEntries" )
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java
index b57e66c..25ee182 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java
@@ -40,7 +40,6 @@ import java.io.InputStream;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.stream.Collectors;
/**
* @author Olivier Lamy
@@ -57,7 +56,7 @@ public class DefaultCommonServices
@Inject
private UtilServices utilServices;
- private Map<String, Map<String,String>> cachei18n = new ConcurrentHashMap<String, Map<String,String>>();
+ private Map<String, String> cachei18n = new ConcurrentHashMap<String, String>();
@Inject
protected CronExpressionValidator cronExpressionValidator;
@@ -73,7 +72,7 @@ public class DefaultCommonServices
}
@Override
- public Map<String,String> getI18nResources( String locale )
+ public String getI18nResources( String locale )
throws ArchivaRestServiceException
{
Properties properties = new Properties();
@@ -90,14 +89,7 @@ public class DefaultCommonServices
log.warn( "skip error loading properties {}", resourceName );
}
- return properties.entrySet().stream().collect(
- Collectors.toMap(
- e -> e.getKey().toString(),
- e -> e.getValue().toString()
- )
- );
-
-
+ return fromProperties( properties );
}
private void loadResource( Properties properties, StringBuilder resourceName, String locale )
@@ -150,11 +142,11 @@ public class DefaultCommonServices
}
@Override
- public Map<String,String> getAllI18nResources( String locale )
+ public String getAllI18nResources( String locale )
throws ArchivaRestServiceException
{
- Map<String,String> cachedi18n = cachei18n.get( StringUtils.isEmpty( locale ) ? "en" : StringUtils.lowerCase( locale ) );
+ String cachedi18n = cachei18n.get( StringUtils.isEmpty( locale ) ? "en" : StringUtils.lowerCase( locale ) );
if ( cachedi18n != null )
{
return cachedi18n;
@@ -166,14 +158,10 @@ public class DefaultCommonServices
Properties all = utilServices.getI18nProperties( locale );
StringBuilder resourceName = new StringBuilder( RESOURCE_NAME );
loadResource( all, resourceName, locale );
- Map<String, String> allMap = all.entrySet().stream().collect(
- Collectors.toMap(
- e -> e.getKey().toString(),
- e -> e.getValue().toString()
- )
- );
- cachei18n.put( StringUtils.isEmpty( locale ) ? "en" : StringUtils.lowerCase( locale ), allMap );
- return allMap;
+
+ String i18n = fromProperties( all );
+ cachei18n.put( StringUtils.isEmpty( locale ) ? "en" : StringUtils.lowerCase( locale ), i18n );
+ return i18n;
}
catch ( IOException e )
{
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java
index ea84684..6aec318 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java
@@ -30,7 +30,6 @@ import org.apache.archiva.metadata.repository.stats.model.RepositoryStatisticsMa
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.ArchivaRepositoryStatistics;
import org.apache.archiva.rest.api.model.FileStatus;
-import org.apache.archiva.rest.api.model.PomSnippet;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
import org.apache.commons.lang3.StringEscapeUtils;
@@ -212,10 +211,10 @@ public class DefaultManagedRepositoriesService
}
@Override
- public PomSnippet getPomSnippet( String repositoryId )
+ public String getPomSnippet( String repositoryId )
throws ArchivaRestServiceException
{
- return new PomSnippet( createSnippet( getManagedRepository( repositoryId ) ) );
+ return createSnippet( getManagedRepository( repositoryId ) );
}
private String createSnippet( ManagedRepository repo )
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPingService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPingService.java
index 8603247..1d89c7e 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPingService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPingService.java
@@ -19,7 +19,6 @@ package org.apache.archiva.rest.services;
* under the License.
*/
-import org.apache.archiva.rest.api.model.PingResult;
import org.apache.archiva.rest.api.services.PingService;
import org.springframework.stereotype.Service;
@@ -32,13 +31,13 @@ public class DefaultPingService
implements PingService
{
@Override
- public PingResult ping()
+ public String ping()
{
- return new PingResult( "Yeah Baby It rocks!" );
+ return "Yeah Baby It rocks!";
}
@Override
- public PingResult pingWithAuthz()
+ public String pingWithAuthz()
{
return ping();
}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java
index 2b1c8ab..7756646 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java
@@ -29,10 +29,8 @@ import org.apache.archiva.repository.scanner.RepositoryScannerInstance;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.CacheEntry;
import org.apache.archiva.rest.api.model.ConsumerScanningStatistics;
-import org.apache.archiva.rest.api.model.MemoryStatus;
import org.apache.archiva.rest.api.model.QueueEntry;
import org.apache.archiva.rest.api.model.RepositoryScannerStatistics;
-import org.apache.archiva.rest.api.model.Timestamp;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.SystemStatusService;
import org.apache.archiva.rest.services.utils.ConsumerScanningStatisticsComparator;
@@ -88,7 +86,7 @@ public class DefaultSystemStatusService
}
@Override
- public MemoryStatus getMemoryStatus()
+ public String getMemoryStatus()
throws ArchivaRestServiceException
{
Runtime runtime = Runtime.getRuntime();
@@ -96,7 +94,7 @@ public class DefaultSystemStatusService
long total = runtime.totalMemory();
long used = total - runtime.freeMemory();
long max = runtime.maxMemory();
- return new MemoryStatus( formatMemory( used ) + "/" + formatMemory( total ) + " (Max: " + formatMemory( max ) + ")" );
+ return formatMemory( used ) + "/" + formatMemory( total ) + " (Max: " + formatMemory( max ) + ")";
}
private static String formatMemory( long l )
@@ -105,11 +103,11 @@ public class DefaultSystemStatusService
}
@Override
- public Timestamp getCurrentServerTime( String locale )
+ public String getCurrentServerTime( String locale )
throws ArchivaRestServiceException
{
SimpleDateFormat sdf = new SimpleDateFormat( "EEE, d MMM yyyy HH:mm:ss Z", new Locale( locale ) );
- return new Timestamp( sdf.format( new Date( ) ) );
+ return sdf.format( new Date() );
}
@Override
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PingServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PingServiceTest.java
index 6fff4d3..7fb242e 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PingServiceTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PingServiceTest.java
@@ -19,7 +19,6 @@ package org.apache.archiva.rest.services;
* under the License.
*/
-import org.apache.archiva.rest.api.model.PingResult;
import org.apache.archiva.rest.api.services.PingService;
import org.apache.cxf.jaxrs.client.WebClient;
import org.junit.Ignore;
@@ -43,8 +42,8 @@ public class PingServiceTest
// 1000000L
//WebClient.getConfig( userService ).getHttpConduit().getClient().setReceiveTimeout(3000);
- PingResult res = getPingService().ping();
- assertEquals( "Yeah Baby It rocks!", res.getOutput() );
+ String res = getPingService().ping();
+ assertEquals( "Yeah Baby It rocks!", res );
}
@Test( expected = ForbiddenException.class )
@@ -54,7 +53,7 @@ public class PingServiceTest
try
{
- PingResult res = getPingService().pingWithAuthz();
+ String res = getPingService().pingWithAuthz();
fail( "not in exception" );
}
catch ( ForbiddenException e )
@@ -72,8 +71,8 @@ public class PingServiceTest
PingService service = getPingService();
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 );
WebClient.client( service ).header( "Authorization", authorizationHeader );
- PingResult res = service.pingWithAuthz();
- assertEquals( "Yeah Baby It rocks!", res.getOutput() );
+ String res = service.pingWithAuthz();
+ assertEquals( "Yeah Baby It rocks!", res );
}
@Ignore( "FIXME guest failed ???" )
@@ -84,7 +83,7 @@ public class PingServiceTest
PingService service = getPingService();
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 );
WebClient.client( service ).header( "Authorization", guestAuthzHeader );
- PingResult res = service.pingWithAuthz();
- assertEquals( "Yeah Baby It rocks!", res.getOutput() );
+ String res = service.pingWithAuthz();
+ assertEquals( "Yeah Baby It rocks!", res );
}
}