Moving some interfaces to the repository-api module
Project: http://git-wip-us.apache.org/repos/asf/archiva/repo Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/e4af2d6c Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/e4af2d6c Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/e4af2d6c Branch: refs/heads/master Commit: e4af2d6c41cdf814bd5b3b6e8f33140d099d6f89 Parents: e2cdbc2 Author: Martin Stockhammer <martin.stockham...@ars.de> Authored: Thu Nov 9 17:32:45 2017 +0100 Committer: Martin Stockhammer <martin.stockham...@ars.de> Committed: Thu Nov 9 17:32:45 2017 +0100 ---------------------------------------------------------------------- .../connector/RepositoryConnector.java | 45 ++ .../archiva/repository/content/PathParser.java | 43 ++ .../connector/RepositoryConnector.java | 45 -- .../archiva/repository/content/PathParser.java | 43 -- .../repository/RepositoryRegistryTest.java | 511 ------------------- .../mock/ManagedRepositoryContentMock.java | 169 ------ .../mock/RemoteRepositoryContentMock.java | 78 --- .../repository/mock/RepositoryProviderMock.java | 231 --------- .../src/main/test/resources/archiva.xml | 202 -------- .../src/main/test/resources/log4j2-test.xml | 45 -- .../src/main/test/resources/spring-context.xml | 53 -- .../repository/RepositoryRegistryTest.java | 511 +++++++++++++++++++ .../mock/ManagedRepositoryContentMock.java | 169 ++++++ .../mock/RemoteRepositoryContentMock.java | 78 +++ .../repository/mock/RepositoryProviderMock.java | 231 +++++++++ .../src/test/resources/archiva.xml | 202 ++++++++ .../src/test/resources/log4j2-test.xml | 45 ++ .../src/test/resources/spring-context.xml | 53 ++ 18 files changed, 1377 insertions(+), 1377 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/archiva/blob/e4af2d6c/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/connector/RepositoryConnector.java ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/connector/RepositoryConnector.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/connector/RepositoryConnector.java new file mode 100644 index 0000000..6f653e2 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/connector/RepositoryConnector.java @@ -0,0 +1,45 @@ +package org.apache.archiva.repository.connector; + +/* + * 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.repository.ManagedRepositoryContent; +import org.apache.archiva.repository.RemoteRepositoryContent; + +import java.util.List; + +/** + * RepositoryConnector + * + * + */ +public interface RepositoryConnector +{ + ManagedRepositoryContent getSourceRepository(); + + RemoteRepositoryContent getTargetRepository(); + + List<String> getBlacklist(); + + List<String> getWhitelist(); + + boolean isDisabled(); + + void setDisabled(boolean disabled); +} http://git-wip-us.apache.org/repos/asf/archiva/blob/e4af2d6c/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/PathParser.java ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/PathParser.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/PathParser.java new file mode 100644 index 0000000..ddbcb6d --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/PathParser.java @@ -0,0 +1,43 @@ +package org.apache.archiva.repository.content; + +/* + * 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.model.ArtifactReference; +import org.apache.archiva.repository.LayoutException; + +/** + * PathParser interface. + * + * + */ +public interface PathParser +{ + + /** + * Take a path and get the ArtifactReference associated with it. + * + * @param path the relative path to parse. + * @return the ArtifactReference for the provided path. (never null) + * @throws LayoutException if there was a problem parsing the path. + */ + ArtifactReference toArtifactReference( String path ) + throws LayoutException; + +} http://git-wip-us.apache.org/repos/asf/archiva/blob/e4af2d6c/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/connector/RepositoryConnector.java ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/connector/RepositoryConnector.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/connector/RepositoryConnector.java deleted file mode 100644 index 6f653e2..0000000 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/connector/RepositoryConnector.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.apache.archiva.repository.connector; - -/* - * 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.repository.ManagedRepositoryContent; -import org.apache.archiva.repository.RemoteRepositoryContent; - -import java.util.List; - -/** - * RepositoryConnector - * - * - */ -public interface RepositoryConnector -{ - ManagedRepositoryContent getSourceRepository(); - - RemoteRepositoryContent getTargetRepository(); - - List<String> getBlacklist(); - - List<String> getWhitelist(); - - boolean isDisabled(); - - void setDisabled(boolean disabled); -} http://git-wip-us.apache.org/repos/asf/archiva/blob/e4af2d6c/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/PathParser.java ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/PathParser.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/PathParser.java deleted file mode 100644 index ddbcb6d..0000000 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/PathParser.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.apache.archiva.repository.content; - -/* - * 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.model.ArtifactReference; -import org.apache.archiva.repository.LayoutException; - -/** - * PathParser interface. - * - * - */ -public interface PathParser -{ - - /** - * Take a path and get the ArtifactReference associated with it. - * - * @param path the relative path to parse. - * @return the ArtifactReference for the provided path. (never null) - * @throws LayoutException if there was a problem parsing the path. - */ - ArtifactReference toArtifactReference( String path ) - throws LayoutException; - -} http://git-wip-us.apache.org/repos/asf/archiva/blob/e4af2d6c/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/java/org/apache/archiva/repository/RepositoryRegistryTest.java ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/java/org/apache/archiva/repository/RepositoryRegistryTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/java/org/apache/archiva/repository/RepositoryRegistryTest.java deleted file mode 100644 index 01dcbd2..0000000 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/java/org/apache/archiva/repository/RepositoryRegistryTest.java +++ /dev/null @@ -1,511 +0,0 @@ -package org.apache.archiva.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.ArchivaConfiguration; -import org.apache.archiva.configuration.Configuration; -import org.apache.archiva.configuration.ManagedRepositoryConfiguration; -import org.apache.archiva.configuration.RemoteRepositoryConfiguration; -import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; - -import javax.inject.Inject; -import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; -import java.util.Collection; - -import static org.junit.Assert.*; - -/** - * Test for RepositoryRegistry - */ -@RunWith(ArchivaSpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" }) -public class RepositoryRegistryTest -{ - - @Inject - RepositoryRegistry repositoryRegistry; - - @Inject - ArchivaConfiguration archivaConfiguration; - - private static final Path userCfg = Paths.get(System.getProperty( "user.home" ), ".m2/archiva.xml"); - - private static Path cfgCopy; - private static Path archivaCfg; - - @BeforeClass - public static void classSetup() throws IOException, URISyntaxException - { - URL archivaCfgUri = Thread.currentThread().getContextClassLoader().getResource( "archiva.xml" ); - if (archivaCfgUri!=null) { - archivaCfg = Paths.get(archivaCfgUri.toURI()); - cfgCopy = Files.createTempFile( "archiva-backup", ".xml" ); - Files.copy( archivaCfg, cfgCopy, StandardCopyOption.REPLACE_EXISTING); - } - } - - @AfterClass - public static void classTearDown() throws IOException - { - if (cfgCopy!=null) { - Files.deleteIfExists( cfgCopy ); - } - } - - @Before - public void setUp( ) throws Exception - { - assertNotNull( repositoryRegistry ); - Files.deleteIfExists( userCfg ); - URL archivaCfgUri = Thread.currentThread().getContextClassLoader().getResource( "archiva.xml" ); - if (archivaCfgUri!=null) { - archivaCfg = Paths.get(archivaCfgUri.toURI()); - if (Files.exists(cfgCopy)) - { - Files.copy( cfgCopy, archivaCfg , StandardCopyOption.REPLACE_EXISTING); - } - } - archivaConfiguration.reload(); - repositoryRegistry.reload(); - } - - @After - public void tearDown( ) throws Exception - { - Files.deleteIfExists( userCfg ); - if (cfgCopy!=null && Files.exists(cfgCopy)) { - Files.copy(cfgCopy, archivaCfg, StandardCopyOption.REPLACE_EXISTING); - } - } - - @Test - public void getRepositories( ) throws Exception - { - Collection<Repository> repos = repositoryRegistry.getRepositories( ); - assertEquals( 5, repos.size( ) ); - assertTrue(repos.stream().anyMatch( rep -> rep.getId().equals("internal") )); - assertTrue( repos.stream( ).anyMatch( rep -> rep.getId( ).equals( "snapshots") ) ); - assertTrue(repos.stream().anyMatch( rep -> rep.getId().equals( "central") )); - } - - @Test - public void getManagedRepositories( ) throws Exception - { - Collection<ManagedRepository> repos = repositoryRegistry.getManagedRepositories(); - assertEquals( 4, repos.size( ) ); - assertTrue(repos.stream().anyMatch( rep -> rep.getId().equals("internal") )); - assertTrue( repos.stream( ).anyMatch( rep -> rep.getId( ).equals( "snapshots") ) ); - } - - @Test - public void getRemoteRepositories( ) throws Exception - { - Collection<RemoteRepository> repos = repositoryRegistry.getRemoteRepositories( ); - assertEquals( 1, repos.size( ) ); - assertTrue(repos.stream().anyMatch( rep -> rep.getId().equals( "central") )); - } - - @Test - public void getRepository( ) throws Exception - { - Repository repo = repositoryRegistry.getRepository( "internal" ); - assertNotNull(repo); - assertEquals("internal", repo.getId()); - assertEquals("Archiva Managed Internal Repository", repo.getName()); - assertEquals("This is internal repository.", repo.getDescription()); - assertEquals( "default", repo.getLayout( ) ); - assertEquals("0 0 * * * ?", repo.getSchedulingDefinition()); - assertTrue(repo instanceof ManagedRepository); - assertTrue( repo.hasIndex( ) ); - assertTrue(repo.isScanned()); - assertEquals(RepositoryType.MAVEN, repo.getType()); - } - - @Test - public void getManagedRepository( ) throws Exception - { - ManagedRepository repo = repositoryRegistry.getManagedRepository( "internal" ); - assertNotNull(repo); - assertEquals("internal", repo.getId()); - assertEquals("Archiva Managed Internal Repository", repo.getName()); - assertEquals("This is internal repository.", repo.getDescription()); - assertEquals( "default", repo.getLayout( ) ); - assertEquals("0 0 * * * ?", repo.getSchedulingDefinition()); - assertTrue( repo.hasIndex( ) ); - assertTrue(repo.isScanned()); - assertEquals(RepositoryType.MAVEN, repo.getType()); - assertTrue(repo.getActiveReleaseSchemes().contains(ReleaseScheme.RELEASE)); - assertFalse( repo.getActiveReleaseSchemes( ).contains( ReleaseScheme.SNAPSHOT ) ); - assertNotNull(repo.getContent()); - - assertNull(repositoryRegistry.getManagedRepository( "xyu" )); - - } - - @Test - public void getRemoteRepository( ) throws Exception - { - RemoteRepository repo = repositoryRegistry.getRemoteRepository( "central" ); - assertNotNull(repo); - assertEquals("central", repo.getId()); - assertEquals("Central Repository", repo.getName()); - assertEquals("", repo.getDescription()); - assertEquals( "default", repo.getLayout( ) ); - assertEquals("0 0 08 ? * SUN", repo.getSchedulingDefinition()); - assertTrue( repo.hasIndex( ) ); - assertTrue(repo.isScanned()); - assertEquals(RepositoryType.MAVEN, repo.getType()); - - assertEquals(35, repo.getTimeout().getSeconds()); - } - - @Test - public void putManagedRepository( ) throws Exception - { - BasicManagedRepository managedRepository = new BasicManagedRepository( "test001", "Test repo" ); - managedRepository.setDescription( managedRepository.getPrimaryLocale(), "This is just a test" ); - repositoryRegistry.putRepository(managedRepository); - - assertNotNull(managedRepository.getContent()); - assertEquals(6, repositoryRegistry.getRepositories().size()); - - managedRepository = new BasicManagedRepository( "central", "Test repo" ); - managedRepository.setDescription( managedRepository.getPrimaryLocale(), "This is just a test" ); - ManagedRepository updatedRepo = null; - try { - repositoryRegistry.putRepository( managedRepository ); - throw new RuntimeException("Repository exception should be thrown, if there exists a remote repository already with that id"); - } catch (RepositoryException e) { - // OK - } - managedRepository = new BasicManagedRepository( "internal", "Test repo" ); - managedRepository.setDescription( managedRepository.getPrimaryLocale(), "This is just a test" ); - updatedRepo = repositoryRegistry.putRepository( managedRepository ); - - assertTrue(updatedRepo==managedRepository); - assertNotNull(managedRepository.getContent()); - assertEquals(6, repositoryRegistry.getRepositories().size()); - ManagedRepository managedRepository1 = repositoryRegistry.getManagedRepository( "internal" ); - assertEquals("Test repo", managedRepository1.getName()); - assertTrue(managedRepository1==managedRepository); - - } - - @Test - public void putManagedRepositoryFromConfig( ) throws Exception - { - ManagedRepositoryConfiguration cfg = new ManagedRepositoryConfiguration(); - cfg.setId("test002"); - cfg.setName("This is test 002"); - ManagedRepository repo = repositoryRegistry.putRepository( cfg ); - assertNotNull(repo); - assertEquals("test002", repo.getId()); - assertEquals("This is test 002", repo.getName()); - assertNotNull(repo.getContent()); - archivaConfiguration.reload(); - Collection<ManagedRepository> repos = repositoryRegistry.getManagedRepositories(); - assertEquals(5, repos.size()); - - ManagedRepository internalRepo = repositoryRegistry.getManagedRepository( "internal" ); - cfg = new ManagedRepositoryConfiguration(); - cfg.setId("internal"); - cfg.setName("This is internal test 002"); - repo = repositoryRegistry.putRepository( cfg ); - assertTrue(internalRepo==repo); - assertEquals("This is internal test 002",repo.getName()); - assertEquals(5, repositoryRegistry.getManagedRepositories().size()); - - repositoryRegistry.reload(); - assertEquals(5, repositoryRegistry.getManagedRepositories().size()); - - } - - @Test - public void putManagedRepositoryFromConfigWithoutSave( ) throws Exception - { - Configuration configuration = archivaConfiguration.getConfiguration(); - ManagedRepositoryConfiguration cfg = new ManagedRepositoryConfiguration(); - cfg.setId("test002"); - cfg.setName("This is test 002"); - ManagedRepository repo = repositoryRegistry.putRepository( cfg, configuration ); - assertNotNull(repo); - assertEquals("test002", repo.getId()); - assertEquals("This is test 002", repo.getName()); - assertNotNull(repo.getContent()); - archivaConfiguration.reload(); - assertEquals(3, archivaConfiguration.getConfiguration().getManagedRepositories().size()); - Collection<ManagedRepository> repos = repositoryRegistry.getManagedRepositories(); - assertEquals(5, repos.size()); - - ManagedRepository internalRepo = repositoryRegistry.getManagedRepository( "internal" ); - cfg = new ManagedRepositoryConfiguration(); - cfg.setId("internal"); - cfg.setName("This is internal test 002"); - repo = repositoryRegistry.putRepository( cfg, configuration ); - assertTrue(internalRepo==repo); - assertEquals("This is internal test 002",repo.getName()); - assertEquals(5, repositoryRegistry.getManagedRepositories().size()); - - repositoryRegistry.reload(); - assertEquals(4, repositoryRegistry.getManagedRepositories().size()); - } - - @Test - public void putRemoteRepository( ) throws Exception - { - BasicRemoteRepository remoteRepository = new BasicRemoteRepository( "test001", "Test repo" ); - remoteRepository.setDescription( remoteRepository.getPrimaryLocale(), "This is just a test" ); - RemoteRepository newRepo = repositoryRegistry.putRepository(remoteRepository); - - assertTrue(remoteRepository==newRepo); - assertNotNull(remoteRepository.getContent()); - assertEquals(6, repositoryRegistry.getRepositories().size()); - - remoteRepository = new BasicRemoteRepository( "internal", "Test repo" ); - remoteRepository.setDescription( remoteRepository.getPrimaryLocale(), "This is just a test" ); - RemoteRepository updatedRepo = null; - try - { - updatedRepo = repositoryRegistry.putRepository( remoteRepository ); - throw new RuntimeException("Should throw repository exception, if repository exists already and is not the same type."); - } catch (RepositoryException e) { - // OK - } - - remoteRepository = new BasicRemoteRepository( "central", "Test repo" ); - remoteRepository.setDescription( remoteRepository.getPrimaryLocale(), "This is just a test" ); - updatedRepo = repositoryRegistry.putRepository( remoteRepository ); - - assertTrue(updatedRepo==remoteRepository); - assertNotNull(remoteRepository.getContent()); - assertEquals(6, repositoryRegistry.getRepositories().size()); - RemoteRepository remoteRepository1 = repositoryRegistry.getRemoteRepository( "central" ); - assertEquals("Test repo", remoteRepository1.getName()); - assertTrue(remoteRepository1==remoteRepository); - } - - @Test - public void putRemoteRepositoryFromConfig( ) throws Exception - { - RemoteRepositoryConfiguration cfg = new RemoteRepositoryConfiguration(); - cfg.setId("test002"); - cfg.setName("This is test 002"); - RemoteRepository repo = repositoryRegistry.putRepository( cfg ); - assertNotNull(repo); - assertEquals("test002", repo.getId()); - assertEquals("This is test 002", repo.getName()); - assertNotNull(repo.getContent()); - archivaConfiguration.reload(); - Collection<RemoteRepository> repos = repositoryRegistry.getRemoteRepositories(); - assertEquals(2, repos.size()); - - RemoteRepository internalRepo = repositoryRegistry.getRemoteRepository( "central" ); - cfg = new RemoteRepositoryConfiguration(); - cfg.setId("central"); - cfg.setName("This is central test 002"); - repo = repositoryRegistry.putRepository( cfg ); - assertTrue(internalRepo==repo); - assertEquals("This is central test 002",repo.getName()); - assertEquals(2, repositoryRegistry.getRemoteRepositories().size()); - - repositoryRegistry.reload(); - assertEquals(2, repositoryRegistry.getRemoteRepositories().size()); - } - - @Test - public void putRemoteRepositoryFromConfigWithoutSave( ) throws Exception - { - Configuration configuration = archivaConfiguration.getConfiguration(); - RemoteRepositoryConfiguration cfg = new RemoteRepositoryConfiguration(); - cfg.setId("test002"); - cfg.setName("This is test 002"); - RemoteRepository repo = repositoryRegistry.putRepository( cfg, configuration ); - assertNotNull(repo); - assertEquals("test002", repo.getId()); - assertEquals("This is test 002", repo.getName()); - assertNotNull(repo.getContent()); - archivaConfiguration.reload(); - assertEquals(1, archivaConfiguration.getConfiguration().getRemoteRepositories().size()); - Collection<RemoteRepository> repos = repositoryRegistry.getRemoteRepositories(); - assertEquals(2, repos.size()); - - RemoteRepository internalRepo = repositoryRegistry.getRemoteRepository( "central" ); - cfg = new RemoteRepositoryConfiguration(); - cfg.setId("central"); - cfg.setName("This is central test 002"); - repo = repositoryRegistry.putRepository( cfg, configuration ); - assertTrue(internalRepo==repo); - assertEquals("This is central test 002",repo.getName()); - assertEquals(2, repositoryRegistry.getRemoteRepositories().size()); - - repositoryRegistry.reload(); - assertEquals(1, repositoryRegistry.getRemoteRepositories().size()); - } - - @Test - public void removeRepository( ) throws Exception - { - assertEquals(5, repositoryRegistry.getRepositories().size()); - Repository repo = repositoryRegistry.getRepository( "snapshots" ); - repositoryRegistry.removeRepository( repo ); - assertEquals(4, repositoryRegistry.getRepositories().size()); - assertTrue( repositoryRegistry.getRepositories( ).stream( ).noneMatch( rep -> rep.getId( ).equals( "snapshots" ) ) ); - archivaConfiguration.reload(); - repositoryRegistry.reload(); - assertEquals(4, repositoryRegistry.getRepositories().size()); - } - - @Test - public void removeManagedRepository( ) throws Exception - { - - assertEquals(4, repositoryRegistry.getManagedRepositories().size()); - ManagedRepository repo = repositoryRegistry.getManagedRepository( "snapshots" ); - repositoryRegistry.removeRepository( repo ); - assertEquals(3, repositoryRegistry.getManagedRepositories().size()); - assertTrue( repositoryRegistry.getManagedRepositories( ).stream( ).noneMatch( rep -> rep.getId( ).equals( "snapshots" ) ) ); - archivaConfiguration.reload(); - repositoryRegistry.reload(); - assertEquals(3, repositoryRegistry.getManagedRepositories().size()); - } - - @Test - public void removeManagedRepositoryWithoutSave( ) throws Exception - { - Configuration configuration = archivaConfiguration.getConfiguration(); - assertEquals(4, repositoryRegistry.getManagedRepositories().size()); - ManagedRepository repo = repositoryRegistry.getManagedRepository( "snapshots" ); - repositoryRegistry.removeRepository( repo, configuration ); - assertEquals(3, repositoryRegistry.getManagedRepositories().size()); - assertTrue( repositoryRegistry.getManagedRepositories( ).stream( ).noneMatch( rep -> rep.getId( ).equals( "snapshots" ) ) ); - archivaConfiguration.reload(); - repositoryRegistry.reload(); - assertEquals(4, repositoryRegistry.getManagedRepositories().size()); - } - - - @Test - public void removeRemoteRepository( ) throws Exception - { - assertEquals(1, repositoryRegistry.getRemoteRepositories().size()); - RemoteRepository repo = repositoryRegistry.getRemoteRepository( "central" ); - repositoryRegistry.removeRepository( repo ); - assertEquals(0, repositoryRegistry.getRemoteRepositories().size()); - assertTrue( repositoryRegistry.getRemoteRepositories( ).stream( ).noneMatch( rep -> rep.getId( ).equals( "central" ) ) ); - archivaConfiguration.reload(); - repositoryRegistry.reload(); - assertEquals(0, repositoryRegistry.getRemoteRepositories().size()); - } - - @Test - public void removeRemoteRepositoryWithoutSave( ) throws Exception - { - Configuration configuration = archivaConfiguration.getConfiguration(); - assertEquals(1, repositoryRegistry.getRemoteRepositories().size()); - RemoteRepository repo = repositoryRegistry.getRemoteRepository( "central" ); - repositoryRegistry.removeRepository( repo, configuration ); - assertEquals(0, repositoryRegistry.getRemoteRepositories().size()); - assertTrue( repositoryRegistry.getRemoteRepositories( ).stream( ).noneMatch( rep -> rep.getId( ).equals( "central" ) ) ); - archivaConfiguration.reload(); - repositoryRegistry.reload(); - assertEquals(1, repositoryRegistry.getRemoteRepositories().size()); - } - - - @Test - public void cloneManagedRepo( ) throws Exception - { - ManagedRepository managedRepository = repositoryRegistry.getManagedRepository( "internal" ); - - try - { - repositoryRegistry.clone(managedRepository, "snapshots"); - throw new RuntimeException("RepositoryRegistry exception should be thrown if id exists already."); - } - catch ( RepositoryException e ) - { - // OK - } - - try - { - repositoryRegistry.clone(managedRepository, "central"); - throw new RuntimeException("RepositoryRegistry exception should be thrown if id exists already."); - } - catch ( RepositoryException e ) - { - // OK - } - - ManagedRepository clone = repositoryRegistry.clone( managedRepository, "newinternal" ); - assertNotNull(clone); - assertNull(clone.getContent()); - assertEquals("Archiva Managed Internal Repository", clone.getName()); - assertFalse(managedRepository==clone); - - } - - @Test - public void cloneRemoteRepo( ) throws Exception - { - RemoteRepository remoteRepository = repositoryRegistry.getRemoteRepository( "central" ); - - try - { - repositoryRegistry.clone(remoteRepository, "snapshots"); - throw new RuntimeException("RepositoryRegistry exception should be thrown if id exists already."); - } - catch ( RepositoryException e ) - { - // OK - } - - try - { - repositoryRegistry.clone(remoteRepository, "central"); - throw new RuntimeException("RepositoryRegistry exception should be thrown if id exists already."); - } - catch ( RepositoryException e ) - { - // OK - } - - RemoteRepository clone = repositoryRegistry.clone( remoteRepository, "newCentral" ); - assertNotNull(clone); - assertNull(clone.getContent()); - assertEquals("Central Repository", clone.getName()); - assertFalse(remoteRepository==clone); - - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/archiva/blob/e4af2d6c/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java deleted file mode 100644 index 1fb6133..0000000 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java +++ /dev/null @@ -1,169 +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.model.ArchivaArtifact; -import org.apache.archiva.model.ArtifactReference; -import org.apache.archiva.model.ProjectReference; -import org.apache.archiva.model.VersionedReference; -import org.apache.archiva.repository.ContentNotFoundException; -import org.apache.archiva.repository.ManagedRepository; -import org.apache.archiva.repository.ManagedRepositoryContent; -import org.apache.archiva.repository.RepositoryException; -import org.apache.archiva.repository.layout.LayoutException; -import org.springframework.stereotype.Service; - -import java.nio.file.Path; -import java.util.Set; - -/** - * @author Martin Stockhammer <marti...@apache.org> - */ -@Service("managedRepositoryContent#mock") -public class ManagedRepositoryContentMock implements ManagedRepositoryContent -{ - private ManagedRepository repository; - - @Override - public void deleteVersion( VersionedReference reference ) throws ContentNotFoundException - { - - } - - @Override - public void deleteArtifact( ArtifactReference artifactReference ) throws ContentNotFoundException - { - - } - - @Override - public void deleteGroupId( String groupId ) throws ContentNotFoundException - { - - } - - @Override - public void deleteProject( String namespace, String projectId ) throws RepositoryException - { - - } - - @Override - public String getId( ) - { - return null; - } - - @Override - public Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference ) throws ContentNotFoundException - { - return null; - } - - @Override - public String getRepoRoot( ) - { - return null; - } - - @Override - public ManagedRepository getRepository( ) - { - return repository; - } - - @Override - public Set<String> getVersions( ProjectReference reference ) throws ContentNotFoundException, LayoutException - { - return null; - } - - @Override - public Set<String> getVersions( VersionedReference reference ) throws ContentNotFoundException - { - return null; - } - - @Override - public boolean hasContent( ArtifactReference reference ) - { - return false; - } - - @Override - public boolean hasContent( ProjectReference reference ) - { - return false; - } - - @Override - public boolean hasContent( VersionedReference reference ) - { - return false; - } - - @Override - public void setRepository( ManagedRepository repo ) - { - this.repository = repo; - } - - @Override - public ArtifactReference toArtifactReference( String path ) throws LayoutException - { - return null; - } - - @Override - public Path toFile( ArtifactReference reference ) - { - return null; - } - - @Override - public Path toFile( ArchivaArtifact reference ) - { - return null; - } - - @Override - public String toMetadataPath( ProjectReference reference ) - { - return null; - } - - @Override - public String toMetadataPath( VersionedReference reference ) - { - return null; - } - - @Override - public String toPath( ArtifactReference reference ) - { - return null; - } - - @Override - public String toPath( ArchivaArtifact reference ) - { - return null; - } -} http://git-wip-us.apache.org/repos/asf/archiva/blob/e4af2d6c/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java deleted file mode 100644 index 238b0cf..0000000 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java +++ /dev/null @@ -1,78 +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.model.ArtifactReference; -import org.apache.archiva.model.RepositoryURL; -import org.apache.archiva.repository.RemoteRepository; -import org.apache.archiva.repository.RemoteRepositoryContent; -import org.apache.archiva.repository.layout.LayoutException; -import org.springframework.stereotype.Service; - -/** - * @author Martin Stockhammer <marti...@apache.org> - */ -@Service("remoteRepositoryContent#mock") -public class RemoteRepositoryContentMock implements RemoteRepositoryContent -{ - RemoteRepository repository; - - @Override - public String getId( ) - { - return null; - } - - @Override - public RemoteRepository getRepository( ) - { - return null; - } - - @Override - public RepositoryURL getURL( ) - { - return null; - } - - @Override - public void setRepository( RemoteRepository repo ) - { - this.repository = repo; - } - - @Override - public ArtifactReference toArtifactReference( String path ) throws LayoutException - { - return null; - } - - @Override - public String toPath( ArtifactReference reference ) - { - return null; - } - - @Override - public RepositoryURL toURL( ArtifactReference reference ) - { - return null; - } -} http://git-wip-us.apache.org/repos/asf/archiva/blob/e4af2d6c/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java deleted file mode 100644 index 834ce5b..0000000 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java +++ /dev/null @@ -1,231 +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.repository.BasicManagedRepository; -import org.apache.archiva.repository.BasicRemoteRepository; -import org.apache.archiva.repository.EditableManagedRepository; -import org.apache.archiva.repository.EditableRemoteRepository; -import org.apache.archiva.repository.ManagedRepository; -import org.apache.archiva.repository.PasswordCredentials; -import org.apache.archiva.repository.ReleaseScheme; -import org.apache.archiva.repository.RemoteRepository; -import org.apache.archiva.repository.RepositoryCredentials; -import org.apache.archiva.repository.RepositoryException; -import org.apache.archiva.repository.RepositoryProvider; -import org.apache.archiva.repository.RepositoryType; -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.net.URI; -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 ) - { - return new BasicManagedRepository( id, name ); - } - - @Override - public EditableRemoteRepository createRemoteInstance( String id, String name ) - { - return new BasicRemoteRepository( id, name ); - } - - @Override - public ManagedRepository createManagedInstance( ManagedRepositoryConfiguration configuration ) throws RepositoryException - { - BasicManagedRepository managedRepository = new BasicManagedRepository( configuration.getId( ), configuration.getName( ) ); - 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 = new BasicManagedRepository( id, configuration.getName( ) ); - updateManagedInstance( managedRepository, configuration ); - return managedRepository; - } - - @Override - public RemoteRepository createRemoteInstance( RemoteRepositoryConfiguration configuration ) throws RepositoryException - { - BasicRemoteRepository remoteRepository = new BasicRemoteRepository( configuration.getId( ), configuration.getName( ) ); - updateRemoteInstance( remoteRepository, configuration ); - return remoteRepository; - } - - @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 ManagedRepositoryConfiguration getManagedConfiguration( ManagedRepository managedRepository ) throws RepositoryException - { - 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.setLayout( managedRepository.getLayout( ) ); - configuration.setScanned( managedRepository.isScanned( ) ); - configuration.setRefreshCronExpression( managedRepository.getSchedulingDefinition( ) ); - configuration.setReleases( managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.RELEASE) ); - configuration.setSnapshots( managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.SNAPSHOT) ); - 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 RemoteRepositoryConfiguration getRemoteConfiguration( RemoteRepository remoteRepository ) throws RepositoryException - { - 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; - } - -} http://git-wip-us.apache.org/repos/asf/archiva/blob/e4af2d6c/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/resources/archiva.xml ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/resources/archiva.xml b/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/resources/archiva.xml deleted file mode 100644 index 308c673..0000000 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/resources/archiva.xml +++ /dev/null @@ -1,202 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<configuration> - <version>3.0.0</version> - <managedRepositories> - <managedRepository> - <id>internal</id> - <name>Archiva Managed Internal Repository</name> - <description>This is internal repository.</description> - <location>${appserver.base}/repositories/internal</location> - <indexDir>${appserver.base}/repositories/internal/.indexer</indexDir> - <layout>default</layout> - <releases>true</releases> - <snapshots>false</snapshots> - <blockRedeployments>true</blockRedeployments> - <scanned>true</scanned> - <refreshCronExpression>0 0 * * * ?</refreshCronExpression> - <retentionPeriod>30</retentionPeriod> - </managedRepository> - <managedRepository> - <id>staging</id> - <name>Repository with staging</name> - <description>This is repository with staging.</description> - <location>${appserver.base}/repositories/internal</location> - <indexDir>${appserver.base}/repositories/internal/.indexer</indexDir> - <layout>default</layout> - <releases>true</releases> - <snapshots>false</snapshots> - <blockRedeployments>true</blockRedeployments> - <scanned>true</scanned> - <refreshCronExpression>0 0 * * * ?</refreshCronExpression> - <retentionPeriod>30</retentionPeriod> - <stageRepoNeeded>true</stageRepoNeeded> - </managedRepository> - <managedRepository> - <id>snapshots</id> - <name>Archiva Managed Snapshot Repository</name> - <location>${appserver.base}/repositories/snapshots</location> - <indexDir>${appserver.base}/repositories/snapshots/.indexer</indexDir> - <layout>default</layout> - <releases>false</releases> - <snapshots>true</snapshots> - <blockRedeployments>false</blockRedeployments> - <scanned>true</scanned> - <refreshCronExpression>0 0\,30 * * * ?</refreshCronExpression> - <retentionPeriod>30</retentionPeriod> - </managedRepository> - </managedRepositories> - <remoteRepositories> - <remoteRepository> - <id>central</id> - <name>Central Repository</name> - <url>https://repo.maven.apache.org/maven2</url> - <layout>default</layout> - <timeout>35</timeout> - </remoteRepository> - </remoteRepositories> - - <proxyConnectors> - <proxyConnector> - <sourceRepoId>internal</sourceRepoId> - <targetRepoId>central</targetRepoId> - <proxyId/> - <policies> - <snapshots>disabled</snapshots> - <releases>once</releases> - <checksum>fix</checksum> - <cache-failures>cached</cache-failures> - </policies> - <whiteListPatterns> - <whiteListPattern>**/*</whiteListPattern> - </whiteListPatterns> - </proxyConnector> - </proxyConnectors> - - <legacyArtifactPaths> - <legacyArtifactPath> - <path>jaxen/jars/jaxen-1.0-FCS-full.jar</path> - <artifact>jaxen:jaxen:1.0-FCS:full:jar</artifact> - </legacyArtifactPath> - </legacyArtifactPaths> - - <repositoryScanning> - <fileTypes> - <fileType> - <id>artifacts</id> - <patterns> - <pattern>**/*.pom</pattern> - <pattern>**/*.jar</pattern> - <pattern>**/*.ear</pattern> - <pattern>**/*.war</pattern> - <pattern>**/*.car</pattern> - <pattern>**/*.sar</pattern> - <pattern>**/*.mar</pattern> - <pattern>**/*.rar</pattern> - <pattern>**/*.dtd</pattern> - <pattern>**/*.tld</pattern> - <pattern>**/*.tar.gz</pattern> - <pattern>**/*.tar.bz2</pattern> - <pattern>**/*.zip</pattern> - </patterns> - </fileType> - <fileType> - <id>indexable-content</id> - <patterns> - <pattern>**/*.txt</pattern> - <pattern>**/*.TXT</pattern> - <pattern>**/*.block</pattern> - <pattern>**/*.config</pattern> - <pattern>**/*.pom</pattern> - <pattern>**/*.xml</pattern> - <pattern>**/*.xsd</pattern> - <pattern>**/*.dtd</pattern> - <pattern>**/*.tld</pattern> - </patterns> - </fileType> - <fileType> - <id>auto-remove</id> - <patterns> - <pattern>**/*.bak</pattern> - <pattern>**/*~</pattern> - <pattern>**/*-</pattern> - </patterns> - </fileType> - <fileType> - <id>ignored</id> - <patterns> - <pattern>**/.htaccess</pattern> - <pattern>**/KEYS</pattern> - <pattern>**/*.rb</pattern> - <pattern>**/*.sh</pattern> - <pattern>**/.svn/**</pattern> - <pattern>**/.DAV/**</pattern> - <pattern>.index/**</pattern> - <pattern>.indexer/**</pattern> - </patterns> - </fileType> - </fileTypes> - <knownContentConsumers> - <knownContentConsumer>create-missing-checksums</knownContentConsumer> - <knownContentConsumer>validate-checksum</knownContentConsumer> - <knownContentConsumer>validate-signature</knownContentConsumer> - <knownContentConsumer>index-content</knownContentConsumer> - <knownContentConsumer>auto-remove</knownContentConsumer> - <knownContentConsumer>auto-rename</knownContentConsumer> - <knownContentConsumer>metadata-updater</knownContentConsumer> - <knownContentConsumer>create-archiva-metadata</knownContentConsumer> - <knownContentConsumer>duplicate-artifacts</knownContentConsumer> - <!--knownContentConsumer>repository-purge</knownContentConsumer--> - </knownContentConsumers> - <invalidContentConsumers> - <invalidContentConsumer>update-db-bad-content</invalidContentConsumer> - </invalidContentConsumers> - </repositoryScanning> - - <webapp> - <ui> - <showFindArtifacts>true</showFindArtifacts> - <appletFindEnabled>true</appletFindEnabled> - </ui> - </webapp> - - <redbackRuntimeConfiguration> - <userManagerImpls> - <userManagerImpl>jpa</userManagerImpl> - </userManagerImpls> - <rbacManagerImpls> - <rbacManagerImpl>cached</rbacManagerImpl> - </rbacManagerImpls> - </redbackRuntimeConfiguration> - - <archivaDefaultConfiguration> - <defaultCheckPaths> - <defaultCheckPath> - <url>http://download.oracle.com/maven</url> - <path>com/sleepycat/je/license.txt</path> - </defaultCheckPath> - <defaultCheckPath> - <url>https://download.oracle.com/maven</url> - <path>com/sleepycat/je/license.txt</path> - </defaultCheckPath> - </defaultCheckPaths> - </archivaDefaultConfiguration> - -</configuration> http://git-wip-us.apache.org/repos/asf/archiva/blob/e4af2d6c/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/resources/log4j2-test.xml ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/resources/log4j2-test.xml b/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/resources/log4j2-test.xml deleted file mode 100644 index 3919a98..0000000 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/resources/log4j2-test.xml +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ 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. - --> - - -<configuration status="debug"> - <appenders> - <Console name="console" target="SYSTEM_OUT"> - <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> - </Console> - </appenders> - <loggers> - - <logger name="org.apache.archiva.admin.repository.managed" level="debug"/> - <logger name="org.apache.archiva.repository" level="TRACE" /> - - <logger name="JPOX" level="error"/> - - - <logger name="org.springframework" level="error"/> - - - <root level="info"> - <appender-ref ref="console"/> - </root> - </loggers> -</configuration> - - http://git-wip-us.apache.org/repos/asf/archiva/blob/e4af2d6c/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/resources/spring-context.xml ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/resources/spring-context.xml deleted file mode 100644 index 2b7748f..0000000 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/test/resources/spring-context.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0"?> - -<!-- - ~ 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. - --> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:context="http://www.springframework.org/schema/context" - xmlns:tx="http://www.springframework.org/schema/tx" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context.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.repository.mock"/> - - - <bean name="commons-configuration" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry"> - <property name="properties"> - <value> - <![CDATA[ - <configuration> - <system/> - <xml fileName="archiva.xml" config-forceCreate="true" - config-optional="true" - config-name="org.apache.archiva.base" config-at="org.apache.archiva"/> - </configuration> - ]]> - </value> - </property> - </bean> - - -</beans> \ No newline at end of file