This is an automated email from the ASF dual-hosted git repository.
martin_s pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/archiva.git
The following commit(s) were added to refs/heads/master by this push:
new c33869d Cleanup of dependencies for maven-model
c33869d is described below
commit c33869db14f79d582dd66d02dece2d0ca1366288
Author: Martin Stockhammer <[email protected]>
AuthorDate: Tue Feb 4 21:31:49 2020 +0100
Cleanup of dependencies for maven-model
---
.../archiva-maven/archiva-maven-common/pom.xml | 17 +++++
.../archiva-maven/archiva-maven-model/pom.xml | 20 ++++++
.../org/apache/archiva/maven2/model/TreeEntry.java | 7 +--
.../org/apache/archiva/maven2/model/ModelTest.java | 72 ++++++++++++++++++++++
.../archiva-rest/archiva-rest-api/pom.xml | 5 ++
status-dep.txt | 4 ++
6 files changed, 120 insertions(+), 5 deletions(-)
diff --git a/archiva-modules/archiva-maven/archiva-maven-common/pom.xml
b/archiva-modules/archiva-maven/archiva-maven-common/pom.xml
index d5153f8..90fdcfa 100644
--- a/archiva-modules/archiva-maven/archiva-maven-common/pom.xml
+++ b/archiva-modules/archiva-maven/archiva-maven-common/pom.xml
@@ -40,11 +40,28 @@
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-provider-api</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ </dependency>
+
+ <!--
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-file</artifactId>
<scope>test</scope>
</dependency>
+ -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
diff --git a/archiva-modules/archiva-maven/archiva-maven-model/pom.xml
b/archiva-modules/archiva-maven/archiva-maven-model/pom.xml
index 2e8d16e..882edce 100644
--- a/archiva-modules/archiva-maven/archiva-maven-model/pom.xml
+++ b/archiva-modules/archiva-maven/archiva-maven-model/pom.xml
@@ -34,10 +34,30 @@
</properties>
<dependencies>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>${jackson.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.module</groupId>
+ <artifactId>jackson-module-jaxb-annotations</artifactId>
+ <version>${jackson.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <version>20190722</version>
+ </dependency>
+ <!--
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
+ -->
</dependencies>
</project>
diff --git
a/archiva-modules/archiva-maven/archiva-maven-model/src/main/java/org/apache/archiva/maven2/model/TreeEntry.java
b/archiva-modules/archiva-maven/archiva-maven-model/src/main/java/org/apache/archiva/maven2/model/TreeEntry.java
index 7a0db88..23a3acf 100644
---
a/archiva-modules/archiva-maven/archiva-maven-model/src/main/java/org/apache/archiva/maven2/model/TreeEntry.java
+++
b/archiva-modules/archiva-maven/archiva-maven-model/src/main/java/org/apache/archiva/maven2/model/TreeEntry.java
@@ -19,9 +19,8 @@ package org.apache.archiva.maven2.model;
*/
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@@ -38,7 +37,6 @@ public class TreeEntry
private Artifact artifact;
- @JsonIgnore
private TreeEntry parent;
public TreeEntry()
@@ -72,13 +70,12 @@ public class TreeEntry
this.childs = childs;
}
- @JsonIgnore
+ @XmlTransient
public TreeEntry getParent()
{
return parent;
}
- @JsonIgnore
public void setParent( TreeEntry parent )
{
this.parent = parent;
diff --git
a/archiva-modules/archiva-maven/archiva-maven-model/src/test/java/org/apache/archiva/maven2/model/ModelTest.java
b/archiva-modules/archiva-maven/archiva-maven-model/src/test/java/org/apache/archiva/maven2/model/ModelTest.java
new file mode 100644
index 0000000..75c4cc2
--- /dev/null
+++
b/archiva-modules/archiva-maven/archiva-maven-model/src/test/java/org/apache/archiva/maven2/model/ModelTest.java
@@ -0,0 +1,72 @@
+package org.apache.archiva.maven2.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
+import org.json.JSONObject;
+import org.junit.jupiter.api.Test;
+
+import javax.xml.bind.JAXBException;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Arrays;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+
+public class ModelTest
+{
+ @Test
+ void testTreeEntry() throws JAXBException, IOException
+ {
+ TreeEntry parent = new TreeEntry( );
+ TreeEntry entry = new TreeEntry( );
+ entry.setParent( parent );
+ Artifact artifact1 = new Artifact( );
+ artifact1.setGroupId( "test.group" );
+ artifact1.setArtifactId( "artifact1" );
+ artifact1.setVersion( "1.0" );
+ entry.setArtifact( artifact1 );
+
+ TreeEntry child1 = new TreeEntry( );
+ TreeEntry child2 = new TreeEntry( );
+ child1.setParent( entry );
+ child2.setParent( entry );
+ Artifact artifact2 = new Artifact( );
+ artifact2.setGroupId( "test.group" );
+ artifact2.setArtifactId( "artifact1" );
+ artifact2.setVersion( "1.1" );
+ child1.setArtifact( artifact2 );
+ child2.setArtifact( artifact2 );
+ entry.setChilds( Arrays.asList( child1, child2) );
+
+ ObjectMapper objectMapper = new ObjectMapper( );
+ objectMapper.registerModule( new JaxbAnnotationModule( ) );
+ StringWriter sw = new StringWriter( );
+ objectMapper.writeValue( sw, entry );
+
+ JSONObject js = new JSONObject( sw.toString() );
+ assertFalse( js.has( "parent" ) );
+ assertTrue( js.has( "childs" ) );
+ assertEquals(2, js.getJSONArray( "childs" ).length());
+ assertTrue( js.has( "artifact" ) );
+
+ }
+}
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 0592cc5..e50ff83 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
@@ -95,6 +95,11 @@
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ </dependency>
+
</dependencies>
<build>
diff --git a/status-dep.txt b/status-dep.txt
index 572cae9..6b4ad53 100644
--- a/status-dep.txt
+++ b/status-dep.txt
@@ -34,6 +34,10 @@ archiva-modules
archiva-scheduler-repository-api
archiva-scheduler-repository
archiva-scheduler-indexer
+ metadata
+ metadata-statistics-api
+ metadata-repository-api
+ metadata-model