From 478c60608d6ca1bd5ac882e1c97679e019f26031 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Tue, 29 Jun 2021 21:09:52 +0200 Subject: [PATCH] Refactoring group handling --- .../archiva/repository/RepositoryHandler.java | 7 + .../base/ArchivaRepositoryRegistry.java | 25 +--- .../base/RepositoryGroupHandler.java | 14 +- .../api/services/v2/ValidationException.java | 38 ++++-- .../v2/ArchivaRestServiceExceptionMapper.java | 2 +- .../v2/DefaultRepositoryGroupService.java | 54 +++----- .../v2/AbstractNativeRestServices.java | 3 +- .../v2/NativeRepositoryGroupServiceTest.java | 127 ++++++++++++++++-- .../v2/NativeRepositoryServiceTest.java | 6 - 9 files changed, 190 insertions(+), 86 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryHandler.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryHandler.java index 49fc4de12..4bb414cf8 100644 --- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryHandler.java +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/RepositoryHandler.java @@ -19,6 +19,7 @@ package org.apache.archiva.repository; import org.apache.archiva.configuration.Configuration; import org.apache.archiva.repository.validation.RepositoryChecker; +import org.apache.archiva.repository.validation.RepositoryValidator; import java.util.Collection; import java.util.Map; @@ -158,6 +159,12 @@ public interface RepositoryHandler */ Collection getAll(); + /** + * Returns a validator that can be used to validate repository data + * @return a validator instance + */ + RepositoryValidator getValidator( ); + /** * Returns true, if the repository is registered with the given id, otherwise false * @param id the repository identifier diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java index db1d626a2..d3eb836c2 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/ArchivaRepositoryRegistry.java @@ -52,6 +52,7 @@ import org.apache.archiva.repository.RepositoryProvider; import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.repository.RepositoryType; import org.apache.archiva.repository.UnsupportedRepositoryTypeException; +import org.apache.archiva.repository.base.validation.CommonGroupValidator; import org.apache.archiva.repository.event.LifecycleEvent; import org.apache.archiva.repository.event.RepositoryEvent; import org.apache.archiva.repository.event.RepositoryIndexEvent; @@ -136,9 +137,6 @@ public class ArchivaRepositoryRegistry implements ConfigurationListener, EventHa private RepositoryGroupHandler groupHandler; private final Set> validators; - private final RepositoryChecker>> groupChecker; - private final RepositoryChecker>> managedChecker; - private final RepositoryChecker>> remoteChecker; private final ConfigurationHandler configurationHandler; @@ -152,27 +150,8 @@ public class ArchivaRepositoryRegistry implements ConfigurationListener, EventHa this.eventManager = new EventManager( this ); this.configurationHandler = configurationHandler; this.validators = initValidatorList( validatorList ); - this.groupChecker = initChecker( RepositoryGroup.class ); - this.managedChecker = initChecker( ManagedRepository.class ); - this.remoteChecker = initChecker( RemoteRepository.class ); } - private RepositoryChecker>> initChecker(Class clazz) { - return new RepositoryChecker>>( ) - { - @Override - public CheckedResult>> apply( R repositoryGroup ) - { - return this.apply( repositoryGroup ); - } - - @Override - public CheckedResult>> applyForUpdate( R repo ) - { - return this.applyForUpdate( repo ); - } - }; - } private Set> initValidatorList( List> validators ) { @@ -909,7 +888,7 @@ public class ArchivaRepositoryRegistry implements ConfigurationListener, EventHa rwLock.writeLock( ).lock( ); try { - return groupHandler.putWithCheck( repositoryGroupConfiguration, this.groupChecker ); + return groupHandler.putWithCheck( repositoryGroupConfiguration, groupHandler.getValidator() ); } finally { diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/RepositoryGroupHandler.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/RepositoryGroupHandler.java index 376be6665..6783f7467 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/RepositoryGroupHandler.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/base/RepositoryGroupHandler.java @@ -36,6 +36,7 @@ import org.apache.archiva.repository.event.RepositoryEvent; import org.apache.archiva.repository.features.IndexCreationFeature; import org.apache.archiva.repository.storage.StorageAsset; import org.apache.archiva.repository.validation.RepositoryChecker; +import org.apache.archiva.repository.validation.RepositoryValidator; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -74,9 +75,11 @@ public class RepositoryGroupHandler implements RepositoryHandler repositoryGroups = new HashMap<>( ); + private final RepositoryValidator validator; private Path groupsDirectory; + /** * Creates a new instance. All dependencies are injected on the constructor. * @@ -86,11 +89,14 @@ public class RepositoryGroupHandler implements RepositoryHandler repositoryGroupValidator + ) { this.configurationHandler = configurationHandler; this.mergedRemoteIndexesScheduler = mergedRemoteIndexesScheduler; this.repositoryRegistry = repositoryRegistry; + this.validator = repositoryGroupValidator; } @Override @@ -552,6 +558,12 @@ public class RepositoryGroupHandler implements RepositoryHandler getValidator( ) + { + return this.validator; + } + @Override public boolean has( String id ) { diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/v2/ValidationException.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/v2/ValidationException.java index bedb46d48..7c44f298e 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/v2/ValidationException.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/v2/ValidationException.java @@ -26,9 +26,11 @@ import java.util.Collections; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * Exception is thrown + * * @author Martin Stockhammer */ public class ValidationException extends ArchivaRestServiceException @@ -39,27 +41,41 @@ public class ValidationException extends ArchivaRestServiceException private List validationErrors; - public ValidationException( ) { + public ValidationException( ) + { super( DEFAULT_MESSAGE, DEFAULT_CODE ); } - public ValidationException( int errorCode) { + public ValidationException( int errorCode ) + { super( DEFAULT_MESSAGE, errorCode ); } - public ValidationException( List errors) { + public ValidationException( List errors ) + { super( DEFAULT_MESSAGE, DEFAULT_CODE ); this.validationErrors = errors; } - public static ValidationException of( List errorList ) { + public static ValidationException of( List errorList ) + { return new ValidationException( errorList.stream( ).map( ValidationError::of ).collect( Collectors.toList( ) ) ); } - public static ValidationException of( ValidationResponse result ) { - if (result.isValid()) { + public static ValidationException of( Map> errorMap ) + { + return new ValidationException( errorMap.entrySet( ).stream( ) + .flatMap( v -> v.getValue( ).stream( ).map( k -> ValidationError.of(v.getKey(), k))) + .collect( Collectors.toList( ) ) ); + } + + public static ValidationException of( ValidationResponse result ) + { + if ( result.isValid( ) ) + { return new ValidationException( ); - } else + } + else { return new ValidationException( result.getResult( ).entrySet( ).stream( ).flatMap( v -> v.getValue( ).stream( ).map( e -> ValidationError.of( v.getKey( ), e ) ) ).collect( Collectors.toList( ) ) ); @@ -68,7 +84,7 @@ public class ValidationException extends ArchivaRestServiceException public List getValidationErrors( ) { - return validationErrors==null? Collections.emptyList() : validationErrors; + return validationErrors == null ? Collections.emptyList( ) : validationErrors; } public void setValidationErrors( List validationErrors ) @@ -76,8 +92,10 @@ public class ValidationException extends ArchivaRestServiceException this.validationErrors = validationErrors; } - public void addValidationError( ValidationError error) { - if (this.validationErrors==null) { + public void addValidationError( ValidationError error ) + { + if ( this.validationErrors == null ) + { this.validationErrors = new ArrayList<>( ); } this.validationErrors.add( error ); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/interceptors/v2/ArchivaRestServiceExceptionMapper.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/interceptors/v2/ArchivaRestServiceExceptionMapper.java index 17237cb85..129637490 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/interceptors/v2/ArchivaRestServiceExceptionMapper.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/interceptors/v2/ArchivaRestServiceExceptionMapper.java @@ -54,7 +54,7 @@ public class ArchivaRestServiceExceptionMapper public Response.Status.Family getFamily() { - return Response.Status.Family.SERVER_ERROR; + return Response.Status.Family.familyOf( e.getHttpErrorCode( ) ); } public String getReasonPhrase() diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/v2/DefaultRepositoryGroupService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/v2/DefaultRepositoryGroupService.java index 4535336d6..146632011 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/v2/DefaultRepositoryGroupService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/v2/DefaultRepositoryGroupService.java @@ -40,11 +40,14 @@ import org.apache.archiva.components.rest.util.QueryHelper; import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.IndeterminateConfigurationException; import org.apache.archiva.configuration.RepositoryGroupConfiguration; +import org.apache.archiva.repository.CheckedResult; import org.apache.archiva.repository.EditableRepositoryGroup; import org.apache.archiva.repository.RepositoryException; import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.repository.base.ConfigurationHandler; +import org.apache.archiva.repository.validation.ValidationError; import org.apache.archiva.repository.validation.ValidationResponse; +import org.apache.archiva.rest.api.model.v2.MergeConfiguration; import org.apache.archiva.rest.api.model.v2.RepositoryGroup; import org.apache.archiva.rest.api.services.v2.ArchivaRestServiceException; import org.apache.archiva.rest.api.services.v2.ErrorKeys; @@ -62,6 +65,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import java.util.Comparator; import java.util.List; +import java.util.Map; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -139,9 +143,13 @@ public class DefaultRepositoryGroupService implements RepositoryGroupService result.setId( group.getId( ) ); result.setLocation( group.getLocation( ) ); result.setRepositories( group.getRepositories( ) ); - result.setMergedIndexPath( group.getMergeConfiguration( ).getMergedIndexPath( ) ); - result.setMergedIndexTtl( group.getMergeConfiguration( ).getMergedIndexTtlMinutes( ) ); - result.setCronExpression( group.getMergeConfiguration( ).getIndexMergeSchedule( ) ); + MergeConfiguration mergeConfig = group.getMergeConfiguration( ); + if (mergeConfig!=null) + { + result.setMergedIndexPath( mergeConfig.getMergedIndexPath( ) ); + result.setMergedIndexTtl( mergeConfig.getMergedIndexTtlMinutes( ) ); + result.setCronExpression( mergeConfig.getIndexMergeSchedule( ) ); + } return result; } @@ -158,27 +166,18 @@ public class DefaultRepositoryGroupService implements RepositoryGroupService } try { + RepositoryGroupConfiguration configuration = toConfig( repositoryGroup ); - Configuration config = configurationHandler.getBaseConfiguration( ); - org.apache.archiva.repository.RepositoryGroup repo = repositoryRegistry.putRepositoryGroup( configuration, config); - if ( repo!=null ) - { - ValidationResponse validationResult = repositoryRegistry.validateRepository( repo ); + CheckedResult>> validationResult = repositoryRegistry.putRepositoryGroupAndValidate( configuration ); if ( validationResult.isValid( ) ) { httpServletResponse.setStatus( 201 ); - configurationHandler.save( config ); - return RepositoryGroup.of( repo ); + return RepositoryGroup.of( validationResult.getRepository() ); } else { - throw ValidationException.of( validationResult ); + throw ValidationException.of( validationResult.getResult() ); } - } - else - { - throw new ArchivaRestServiceException( ErrorMessage.of( ErrorKeys.REPOSITORY_GROUP_ADD_FAILED ) ); - } } - catch ( RepositoryException | IndeterminateConfigurationException | RegistryException e ) + catch ( RepositoryException e ) { throw new ArchivaRestServiceException( ErrorMessage.of( ErrorKeys.REPOSITORY_GROUP_ADD_FAILED ) ); } @@ -196,32 +195,19 @@ public class DefaultRepositoryGroupService implements RepositoryGroupService throw new ArchivaRestServiceException( ErrorMessage.of( ErrorKeys.REPOSITORY_GROUP_NOT_FOUND ), 404 ); } repositoryGroup.setId( repositoryGroupId ); - try { RepositoryGroupConfiguration configuration = toConfig( repositoryGroup ); - Configuration config = configurationHandler.getBaseConfiguration( ); - org.apache.archiva.repository.RepositoryGroup repo = repositoryRegistry.putRepositoryGroup( configuration, config); - if ( repo!=null ) - { - ValidationResponse validationResult = repositoryRegistry.validateRepository( repo ); + CheckedResult>> validationResult = repositoryRegistry.putRepositoryGroupAndValidate( configuration ); if ( validationResult.isValid( ) ) { httpServletResponse.setStatus( 201 ); - configurationHandler.save( config ); - return RepositoryGroup.of( repo ); + return RepositoryGroup.of( validationResult.getRepository() ); } else { - throw ValidationException.of( validationResult ); + throw ValidationException.of( validationResult.getResult() ); } - } - else - { - log.error( "Returned repository group was null {}", repositoryGroupId ); - throw new ArchivaRestServiceException( ErrorMessage.of( ErrorKeys.REPOSITORY_GROUP_UPDATE_FAILED ) ); - } - } - catch ( RepositoryException | IndeterminateConfigurationException | RegistryException e ) + catch ( RepositoryException e ) { log.error( "Exception during repository group update: {}", e.getMessage( ), e ); throw new ArchivaRestServiceException( ErrorMessage.of( ErrorKeys.REPOSITORY_GROUP_UPDATE_FAILED, e.getMessage() ) ); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/v2/AbstractNativeRestServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/v2/AbstractNativeRestServices.java index 18093fa21..9a9b7e829 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/v2/AbstractNativeRestServices.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/v2/AbstractNativeRestServices.java @@ -487,9 +487,8 @@ public abstract class AbstractNativeRestServices Response result = given( ).spec( getAuthRequestSpecBuilder().build() ) .contentType( JSON ) .body( jsonAsMap ) - .when( ).post( "/authenticate").prettyPeek().then( ).statusCode( 200 ) + .when( ).post( "/authenticate").then( ).statusCode( 200 ) .extract( ).response( ); - result.getBody( ).prettyPrint( ); return result.body( ).jsonPath( ).getString( "access_token" ); } protected String getAdminToken() { diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/v2/NativeRepositoryGroupServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/v2/NativeRepositoryGroupServiceTest.java index 1e4409fba..226c5a8ed 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/v2/NativeRepositoryGroupServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/v2/NativeRepositoryGroupServiceTest.java @@ -20,10 +20,7 @@ package org.apache.archiva.rest.services.v2; import io.restassured.response.Response; import org.apache.archiva.components.rest.model.PagedResult; -import org.apache.archiva.components.rest.model.PropertyEntry; -import org.apache.archiva.rest.api.model.v2.BeanInformation; -import org.apache.archiva.rest.api.model.v2.CacheConfiguration; -import org.apache.archiva.rest.api.model.v2.LdapConfiguration; +import org.apache.archiva.rest.api.model.v2.RepositoryGroup; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; @@ -33,14 +30,17 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestMethodOrder; -import java.util.Arrays; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import static io.restassured.RestAssured.given; import static io.restassured.http.ContentType.JSON; -import static org.junit.jupiter.api.Assertions.*; +import static org.easymock.EasyMock.contains; +import static org.hamcrest.Matchers.endsWith; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; /** * @author Martin Stockhammer @@ -70,16 +70,125 @@ public class NativeRepositoryGroupServiceTest extends AbstractNativeRestServices } @Test - void testGetConfiguration() { + void testGetEmptyList( ) + { + String token = getAdminToken( ); + Response response = given( ).spec( getRequestSpec( token ) ).contentType( JSON ) + .when( ) + .get( "" ) + .then( ).statusCode( 200 ).extract( ).response( ); + assertNotNull( response ); + PagedResult result = response.getBody( ).jsonPath( ).getObject( "", PagedResult.class ); + assertEquals( 0, result.getPagination( ).getTotalCount( ) ); + + } + + @Test + void testAddGroup( ) + { String token = getAdminToken( ); + try + { + Map jsonAsMap = new HashMap<>( ); + jsonAsMap.put( "id", "group_001" ); Response response = given( ).spec( getRequestSpec( token ) ).contentType( JSON ) .when( ) - .get( "" ) + .body( jsonAsMap ) + .post( "" ) .prettyPeek() + .then( ).statusCode( 201 ).extract( ).response( ); + assertNotNull( response ); + RepositoryGroup result = response.getBody( ).jsonPath( ).getObject( "", RepositoryGroup.class ); + assertNotNull( result ); + + response = given( ).spec( getRequestSpec( token ) ).contentType( JSON ) + .when( ) + .get( "" ) .then( ).statusCode( 200 ).extract( ).response( ); - assertNotNull( response ); + assertNotNull( response ); + PagedResult resultList = response.getBody( ).jsonPath( ).getObject( "", PagedResult.class ); + assertEquals( 1, resultList.getPagination( ).getTotalCount( ) ); + } finally + { + given( ).spec( getRequestSpec( token ) ).contentType( JSON ) + .when( ) + .delete( "group_001" ) + .then( ).statusCode( 200 ); + } + } + + @Test + void testAddExistingGroup( ) + { + String token = getAdminToken( ); + try + { + Map jsonAsMap = new HashMap<>( ); + jsonAsMap.put( "id", "group_001" ); + Response response = given( ).spec( getRequestSpec( token ) ).contentType( JSON ) + .when( ) + .body( jsonAsMap ) + .post( "" ) + .then( ).statusCode( 201 ).extract( ).response( ); + assertNotNull( response ); + response = given( ).spec( getRequestSpec( token ) ).contentType( JSON ) + .when( ) + .redirects().follow( false ) + .body( jsonAsMap ) + .post( "" ) + .prettyPeek() + .then( ).statusCode( 303 ) + .assertThat() + .header( "Location", endsWith("group_001") ).extract( ).response( ); + } finally + { + given( ).spec( getRequestSpec( token ) ).contentType( JSON ) + .when( ) + .delete( "group_001" ) + .then( ).statusCode( 200 ); + } } + @Test + void testAddMultipleGroups( ) + { + String token = getAdminToken( ); + List groups = new ArrayList<>( ); + try + { + for ( int i=0; i<10; i++) + { + String groupName = String.format( "group_%03d", i ); + groups.add( groupName ); + Map jsonAsMap = new HashMap<>( ); + jsonAsMap.put( "id", groupName ); + Response response = given( ).spec( getRequestSpec( token ) ).contentType( JSON ) + .when( ) + .body( jsonAsMap ) + .post( "" ) + .then( ).statusCode( 201 ).extract( ).response( ); + assertNotNull( response ); + RepositoryGroup result = response.getBody( ).jsonPath( ).getObject( "", RepositoryGroup.class ); + assertNotNull( result ); + } + Response response = given( ).spec( getRequestSpec( token ) ).contentType( JSON ) + .when( ) + .get( "" ) + .then( ).statusCode( 200 ).extract( ).response( ); + assertNotNull( response ); + PagedResult resultList = response.getBody( ).jsonPath( ).getObject( "", PagedResult.class ); + assertEquals( 10, resultList.getPagination( ).getTotalCount( ) ); + } finally + { + for (String groupName : groups) + { + given( ).spec( getRequestSpec( token ) ).contentType( JSON ) + .when( ) + .delete( groupName ) + .then( ).statusCode( 200 ); + } + } + } } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/v2/NativeRepositoryServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/v2/NativeRepositoryServiceTest.java index 4e9cdbeb0..1976fa1f0 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/v2/NativeRepositoryServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/v2/NativeRepositoryServiceTest.java @@ -69,7 +69,6 @@ public class NativeRepositoryServiceTest extends AbstractNativeRestServices Response response = given( ).spec( getRequestSpec( token ) ).contentType( JSON ) .when( ) .get( "" ) - .prettyPeek() .then( ).statusCode( 200 ).extract( ).response( ); assertNotNull( response ); PagedResult repositoryPagedResult = response.getBody( ).jsonPath( ).getObject( "", PagedResult.class ); @@ -102,7 +101,6 @@ public class NativeRepositoryServiceTest extends AbstractNativeRestServices .when( ) .queryParam( "q", "central" ) .get( "" ) - .prettyPeek() .then( ).statusCode( 200 ).extract( ).response( ); assertNotNull( response ); PagedResult repositoryPagedResult = response.getBody( ).jsonPath( ).getObject( "", PagedResult.class ); @@ -118,7 +116,6 @@ public class NativeRepositoryServiceTest extends AbstractNativeRestServices Response response = given( ).spec( getRequestSpec( token ) ).contentType( JSON ) .when( ) .get( "managed/internal/statistics" ) - .prettyPeek() .then( ).statusCode( 200 ).extract( ).response( ); assertNotNull( response ); @@ -130,7 +127,6 @@ public class NativeRepositoryServiceTest extends AbstractNativeRestServices Response response = given( ).spec( getRequestSpec( token ) ).contentType( JSON ) .when( ) .post( "managed/internal/scan/schedule" ) - .prettyPeek() .then( ).statusCode( 200 ).extract( ).response( ); assertNotNull( response ); @@ -142,7 +138,6 @@ public class NativeRepositoryServiceTest extends AbstractNativeRestServices Response response = given( ).spec( getRequestSpec( token ) ).contentType( JSON ) .when( ) .post( "managed/internal/scan/now" ) - .prettyPeek() .then( ).statusCode( 200 ).extract( ).response( ); assertNotNull( response ); @@ -154,7 +149,6 @@ public class NativeRepositoryServiceTest extends AbstractNativeRestServices Response response = given( ).spec( getRequestSpec( token ) ).contentType( JSON ) .when( ) .get( "managed/internal/scan/status" ) - .prettyPeek() .then( ).statusCode( 200 ).extract( ).response( ); assertNotNull( response ); -- 2.39.5