diff options
author | Martin Stockhammer <martin_s@apache.org> | 2020-06-30 21:20:29 +0200 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2020-06-30 21:20:29 +0200 |
commit | 509aad470c1ed42e108ea3294d1db71fdcee8aac (patch) | |
tree | 7b254587c150b834053f1c7a0dae61dda1ecc922 /archiva-modules | |
parent | bef02ef5b8d1f47f6cded2257ac49ae770e4f0fb (diff) | |
download | archiva-509aad470c1ed42e108ea3294d1db71fdcee8aac.tar.gz archiva-509aad470c1ed42e108ea3294d1db71fdcee8aac.zip |
Adapting to changes in parent pom and redback
Diffstat (limited to 'archiva-modules')
7 files changed, 33 insertions, 147 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml index 5a62d7ea6..cff05468d 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml @@ -31,8 +31,6 @@ <properties> <enunciate.docsDir>${project.build.outputDirectory}/rest-docs-archiva-rest-api</enunciate.docsDir> <site.staging.base>${project.parent.parent.parent.basedir}</site.staging.base> - <swagger-maven-plugin-version>2.1.2</swagger-maven-plugin-version> - <io.swagger.version>2.1.2</io.swagger.version> </properties> <dependencies> @@ -79,46 +77,6 @@ <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> </dependency> - <dependency> - <groupId>io.swagger.core.v3</groupId> - <artifactId>swagger-core</artifactId> - <scope>compile</scope> - <version>${io.swagger.version}</version> - <exclusions> - <exclusion> - <groupId>javax.ws.rs</groupId> - <artifactId>jsr311-api</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>io.swagger.core.v3</groupId> - <artifactId>swagger-jaxrs2</artifactId> - <version>${io.swagger.version}</version> - <exclusions> - <exclusion> - <groupId>javax.ws.rs</groupId> - <artifactId>jsr311-api</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>io.swagger.core.v3</groupId> - <artifactId>swagger-annotations</artifactId> - <version>${io.swagger.version}</version> - <exclusions> - <exclusion> - <groupId>javax.ws.rs</groupId> - <artifactId>jsr311-api</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>jakarta.xml.bind</groupId> - <artifactId>jakarta.xml.bind-api</artifactId> - </dependency> - - </dependencies> @@ -135,95 +93,6 @@ </excludes> </configuration> </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-source-plugin</artifactId> - <executions> - <execution> - <id>bind-sources</id> - <goals> - <goal>jar-no-fork</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>io.swagger.core.v3</groupId> - <artifactId>swagger-maven-plugin</artifactId> - <version>${swagger-maven-plugin-version}</version> - <configuration> - <outputFileName>openapi</outputFileName> - <outputPath>${project.build.directory}/generated</outputPath> - <outputFormat>JSONANDYAML</outputFormat> - <resourcePackages> - <package>org.apache.archiva.rest.api</package> - </resourcePackages> - <prettyPrint>TRUE</prettyPrint> - <configurationFilePath>${project.basedir}/src/main/resources/openapi-configuration.yaml</configurationFilePath> - </configuration> - <executions> - <execution> - <phase>compile</phase> - <goals> - <goal>resolve</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>io.swagger.codegen.v3</groupId> - <artifactId>swagger-codegen-maven-plugin</artifactId> - <version>3.0.20</version> - <executions> - <execution> - <phase>compile</phase> - <goals> - <goal>generate</goal> - </goals> - <configuration> - <inputSpec>${project.build.directory}/generated/openapi.yaml</inputSpec> - <language>html</language> - <output>${project.build.directory}/generated-sources</output> - <ignoreFileOverride>${project.basedir}/src/main/resources/openapi-codegen-ignore</ignoreFileOverride> - <templateDirectory>${project.basedir}/src/main/resources/templates</templateDirectory> - <supportingFilesToGenerate>index.html,index2.html</supportingFilesToGenerate> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <artifactId>maven-resources-plugin</artifactId> - <version>3.1.0</version> - <executions> - <execution> - <id>copy-resources</id> - <phase>site</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${basedir}/target/site/openapi/</outputDirectory> - <resources> - <resource> - <directory>${project.build.directory}/generated</directory> <!-- source directory --> - <filtering>false</filtering> - <include>openapi.json</include> - <include>openapi.yaml</include> - </resource> - <resource> - <directory>${project.build.directory}/generated-sources/</directory> - <filtering>false</filtering> - <include>**/*</include> - <exclude>.swagger-codegen/**</exclude> - <exclude>.swagger-codegen-ignore</exclude> - </resource> - </resources> - </configuration> - </execution> - </executions> - </plugin> </plugins> </build> diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ActionStatus.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ActionStatus.java index 5620f4f35..b4534b9a7 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ActionStatus.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ActionStatus.java @@ -18,7 +18,6 @@ package org.apache.archiva.rest.api.model; * under the License. */ -import javax.swing.*; import javax.xml.bind.annotation.XmlRootElement; /** @@ -32,6 +31,9 @@ public class ActionStatus public static final ActionStatus SUCCESS = new ActionStatus( true ); public static final ActionStatus FAIL = new ActionStatus( false ); + public static ActionStatus FROM(boolean status) { + return status ? SUCCESS : FAIL; + } public ActionStatus() { @@ -51,5 +53,9 @@ public class ActionStatus this.success = success; } - + @Override + public String toString( ) + { + return Boolean.toString( success ); + } } 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 d8fed9482..6e9f62600 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 @@ -439,6 +439,12 @@ <scope>provided</scope> </dependency> + <dependency> + <groupId>javax.validation</groupId> + <artifactId>validation-api</artifactId> + <scope>provided</scope> + </dependency> + <!-- Needed for JDK >= 9 --> <dependency> diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/interceptors/JacksonJsonConfigurator.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/interceptors/JacksonJsonConfigurator.java index 4137eb74f..aaca91779 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/interceptors/JacksonJsonConfigurator.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/interceptors/JacksonJsonConfigurator.java @@ -21,11 +21,13 @@ package org.apache.archiva.rest.services.interceptors; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.dataformat.xml.XmlMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import javax.inject.Inject; +import javax.inject.Named; /** * class to setup Jackson Json configuration @@ -39,9 +41,12 @@ public class JacksonJsonConfigurator private Logger log = LoggerFactory.getLogger( getClass() ); @Inject - public JacksonJsonConfigurator( ObjectMapper objectMapper ) + public JacksonJsonConfigurator( @Named( "redbackJacksonJsonMapper" ) ObjectMapper objectMapper, + @Named( "redbackJacksonXMLMapper" ) XmlMapper xmlMapper ) { + log.info( "configure jackson ObjectMapper" ); - objectMapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false ); + objectMapper.disable( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + xmlMapper.disable( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES ); } } 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 ede2fe6c0..a7ace5160 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 @@ -39,17 +39,23 @@ <context:component-scan base-package="org.apache.archiva.rest.services,org.apache.archiva.redback.rest.services"/> + <bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider"> + <property name="mapper" ref="redbackJacksonJsonMapper"/> + </bean> - <bean id="eventSender" class="org.apache.cxf.ext.logging.slf4j.Slf4jVerboseEventSender"> - <property name="loggingLevel" value="DEBUG" /> + <bean id="xmlProvider" class="com.fasterxml.jackson.jaxrs.xml.JacksonJaxbXMLProvider"> + <property name="mapper" ref="redbackJacksonXMLMapper"/> </bean> + <bean id="redbackJacksonJsonMapper" class="com.fasterxml.jackson.databind.ObjectMapper" /> + <bean id="redbackJacksonXMLMapper" class="com.fasterxml.jackson.dataformat.xml.XmlMapper" /> + <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="jsonProvider" /> + <ref bean="xmlProvider" /> <ref bean="authenticationInterceptor#rest"/> <ref bean="permissionInterceptor#rest"/> <ref bean="requestValidationInterceptor#rest" /> @@ -78,12 +84,6 @@ <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> diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java index acd74d0e3..436ea5d96 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java @@ -168,7 +168,7 @@ public class DownloadArtifactsTest RoleManagementService roleManagementService = getRoleManagementService( authorizationHeader ); if ( !roleManagementService.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, - "internal" ) ) + "internal" ).isExists() ) { roleManagementService.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, "internal" ); } diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadSnapshotTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadSnapshotTest.java index 05a29966c..07c2a7101 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadSnapshotTest.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadSnapshotTest.java @@ -131,7 +131,7 @@ public class DownloadSnapshotTest RoleManagementService roleManagementService = getRoleManagementService( authorizationHeader ); if ( !roleManagementService.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, - id ) ) + id ).isExists() ) { roleManagementService.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, id ); } |