From ff068497463318d18b001bf17f04271099cdd5d4 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Fri, 24 Dec 2021 16:29:21 +0100 Subject: [PATCH] Refactoring packages for mock classes --- .../src/test/conf/repository-manager.xml | 6 +++--- .../core/mock/repository}/RepositoryProviderMock.java | 5 ++--- .../test/resources/spring-context-purge-consumer-test.xml | 2 +- .../src/test/resources/spring-context.xml | 2 +- .../archiva/webdav/AbstractRepositoryServletTestCase.java | 2 +- .../apache/archiva/webdav/RepositoryServletDeployTest.java | 2 +- .../archiva/webdav/RepositoryServletSecurityTest.java | 2 +- .../webdav/{ => mock}/httpunit/MkColMethodWebRequest.java | 5 ++--- .../{ => webdav/mock}/metadata/audit/TestAuditListener.java | 6 +++--- .../cassandra/DefaultCassandraArchivaManager.java | 1 - .../cassandra/CassandraMetadataRepositoryTest.java | 5 ----- 11 files changed, 15 insertions(+), 23 deletions(-) rename archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/{repository/mock => consumers/core/mock/repository}/RepositoryProviderMock.java (99%) rename archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/{ => mock}/httpunit/MkColMethodWebRequest.java (91%) rename archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/{ => webdav/mock}/metadata/audit/TestAuditListener.java (88%) diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager.xml index 384891f04..8a42a291f 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager.xml @@ -24,7 +24,7 @@ internal Archiva Managed Internal Repository - file://${appserver.base}/repositories/internal + ${appserver.base}/repositories/internal ${appserver.base}/repositories/internal/.indexer default true @@ -35,7 +35,7 @@ snapshots Archiva Managed Snapshot Repository - file://${appserver.base}/repositories/snapshots + ${appserver.base}/repositories/snapshots .indexer default false @@ -46,7 +46,7 @@ test-repo Test Repository - file://${appserver.base}/test-repo + ${appserver.base}/test-repo default true true diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/mock/repository/RepositoryProviderMock.java similarity index 99% rename from archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java rename to archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/mock/repository/RepositoryProviderMock.java index 0c8f71f14..a74ae2461 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/mock/repository/RepositoryProviderMock.java @@ -1,4 +1,4 @@ -package org.apache.archiva.repository.mock; +package org.apache.archiva.consumers.core.mock.repository; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -9,8 +9,7 @@ package org.apache.archiva.repository.mock; * "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 - * + * 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 diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context-purge-consumer-test.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context-purge-consumer-test.xml index 2f1521abc..0657f9551 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context-purge-consumer-test.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context-purge-consumer-test.xml @@ -28,7 +28,7 @@ default-lazy-init="true"> - + diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context.xml index 1e1030ff0..a0014e153 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context.xml @@ -27,7 +27,7 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-lazy-init="true"> - + diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java index 73f181f39..22d7c58a5 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java @@ -35,7 +35,7 @@ import org.apache.archiva.repository.RepositoryException; import org.apache.archiva.repository.base.ArchivaRepositoryRegistry; import org.apache.archiva.repository.base.RepositoryHandlerDependencies; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; -import org.apache.archiva.webdav.httpunit.MkColMethodWebRequest; +import org.apache.archiva.webdav.mock.httpunit.MkColMethodWebRequest; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletDeployTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletDeployTest.java index 3b170401a..e29190aac 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletDeployTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletDeployTest.java @@ -22,7 +22,7 @@ package org.apache.archiva.webdav; import com.gargoylesoftware.htmlunit.WebRequest; import com.gargoylesoftware.htmlunit.WebResponse; import org.apache.archiva.configuration.ManagedRepositoryConfiguration; -import org.apache.archiva.webdav.httpunit.MkColMethodWebRequest; +import org.apache.archiva.webdav.mock.httpunit.MkColMethodWebRequest; import org.junit.After; import org.junit.Before; import org.junit.Test; diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java index 6713786ed..36e1f1dca 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java @@ -34,7 +34,7 @@ import org.apache.archiva.redback.system.SecuritySession; import org.apache.archiva.redback.users.User; import org.apache.archiva.redback.users.memory.SimpleUser; import org.apache.archiva.repository.RepositoryRegistry; -import org.apache.archiva.metadata.audit.TestAuditListener; +import org.apache.archiva.webdav.mock.metadata.audit.TestAuditListener; import org.apache.archiva.repository.base.group.RepositoryGroupHandler; import org.apache.archiva.security.ServletAuthenticator; import org.apache.archiva.security.common.ArchivaRoleConstants; diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/httpunit/MkColMethodWebRequest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/mock/httpunit/MkColMethodWebRequest.java similarity index 91% rename from archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/httpunit/MkColMethodWebRequest.java rename to archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/mock/httpunit/MkColMethodWebRequest.java index 7702a9ce1..1e091bfff 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/httpunit/MkColMethodWebRequest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/mock/httpunit/MkColMethodWebRequest.java @@ -1,4 +1,4 @@ -package org.apache.archiva.webdav.httpunit; +package org.apache.archiva.webdav.mock.httpunit; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -9,8 +9,7 @@ package org.apache.archiva.webdav.httpunit; * "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 - * + * 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 diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/audit/TestAuditListener.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/mock/metadata/audit/TestAuditListener.java similarity index 88% rename from archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/audit/TestAuditListener.java rename to archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/mock/metadata/audit/TestAuditListener.java index 7f4a9538d..f8d0af173 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/audit/TestAuditListener.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/mock/metadata/audit/TestAuditListener.java @@ -1,4 +1,4 @@ -package org.apache.archiva.metadata.audit; +package org.apache.archiva.webdav.mock.metadata.audit; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -9,8 +9,7 @@ package org.apache.archiva.metadata.audit; * "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 - * + * 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 @@ -19,6 +18,7 @@ package org.apache.archiva.metadata.audit; * under the License. */ +import org.apache.archiva.metadata.audit.AuditListener; import org.apache.archiva.metadata.model.facets.AuditEvent; import java.util.ArrayList; diff --git a/archiva-modules/metadata/metadata-store-provider/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraArchivaManager.java b/archiva-modules/metadata/metadata-store-provider/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraArchivaManager.java index 720f1a912..df53f600b 100644 --- a/archiva-modules/metadata/metadata-store-provider/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraArchivaManager.java +++ b/archiva-modules/metadata/metadata-store-provider/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraArchivaManager.java @@ -180,7 +180,6 @@ public class DefaultCassandraArchivaManager List hostNames = new ArrayList<>( ); hostNames.add( cassandraHost + ":" + cassandraPort ); - System.out.println( "Contact point: " + cassandraHost + ":" + cassandraPort ); configLoader = DriverConfigLoader.programmaticBuilder( ) diff --git a/archiva-modules/metadata/metadata-store-provider/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java b/archiva-modules/metadata/metadata-store-provider/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java index ccdb3039f..a6c4bf0fe 100644 --- a/archiva-modules/metadata/metadata-store-provider/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java +++ b/archiva-modules/metadata/metadata-store-provider/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java @@ -95,9 +95,7 @@ public class CassandraMetadataRepositoryTest throws Exception { cTime = System.currentTimeMillis( ); - System.err.println( "Setting up - "+(testNum++) + " - " + testInfo.getDisplayName() + " - 0ms"); super.setUp(); - System.err.println( "Setting up - " + testInfo.getDisplayName( ) + " - " + (System.currentTimeMillis( ) - cTime) +"ms"); assertMaxTries =1; assertRetrySleepMs=10; @@ -126,7 +124,6 @@ public class CassandraMetadataRepositoryTest { clearReposAndNamespace( cassandraArchivaManager, clearedTables ); } - System.err.println( "Finished setting up - "+testInfo.getDisplayName() + " - " + (System.currentTimeMillis( ) - cTime) +"ms"); } /** @@ -165,10 +162,8 @@ public class CassandraMetadataRepositoryTest public void shutdown(TestInfo testInfo) throws Exception { - System.err.println( "Shutting down - " + (testNum-1) + " - " + testInfo.getDisplayName( ) + " - " + ( System.currentTimeMillis( ) - cTime ) +"ms"); clearReposAndNamespace( cassandraArchivaManager, clearedTables ); super.tearDown(); - System.err.println( "Shutting down finished - " + testInfo.getDisplayName( ) + " - " + ( System.currentTimeMillis( ) - cTime ) +"ms"); } static void clearReposAndNamespace( final CassandraArchivaManager cassandraArchivaManager, final AtomicBoolean clearedFlag )