]> source.dussan.org Git - archiva.git/commitdiff
Refactoring packages for mock classes
authorMartin Stockhammer <martin_s@apache.org>
Fri, 24 Dec 2021 15:29:21 +0000 (16:29 +0100)
committerMartin Stockhammer <martin_s@apache.org>
Fri, 24 Dec 2021 15:29:21 +0000 (16:29 +0100)
14 files changed:
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager.xml
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/mock/repository/RepositoryProviderMock.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java [deleted file]
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context-purge-consumer-test.xml
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context.xml
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/audit/TestAuditListener.java [deleted file]
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletDeployTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/httpunit/MkColMethodWebRequest.java [deleted file]
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/mock/httpunit/MkColMethodWebRequest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/mock/metadata/audit/TestAuditListener.java [new file with mode: 0644]
archiva-modules/metadata/metadata-store-provider/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraArchivaManager.java
archiva-modules/metadata/metadata-store-provider/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java

index 384891f0424858938373d9b561244443fbead414..8a42a291faecbc54b73ab7ec00972320003f5cee 100644 (file)
@@ -24,7 +24,7 @@
     <managedRepository>
       <id>internal</id>
       <name>Archiva Managed Internal Repository</name>
-      <location>file://${appserver.base}/repositories/internal</location>
+      <location>${appserver.base}/repositories/internal</location>
       <indexDir>${appserver.base}/repositories/internal/.indexer</indexDir>
       <layout>default</layout>
       <releases>true</releases>
@@ -35,7 +35,7 @@
     <managedRepository>
       <id>snapshots</id>
       <name>Archiva Managed Snapshot Repository</name>
-      <location>file://${appserver.base}/repositories/snapshots</location>
+      <location>${appserver.base}/repositories/snapshots</location>
       <indexDir>.indexer</indexDir>
       <layout>default</layout>
       <releases>false</releases>
@@ -46,7 +46,7 @@
     <managedRepository>
       <id>test-repo</id>
       <name>Test Repository</name>
