aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-rest/archiva-rest-services
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2020-06-30 08:05:07 +0200
committerMartin Stockhammer <martin_s@apache.org>2020-06-30 08:05:07 +0200
commitb9316745df508c88c3c691bb4a509265a523dfde (patch)
tree6236f48663811bc92848af05c8ab5cf1d055c835 /archiva-modules/archiva-web/archiva-rest/archiva-rest-services
parent827bd5d95ed7ba369b7d6e4dce8ed1b65af2909a (diff)
downloadarchiva-b9316745df508c88c3c691bb4a509265a523dfde.tar.gz
archiva-b9316745df508c88c3c691bb4a509265a523dfde.zip
Adapting to new cxf version. Using result objects instead of simple types in REST services.
Diffstat (limited to 'archiva-modules/archiva-web/archiva-rest/archiva-rest-services')
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml13
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java39
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaRuntimeConfigurationService.java5
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java36
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java7
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java20
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultNetworkProxyService.java5
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorRuleService.java13
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorService.java21
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java15
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java25
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java63
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoryGroupService.java39
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java9
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/cxf/org.apache.cxf.Logger1
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml13
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java25
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaAdministrationServiceTest.java1
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/CommonServicesTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/CopyArtifactTest.java2
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ManagedRepositoriesServiceTest.java13
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java6
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java10
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml3
24 files changed, 209 insertions, 179 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
index a5c914b83..d8fed9482 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
@@ -312,11 +312,12 @@
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
+ <version>2.10.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-xml-provider</artifactId>
- <scope>runtime</scope>
+ <version>2.10.4</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
@@ -328,9 +329,18 @@
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-features-logging</artifactId>
+ </dependency>
<!-- TEST Scope -->
<dependency>
@@ -456,6 +466,7 @@
<exclude>src/test/repo-with-osgi-stage/**</exclude>
<exclude>src/test/repo-with-classifier-only/**</exclude>
<exclude>src/test/repo-with-snapshots/**</exclude>
+ <exclude>src/main/resources/META-INF/cxf/org.apache.cxf.Logger</exclude>
</excludes>
</configuration>
</plugin>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java
index 18d14807f..dabab53ea 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java
@@ -22,6 +22,7 @@ import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.admin.ArchivaAdministration;
import org.apache.archiva.admin.model.beans.*;
import org.apache.archiva.repository.scanner.RepositoryContentConsumers;
+import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.AdminRepositoryConsumer;
import org.apache.archiva.rest.api.services.ArchivaAdministrationService;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
@@ -68,13 +69,13 @@ public class DefaultArchivaAdministrationService
@Override
- public Boolean deleteLegacyArtifactPath( String path )
+ public ActionStatus deleteLegacyArtifactPath( String path )
throws ArchivaRestServiceException
{
try
{
archivaAdministration.deleteLegacyArtifactPath( path, getAuditInformation() );
- return Boolean.TRUE;
+ return new ActionStatus( true );
}
catch ( RepositoryAdminException e )
{
@@ -84,13 +85,13 @@ public class DefaultArchivaAdministrationService
@Override
- public Boolean addFileTypePattern( String fileTypeId, String pattern )
+ public ActionStatus addFileTypePattern( String fileTypeId, String pattern )
throws ArchivaRestServiceException
{
try
{
archivaAdministration.addFileTypePattern( fileTypeId, pattern, getAuditInformation() );
- return Boolean.TRUE;
+ return new ActionStatus(true);
}
catch ( RepositoryAdminException e )
{
@@ -99,13 +100,13 @@ public class DefaultArchivaAdministrationService
}
@Override
- public Boolean removeFileTypePattern( String fileTypeId, String pattern )
+ public ActionStatus removeFileTypePattern( String fileTypeId, String pattern )
throws ArchivaRestServiceException
{
try
{
archivaAdministration.removeFileTypePattern( fileTypeId, pattern, getAuditInformation() );
- return Boolean.TRUE;
+ return new ActionStatus(true);
}
catch ( RepositoryAdminException e )
{
@@ -142,13 +143,13 @@ public class DefaultArchivaAdministrationService
}
@Override
- public Boolean removeFileType( String fileTypeId )
+ public ActionStatus removeFileType( String fileTypeId )
throws ArchivaRestServiceException
{
try
{
archivaAdministration.removeFileType( fileTypeId, getAuditInformation() );
- return Boolean.TRUE;
+ return new ActionStatus(true);
}
catch ( RepositoryAdminException e )
{
@@ -157,13 +158,13 @@ public class DefaultArchivaAdministrationService
}
@Override
- public Boolean enabledKnownContentConsumer( String knownContentConsumer )
+ public ActionStatus enabledKnownContentConsumer( String knownContentConsumer )
throws ArchivaRestServiceException
{
try
{
archivaAdministration.addKnownContentConsumer( knownContentConsumer, getAuditInformation() );
- return Boolean.TRUE;
+ return new ActionStatus(true);
}
catch ( RepositoryAdminException e )
{
@@ -186,13 +187,13 @@ public class DefaultArchivaAdministrationService
}
@Override
- public Boolean disabledKnownContentConsumer( String knownContentConsumer )
+ public ActionStatus disabledKnownContentConsumer( String knownContentConsumer )
throws ArchivaRestServiceException
{
try
{
archivaAdministration.removeKnownContentConsumer( knownContentConsumer, getAuditInformation() );
- return Boolean.TRUE;
+ return new ActionStatus(true);
}
catch ( RepositoryAdminException e )
{
@@ -201,13 +202,13 @@ public class DefaultArchivaAdministrationService
}
@Override
- public Boolean enabledInvalidContentConsumer( String invalidContentConsumer )
+ public ActionStatus enabledInvalidContentConsumer( String invalidContentConsumer )
throws ArchivaRestServiceException
{
try
{
archivaAdministration.addInvalidContentConsumer( invalidContentConsumer, getAuditInformation() );
- return Boolean.TRUE;
+ return new ActionStatus(true);
}
catch ( RepositoryAdminException e )
{
@@ -230,13 +231,13 @@ public class DefaultArchivaAdministrationService
}
@Override
- public Boolean disabledInvalidContentConsumer( String invalidContentConsumer )
+ public ActionStatus disabledInvalidContentConsumer( String invalidContentConsumer )
throws ArchivaRestServiceException
{
try
{
archivaAdministration.removeInvalidContentConsumer( invalidContentConsumer, getAuditInformation() );
- return Boolean.TRUE;
+ return new ActionStatus(true);
}
catch ( RepositoryAdminException e )
{
@@ -319,12 +320,6 @@ public class DefaultArchivaAdministrationService
}
}
- @Override
- public Boolean registrationDisabled()
- throws ArchivaRestServiceException
- {
- return getUiConfiguration().isDisableRegistration();
- }
@Override
public UiConfiguration getUiConfiguration()
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaRuntimeConfigurationService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaRuntimeConfigurationService.java
index a799462ed..6d012ad72 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaRuntimeConfigurationService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaRuntimeConfigurationService.java
@@ -25,6 +25,7 @@ import org.apache.archiva.admin.model.beans.FileLockConfiguration;
import org.apache.archiva.admin.model.runtime.ArchivaRuntimeConfigurationAdmin;
import org.apache.archiva.common.filelock.FileLockManager;
import org.apache.archiva.components.cache.Cache;
+import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.ArchivaRuntimeConfigurationService;
import org.springframework.stereotype.Service;
@@ -67,7 +68,7 @@ public class DefaultArchivaRuntimeConfigurationService
}
@Override
- public Boolean updateArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
+ public ActionStatus updateArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
throws ArchivaRestServiceException
{
try
@@ -95,6 +96,6 @@ public class DefaultArchivaRuntimeConfigurationService
{
throw new ArchivaRestServiceException( e.getMessage(), e );
}
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java
index 76fd075c0..912b24ba4 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java
@@ -613,8 +613,8 @@ public class DefaultBrowseService
}
@Override
- public Boolean addMetadata( String groupId, String artifactId, String version, String key, String value,
- String repositoryId )
+ public ActionStatus addMetadata( String groupId, String artifactId, String version, String key, String value,
+ String repositoryId )
throws ArchivaRestServiceException
{
ProjectVersionMetadata projectVersionMetadata =
@@ -622,7 +622,7 @@ public class DefaultBrowseService
if ( projectVersionMetadata == null )
{
- return Boolean.FALSE;
+ return new ActionStatus( false );
}
Map<String, String> properties = new HashMap<>();
@@ -672,11 +672,11 @@ public class DefaultBrowseService
{
repositorySession.close();
}
- return Boolean.TRUE;
+ return new ActionStatus( true );
}
@Override
- public Boolean deleteMetadata( String groupId, String artifactId, String version, String key, String repositoryId )
+ public ActionStatus deleteMetadata( String groupId, String artifactId, String version, String key, String repositoryId )
throws ArchivaRestServiceException
{
ProjectVersionMetadata projectVersionMetadata =
@@ -684,7 +684,7 @@ public class DefaultBrowseService
if ( projectVersionMetadata == null )
{
- return Boolean.FALSE;
+ return new ActionStatus( false );
}
GenericMetadataFacet metadataFacet =
@@ -698,7 +698,7 @@ public class DefaultBrowseService
}
else
{
- return Boolean.TRUE;
+ return new ActionStatus( true );
}
RepositorySession repositorySession = null;
@@ -729,7 +729,7 @@ public class DefaultBrowseService
{
repositorySession.close();
}
- return Boolean.TRUE;
+ return new ActionStatus( true );
}
@Override
@@ -883,8 +883,8 @@ public class DefaultBrowseService
}
@Override
- public Boolean artifactAvailable( String groupId, String artifactId, String version, String classifier,
- String repositoryId )
+ public AvailabilityStatus artifactAvailable( String groupId, String artifactId, String version, String classifier,
+ String repositoryId )
throws ArchivaRestServiceException
{
List<String> selectedRepos = getSelectedRepos( repositoryId );
@@ -920,7 +920,7 @@ public class DefaultBrowseService
if ( file != null && file.exists() )
{
- return true;
+ return new AvailabilityStatus( true );
}
// in case of SNAPSHOT we can have timestamped version locally !
@@ -946,7 +946,7 @@ public class DefaultBrowseService
log.debug( "try to find timestamped snapshot version file: {}", timeStampFile.getPath() );
if ( timeStampFile.exists() )
{
- return true;
+ return new AvailabilityStatus( true );
}
}
}
@@ -960,7 +960,7 @@ public class DefaultBrowseService
// download pom now
String pomPath = StringUtils.substringBeforeLast( path, ".jar" ) + ".pom";
proxyHandler.fetchFromProxies( managedRepositoryContent.getRepository(), pomPath );
- return true;
+ return new AvailabilityStatus( true );
}
}
} catch ( RepositoryException e )
@@ -970,11 +970,11 @@ public class DefaultBrowseService
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
}
- return false;
+ return new AvailabilityStatus( false );
}
@Override
- public Boolean artifactAvailable( String groupId, String artifactId, String version, String repositoryId )
+ public AvailabilityStatus artifactAvailable( String groupId, String artifactId, String version, String repositoryId )
throws ArchivaRestServiceException
{
return artifactAvailable( groupId, artifactId, version, null, repositoryId );
@@ -1093,16 +1093,16 @@ public class DefaultBrowseService
}
@Override
- public Boolean importMetadata( MetadataAddRequest metadataAddRequest, String repositoryId )
+ public ActionStatus importMetadata( MetadataAddRequest metadataAddRequest, String repositoryId )
throws ArchivaRestServiceException
{
- boolean result = true;
+ ActionStatus result = new ActionStatus( true );
for ( Map.Entry<String, String> metadata : metadataAddRequest.getMetadatas().entrySet() )
{
result = addMetadata( metadataAddRequest.getGroupId(), metadataAddRequest.getArtifactId(),
metadataAddRequest.getVersion(), metadata.getKey(), metadata.getValue(),
repositoryId );
- if ( !result )
+ if ( !result.isSuccess() )
{
break;
}
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 2005a4450..25ee182f7 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
@@ -21,6 +21,8 @@ package org.apache.archiva.rest.services;
import org.apache.archiva.components.scheduler.CronExpressionValidator;
import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
import org.apache.archiva.redback.rest.api.services.UtilServices;
+import org.apache.archiva.rest.api.model.ActionStatus;
+import org.apache.archiva.rest.api.model.ValidationStatus;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.CommonServices;
import org.apache.commons.lang3.StringUtils;
@@ -30,6 +32,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+import javax.validation.Valid;
import javax.ws.rs.core.Response;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -187,9 +190,9 @@ public class DefaultCommonServices
@Override
- public Boolean validateCronExpression( String cronExpression )
+ public ValidationStatus validateCronExpression( String cronExpression )
throws ArchivaRestServiceException
{
- return cronExpressionValidator.validate( cronExpression );
+ return new ValidationStatus(cronExpressionValidator.validate( cronExpression ));
}
}
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 ca5513545..6aec318da 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
@@ -27,7 +27,9 @@ import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.stats.model.RepositoryStatistics;
import org.apache.archiva.metadata.repository.stats.model.RepositoryStatisticsManager;
+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.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
import org.apache.commons.lang3.StringEscapeUtils;
@@ -95,13 +97,13 @@ public class DefaultManagedRepositoriesService
@Override
- public Boolean deleteManagedRepository( String repoId, boolean deleteContent )
+ public ActionStatus deleteManagedRepository( String repoId, boolean deleteContent )
throws ArchivaRestServiceException
{
try
{
- return managedRepositoryAdmin.deleteManagedRepository( repoId, getAuditInformation(), deleteContent );
+ return new ActionStatus( managedRepositoryAdmin.deleteManagedRepository( repoId, getAuditInformation( ), deleteContent ) );
}
catch ( RepositoryAdminException e )
{
@@ -134,16 +136,16 @@ public class DefaultManagedRepositoriesService
@Override
- public Boolean updateManagedRepository( ManagedRepository managedRepository )
+ public ActionStatus updateManagedRepository( ManagedRepository managedRepository )
throws ArchivaRestServiceException
{
try
{
- return managedRepositoryAdmin.updateManagedRepository( managedRepository,
- managedRepository.isStageRepoNeeded(),
- getAuditInformation(),
- managedRepository.isResetStats() );
+ return new ActionStatus( managedRepositoryAdmin.updateManagedRepository( managedRepository,
+ managedRepository.isStageRepoNeeded( ),
+ getAuditInformation( ),
+ managedRepository.isResetStats( ) ) );
}
catch ( RepositoryAdminException e )
{
@@ -152,11 +154,11 @@ public class DefaultManagedRepositoriesService
}
@Override
- public Boolean fileLocationExists( String fileLocation )
+ public FileStatus getFileStatus( String fileLocation )
throws ArchivaRestServiceException
{
String location = repositoryCommonValidator.removeExpressions( fileLocation );
- return Files.exists( Paths.get( location ));
+ return new FileStatus( Files.exists( Paths.get( location ) ) );
}
@Override
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultNetworkProxyService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultNetworkProxyService.java
index 6e3c0fec8..4d06e39bd 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultNetworkProxyService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultNetworkProxyService.java
@@ -21,6 +21,7 @@ package org.apache.archiva.rest.services;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.NetworkProxy;
import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin;
+import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.NetworkProxyService;
import org.springframework.stereotype.Service;
@@ -106,13 +107,13 @@ public class DefaultNetworkProxyService
}
@Override
- public Boolean deleteNetworkProxy( String networkProxyId )
+ public ActionStatus deleteNetworkProxy( String networkProxyId )
throws ArchivaRestServiceException
{
try
{
getNetworkProxyAdmin().deleteNetworkProxy( networkProxyId, getAuditInformation() );
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
catch ( RepositoryAdminException e )
{
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorRuleService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorRuleService.java
index b21b8235f..1972a2009 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorRuleService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorRuleService.java
@@ -21,6 +21,7 @@ package org.apache.archiva.rest.services;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.ProxyConnectorRule;
import org.apache.archiva.admin.model.proxyconnectorrule.ProxyConnectorRuleAdmin;
+import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.ProxyConnectorRuleService;
import org.apache.commons.lang3.StringUtils;
@@ -87,7 +88,7 @@ public class DefaultProxyConnectorRuleService
}
@Override
- public Boolean addProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
+ public ActionStatus addProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
throws ArchivaRestServiceException
{
@@ -96,7 +97,7 @@ public class DefaultProxyConnectorRuleService
try
{
proxyConnectorRuleAdmin.addProxyConnectorRule( proxyConnectorRule, getAuditInformation() );
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
catch ( RepositoryAdminException e )
{
@@ -105,13 +106,13 @@ public class DefaultProxyConnectorRuleService
}
@Override
- public Boolean deleteProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
+ public ActionStatus deleteProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
throws ArchivaRestServiceException
{
try
{
proxyConnectorRuleAdmin.deleteProxyConnectorRule( proxyConnectorRule, getAuditInformation() );
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
catch ( RepositoryAdminException e )
{
@@ -120,13 +121,13 @@ public class DefaultProxyConnectorRuleService
}
@Override
- public Boolean updateProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
+ public ActionStatus updateProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
throws ArchivaRestServiceException
{
try
{
proxyConnectorRuleAdmin.updateProxyConnectorRule( proxyConnectorRule, getAuditInformation() );
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
catch ( RepositoryAdminException e )
{
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorService.java
index 88ebe9616..e8bc8e9d8 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorService.java
@@ -22,6 +22,7 @@ import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.ProxyConnector;
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
import org.apache.archiva.policies.Policy;
+import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.PolicyInformation;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.ProxyConnectorService;
@@ -80,16 +81,16 @@ public class DefaultProxyConnectorService
}
@Override
- public Boolean addProxyConnector( ProxyConnector proxyConnector )
+ public ActionStatus addProxyConnector( ProxyConnector proxyConnector )
throws ArchivaRestServiceException
{
if ( proxyConnector == null )
{
- return Boolean.FALSE;
+ return ActionStatus.FAIL;
}
try
{
- return proxyConnectorAdmin.addProxyConnector( proxyConnector, getAuditInformation() );
+ return new ActionStatus( proxyConnectorAdmin.addProxyConnector( proxyConnector, getAuditInformation( ) ) );
}
catch ( RepositoryAdminException e )
{
@@ -98,16 +99,16 @@ public class DefaultProxyConnectorService
}
@Override
- public Boolean deleteProxyConnector( ProxyConnector proxyConnector )
+ public ActionStatus deleteProxyConnector( ProxyConnector proxyConnector )
throws ArchivaRestServiceException
{
if ( proxyConnector == null )
{
- return Boolean.FALSE;
+ return ActionStatus.FAIL;
}
try
{
- return proxyConnectorAdmin.deleteProxyConnector( proxyConnector, getAuditInformation() );
+ return new ActionStatus( proxyConnectorAdmin.deleteProxyConnector( proxyConnector, getAuditInformation( ) ) );
}
catch ( RepositoryAdminException e )
{
@@ -116,7 +117,7 @@ public class DefaultProxyConnectorService
}
@Override
- public Boolean removeProxyConnector( String sourceRepoId, String targetRepoId )
+ public ActionStatus removeProxyConnector( String sourceRepoId, String targetRepoId )
throws ArchivaRestServiceException
{
ProxyConnector proxyConnector = getProxyConnector( sourceRepoId, targetRepoId );
@@ -130,16 +131,16 @@ public class DefaultProxyConnectorService
}
@Override
- public Boolean updateProxyConnector( ProxyConnector proxyConnector )
+ public ActionStatus updateProxyConnector( ProxyConnector proxyConnector )
throws ArchivaRestServiceException
{
if ( proxyConnector == null )
{
- return Boolean.FALSE;
+ return ActionStatus.FAIL;
}
try
{
- return proxyConnectorAdmin.updateProxyConnector( proxyConnector, getAuditInformation() );
+ return new ActionStatus( proxyConnectorAdmin.updateProxyConnector( proxyConnector, getAuditInformation( ) ) );
}
catch ( RepositoryAdminException e )
{
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java
index 96b544f8e..c45b1da2f 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java
@@ -34,6 +34,7 @@ import org.apache.archiva.redback.policy.PasswordRule;
import org.apache.archiva.redback.rbac.RBACManager;
import org.apache.archiva.redback.role.RoleManager;
import org.apache.archiva.redback.users.UserManager;
+import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.RBACManagerImplementationInformation;
import org.apache.archiva.rest.api.model.RedbackImplementationsInformations;
import org.apache.archiva.rest.api.model.UserManagerImplementationInformation;
@@ -112,7 +113,7 @@ public class DefaultRedbackRuntimeConfigurationService
}
@Override
- public Boolean updateRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
+ public ActionStatus updateRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
throws ArchivaRestServiceException
{
try
@@ -221,9 +222,7 @@ public class DefaultRedbackRuntimeConfigurationService
}
-
-
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
catch (ArchivaRestServiceException e) {
log.error(e.getMessage(), e);
@@ -303,7 +302,7 @@ public class DefaultRedbackRuntimeConfigurationService
}
@Override
- public Boolean checkLdapConnection()
+ public ActionStatus checkLdapConnection()
throws ArchivaRestServiceException
{
LdapConnection ldapConnection = null;
@@ -325,11 +324,11 @@ public class DefaultRedbackRuntimeConfigurationService
}
}
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
@Override
- public Boolean checkLdapConnection( LdapConfiguration ldapConfiguration )
+ public ActionStatus checkLdapConnection( LdapConfiguration ldapConfiguration )
throws ArchivaRestServiceException
{
LdapConnection ldapConnection = null;
@@ -380,7 +379,7 @@ public class DefaultRedbackRuntimeConfigurationService
}
}
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
private Properties toProperties( Map<String, String> map )
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java
index f32ddde32..1e9a39c27 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java
@@ -26,6 +26,7 @@ import org.apache.archiva.proxy.ProxyRegistry;
import org.apache.archiva.proxy.maven.WagonFactory;
import org.apache.archiva.proxy.maven.WagonFactoryRequest;
import org.apache.archiva.proxy.model.NetworkProxy;
+import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.RemoteRepositoriesService;
import org.apache.commons.lang3.StringUtils;
@@ -91,10 +92,10 @@ public class DefaultRemoteRepositoriesService
}
@Override
- public Boolean deleteRemoteRepository(String repositoryId)
+ public ActionStatus deleteRemoteRepository( String repositoryId)
throws ArchivaRestServiceException {
try {
- return remoteRepositoryAdmin.deleteRemoteRepository(repositoryId, getAuditInformation());
+ return new ActionStatus( remoteRepositoryAdmin.deleteRemoteRepository( repositoryId, getAuditInformation( ) ) );
} catch (RepositoryAdminException e) {
log.error(e.getMessage(), e);
throw new ArchivaRestServiceException(e.getMessage(), e.getFieldName(), e);
@@ -102,10 +103,10 @@ public class DefaultRemoteRepositoriesService
}
@Override
- public Boolean addRemoteRepository(RemoteRepository remoteRepository)
+ public ActionStatus addRemoteRepository(RemoteRepository remoteRepository)
throws ArchivaRestServiceException {
try {
- return remoteRepositoryAdmin.addRemoteRepository(remoteRepository, getAuditInformation());
+ return new ActionStatus( remoteRepositoryAdmin.addRemoteRepository( remoteRepository, getAuditInformation( ) ) );
} catch (RepositoryAdminException e) {
log.error(e.getMessage(), e);
throw new ArchivaRestServiceException(e.getMessage(), e.getFieldName(), e);
@@ -113,10 +114,10 @@ public class DefaultRemoteRepositoriesService
}
@Override
- public Boolean updateRemoteRepository(RemoteRepository remoteRepository)
+ public ActionStatus updateRemoteRepository(RemoteRepository remoteRepository)
throws ArchivaRestServiceException {
try {
- return remoteRepositoryAdmin.updateRemoteRepository(remoteRepository, getAuditInformation());
+ return new ActionStatus( remoteRepositoryAdmin.updateRemoteRepository( remoteRepository, getAuditInformation( ) ) );
} catch (RepositoryAdminException e) {
log.error(e.getMessage(), e);
throw new ArchivaRestServiceException(e.getMessage(), e.getFieldName(), e);
@@ -124,13 +125,13 @@ public class DefaultRemoteRepositoriesService
}
@Override
- public Boolean checkRemoteConnectivity(String repositoryId)
+ public ActionStatus checkRemoteConnectivity( String repositoryId)
throws ArchivaRestServiceException {
try {
RemoteRepository remoteRepository = remoteRepositoryAdmin.getRemoteRepository(repositoryId);
if (remoteRepository == null) {
log.warn("Remote repository {} does not exist. Connectivity check returns false.", repositoryId);
- return Boolean.FALSE;
+ return ActionStatus.FAIL;
}
NetworkProxy networkProxy = null;
if (StringUtils.isNotBlank(remoteRepository.getRemoteDownloadNetworkProxyId())) {
@@ -175,22 +176,22 @@ public class DefaultRemoteRepositoriesService
// MRM-1933, there are certain servers that do not allow browsing
if (!(StringUtils.isEmpty(remoteRepository.getCheckPath()) ||
"/".equals(remoteRepository.getCheckPath()))) {
- return wagon.resourceExists(remoteRepository.getCheckPath());
+ return new ActionStatus( wagon.resourceExists( remoteRepository.getCheckPath( ) ) );
} else {
// we only check connectivity as remote repo can be empty
// MRM-1909: Wagon implementation appends a slash already
wagon.getFileList("");
}
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
} catch (TransferFailedException e) {
log.info("TransferFailedException :{}", e.getMessage());
- return Boolean.FALSE;
+ return ActionStatus.FAIL;
} catch (Exception e) {
// This service returns either true or false, Exception cannot be handled by the clients
log.debug("Exception occured on connectivity test.", e);
log.info("Connection exception: {}", e.getMessage());
- return Boolean.FALSE;
+ return ActionStatus.FAIL;
}
}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
index 3967d12df..f99b06db7 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
@@ -71,7 +71,10 @@ import org.apache.archiva.repository.scanner.RepositoryScannerInstance;
import org.apache.archiva.repository.storage.RepositoryStorage;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.archiva.repository.storage.fs.FsStorageUtil;
+import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.ArtifactTransferRequest;
+import org.apache.archiva.rest.api.model.PermissionStatus;
+import org.apache.archiva.rest.api.model.ScanStatus;
import org.apache.archiva.rest.api.model.StringList;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.RepositoriesService;
@@ -156,42 +159,42 @@ public class DefaultRepositoriesService
private List<ChecksumAlgorithm> algorithms = Arrays.asList(ChecksumAlgorithm.SHA256, ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 );
@Override
- public Boolean scanRepository( String repositoryId, boolean fullScan )
+ public ActionStatus scanRepository( String repositoryId, boolean fullScan )
{
- return doScanRepository( repositoryId, fullScan );
+ return new ActionStatus( doScanRepository( repositoryId, fullScan ) );
}
@Override
- public Boolean alreadyScanning( String repositoryId )
+ public ScanStatus getScanStatus( String repositoryId )
{
// check queue first to make sure it doesn't get dequeued between calls
if ( repositoryTaskScheduler.isProcessingRepositoryTask( repositoryId ) )
{
- return true;
+ return new ScanStatus( true );
}
for ( RepositoryScannerInstance scan : repoScanner.getInProgressScans() )
{
if ( scan.getRepository().getId().equals( repositoryId ) )
{
- return true;
+ return new ScanStatus( true );
}
}
- return false;
+ return new ScanStatus( false );
}
@Override
- public Boolean removeScanningTaskFromQueue( String repositoryId )
+ public ActionStatus removeScanningTaskFromQueue( String repositoryId )
{
RepositoryTask task = new RepositoryTask();
task.setRepositoryId( repositoryId );
try
{
- return repositoryTaskScheduler.unQueueTask( task );
+ return new ActionStatus( repositoryTaskScheduler.unQueueTask( task ) );
}
catch ( TaskQueueException e )
{
log.error( "failed to unschedule scanning of repo with id {}", repositoryId, e );
- return false;
+ return ActionStatus.FAIL;
}
}
@@ -205,7 +208,7 @@ public class DefaultRepositoriesService
}
@Override
- public Boolean scanRepositoryNow( String repositoryId, boolean fullScan )
+ public ActionStatus scanRepositoryNow( String repositoryId, boolean fullScan )
throws ArchivaRestServiceException
{
@@ -225,7 +228,7 @@ public class DefaultRepositoriesService
scheduler.queueTask( new RepositoryTask( repositoryId, fullScan ) );
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
catch ( Exception e )
{
@@ -235,7 +238,7 @@ public class DefaultRepositoriesService
}
@Override
- public Boolean scheduleDownloadRemoteIndex( String repositoryId, boolean now, boolean fullDownload )
+ public ActionStatus scheduleDownloadRemoteIndex( String repositoryId, boolean now, boolean fullDownload )
throws ArchivaRestServiceException
{
try
@@ -247,11 +250,11 @@ public class DefaultRepositoriesService
log.error( e.getMessage(), e );
throw new ArchivaRestServiceException( e.getMessage(), e );
}
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
@Override
- public Boolean copyArtifact( ArtifactTransferRequest artifactTransferRequest )
+ public ActionStatus copyArtifact( ArtifactTransferRequest artifactTransferRequest )
throws ArchivaRestServiceException
{
// check parameters
@@ -487,7 +490,7 @@ public class DefaultRepositoriesService
log.error( "IOException: {}", e.getMessage(), e );
throw new ArchivaRestServiceException( e.getMessage(), e );
}
- return true;
+ return ActionStatus.SUCCESS;
}
private void queueRepositoryTask( String repositoryId, StorageAsset localFile )
@@ -616,7 +619,7 @@ public class DefaultRepositoriesService
}
@Override
- public Boolean removeProjectVersion( String repositoryId, String namespace, String projectId, String version )
+ public ActionStatus removeProjectVersion( String repositoryId, String namespace, String projectId, String version )
throws ArchivaRestServiceException
{
// if not a generic we can use the standard way to delete artifact
@@ -633,7 +636,7 @@ public class DefaultRepositoriesService
throw new ArchivaRestServiceException( "repositoryId cannot be null", 400, null );
}
- if ( !isAuthorizedToDeleteArtifacts( repositoryId ) )
+ if ( !getPermissionStatus( repositoryId ).isAuthorizedToDeleteArtifacts() )
{
throw new ArchivaRestServiceException( "not authorized to delete artifacts", 403, null );
}
@@ -707,11 +710,11 @@ public class DefaultRepositoriesService
}
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
@Override
- public Boolean deleteArtifact( Artifact artifact )
+ public ActionStatus deleteArtifact( Artifact artifact )
throws ArchivaRestServiceException
{
@@ -727,7 +730,7 @@ public class DefaultRepositoriesService
throw new ArchivaRestServiceException( "repositoryId cannot be null", 400, null );
}
- if ( !isAuthorizedToDeleteArtifacts( repositoryId ) )
+ if ( !getPermissionStatus( repositoryId ).isAuthorizedToDeleteArtifacts() )
{
throw new ArchivaRestServiceException( "not authorized to delete artifacts", 403, null );
}
@@ -825,7 +828,7 @@ public class DefaultRepositoriesService
//throw new ContentNotFoundException(
// artifact.getNamespace() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion() );
log.warn( "targetPath {} not found skip file deletion", targetPath );
- return false;
+ return ActionStatus.FAIL;
}
// TODO: this should be in the storage mechanism so that it is all tied together
@@ -981,11 +984,11 @@ public class DefaultRepositoriesService
repositorySession.close();
}
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
@Override
- public Boolean deleteGroupId( String groupId, String repositoryId )
+ public ActionStatus deleteGroupId( String groupId, String repositoryId )
throws ArchivaRestServiceException
{
if ( StringUtils.isEmpty( repositoryId ) )
@@ -993,7 +996,7 @@ public class DefaultRepositoriesService
throw new ArchivaRestServiceException( "repositoryId cannot be null", 400, null );
}
- if ( !isAuthorizedToDeleteArtifacts( repositoryId ) )
+ if ( !getPermissionStatus( repositoryId ).isAuthorizedToDeleteArtifacts() )
{
throw new ArchivaRestServiceException( "not authorized to delete artifacts", 403, null );
}
@@ -1051,11 +1054,11 @@ public class DefaultRepositoriesService
repositorySession.close();
}
- return true;
+ return ActionStatus.SUCCESS;
}
@Override
- public Boolean deleteProject( String groupId, String projectId, String repositoryId )
+ public ActionStatus deleteProject( String groupId, String projectId, String repositoryId )
throws ArchivaRestServiceException
{
if ( StringUtils.isEmpty( repositoryId ) )
@@ -1063,7 +1066,7 @@ public class DefaultRepositoriesService
throw new ArchivaRestServiceException( "repositoryId cannot be null", 400, null );
}
- if ( !isAuthorizedToDeleteArtifacts( repositoryId ) )
+ if ( !getPermissionStatus( repositoryId ).isAuthorizedToDeleteArtifacts() )
{
throw new ArchivaRestServiceException( "not authorized to delete artifacts", 403, null );
}
@@ -1131,12 +1134,12 @@ public class DefaultRepositoriesService
repositorySession.close();
}
- return true;
+ return ActionStatus.SUCCESS;
}
@Override
- public Boolean isAuthorizedToDeleteArtifacts( String repoId )
+ public PermissionStatus getPermissionStatus( String repoId )
throws ArchivaRestServiceException
{
String userName =
@@ -1144,7 +1147,7 @@ public class DefaultRepositoriesService
try
{
- return userRepositories.isAuthorizedToDeleteArtifacts( userName, repoId );
+ return new PermissionStatus( userRepositories.isAuthorizedToDeleteArtifacts( userName, repoId ) );
}
catch ( ArchivaSecurityException e )
{
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoryGroupService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoryGroupService.java
index 1f33314b1..9053f00e5 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoryGroupService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoryGroupService.java
@@ -21,6 +21,7 @@ package org.apache.archiva.rest.services;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.RepositoryGroup;
import org.apache.archiva.admin.model.group.RepositoryGroupAdmin;
+import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.RepositoryGroupService;
import org.apache.commons.lang3.StringUtils;
@@ -79,16 +80,16 @@ public class DefaultRepositoryGroupService
}
@Override
- public Boolean addRepositoryGroup( RepositoryGroup repoGroup )
+ public ActionStatus addRepositoryGroup( RepositoryGroup repoGroup )
throws ArchivaRestServiceException
{
try
{
- return repositoryGroupAdmin.addRepositoryGroup(
- new org.apache.archiva.admin.model.beans.RepositoryGroup( repoGroup.getId(), new ArrayList<>(
- repoGroup.getRepositories() ) ).mergedIndexPath( repoGroup.getMergedIndexPath() ).mergedIndexTtl(
- repoGroup.getMergedIndexTtl() ).cronExpression( repoGroup.getCronExpression() ),
- getAuditInformation() );
+ return new ActionStatus( repositoryGroupAdmin.addRepositoryGroup(
+ new org.apache.archiva.admin.model.beans.RepositoryGroup( repoGroup.getId( ), new ArrayList<>(
+ repoGroup.getRepositories( ) ) ).mergedIndexPath( repoGroup.getMergedIndexPath( ) ).mergedIndexTtl(
+ repoGroup.getMergedIndexTtl( ) ).cronExpression( repoGroup.getCronExpression( ) ),
+ getAuditInformation( ) ) );
}
catch ( RepositoryAdminException e )
{
@@ -97,16 +98,16 @@ public class DefaultRepositoryGroupService
}
@Override
- public Boolean updateRepositoryGroup( RepositoryGroup repoGroup )
+ public ActionStatus updateRepositoryGroup( RepositoryGroup repoGroup )
throws ArchivaRestServiceException
{
try
{
- return repositoryGroupAdmin.updateRepositoryGroup(
- new org.apache.archiva.admin.model.beans.RepositoryGroup( repoGroup.getId(), new ArrayList<>(
- repoGroup.getRepositories() ) ).mergedIndexPath( repoGroup.getMergedIndexPath() ).mergedIndexTtl(
- repoGroup.getMergedIndexTtl() ).cronExpression( repoGroup.getCronExpression() ),
- getAuditInformation() );
+ return new ActionStatus( repositoryGroupAdmin.updateRepositoryGroup(
+ new org.apache.archiva.admin.model.beans.RepositoryGroup( repoGroup.getId( ), new ArrayList<>(
+ repoGroup.getRepositories( ) ) ).mergedIndexPath( repoGroup.getMergedIndexPath( ) ).mergedIndexTtl(
+ repoGroup.getMergedIndexTtl( ) ).cronExpression( repoGroup.getCronExpression( ) ),
+ getAuditInformation( ) ) );
}
catch ( RepositoryAdminException e )
{
@@ -115,12 +116,12 @@ public class DefaultRepositoryGroupService
}
@Override
- public Boolean deleteRepositoryGroup( String repositoryGroupId )
+ public ActionStatus deleteRepositoryGroup( String repositoryGroupId )
throws ArchivaRestServiceException
{
try
{
- return repositoryGroupAdmin.deleteRepositoryGroup( repositoryGroupId, getAuditInformation() );
+ return new ActionStatus( repositoryGroupAdmin.deleteRepositoryGroup( repositoryGroupId, getAuditInformation( ) ) );
}
catch ( RepositoryAdminException e )
{
@@ -129,12 +130,12 @@ public class DefaultRepositoryGroupService
}
@Override
- public Boolean addRepositoryToGroup( String repositoryGroupId, String repositoryId )
+ public ActionStatus addRepositoryToGroup( String repositoryGroupId, String repositoryId )
throws ArchivaRestServiceException
{
try
{
- return repositoryGroupAdmin.addRepositoryToGroup( repositoryGroupId, repositoryId, getAuditInformation() );
+ return new ActionStatus( repositoryGroupAdmin.addRepositoryToGroup( repositoryGroupId, repositoryId, getAuditInformation( ) ) );
}
catch ( RepositoryAdminException e )
{
@@ -143,13 +144,13 @@ public class DefaultRepositoryGroupService
}
@Override
- public Boolean deleteRepositoryFromGroup( String repositoryGroupId, String repositoryId )
+ public ActionStatus deleteRepositoryFromGroup( String repositoryGroupId, String repositoryId )
throws ArchivaRestServiceException
{
try
{
- return repositoryGroupAdmin.deleteRepositoryFromGroup( repositoryGroupId, repositoryId,
- getAuditInformation() );
+ return new ActionStatus( repositoryGroupAdmin.deleteRepositoryFromGroup( repositoryGroupId, repositoryId,
+ getAuditInformation( ) ) );
}
catch ( RepositoryAdminException e )
{
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 e62cdc99e..775664662 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
@@ -26,6 +26,7 @@ import org.apache.archiva.components.taskqueue.TaskQueue;
import org.apache.archiva.components.taskqueue.TaskQueueException;
import org.apache.archiva.repository.scanner.RepositoryScanner;
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.QueueEntry;
@@ -165,7 +166,7 @@ public class DefaultSystemStatusService
}
@Override
- public Boolean clearCache( String cacheKey )
+ public ActionStatus clearCache( String cacheKey )
throws ArchivaRestServiceException
{
Cache cache = caches.get( cacheKey );
@@ -176,18 +177,18 @@ public class DefaultSystemStatusService
}
cache.clear();
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
@Override
- public Boolean clearAllCaches()
+ public ActionStatus clearAllCaches()
throws ArchivaRestServiceException
{
for ( Cache cache : caches.values() )
{
cache.clear();
}
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
@Override
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/cxf/org.apache.cxf.Logger b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/cxf/org.apache.cxf.Logger
new file mode 100644
index 000000000..27dd788b3
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/cxf/org.apache.cxf.Logger
@@ -0,0 +1 @@
+org.apache.cxf.common.logging.Slf4jLogger \ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml
index 3373b12dc..ede2fe6c0 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml
@@ -40,10 +40,16 @@
base-package="org.apache.archiva.rest.services,org.apache.archiva.redback.rest.services"/>
+ <bean id="eventSender" class="org.apache.cxf.ext.logging.slf4j.Slf4jVerboseEventSender">
+ <property name="loggingLevel" value="DEBUG" />
+ </bean>
+
+
<jaxrs:server id="archivaServices" address="/archivaServices" >
<jaxrs:providers>
<bean class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider"/>
+ <bean class="com.fasterxml.jackson.jaxrs.xml.JacksonJaxbXMLProvider"/>
<ref bean="authenticationInterceptor#rest"/>
<ref bean="permissionInterceptor#rest"/>
<ref bean="requestValidationInterceptor#rest" />
@@ -72,6 +78,13 @@
<ref bean="redbackRuntimeConfigurationService#rest"/>
</jaxrs:serviceBeans>
+ <jaxrs:features>
+ <bean class="org.apache.cxf.ext.logging.LoggingFeature">
+ <property name="sender" ref="eventSender"/>
+ </bean>
+ </jaxrs:features>
+
+
</jaxrs:server>
<bean name="browse#versionMetadata" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
index 80172e294..efd48408d 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
@@ -20,6 +20,7 @@ package org.apache.archiva.rest.services;
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
+import com.fasterxml.jackson.jaxrs.xml.JacksonJaxbXMLProvider;
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
import org.apache.archiva.redback.rest.services.AbstractRestServicesTest;
@@ -50,7 +51,6 @@ import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
-import org.slf4j.LoggerFactory;
import javax.ws.rs.core.MediaType;
import java.io.IOException;
@@ -58,11 +58,10 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalTime;
-import java.util.Collections;
+import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicReference;
-import java.util.function.Function;
/**
* @author Olivier Lamy
@@ -238,7 +237,7 @@ public abstract class AbstractArchivaRestTest
protected <T> T getService( Class<T> clazz, String authzHeader )
{
T service = JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/", clazz,
- Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
if ( authzHeader != null )
{
@@ -296,7 +295,7 @@ public abstract class AbstractArchivaRestTest
{
return JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
RepositoryGroupService.class,
- Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
}
protected ProxyConnectorService getProxyConnectorService()
@@ -304,7 +303,7 @@ public abstract class AbstractArchivaRestTest
ProxyConnectorService service =
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
ProxyConnectorService.class,
- Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
WebClient.client(service).header("Referer","http://localhost:"+getServerPort());
@@ -319,7 +318,7 @@ public abstract class AbstractArchivaRestTest
NetworkProxyService service =
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
NetworkProxyService.class,
- Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
WebClient.client(service).header("Referer","http://localhost:"+getServerPort());
@@ -334,7 +333,7 @@ public abstract class AbstractArchivaRestTest
ArchivaAdministrationService service =
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
ArchivaAdministrationService.class,
- Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE );
WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE );
@@ -351,7 +350,7 @@ public abstract class AbstractArchivaRestTest
RedbackRuntimeConfigurationService service =
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
RedbackRuntimeConfigurationService.class,
- Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE );
WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE );
@@ -368,7 +367,7 @@ public abstract class AbstractArchivaRestTest
BrowseService service =
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
BrowseService.class,
- Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
// to add authentification
if ( authzHeader != null )
{
@@ -399,7 +398,7 @@ public abstract class AbstractArchivaRestTest
SearchService service =
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
SearchService.class,
- Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
// to add authentification
if ( authzHeader != null )
{
@@ -422,7 +421,7 @@ public abstract class AbstractArchivaRestTest
CommonServices service =
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
CommonServices.class,
- Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
if ( authzHeader != null )
{
@@ -664,7 +663,7 @@ public abstract class AbstractArchivaRestTest
protected void waitForScanToComplete( String repoId )
throws ArchivaRestServiceException, InterruptedException
{
- while ( getRepositoriesService( authorizationHeader ).alreadyScanning( repoId ) ) {
+ while ( getRepositoriesService( authorizationHeader ).getScanStatus( repoId ).isAlreadyScanning() ) {
// Would be better to cancel, if we had that capacity
Thread.sleep( 100 );
}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaAdministrationServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaAdministrationServiceTest.java
index 77eb008f8..0c34b1d2c 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaAdministrationServiceTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaAdministrationServiceTest.java
@@ -22,7 +22,6 @@ import org.apache.archiva.admin.model.beans.FileType;
import org.apache.archiva.admin.model.beans.OrganisationInformation;
import org.apache.archiva.admin.model.beans.UiConfiguration;
import org.apache.archiva.rest.api.model.AdminRepositoryConsumer;
-import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/CommonServicesTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/CommonServicesTest.java
index eac5aa983..ff5e86350 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/CommonServicesTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/CommonServicesTest.java
@@ -32,7 +32,7 @@ public class CommonServicesTest
throws Exception
{
CommonServices commonServices = getCommonServices( null );
- assertTrue( commonServices.validateCronExpression( "0 0,30 * * * ?" ) );
+ assertTrue( commonServices.validateCronExpression( "0 0,30 * * * ?" ).isValid() );
}
@Test
@@ -40,6 +40,6 @@ public class CommonServicesTest
throws Exception
{
CommonServices commonServices = getCommonServices( null );
- assertFalse( commonServices.validateCronExpression( "0,30 * * * ?" ) );
+ assertFalse( commonServices.validateCronExpression( "0,30 * * * ?" ).isValid() );
}
}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/CopyArtifactTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/CopyArtifactTest.java
index 51ee1cd86..62fc7c044 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/CopyArtifactTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/CopyArtifactTest.java
@@ -56,7 +56,7 @@ public class CopyArtifactTest
// retrieve the service
RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );
// copy the artifact
- Boolean res = repositoriesService.copyArtifact( artifactTransferRequest );
+ Boolean res = repositoriesService.copyArtifact( artifactTransferRequest ).isSuccess();
// END SNIPPET: copy-artifact
assertTrue( res );
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ManagedRepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ManagedRepositoriesServiceTest.java
index 41296cb2b..8838c461c 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ManagedRepositoriesServiceTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ManagedRepositoriesServiceTest.java
@@ -26,7 +26,6 @@ import org.apache.archiva.rest.api.services.RepositoriesService;
import org.junit.Test;
import java.nio.file.Path;
-import java.nio.file.Paths;
/**
@@ -58,7 +57,7 @@ public class ManagedRepositoriesServiceTest
RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );
int timeout = 20000;
- while ( timeout > 0 && repositoriesService.alreadyScanning( repo.getId() ) )
+ while ( timeout > 0 && repositoriesService.getScanStatus( repo.getId() ).isAlreadyScanning() )
{
Thread.sleep( 500 );
timeout -= 500;
@@ -85,7 +84,7 @@ public class ManagedRepositoriesServiceTest
RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );
int timeout = 20000;
- while ( timeout > 0 && repositoriesService.alreadyScanning( repo.getId() ) )
+ while ( timeout > 0 && repositoriesService.getScanStatus( repo.getId() ).isAlreadyScanning() )
{
Thread.sleep( 500 );
timeout -= 500;
@@ -104,7 +103,7 @@ public class ManagedRepositoriesServiceTest
assertEquals( "toto", repo.getName() );
timeout = 20000;
- while ( timeout > 0 && repositoriesService.alreadyScanning( repo.getId() ) )
+ while ( timeout > 0 && repositoriesService.getScanStatus( repo.getId() ).isAlreadyScanning() )
{
Thread.sleep( 500 );
timeout -= 500;
@@ -122,10 +121,10 @@ public class ManagedRepositoriesServiceTest
ManagedRepositoriesService service = getManagedRepositoriesService( authorizationHeader );
Path target = getProjectDirectory().resolve( "target" );
- assertTrue( service.fileLocationExists( target.toAbsolutePath().toString() ) );
+ assertTrue( service.getFileStatus( target.toAbsolutePath().toString() ).isExists() );
// normally should not exists :-)
- assertFalse( service.fileLocationExists( "/fooofofof/foddfdofd/dedede/kdeo" ) );
+ assertFalse( service.getFileStatus( "/fooofofof/foddfdofd/dedede/kdeo" ).isExists() );
}
@@ -151,7 +150,7 @@ public class ManagedRepositoriesServiceTest
repositoriesService.scanRepositoryDirectoriesNow( testRepoId );
int timeout = 20000;
- while ( timeout > 0 && repositoriesService.alreadyScanning( testRepoId ) )
+ while ( timeout > 0 && repositoriesService.getScanStatus( testRepoId ).isAlreadyScanning() )
{
Thread.sleep( 500 );
timeout -= 500;
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java
index b2471edfe..ed5b731c8 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java
@@ -176,7 +176,7 @@ public class RemoteRepositoriesServiceTest
service.addRemoteRepository(getRemoteRepository());
- assertTrue(service.checkRemoteConnectivity("id-new"));
+ assertTrue(service.checkRemoteConnectivity("id-new").isSuccess());
} finally {
removeRemoteRepositories("id-new");
}
@@ -198,7 +198,7 @@ public class RemoteRepositoriesServiceTest
service.addRemoteRepository(getRemoteMavenRepository());
- assertTrue(service.checkRemoteConnectivity("id-maven1"));
+ assertTrue(service.checkRemoteConnectivity("id-maven1").isSuccess());
} finally {
removeRemoteRepositories("id-maven1");
}
@@ -222,7 +222,7 @@ public class RemoteRepositoriesServiceTest
service.addRemoteRepository(getRemoteOracleRepository());
- assertTrue(service.checkRemoteConnectivity("id-oracle"));
+ assertTrue(service.checkRemoteConnectivity("id-oracle").isSuccess());
} finally {
removeRemoteRepositories("id-oracle");
}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java
index 7b765c2b1..fd14b026e 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java
@@ -21,7 +21,6 @@ package org.apache.archiva.rest.services;
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.maven2.model.Artifact;
-import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
import org.apache.archiva.redback.rest.api.services.UserService;
import org.apache.archiva.rest.api.model.BrowseResult;
import org.apache.archiva.rest.api.model.BrowseResultEntry;
@@ -37,7 +36,6 @@ import javax.ws.rs.ForbiddenException;
import javax.ws.rs.core.Response;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.List;
import java.util.Locale;
@@ -77,13 +75,13 @@ public class RepositoriesServiceTest
String repoId = managedRepositoriesService.getManagedRepositories().get( 0 ).getId();
int timeout = 20000;
- while ( timeout > 0 && service.alreadyScanning( repoId ) )
+ while ( timeout > 0 && service.getScanStatus( repoId ).isAlreadyScanning() )
{
Thread.sleep( 500 );
timeout -= 500;
}
- assertTrue( service.scanRepository( repoId, true ) );
+ assertTrue( service.scanRepository( repoId, true ).isSuccess() );
}
@Test( expected = ForbiddenException.class )
@@ -393,7 +391,7 @@ public class RepositoriesServiceTest
{
getManagedRepositoriesService( authorizationHeader ).addManagedRepository( managedRepository );
RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );
- assertTrue( repositoriesService.isAuthorizedToDeleteArtifacts( managedRepository.getId() ) );
+ assertTrue( repositoriesService.getPermissionStatus( managedRepository.getId() ).isAuthorizedToDeleteArtifacts() );
}
finally
{
@@ -413,7 +411,7 @@ public class RepositoriesServiceTest
{
getManagedRepositoriesService( authorizationHeader ).addManagedRepository( managedRepository );
RepositoriesService repositoriesService = getRepositoriesService( );
- assertFalse( repositoriesService.isAuthorizedToDeleteArtifacts( managedRepository.getId() ) );
+ assertFalse( repositoriesService.getPermissionStatus( managedRepository.getId() ).isAuthorizedToDeleteArtifacts() );
}
finally
{
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml
index 11a7b9022..8e0fce6e0 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml
@@ -49,7 +49,8 @@
<logger name="org.apache.archiva.rest.services" level="info"/>
<logger name="org.springframework" level="error"/>
<logger name="org.apache.commons.configuration" level="info"/>
- <logger name="org.apache.archiva.metadata.repository.storage.maven2" level="error" />
+ <logger name="org.apache.archiva.metadata" level="error" />
+ <logger name="org.apache.cxf" level="debug" />
<root level="info">
<appender-ref ref="console"/>