<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>
<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>
<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>
--- /dev/null
+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) {
+
+ }
+}
+++ /dev/null
-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) {
-
- }
-}
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 -->
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">
+++ /dev/null
-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 );
- }
-}
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;
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;
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;
+++ /dev/null
-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 ) );
- }
-
-
-}
--- /dev/null
+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 ) );
+ }
+
+
+}
--- /dev/null
+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 );
+ }
+}
List<String> hostNames = new ArrayList<>( );
hostNames.add( cassandraHost + ":" + cassandraPort );
- System.out.println( "Contact point: " + cassandraHost + ":" + cassandraPort );
configLoader =
DriverConfigLoader.programmaticBuilder( )
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;
{
clearReposAndNamespace( cassandraArchivaManager, clearedTables );
}
- System.err.println( "Finished setting up - "+testInfo.getDisplayName() + " - " + (System.currentTimeMillis( ) - cTime) +"ms");
}
/**
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 )