From: Martin Stockhammer Date: Fri, 13 Mar 2020 22:21:01 +0000 (+0100) Subject: Adding additional tests for new content API X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=49e9ba8d5f808abedd4913d8fec455ae7cfd53f7;p=archiva.git Adding additional tests for new content API --- diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContentTest.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContentTest.java index a0dbbd22f..4f1d936b2 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContentTest.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContentTest.java @@ -648,28 +648,28 @@ public class ManagedDefaultRepositoryContentTest @Test - public void testArtifactListWithProjectSelector1() { + public void testArtifactListWithProjectSelector() { ItemSelector selector = ArchivaItemSelector.builder( ) .withNamespace( "org.apache.maven.shared" ) .withProjectId( "maven-downloader" ) .build( ); List results = repoContent.getArtifacts( selector ); - checkArtifactListWithProjectSelector1( results ); + checkArtifactListWithProjectSelector( results ); } @Test - public void testArtifactStreamWithProjectSelector1() { + public void testArtifactStreamWithProjectSelector() { ItemSelector selector = ArchivaItemSelector.builder( ) .withNamespace( "org.apache.maven.shared" ) .withProjectId( "maven-downloader" ) .build( ); Stream results = repoContent.newArtifactStream( selector ); - checkArtifactListWithProjectSelector1( results.collect( Collectors.toList()) ); + checkArtifactListWithProjectSelector( results.collect( Collectors.toList()) ); } - private void checkArtifactListWithProjectSelector1( List results ) + private void checkArtifactListWithProjectSelector( List results ) { assertNotNull( results ); assertEquals( 27, results.size( ) ); @@ -696,4 +696,37 @@ public class ManagedDefaultRepositoryContentTest assertEquals( ".jar.sha1", artifact.getRemainder( ) ); } + @Test + public void testArtifactListWithNamespaceSelector() { + ItemSelector selector = ArchivaItemSelector.builder( ) + .withNamespace( "org.multilevel" ) + .build( ); + List results = repoContent.getArtifacts( selector ); + assertNotNull( results ); + assertEquals( 3, results.size( ) ); + assertTrue( results.get( 0 ).getFileName( ).startsWith( "testproj1" ) ); + } + + @Test + public void testArtifactListWithNamespaceSelectorRecursive() { + ItemSelector selector = ArchivaItemSelector.builder( ) + .withNamespace( "org.multilevel" ) + .recurse() + .build( ); + List results = repoContent.getArtifacts( selector ); + assertNotNull( results ); + assertEquals( 6, results.size( ) ); + + Artifact artifact = results.stream( ).filter( a -> a.getFileName( ).equalsIgnoreCase( "testproj2-1.0.pom" ) ) + .findFirst( ).get( ); + assertNotNull( artifact ); + assertEquals( 6, artifact.getAsset( ).getParent( ).getPath( ).split( "/" ).length ); + + artifact = results.stream( ).filter( a -> a.getFileName( ).equalsIgnoreCase( "testproj1-1.0.pom" ) ) + .findFirst( ).get( ); + assertNotNull( artifact ); + assertEquals( 5, artifact.getAsset( ).getParent( ).getPath( ).split( "/" ).length ); + + } + } diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/1.0/mulitlevel-1.0.pom b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/1.0/mulitlevel-1.0.pom deleted file mode 100644 index ecc1a93b7..000000000 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/1.0/mulitlevel-1.0.pom +++ /dev/null @@ -1,161 +0,0 @@ - - - 4.0.0 - - org - multilevel - Multilevel Test - 1.0 - pom - - - Company - http://www.company.com/ - - 2002 - - - api - common - broker - endpoint - - - - - junit - junit - 3.8.1 - test - - - - - - - javax.activation - activation - 1.0.2 - provided - - - javax.jms - jms - 1.0.2 - provided - - - javax.ejb - ejb - 2.0 - provided - - - javax.servlet - servlet-api - 2.4 - provided - - - javax.mail - mail - 1.4 - provided - - - xml-apis - xml-apis - 2.0.2 - provided - - - commons-logging - commons-logging - 1.0.4 - - - commons-lang - commons-lang - 2.1 - - - commons-collections - commons-collections - 3.2 - - - org.springframework - spring - 2.0.7 - - - org.springframework - spring-mock - 2.0.7 - test - - - org.springframework - spring-jdbc - - - org.springframework - spring-web - - - - - log4j - log4j - 1.2.8 - - - commons-discovery - commons-discovery - 0.2 - - - commons-id - commons-id - 0.1-dev - - - org.codehaus.castor - castor - 1.0.5-xml - - - xerces - xerces - 2.4.0 - - - commons-httpclient - commons-httpclient - 3.1 - - - stax - stax-api - 1.0.1 - - - org.codehaus.woodstox - wstx-asl - 3.2.1 - - - com.thoughtworks.xstream - xstream - 1.2.2 - - - javax.management - jmxri - 1.2.1 - provided - - - - - diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/1.0/mulitlevel-1.0.pom.md5 b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/1.0/mulitlevel-1.0.pom.md5 deleted file mode 100644 index 5a2e50713..000000000 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/1.0/mulitlevel-1.0.pom.md5 +++ /dev/null @@ -1 +0,0 @@ -f47d2f7fe7abf0939aca96197ca21a13 mulitlevel-1.0.pom diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/1.0/mulitlevel-1.0.pom.sha256 b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/1.0/mulitlevel-1.0.pom.sha256 deleted file mode 100644 index 902140c86..000000000 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/1.0/mulitlevel-1.0.pom.sha256 +++ /dev/null @@ -1 +0,0 @@ -de1d43c63ea17a7aad03c6edc8477a8e196ad406a6c7e18c23db057f9e030a13 mulitlevel-1.0.pom diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/test/1.0/test-1.0.pom b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/test/1.0/test-1.0.pom deleted file mode 100644 index 734987350..000000000 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/test/1.0/test-1.0.pom +++ /dev/null @@ -1,161 +0,0 @@ - - - 4.0.0 - - org.multilevel - test - Multilevel Test Sub 1 - 1.0 - pom - - - Company - http://www.company.com/ - - 2002 - - - api - common - broker - endpoint - - - - - junit - junit - 3.8.1 - test - - - - - - - javax.activation - activation - 1.0.2 - provided - - - javax.jms - jms - 1.0.2 - provided - - - javax.ejb - ejb - 2.0 - provided - - - javax.servlet - servlet-api - 2.4 - provided - - - javax.mail - mail - 1.4 - provided - - - xml-apis - xml-apis - 2.0.2 - provided - - - commons-logging - commons-logging - 1.0.4 - - - commons-lang - commons-lang - 2.1 - - - commons-collections - commons-collections - 3.2 - - - org.springframework - spring - 2.0.7 - - - org.springframework - spring-mock - 2.0.7 - test - - - org.springframework - spring-jdbc - - - org.springframework - spring-web - - - - - log4j - log4j - 1.2.8 - - - commons-discovery - commons-discovery - 0.2 - - - commons-id - commons-id - 0.1-dev - - - org.codehaus.castor - castor - 1.0.5-xml - - - xerces - xerces - 2.4.0 - - - commons-httpclient - commons-httpclient - 3.1 - - - stax - stax-api - 1.0.1 - - - org.codehaus.woodstox - wstx-asl - 3.2.1 - - - com.thoughtworks.xstream - xstream - 1.2.2 - - - javax.management - jmxri - 1.2.1 - provided - - - - - diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/test/1.0/test-1.0.pom.md5 b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/test/1.0/test-1.0.pom.md5 deleted file mode 100644 index 4af4123e9..000000000 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/test/1.0/test-1.0.pom.md5 +++ /dev/null @@ -1 +0,0 @@ -ef3e226769f6e4ef6ba17a39d1ae7832 test-1.0.pom diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/test/1.0/test-1.0.pom.sha256 b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/test/1.0/test-1.0.pom.sha256 deleted file mode 100644 index fef1c3f8a..000000000 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/test/1.0/test-1.0.pom.sha256 +++ /dev/null @@ -1 +0,0 @@ -340253fb0649f043044a96857c5a6ec4b74992e25d58071b46de1ef99f046cf0 test-1.0.pom diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/1.0/testproj1-1.0.pom b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/1.0/testproj1-1.0.pom new file mode 100644 index 000000000..bcfea0a04 --- /dev/null +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/1.0/testproj1-1.0.pom @@ -0,0 +1,161 @@ + + + 4.0.0 + + org.multilevel + testproj1 + Multilevel Test 1 + 1.0 + pom + + + Company + http://www.company.com/ + + 2002 + + + api + common + broker + endpoint + + + + + junit + junit + 3.8.1 + test + + + + + + + javax.activation + activation + 1.0.2 + provided + + + javax.jms + jms + 1.0.2 + provided + + + javax.ejb + ejb + 2.0 + provided + + + javax.servlet + servlet-api + 2.4 + provided + + + javax.mail + mail + 1.4 + provided + + + xml-apis + xml-apis + 2.0.2 + provided + + + commons-logging + commons-logging + 1.0.4 + + + commons-lang + commons-lang + 2.1 + + + commons-collections + commons-collections + 3.2 + + + org.springframework + spring + 2.0.7 + + + org.springframework + spring-mock + 2.0.7 + test + + + org.springframework + spring-jdbc + + + org.springframework + spring-web + + + + + log4j + log4j + 1.2.8 + + + commons-discovery + commons-discovery + 0.2 + + + commons-id + commons-id + 0.1-dev + + + org.codehaus.castor + castor + 1.0.5-xml + + + xerces + xerces + 2.4.0 + + + commons-httpclient + commons-httpclient + 3.1 + + + stax + stax-api + 1.0.1 + + + org.codehaus.woodstox + wstx-asl + 3.2.1 + + + com.thoughtworks.xstream + xstream + 1.2.2 + + + javax.management + jmxri + 1.2.1 + provided + + + + + diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/1.0/testproj1-1.0.pom.md5 b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/1.0/testproj1-1.0.pom.md5 new file mode 100644 index 000000000..5a2e50713 --- /dev/null +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/1.0/testproj1-1.0.pom.md5 @@ -0,0 +1 @@ +f47d2f7fe7abf0939aca96197ca21a13 mulitlevel-1.0.pom diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/1.0/testproj1-1.0.pom.sha256 b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/1.0/testproj1-1.0.pom.sha256 new file mode 100644 index 000000000..902140c86 --- /dev/null +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/1.0/testproj1-1.0.pom.sha256 @@ -0,0 +1 @@ +de1d43c63ea17a7aad03c6edc8477a8e196ad406a6c7e18c23db057f9e030a13 mulitlevel-1.0.pom diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/testproj2/1.0/testproj2-1.0.pom b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/testproj2/1.0/testproj2-1.0.pom new file mode 100644 index 000000000..9605c2bd1 --- /dev/null +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/testproj2/1.0/testproj2-1.0.pom @@ -0,0 +1,161 @@ + + + 4.0.0 + + org.multilevel.testproj1 + testproj2 + Multilevel Test Sub 2 + 1.0 + pom + + + Company + http://www.company.com/ + + 2002 + + + api + common + broker + endpoint + + + + + junit + junit + 3.8.1 + test + + + + + + + javax.activation + activation + 1.0.2 + provided + + + javax.jms + jms + 1.0.2 + provided + + + javax.ejb + ejb + 2.0 + provided + + + javax.servlet + servlet-api + 2.4 + provided + + + javax.mail + mail + 1.4 + provided + + + xml-apis + xml-apis + 2.0.2 + provided + + + commons-logging + commons-logging + 1.0.4 + + + commons-lang + commons-lang + 2.1 + + + commons-collections + commons-collections + 3.2 + + + org.springframework + spring + 2.0.7 + + + org.springframework + spring-mock + 2.0.7 + test + + + org.springframework + spring-jdbc + + + org.springframework + spring-web + + + + + log4j + log4j + 1.2.8 + + + commons-discovery + commons-discovery + 0.2 + + + commons-id + commons-id + 0.1-dev + + + org.codehaus.castor + castor + 1.0.5-xml + + + xerces + xerces + 2.4.0 + + + commons-httpclient + commons-httpclient + 3.1 + + + stax + stax-api + 1.0.1 + + + org.codehaus.woodstox + wstx-asl + 3.2.1 + + + com.thoughtworks.xstream + xstream + 1.2.2 + + + javax.management + jmxri + 1.2.1 + provided + + + + + diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/testproj2/1.0/testproj2-1.0.pom.md5 b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/testproj2/1.0/testproj2-1.0.pom.md5 new file mode 100644 index 000000000..4af4123e9 --- /dev/null +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/testproj2/1.0/testproj2-1.0.pom.md5 @@ -0,0 +1 @@ +ef3e226769f6e4ef6ba17a39d1ae7832 test-1.0.pom diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/testproj2/1.0/testproj2-1.0.pom.sha256 b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/testproj2/1.0/testproj2-1.0.pom.sha256 new file mode 100644 index 000000000..fef1c3f8a --- /dev/null +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/resources/repositories/default-repository/org/multilevel/testproj1/testproj2/1.0/testproj2-1.0.pom.sha256 @@ -0,0 +1 @@ +340253fb0649f043044a96857c5a6ec4b74992e25d58071b46de1ef99f046cf0 test-1.0.pom