-      <location>file://${appserver.base}/test-repo</location>
+      <location>${appserver.base}/test-repo</location>
       <layout>default</layout>
       <releases>true</releases>
       <snapshots>true</snapshots>
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/mock/repository/RepositoryProviderMock.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/mock/repository/RepositoryProviderMock.java
new file mode 100644 (file)
index 0000000..a74ae24
--- /dev/null
@@ -0,0 +1,297 @@
+package org.apache.archiva.consumers.core.mock.repository;
+
+/*
+ * 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 org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.RepositoryGroupConfiguration;
+import org.apache.archiva.event.EventHandler;
+import org.apache.archiva.repository.base.managed.BasicManagedRepository;
+import org.apache.archiva.repository.base.remote.BasicRemoteRepository;
+import org.apache.archiva.repository.EditableManagedRepository;
+import org.apache.archiva.repository.EditableRemoteRepository;
+import org.apache.archiva.repository.EditableRepositoryGroup;
+import org.apache.archiva.repository.ManagedRepository;
+import org.apache.archiva.repository.base.PasswordCredentials;
+import org.apache.archiva.repository.ReleaseScheme;
+import org.apache.archiva.repository.RemoteRepository;
+import org.apache.archiva.repository.RepositoryCredentials;
+import org.apache.archiva.event.Event;
+import org.apache.archiva.repository.RepositoryException;
+import org.apache.archiva.repository.RepositoryGroup;
+import org.apache.archiva.repository.RepositoryProvider;
+import org.apache.archiva.repository.RepositoryType;
+import org.apache.archiva.repository.event.RepositoryEvent;
+import org.apache.archiva.repository.features.ArtifactCleanupFeature;
+import org.apache.archiva.repository.features.IndexCreationFeature;
+import org.apache.archiva.repository.features.RemoteIndexFeature;
+import org.apache.archiva.repository.features.StagingRepositoryFeature;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.net.URI;
+import java.nio.file.Paths;
+import java.time.Duration;
+import java.time.Period;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Just a simple mock class for the repository provider
+ */
+@Service("mockRepositoryProvider")
+public class RepositoryProviderMock implements RepositoryProvider
+{
+
+    private static final Set<RepositoryType> TYPES = new HashSet<>( );
+
+    static
+    {
+        TYPES.add( RepositoryType.MAVEN );
+        TYPES.add( RepositoryType.NPM );
+    }
+
+    @Override
+    public Set<RepositoryType> provides( )
+    {
+        return TYPES;
+    }
+
+    @Override
+    public EditableManagedRepository createManagedInstance( String id, String name )
+    {
+        try {
+            return BasicManagedRepository.newFilesystemInstance( id, name, Paths.get("target/repositories").resolve(id) );
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Override
+    public EditableRemoteRepository createRemoteInstance( String id, String name )
+    {
+        try {
+            return BasicRemoteRepository.newFilesystemInstance( id, name, Paths.get("target/remotes") );
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Override
+    public EditableRepositoryGroup createRepositoryGroup( String id, String name )
+    {
+
+        return null;
+    }
+
+    @Override
+    public ManagedRepository createManagedInstance( ManagedRepositoryConfiguration configuration ) throws RepositoryException
+    {
+        BasicManagedRepository managedRepository = null;
+        try {
+            managedRepository = BasicManagedRepository.newFilesystemInstance( configuration.getId( ), configuration.getName( ), Paths.get("target/repositories").resolve(configuration.getId()) );
+        } catch (IOException e) {
+            throw new RepositoryException(e);
+        }
+        updateManagedInstance( managedRepository, configuration );
+        return managedRepository;
+    }
+
+
+    @Override
+    public void updateManagedInstance( EditableManagedRepository managedRepository, ManagedRepositoryConfiguration configuration ) throws RepositoryException
+    {
+        try
+        {
+            managedRepository.setName( managedRepository.getPrimaryLocale(), configuration.getName( ) );
+            managedRepository.setLocation( new URI( configuration.getLocation( )==null ?"" : configuration.getLocation() ) );
+            managedRepository.setBaseUri( new URI( "" ) );
+            managedRepository.setBlocksRedeployment( configuration.isBlockRedeployments( ) );
+            managedRepository.setDescription( managedRepository.getPrimaryLocale(), configuration.getDescription( ) );
+            managedRepository.setLayout( configuration.getLayout( ) );
+            managedRepository.setScanned( configuration.isScanned( ) );
+            managedRepository.setSchedulingDefinition( configuration.getRefreshCronExpression( ) );
+            if (configuration.isReleases()) {
+                managedRepository.addActiveReleaseScheme( ReleaseScheme.RELEASE );
+            }
+            if (configuration.isSnapshots()) {
+                managedRepository.addActiveReleaseScheme( ReleaseScheme.SNAPSHOT );
+            }
+            ArtifactCleanupFeature acf = managedRepository.getFeature( ArtifactCleanupFeature.class ).get( );
+            acf.setRetentionPeriod( Period.ofDays( configuration.getRetentionPeriod( ) ) );
+            acf.setDeleteReleasedSnapshots( configuration.isDeleteReleasedSnapshots( ) );
+            acf.setRetentionCount( configuration.getRetentionCount( ) );
+            IndexCreationFeature icf = managedRepository.getFeature( IndexCreationFeature.class ).get( );
+            icf.setIndexPath( new URI( configuration.getIndexDir( ) ) );
+            icf.setSkipPackedIndexCreation( configuration.isSkipPackedIndexCreation( ) );
+            StagingRepositoryFeature srf = managedRepository.getFeature( StagingRepositoryFeature.class ).get( );
+            srf.setStageRepoNeeded( configuration.isStageRepoNeeded( ) );
+        }
+        catch ( Exception e )
+        {
+            throw new RepositoryException( "Error", e );
+        }
+
+    }
+
+
+    @Override
+    public ManagedRepository createStagingInstance( ManagedRepositoryConfiguration configuration ) throws RepositoryException
+    {
+        String id = configuration.getId( ) + StagingRepositoryFeature.STAGING_REPO_POSTFIX;
+        BasicManagedRepository managedRepository = null;
+        try {
+            managedRepository = BasicManagedRepository.newFilesystemInstance(id, configuration.getName(), Paths.get("target/repositories").resolve(id));
+        } catch (IOException e) {
+            throw new RepositoryException(e);
+        }
+        updateManagedInstance( managedRepository, configuration );
+        return managedRepository;
+    }
+
+    @Override
+    public RemoteRepository createRemoteInstance( RemoteRepositoryConfiguration configuration ) throws RepositoryException
+    {
+        BasicRemoteRepository remoteRepository = null;
+        try {
+            remoteRepository = BasicRemoteRepository.newFilesystemInstance( configuration.getId( ), configuration.getName( ), Paths.get("target/remotes") );
+        } catch (IOException e) {
+            throw new RepositoryException(e);
+        }
+        updateRemoteInstance( remoteRepository, configuration );
+        return remoteRepository;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public void updateRemoteInstance( EditableRemoteRepository remoteRepository, RemoteRepositoryConfiguration configuration ) throws RepositoryException
+    {
+        try
+        {
+            remoteRepository.setName( remoteRepository.getPrimaryLocale(), configuration.getName( ) );
+            remoteRepository.setBaseUri( new URI( "" ) );
+            remoteRepository.setDescription( remoteRepository.getPrimaryLocale(), configuration.getDescription( ) );
+            remoteRepository.setLayout( configuration.getLayout( ) );
+            remoteRepository.setSchedulingDefinition( configuration.getRefreshCronExpression( ) );
+            remoteRepository.setCheckPath( configuration.getCheckPath( ) );
+            remoteRepository.setExtraHeaders( configuration.getExtraHeaders( ) );
+            remoteRepository.setExtraParameters( configuration.getExtraParameters( ) );
+            remoteRepository.setTimeout( Duration.ofSeconds( configuration.getTimeout( ) ) );
+            char[] pwd = configuration.getPassword()==null ? "".toCharArray() : configuration.getPassword().toCharArray();
+            remoteRepository.setCredentials( new PasswordCredentials( configuration.getUsername( ), pwd ) );
+            remoteRepository.setLocation( new URI( configuration.getUrl( )==null ? "" : configuration.getUrl() ) );
+            RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( );
+            rif.setDownloadRemoteIndexOnStartup( configuration.isDownloadRemoteIndexOnStartup( ) );
+            rif.setDownloadRemoteIndex( configuration.isDownloadRemoteIndex( ) );
+            rif.setIndexUri( new URI( configuration.getIndexDir( ) ) );
+            rif.setDownloadTimeout( Duration.ofSeconds( configuration.getRemoteDownloadTimeout( ) ) );
+            rif.setProxyId( configuration.getRemoteDownloadNetworkProxyId( ) );
+        }
+        catch ( Exception e )
+        {
+            throw new RepositoryException( "Error", e );
+        }
+
+    }
+
+    @Override
+    public RepositoryGroup createRepositoryGroup( RepositoryGroupConfiguration configuration ) throws RepositoryException
+    {
+        return null;
+    }
+
+    @Override
+    public void updateRepositoryGroupInstance( EditableRepositoryGroup repositoryGroup, RepositoryGroupConfiguration configuration ) throws RepositoryException
+    {
+
+    }
+
+    @Override
+    public ManagedRepositoryConfiguration getManagedConfiguration( ManagedRepository managedRepository )
+    {
+        ManagedRepositoryConfiguration configuration = new ManagedRepositoryConfiguration( );
+        configuration.setId( managedRepository.getId( ) );
+        configuration.setName(managedRepository.getName());
+        configuration.setLocation( managedRepository.getLocation( ) == null ? "" : managedRepository.getLocation().toString( ) );
+        configuration.setBlockRedeployments( managedRepository.blocksRedeployments( ) );
+        configuration.setDescription( managedRepository.getDescription( ) );
+        configuration.setScanned( managedRepository.isScanned( ) );
+        configuration.setRefreshCronExpression( managedRepository.getSchedulingDefinition( ) );
+        configuration.setReleases( managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.RELEASE) );
+        configuration.setSnapshots( managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.SNAPSHOT) );
+        configuration.setLayout( managedRepository.getLayout() );
+        ArtifactCleanupFeature acf = managedRepository.getFeature( ArtifactCleanupFeature.class ).get( );
+        configuration.setRetentionPeriod( acf.getRetentionPeriod( ).getDays( ) );
+        configuration.setDeleteReleasedSnapshots( acf.isDeleteReleasedSnapshots( ) );
+        configuration.setRetentionCount( acf.getRetentionCount( ) );
+        IndexCreationFeature icf = managedRepository.getFeature( IndexCreationFeature.class ).get( );
+        configuration.setSkipPackedIndexCreation( icf.isSkipPackedIndexCreation( ) );
+        configuration.setIndexDir( icf.getIndexPath( ) == null ? "" : icf.getIndexPath().toString( ) );
+        StagingRepositoryFeature srf = managedRepository.getFeature( StagingRepositoryFeature.class ).get( );
+        configuration.setStageRepoNeeded( srf.isStageRepoNeeded( ) );
+        return configuration;
+    }
+
+    @Override
+    public RepositoryGroupConfiguration getRepositoryGroupConfiguration( RepositoryGroup repositoryGroup ) throws RepositoryException
+    {
+        return null;
+    }
+
+    @Override
+    public void addRepositoryEventHandler( EventHandler<? super RepositoryEvent> eventHandler )
+    {
+        // do nothing
+    }
+
+
+    @Override
+    public RemoteRepositoryConfiguration getRemoteConfiguration( RemoteRepository remoteRepository )
+    {
+        RemoteRepositoryConfiguration configuration = new RemoteRepositoryConfiguration( );
+        configuration.setId( remoteRepository.getId( ) );
+        configuration.setName( remoteRepository.getName( ) );
+        configuration.setDescription( remoteRepository.getDescription( ) );
+        configuration.setLayout( remoteRepository.getLayout( ) );
+        configuration.setRefreshCronExpression( remoteRepository.getSchedulingDefinition( ) );
+        configuration.setCheckPath( remoteRepository.getCheckPath( ) );
+        configuration.setExtraHeaders( remoteRepository.getExtraHeaders( ) );
+        configuration.setExtraParameters( remoteRepository.getExtraParameters( ) );
+        configuration.setTimeout( (int) remoteRepository.getTimeout( ).getSeconds( ) );
+        RepositoryCredentials creds = remoteRepository.getLoginCredentials( );
+        if (creds!=null)
+        {
+            PasswordCredentials pwdCreds = (PasswordCredentials) creds;
+            configuration.setUsername( pwdCreds.getUsername( ) );
+            configuration.setPassword( new String( pwdCreds.getPassword( ) ) );
+        }
+        configuration.setUrl( remoteRepository.getLocation( ) == null ? "" : remoteRepository.getLocation().toString( ) );
+        RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( );
+        configuration.setDownloadRemoteIndex( rif.isDownloadRemoteIndex( ) );
+        configuration.setDownloadRemoteIndexOnStartup( rif.isDownloadRemoteIndexOnStartup( ) );
+        configuration.setIndexDir( rif.getIndexUri( )==null ? "" : rif.getIndexUri().toString( ) );
+        configuration.setRemoteDownloadNetworkProxyId( rif.getProxyId( ) );
+        return configuration;
+    }
+
+    @Override
+    public void handle(Event event) {
+
+    }
+}
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/repository/mock/RepositoryProviderMock.java
deleted file mode 100644 (file)
index 0c8f71f..0000000
+++ /dev/null
@@ -1,298 +0,0 @@
-package org.apache.archiva.repository.mock;
-
-/*
- * 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 org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.configuration.RepositoryGroupConfiguration;
-import org.apache.archiva.event.EventHandler;
-import org.apache.archiva.repository.base.managed.BasicManagedRepository;
-import org.apache.archiva.repository.base.remote.BasicRemoteRepository;
-import org.apache.archiva.repository.EditableManagedRepository;
-import org.apache.archiva.repository.EditableRemoteRepository;
-import org.apache.archiva.repository.EditableRepositoryGroup;
-import org.apache.archiva.repository.ManagedRepository;
-import org.apache.archiva.repository.base.PasswordCredentials;
-import org.apache.archiva.repository.ReleaseScheme;
-import org.apache.archiva.repository.RemoteRepository;
-import org.apache.archiva.repository.RepositoryCredentials;
-import org.apache.archiva.event.Event;
-import org.apache.archiva.repository.RepositoryException;
-import org.apache.archiva.repository.RepositoryGroup;
-import org.apache.archiva.repository.RepositoryProvider;
-import org.apache.archiva.repository.RepositoryType;
-import org.apache.archiva.repository.event.RepositoryEvent;
-import org.apache.archiva.repository.features.ArtifactCleanupFeature;
-import org.apache.archiva.repository.features.IndexCreationFeature;
-import org.apache.archiva.repository.features.RemoteIndexFeature;
-import org.apache.archiva.repository.features.StagingRepositoryFeature;
-import org.springframework.stereotype.Service;
-
-import java.io.IOException;
-import java.net.URI;
-import java.nio.file.Paths;
-import java.time.Duration;
-import java.time.Period;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Just a simple mock class for the repository provider
- */
-@Service("mockRepositoryProvider")
-public class RepositoryProviderMock implements RepositoryProvider
-{
-
-    private static final Set<RepositoryType> TYPES = new HashSet<>( );
-
-    static
-    {
-        TYPES.add( RepositoryType.MAVEN );
-        TYPES.add( RepositoryType.NPM );
-    }
-
-    @Override
-    public Set<RepositoryType> provides( )
-    {
-        return TYPES;
-    }
-
-    @Override
-    public EditableManagedRepository createManagedInstance( String id, String name )
-    {
-        try {
-            return BasicManagedRepository.newFilesystemInstance( id, name, Paths.get("target/repositories").resolve(id) );
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    @Override
-    public EditableRemoteRepository createRemoteInstance( String id, String name )
-    {
-        try {
-            return BasicRemoteRepository.newFilesystemInstance( id, name, Paths.get("target/remotes") );
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    @Override
-    public EditableRepositoryGroup createRepositoryGroup( String id, String name )
-    {
-
-        return null;
-    }
-
-    @Override
-    public ManagedRepository createManagedInstance( ManagedRepositoryConfiguration configuration ) throws RepositoryException
-    {
-        BasicManagedRepository managedRepository = null;
-        try {
-            managedRepository = BasicManagedRepository.newFilesystemInstance( configuration.getId( ), configuration.getName( ), Paths.get("target/repositories").resolve(configuration.getId()) );
-        } catch (IOException e) {
-            throw new RepositoryException(e);
-        }
-        updateManagedInstance( managedRepository, configuration );
-        return managedRepository;
-    }
-
-
-    @Override
-    public void updateManagedInstance( EditableManagedRepository managedRepository, ManagedRepositoryConfiguration configuration ) throws RepositoryException
-    {
-        try
-        {
-            managedRepository.setName( managedRepository.getPrimaryLocale(), configuration.getName( ) );
-            managedRepository.setLocation( new URI( configuration.getLocation( )==null ?"" : configuration.getLocation() ) );
-            managedRepository.setBaseUri( new URI( "" ) );
-            managedRepository.setBlocksRedeployment( configuration.isBlockRedeployments( ) );
-            managedRepository.setDescription( managedRepository.getPrimaryLocale(), configuration.getDescription( ) );
-            managedRepository.setLayout( configuration.getLayout( ) );
-            managedRepository.setScanned( configuration.isScanned( ) );
-            managedRepository.setSchedulingDefinition( configuration.getRefreshCronExpression( ) );
-            if (configuration.isReleases()) {
-                managedRepository.addActiveReleaseScheme( ReleaseScheme.RELEASE );
-            }
-            if (configuration.isSnapshots()) {
-                managedRepository.addActiveReleaseScheme( ReleaseScheme.SNAPSHOT );
-            }
-            ArtifactCleanupFeature acf = managedRepository.getFeature( ArtifactCleanupFeature.class ).get( );
-            acf.setRetentionPeriod( Period.ofDays( configuration.getRetentionPeriod( ) ) );
-            acf.setDeleteReleasedSnapshots( configuration.isDeleteReleasedSnapshots( ) );
-            acf.setRetentionCount( configuration.getRetentionCount( ) );
-            IndexCreationFeature icf = managedRepository.getFeature( IndexCreationFeature.class ).get( );
-            icf.setIndexPath( new URI( configuration.getIndexDir( ) ) );
-            icf.setSkipPackedIndexCreation( configuration.isSkipPackedIndexCreation( ) );
-            StagingRepositoryFeature srf = managedRepository.getFeature( StagingRepositoryFeature.class ).get( );
-            srf.setStageRepoNeeded( configuration.isStageRepoNeeded( ) );
-        }
-        catch ( Exception e )
-        {
-            throw new RepositoryException( "Error", e );
-        }
-
-    }
-
-
-    @Override
-    public ManagedRepository createStagingInstance( ManagedRepositoryConfiguration configuration ) throws RepositoryException
-    {
-        String id = configuration.getId( ) + StagingRepositoryFeature.STAGING_REPO_POSTFIX;
-        BasicManagedRepository managedRepository = null;
-        try {
-            managedRepository = BasicManagedRepository.newFilesystemInstance(id, configuration.getName(), Paths.get("target/repositories").resolve(id));
-        } catch (IOException e) {
-            throw new RepositoryException(e);
-        }
-        updateManagedInstance( managedRepository, configuration );
-        return managedRepository;
-    }
-
-    @Override
-    public RemoteRepository createRemoteInstance( RemoteRepositoryConfiguration configuration ) throws RepositoryException
-    {
-        BasicRemoteRepository remoteRepository = null;
-        try {
-            remoteRepository = BasicRemoteRepository.newFilesystemInstance( configuration.getId( ), configuration.getName( ), Paths.get("target/remotes") );
-        } catch (IOException e) {
-            throw new RepositoryException(e);
-        }
-        updateRemoteInstance( remoteRepository, configuration );
-        return remoteRepository;
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public void updateRemoteInstance( EditableRemoteRepository remoteRepository, RemoteRepositoryConfiguration configuration ) throws RepositoryException
-    {
-        try
-        {
-            remoteRepository.setName( remoteRepository.getPrimaryLocale(), configuration.getName( ) );
-            remoteRepository.setBaseUri( new URI( "" ) );
-            remoteRepository.setDescription( remoteRepository.getPrimaryLocale(), configuration.getDescription( ) );
-            remoteRepository.setLayout( configuration.getLayout( ) );
-            remoteRepository.setSchedulingDefinition( configuration.getRefreshCronExpression( ) );
-            remoteRepository.setCheckPath( configuration.getCheckPath( ) );
-            remoteRepository.setExtraHeaders( configuration.getExtraHeaders( ) );
-            remoteRepository.setExtraParameters( configuration.getExtraParameters( ) );
-            remoteRepository.setTimeout( Duration.ofSeconds( configuration.getTimeout( ) ) );
-            char[] pwd = configuration.getPassword()==null ? "".toCharArray() : configuration.getPassword().toCharArray();
-            remoteRepository.setCredentials( new PasswordCredentials( configuration.getUsername( ), pwd ) );
-            remoteRepository.setLocation( new URI( configuration.getUrl( )==null ? "" : configuration.getUrl() ) );
-            RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( );
-            rif.setDownloadRemoteIndexOnStartup( configuration.isDownloadRemoteIndexOnStartup( ) );
-            rif.setDownloadRemoteIndex( configuration.isDownloadRemoteIndex( ) );
-            rif.setIndexUri( new URI( configuration.getIndexDir( ) ) );
-            rif.setDownloadTimeout( Duration.ofSeconds( configuration.getRemoteDownloadTimeout( ) ) );
-            rif.setProxyId( configuration.getRemoteDownloadNetworkProxyId( ) );
-        }
-        catch ( Exception e )
-        {
-            throw new RepositoryException( "Error", e );
-        }
-
-    }
-
-    @Override
-    public RepositoryGroup createRepositoryGroup( RepositoryGroupConfiguration configuration ) throws RepositoryException
-    {
-        return null;
-    }
-
-    @Override
-    public void updateRepositoryGroupInstance( EditableRepositoryGroup repositoryGroup, RepositoryGroupConfiguration configuration ) throws RepositoryException
-    {
-
-    }
-
-    @Override
-    public ManagedRepositoryConfiguration getManagedConfiguration( ManagedRepository managedRepository )
-    {
-        ManagedRepositoryConfiguration configuration = new ManagedRepositoryConfiguration( );
-        configuration.setId( managedRepository.getId( ) );
-        configuration.setName(managedRepository.getName());
-        configuration.setLocation( managedRepository.getLocation( ) == null ? "" : managedRepository.getLocation().toString( ) );
-        configuration.setBlockRedeployments( managedRepository.blocksRedeployments( ) );
-        configuration.setDescription( managedRepository.getDescription( ) );
-        configuration.setScanned( managedRepository.isScanned( ) );
-        configuration.setRefreshCronExpression( managedRepository.getSchedulingDefinition( ) );
-        configuration.setReleases( managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.RELEASE) );
-        configuration.setSnapshots( managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.SNAPSHOT) );
-        configuration.setLayout( managedRepository.getLayout() );
-        ArtifactCleanupFeature acf = managedRepository.getFeature( ArtifactCleanupFeature.class ).get( );
-        configuration.setRetentionPeriod( acf.getRetentionPeriod( ).getDays( ) );
-        configuration.setDeleteReleasedSnapshots( acf.isDeleteReleasedSnapshots( ) );
-        configuration.setRetentionCount( acf.getRetentionCount( ) );
-        IndexCreationFeature icf = managedRepository.getFeature( IndexCreationFeature.class ).get( );
-        configuration.setSkipPackedIndexCreation( icf.isSkipPackedIndexCreation( ) );
-        configuration.setIndexDir( icf.getIndexPath( ) == null ? "" : icf.getIndexPath().toString( ) );
-        StagingRepositoryFeature srf = managedRepository.getFeature( StagingRepositoryFeature.class ).get( );
-        configuration.setStageRepoNeeded( srf.isStageRepoNeeded( ) );
-        return configuration;
-    }
-
-    @Override
-    public RepositoryGroupConfiguration getRepositoryGroupConfiguration( RepositoryGroup repositoryGroup ) throws RepositoryException
-    {
-        return null;
-    }
-
-    @Override
-    public void addRepositoryEventHandler( EventHandler<? super RepositoryEvent> eventHandler )
-    {
-        // do nothing
-    }
-
-
-    @Override
-    public RemoteRepositoryConfiguration getRemoteConfiguration( RemoteRepository remoteRepository )
-    {
-        RemoteRepositoryConfiguration configuration = new RemoteRepositoryConfiguration( );
-        configuration.setId( remoteRepository.getId( ) );
-        configuration.setName( remoteRepository.getName( ) );
-        configuration.setDescription( remoteRepository.getDescription( ) );
-        configuration.setLayout( remoteRepository.getLayout( ) );
-        configuration.setRefreshCronExpression( remoteRepository.getSchedulingDefinition( ) );
-        configuration.setCheckPath( remoteRepository.getCheckPath( ) );
-        configuration.setExtraHeaders( remoteRepository.getExtraHeaders( ) );
-        configuration.setExtraParameters( remoteRepository.getExtraParameters( ) );
-        configuration.setTimeout( (int) remoteRepository.getTimeout( ).getSeconds( ) );
-        RepositoryCredentials creds = remoteRepository.getLoginCredentials( );
-        if (creds!=null)
-        {
-            PasswordCredentials pwdCreds = (PasswordCredentials) creds;
-            configuration.setUsername( pwdCreds.getUsername( ) );
-            configuration.setPassword( new String( pwdCreds.getPassword( ) ) );
-        }
-        configuration.setUrl( remoteRepository.getLocation( ) == null ? "" : remoteRepository.getLocation().toString( ) );
-        RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( );
-        configuration.setDownloadRemoteIndex( rif.isDownloadRemoteIndex( ) );
-        configuration.setDownloadRemoteIndexOnStartup( rif.isDownloadRemoteIndexOnStartup( ) );
-        configuration.setIndexDir( rif.getIndexUri( )==null ? "" : rif.getIndexUri().toString( ) );
-        configuration.setRemoteDownloadNetworkProxyId( rif.getProxyId( ) );
-        return configuration;
-    }
-
-    @Override
-    public void handle(Event event) {
-
-    }
-}
index 2f1521abc3a4311aaa48575476a32351bbf5e836..0657f95518172aaa4c732a69a48c802fe7ba0937 100644 (file)
@@ -28,7 +28,7 @@
        default-lazy-init="true">
 
   <context:annotation-config/>
-  <context:component-scan base-package="org.apache.archiva.metadata.repository,org.apache.archiva.repository.maven.content"/>
+  <context:component-scan base-package="org.apache.archiva.metadata.repository,org.apache.archiva.maven.repository.content"/>
 
   <!-- for testing repo purge using retention count -->
 
index 1e1030ff08f5dff0b5370be042e251c9204b15f2..a0014e153b14472475e8a645230f840cd736e4ed 100644 (file)
@@ -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">
   <context:annotation-config/>
-  <context:component-scan base-package="org.apache.archiva.metadata.repository,org.apache.archiva.repository.maven.content,org.apache.archiva.maven.metadata"/>
+  <context:component-scan base-package="org.apache.archiva.metadata.repository,org.apache.archiva.maven.repository.content,org.apache.archiva.maven.metadata"/>
 
   <bean name="commons-configuration" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
     <property name="initialConfiguration">
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/metadata/audit/TestAuditListener.java
deleted file mode 100644 (file)
index 7f4a953..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.apache.archiva.metadata.audit;
-
-/*
- * 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 org.apache.archiva.metadata.model.facets.AuditEvent;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class TestAuditListener
-    implements AuditListener
-{
-    public List<AuditEvent> getEvents()
-    {
-        return events;
-    }
-
-    private List<AuditEvent> events = new ArrayList<>();
-
-    @Override
-    public void auditEvent( AuditEvent event )
-    {
-        events.add( event );
-    }
-}
index 73f181f3998a0d1908086eefddbcd8047181d15e..22d7c58a5947f944a48b4415d28795b7cdb844a5 100644 (file)
@@ -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;
index 3b170401a1d15d02e64a5ed8aa9c08764ab7c783..e29190aac39714eefac2eec16795ade3221753e8 100644 (file)
@@ -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;
index 6713786ed142294f1f91ce625e1895add513994f..36e1f1dca6a52c06a48dc7233bd3775cca2a78bd 100644 (file)
@@ -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/httpunit/MkColMethodWebRequest.java
deleted file mode 100644 (file)
index 7702a9c..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.apache.archiva.webdav.httpunit;
-
-/*
- * 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.gargoylesoftware.htmlunit.WebRequest;
-
-import java.net.URL;
-
-/**
- * MkColMethodWebRequest
- * See RFC-2518 Section 8.3
- */
-public class MkColMethodWebRequest
-    extends WebRequest
-{
-    public MkColMethodWebRequest( String urlString )
-        throws Exception
-    {
-        super( new URL( urlString ) );
-    }
-
-
-}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/mock/httpunit/MkColMethodWebRequest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/mock/httpunit/MkColMethodWebRequest.java
new file mode 100644 (file)
index 0000000..1e091bf
--- /dev/null
@@ -0,0 +1,40 @@
+package org.apache.archiva.webdav.mock.httpunit;
+
+/*
+ * 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.gargoylesoftware.htmlunit.WebRequest;
+
+import java.net.URL;
+
+/**
+ * MkColMethodWebRequest
+ * See RFC-2518 Section 8.3
+ */
+public class MkColMethodWebRequest
+    extends WebRequest
+{
+    public MkColMethodWebRequest( String urlString )
+        throws Exception
+    {
+        super( new URL( urlString ) );
+    }
+
+
+}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/mock/metadata/audit/TestAuditListener.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/mock/metadata/audit/TestAuditListener.java
new file mode 100644 (file)
index 0000000..f8d0af1
--- /dev/null
@@ -0,0 +1,42 @@
+package org.apache.archiva.webdav.mock.metadata.audit;
+
+/*
+ * 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 org.apache.archiva.metadata.audit.AuditListener;
+import org.apache.archiva.metadata.model.facets.AuditEvent;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class TestAuditListener
+    implements AuditListener
+{
+    public List<AuditEvent> getEvents()
+    {
+        return events;
+    }
+
+    private List<AuditEvent> events = new ArrayList<>();
+
+    @Override
+    public void auditEvent( AuditEvent event )
+    {
+        events.add( event );
+    }
+}
index 720f1a912f1926219c1360489f3aa8a5c43dd159..df53f600b12434a5b60b87eccc9910504da43bbb 100644 (file)
@@ -180,7 +180,6 @@ public class DefaultCassandraArchivaManager
 
         List<String> hostNames = new ArrayList<>( );
         hostNames.add( cassandraHost + ":" + cassandraPort );
-        System.out.println( "Contact point: " + cassandraHost + ":" + cassandraPort );
         configLoader =
             DriverConfigLoader.programmaticBuilder( )
 
index ccdb3039f36fcf8a495f65187267a8a55a2f7df5..a6c4bf0fe6574a5cd4784878962926d538c5304e 100644 (file)
@@ -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 )