diff options
author | Joakim Erdfelt <joakime@apache.org> | 2007-10-19 16:40:05 +0000 |
---|---|---|
committer | Joakim Erdfelt <joakime@apache.org> | 2007-10-19 16:40:05 +0000 |
commit | 8d22aca37f827ece225cebb4863e2edb77109293 (patch) | |
tree | a2e46fd4723b71b5600a47854dab0935549c018d /archiva-base | |
parent | 53b29620d5760792f4b2d3fb4ed34facbbac14f8 (diff) | |
download | archiva-8d22aca37f827ece225cebb4863e2edb77109293.tar.gz archiva-8d22aca37f827ece225cebb4863e2edb77109293.zip |
Beefing up tests for RepositoryContentConsumers.
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@586524 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-base')
7 files changed, 425 insertions, 260 deletions
diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/InvalidScanConsumer.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/InvalidScanConsumer.java index bb5e7a315..ce4868616 100644 --- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/InvalidScanConsumer.java +++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/InvalidScanConsumer.java @@ -36,6 +36,11 @@ public class InvalidScanConsumer extends AbstractMonitoredConsumer implements InvalidRepositoryContentConsumer { + /** + * @plexus.configuration default-value="unset-id" + */ + private String id = "unset-id"; + private int processCount = 0; public void beginScan( ManagedRepositoryConfiguration repository ) @@ -72,7 +77,7 @@ public class InvalidScanConsumer public String getId() { - return "test-invalid-consumer"; + return id; } public boolean isPermanent() diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.java deleted file mode 100644 index e89558057..000000000 --- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.java +++ /dev/null @@ -1,204 +0,0 @@ -package org.apache.maven.archiva.repository.scanner; - -/* - * 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.commons.lang.SystemUtils; -import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; -import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer; -import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; -import org.apache.maven.archiva.consumers.RepositoryContentConsumer; -import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase; -import org.easymock.MockControl; - -import java.io.File; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -/** - * RepositoryContentConsumerUtilTest - * - * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> - * @version $Id$ - */ -public class RepositoryContentConsumerUtilTest - extends AbstractRepositoryLayerTestCase -{ - private RepositoryContentConsumers lookupRepositoryConsumerUtil() - throws Exception - { - RepositoryContentConsumers consumerUtil = (RepositoryContentConsumers) lookup( RepositoryContentConsumers.class - .getName() ); - assertNotNull( "RepositoryContentConsumerUtil should not be null.", consumerUtil ); - return consumerUtil; - } - - public void testGetSelectedIds() - throws Exception - { - RepositoryContentConsumers consumerutil = lookupRepositoryConsumerUtil(); - - List knownConsumers = consumerutil.getSelectedKnownConsumerIds(); - assertNotNull( "Known Consumer IDs should not be null", knownConsumers ); - assertEquals( "Known Consumer IDs.size", 9, knownConsumers.size() ); - - List invalidConsumers = consumerutil.getSelectedInvalidConsumerIds(); - assertNotNull( "Invalid Consumer IDs should not be null", invalidConsumers ); - assertEquals( "Invalid Consumer IDs.size", 1, invalidConsumers.size() ); - } - - public void testGetSelectedConsumersMaps() - throws Exception - { - RepositoryContentConsumers consumerutil = lookupRepositoryConsumerUtil(); - - Map knownConsumerMap = consumerutil.getSelectedKnownConsumersMap(); - assertNotNull( "Known Consumer Map should not be null", knownConsumerMap ); - assertEquals( "Known Consumer Map.size", 1, knownConsumerMap.size() ); - - Object o = knownConsumerMap.get( "sample-known" ); - assertNotNull( "Known[sample-known] should not be null.", o ); - assertInstanceof( "Known[sample-known]", RepositoryContentConsumer.class, o ); - assertInstanceof( "Known[sample-known]", KnownRepositoryContentConsumer.class, o ); - - Map invalidConsumerMap = consumerutil.getSelectedInvalidConsumersMap(); - assertNotNull( "Invalid Consumer Map should not be null", invalidConsumerMap ); - assertEquals( "Invalid Consumer Map.size", 0, invalidConsumerMap.size() ); - } - - private void assertInstanceof( String msg, Class clazz, Object o ) - { - if ( clazz.isInstance( o ) == false ) - { - fail( msg + ": Object [" + o.getClass().getName() + "] should have been an instanceof [" + clazz.getName() + - "]" ); - } - } - - public void testGetAvailableLists() - throws Exception - { - RepositoryContentConsumers consumerutil = lookupRepositoryConsumerUtil(); - - List knownConsumers = consumerutil.getAvailableKnownConsumers(); - assertNotNull( "known consumers should not be null.", knownConsumers ); - assertEquals( "known consumers", 1, knownConsumers.size() ); - assertInstanceof( "Available Known Consumers", RepositoryContentConsumer.class, knownConsumers.get( 0 ) ); - - List invalidConsumers = consumerutil.getAvailableInvalidConsumers(); - assertNotNull( "invalid consumers should not be null.", invalidConsumers ); - assertEquals( "invalid consumers", 0, invalidConsumers.size() ); - } - - public void testExecution() - throws Exception - { - MockControl knownControl = MockControl.createNiceControl( KnownRepositoryContentConsumer.class ); - RepositoryContentConsumers consumers = lookupRepositoryConsumerUtil(); - KnownRepositoryContentConsumer knownConsumer = (KnownRepositoryContentConsumer) knownControl.getMock(); - consumers.setAvailableKnownConsumers( Collections.singletonList( knownConsumer ) ); - - MockControl invalidControl = MockControl.createControl( InvalidRepositoryContentConsumer.class ); - InvalidRepositoryContentConsumer invalidConsumer = (InvalidRepositoryContentConsumer) invalidControl.getMock(); - consumers.setAvailableInvalidConsumers( Collections.singletonList( invalidConsumer ) ); - - ManagedRepositoryConfiguration repo = createRepository( "id", "name", getTestFile( "target/test-repo" ) ); - File testFile = getTestFile( "target/test-repo/path/to/test-file.txt" ); - - knownConsumer.beginScan( repo ); - knownConsumer.getExcludes(); - knownControl.setReturnValue( Collections.EMPTY_LIST ); - knownConsumer.getIncludes(); - knownControl.setReturnValue( Collections.singletonList( "**/*.txt" ) ); - knownConsumer.processFile( _OS("path/to/test-file.txt") ); -// knownConsumer.completeScan(); - knownControl.replay(); - - invalidConsumer.beginScan( repo ); -// invalidConsumer.completeScan(); - invalidControl.replay(); - - consumers.executeConsumers( repo, testFile ); - - knownControl.verify(); - invalidControl.verify(); - - knownControl.reset(); - invalidControl.reset(); - - File notIncludedTestFile = getTestFile( "target/test-repo/path/to/test-file.xml" ); - - knownConsumer.beginScan( repo ); - knownConsumer.getExcludes(); - knownControl.setReturnValue( Collections.EMPTY_LIST ); - knownConsumer.getIncludes(); - knownControl.setReturnValue( Collections.singletonList( "**/*.txt" ) ); -// knownConsumer.completeScan(); - knownControl.replay(); - - invalidConsumer.beginScan( repo ); - invalidConsumer.processFile( _OS("path/to/test-file.xml") ); - invalidConsumer.getId(); - invalidControl.setReturnValue( "invalid" ); -// invalidConsumer.completeScan(); - invalidControl.replay(); - - consumers.executeConsumers( repo, notIncludedTestFile ); - - knownControl.verify(); - invalidControl.verify(); - - knownControl.reset(); - invalidControl.reset(); - - File excludedTestFile = getTestFile( "target/test-repo/path/to/test-file.txt" ); - - knownConsumer.beginScan( repo ); - knownConsumer.getExcludes(); - knownControl.setReturnValue( Collections.singletonList( "**/test-file.txt" ) ); -// knownConsumer.completeScan(); - knownControl.replay(); - - invalidConsumer.beginScan( repo ); - invalidConsumer.processFile( _OS("path/to/test-file.txt") ); - invalidConsumer.getId(); - invalidControl.setReturnValue( "invalid" ); -// invalidConsumer.completeScan(); - invalidControl.replay(); - - consumers.executeConsumers( repo, excludedTestFile ); - - knownControl.verify(); - invalidControl.verify(); - } - - /** - * Create an OS specific version of the filepath. - * Provide path in unix "/" format. - */ - private String _OS( String path ) - { - if ( SystemUtils.IS_OS_WINDOWS ) - { - return path.replace( '/', '\\' ); - } - return path; - } -} diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java new file mode 100644 index 000000000..d0ee6e2d2 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java @@ -0,0 +1,282 @@ +package org.apache.maven.archiva.repository.scanner; + +/* + * 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.commons.lang.SystemUtils; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; +import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer; +import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; +import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase; +import org.easymock.MockControl; + +import java.io.File; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + * RepositoryContentConsumersTest + * + * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> + * @version $Id$ + */ +public class RepositoryContentConsumersTest + extends AbstractRepositoryLayerTestCase +{ + private RepositoryContentConsumers lookupRepositoryConsumers() + throws Exception + { + RepositoryContentConsumers consumerUtil = (RepositoryContentConsumers) lookup( RepositoryContentConsumers.class + .getName() ); + assertNotNull( "RepositoryContentConsumers should not be null.", consumerUtil ); + return consumerUtil; + } + + public void testGetSelectedKnownIds() + throws Exception + { + RepositoryContentConsumers consumerutil = lookupRepositoryConsumers(); + + String expectedKnownIds[] = new String[] { + "update-db-artifact", + "create-missing-checksums", + "update-db-repository-metadata", + "validate-checksum", + "validate-signature", + "index-content", + "auto-remove", + "auto-rename" }; + + List<String> knownConsumers = consumerutil.getSelectedKnownConsumerIds(); + assertNotNull( "Known Consumer IDs should not be null", knownConsumers ); + assertEquals( "Known Consumer IDs.size", expectedKnownIds.length, knownConsumers.size() ); + + for ( String expectedId : expectedKnownIds ) + { + assertTrue( "Known id [" + expectedId + "] exists.", knownConsumers.contains( expectedId ) ); + } + } + + public void testGetSelectedInvalidIds() + throws Exception + { + RepositoryContentConsumers consumerutil = lookupRepositoryConsumers(); + + String expectedInvalidIds[] = new String[] { "update-db-bad-content" }; + + List<String> invalidConsumers = consumerutil.getSelectedInvalidConsumerIds(); + assertNotNull( "Invalid Consumer IDs should not be null", invalidConsumers ); + assertEquals( "Invalid Consumer IDs.size", expectedInvalidIds.length, invalidConsumers.size() ); + + for ( String expectedId : expectedInvalidIds ) + { + assertTrue( "Invalid id [" + expectedId + "] exists.", invalidConsumers.contains( expectedId ) ); + } + } + + public void testGetSelectedKnownConsumerMap() + throws Exception + { + RepositoryContentConsumers consumerutil = lookupRepositoryConsumers(); + + String expectedSelectedKnownIds[] = new String[] { + "update-db-artifact", + "create-missing-checksums", + "update-db-repository-metadata", + "validate-checksum", + "index-content", + "auto-remove", + "auto-rename" }; + + Map<String, KnownRepositoryContentConsumer> knownConsumerMap = consumerutil.getSelectedKnownConsumersMap(); + assertNotNull( "Known Consumer Map should not be null", knownConsumerMap ); + assertEquals( "Known Consumer Map.size", expectedSelectedKnownIds.length, knownConsumerMap.size() ); + + for ( String expectedId : expectedSelectedKnownIds ) + { + KnownRepositoryContentConsumer consumer = knownConsumerMap.get( expectedId ); + assertNotNull( "Known[" + expectedId + "] should not be null.", consumer ); + assertEquals( "Known[" + expectedId + "].id", expectedId, consumer.getId() ); + } + } + + public void testGetSelectedInvalidConsumerMap() + throws Exception + { + RepositoryContentConsumers consumerutil = lookupRepositoryConsumers(); + + String expectedSelectedInvalidIds[] = new String[] { "update-db-bad-content" }; + + Map<String, InvalidRepositoryContentConsumer> invalidConsumerMap = consumerutil + .getSelectedInvalidConsumersMap(); + assertNotNull( "Invalid Consumer Map should not be null", invalidConsumerMap ); + assertEquals( "Invalid Consumer Map.size", expectedSelectedInvalidIds.length, invalidConsumerMap.size() ); + + for ( String expectedId : expectedSelectedInvalidIds ) + { + InvalidRepositoryContentConsumer consumer = invalidConsumerMap.get( expectedId ); + assertNotNull( "Known[" + expectedId + "] should not be null.", consumer ); + assertEquals( "Known[" + expectedId + "].id", expectedId, consumer.getId() ); + } + } + + public void testGetAvailableKnownList() + throws Exception + { + RepositoryContentConsumers consumerutil = lookupRepositoryConsumers(); + + String expectedKnownIds[] = new String[] { + "update-db-artifact", + "create-missing-checksums", + "update-db-repository-metadata", + "validate-checksum", + "index-content", + "auto-remove", + "auto-rename", + "available-but-unselected" }; + + List<KnownRepositoryContentConsumer> knownConsumers = consumerutil.getAvailableKnownConsumers(); + assertNotNull( "known consumers should not be null.", knownConsumers ); + assertEquals( "known consumers", expectedKnownIds.length, knownConsumers.size() ); + + List<String> expectedIds = Arrays.asList( expectedKnownIds ); + for ( KnownRepositoryContentConsumer consumer : knownConsumers ) + { + assertTrue( "Consumer [" + consumer.getId() + "] returned by .getAvailableKnownConsumers() is unexpected.", + expectedIds.contains( consumer.getId() ) ); + } + } + + public void testGetAvailableInvalidList() + throws Exception + { + RepositoryContentConsumers consumerutil = lookupRepositoryConsumers(); + + String expectedInvalidIds[] = new String[] { "update-db-bad-content", "move-to-trash-then-notify" }; + + List<InvalidRepositoryContentConsumer> invalidConsumers = consumerutil.getAvailableInvalidConsumers(); + assertNotNull( "invalid consumers should not be null.", invalidConsumers ); + assertEquals( "invalid consumers", expectedInvalidIds.length, invalidConsumers.size() ); + + List<String> expectedIds = Arrays.asList( expectedInvalidIds ); + for ( InvalidRepositoryContentConsumer consumer : invalidConsumers ) + { + assertTrue( "Consumer [" + consumer.getId() + + "] returned by .getAvailableInvalidConsumers() is unexpected.", expectedIds.contains( consumer + .getId() ) ); + } + } + + public void testExecution() + throws Exception + { + MockControl knownControl = MockControl.createNiceControl( KnownRepositoryContentConsumer.class ); + RepositoryContentConsumers consumers = lookupRepositoryConsumers(); + KnownRepositoryContentConsumer knownConsumer = (KnownRepositoryContentConsumer) knownControl.getMock(); + consumers.setAvailableKnownConsumers( Collections.singletonList( knownConsumer ) ); + + MockControl invalidControl = MockControl.createControl( InvalidRepositoryContentConsumer.class ); + InvalidRepositoryContentConsumer invalidConsumer = (InvalidRepositoryContentConsumer) invalidControl.getMock(); + consumers.setAvailableInvalidConsumers( Collections.singletonList( invalidConsumer ) ); + + ManagedRepositoryConfiguration repo = createRepository( "id", "name", getTestFile( "target/test-repo" ) ); + File testFile = getTestFile( "target/test-repo/path/to/test-file.txt" ); + + knownConsumer.beginScan( repo ); + knownConsumer.getExcludes(); + knownControl.setReturnValue( Collections.EMPTY_LIST ); + knownConsumer.getIncludes(); + knownControl.setReturnValue( Collections.singletonList( "**/*.txt" ) ); + knownConsumer.processFile( _OS( "path/to/test-file.txt" ) ); + // knownConsumer.completeScan(); + knownControl.replay(); + + invalidConsumer.beginScan( repo ); + // invalidConsumer.completeScan(); + invalidControl.replay(); + + consumers.executeConsumers( repo, testFile ); + + knownControl.verify(); + invalidControl.verify(); + + knownControl.reset(); + invalidControl.reset(); + + File notIncludedTestFile = getTestFile( "target/test-repo/path/to/test-file.xml" ); + + knownConsumer.beginScan( repo ); + knownConsumer.getExcludes(); + knownControl.setReturnValue( Collections.EMPTY_LIST ); + knownConsumer.getIncludes(); + knownControl.setReturnValue( Collections.singletonList( "**/*.txt" ) ); + // knownConsumer.completeScan(); + knownControl.replay(); + + invalidConsumer.beginScan( repo ); + invalidConsumer.processFile( _OS( "path/to/test-file.xml" ) ); + invalidConsumer.getId(); + invalidControl.setReturnValue( "invalid" ); + // invalidConsumer.completeScan(); + invalidControl.replay(); + + consumers.executeConsumers( repo, notIncludedTestFile ); + + knownControl.verify(); + invalidControl.verify(); + + knownControl.reset(); + invalidControl.reset(); + + File excludedTestFile = getTestFile( "target/test-repo/path/to/test-file.txt" ); + + knownConsumer.beginScan( repo ); + knownConsumer.getExcludes(); + knownControl.setReturnValue( Collections.singletonList( "**/test-file.txt" ) ); + // knownConsumer.completeScan(); + knownControl.replay(); + + invalidConsumer.beginScan( repo ); + invalidConsumer.processFile( _OS( "path/to/test-file.txt" ) ); + invalidConsumer.getId(); + invalidControl.setReturnValue( "invalid" ); + // invalidConsumer.completeScan(); + invalidControl.replay(); + + consumers.executeConsumers( repo, excludedTestFile ); + + knownControl.verify(); + invalidControl.verify(); + } + + /** + * Create an OS specific version of the filepath. + * Provide path in unix "/" format. + */ + private String _OS( String path ) + { + if ( SystemUtils.IS_OS_WINDOWS ) + { + return path.replace( '/', '\\' ); + } + return path; + } +} diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java index 3cd495920..150d347fa 100644 --- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java +++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java @@ -39,6 +39,11 @@ public class SampleKnownConsumer extends AbstractMonitoredConsumer implements KnownRepositoryContentConsumer { + /** + * @plexus.configuration default-value="unset-id" + */ + private String id = "unset-id"; + public void beginScan( ManagedRepositoryConfiguration repository ) throws ConsumerException { @@ -73,7 +78,7 @@ public class SampleKnownConsumer public String getId() { - return "sample-known"; + return id; } public boolean isPermanent() diff --git a/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.xml b/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.xml deleted file mode 100644 index 98b210894..000000000 --- a/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - ~ 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. - --> - -<component-set> - <components> - <component> - <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> - <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> - <requirements> - <requirement> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>configured</role-hint> - </requirement> - </requirements> - </component> - <component> - <role>org.codehaus.plexus.registry.Registry</role> - <role-hint>configured</role-hint> - <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation> - <configuration> - <properties> - <system/> - <xml fileName="${basedir}/src/test/resources/scanner-archiva.xml" - config-name="org.apache.maven.archiva" config-at="org.apache.maven.archiva"/> - </properties> - </configuration> - </component> - - <component> - <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role> - <role-hint>sample-known</role-hint> - <implementation>org.apache.maven.archiva.repository.scanner.SampleKnownConsumer</implementation> - </component> - </components> - -</component-set> diff --git a/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.xml b/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.xml new file mode 100644 index 000000000..f8c35f489 --- /dev/null +++ b/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.xml @@ -0,0 +1,131 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + ~ 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. + --> + +<component-set> + <components> + <component> + <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role> + <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation> + <requirements> + <requirement> + <role>org.codehaus.plexus.registry.Registry</role> + <role-hint>configured</role-hint> + </requirement> + </requirements> + </component> + <component> + <role>org.codehaus.plexus.registry.Registry</role> + <role-hint>configured</role-hint> + <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation> + <configuration> + <properties> + <system/> + <xml fileName="${basedir}/src/test/resources/scanner-archiva.xml" + config-name="org.apache.maven.archiva" config-at="org.apache.maven.archiva"/> + </properties> + </configuration> + </component> + + <!-- Known Content Consumers --> + <component> + <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role> + <role-hint>update-db-artifact</role-hint> + <implementation>org.apache.maven.archiva.repository.scanner.SampleKnownConsumer</implementation> + <configuration> + <id>update-db-artifact</id> + </configuration> + </component> + <component> + <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role> + <role-hint>create-missing-checksums</role-hint> + <implementation>org.apache.maven.archiva.repository.scanner.SampleKnownConsumer</implementation> + <configuration> + <id>create-missing-checksums</id> + </configuration> + </component> + <component> + <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role> + <role-hint>update-db-repository-metadata</role-hint> + <implementation>org.apache.maven.archiva.repository.scanner.SampleKnownConsumer</implementation> + <configuration> + <id>update-db-repository-metadata</id> + </configuration> + </component> + <component> + <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role> + <role-hint>validate-checksum</role-hint> + <implementation>org.apache.maven.archiva.repository.scanner.SampleKnownConsumer</implementation> + <configuration> + <id>validate-checksum</id> + </configuration> + </component> + <component> + <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role> + <role-hint>index-content</role-hint> + <implementation>org.apache.maven.archiva.repository.scanner.SampleKnownConsumer</implementation> + <configuration> + <id>index-content</id> + </configuration> + </component> + <component> + <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role> + <role-hint>auto-remove</role-hint> + <implementation>org.apache.maven.archiva.repository.scanner.SampleKnownConsumer</implementation> + <configuration> + <id>auto-remove</id> + </configuration> + </component> + <component> + <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role> + <role-hint>auto-rename</role-hint> + <implementation>org.apache.maven.archiva.repository.scanner.SampleKnownConsumer</implementation> + <configuration> + <id>auto-rename</id> + </configuration> + </component> + <component> + <role>org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer</role> + <role-hint>available-but-unselected</role-hint> + <implementation>org.apache.maven.archiva.repository.scanner.SampleKnownConsumer</implementation> + <configuration> + <id>available-but-unselected</id> + </configuration> + </component> + + <!-- Invalid Content Consumers --> + <component> + <role>org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer</role> + <role-hint>update-db-bad-content</role-hint> + <implementation>org.apache.maven.archiva.repository.scanner.InvalidScanConsumer</implementation> + <configuration> + <id>update-db-bad-content</id> + </configuration> + </component> + <component> + <role>org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer</role> + <role-hint>move-to-trash-then-notify</role-hint> + <implementation>org.apache.maven.archiva.repository.scanner.InvalidScanConsumer</implementation> + <configuration> + <id>move-to-trash-then-notify</id> + </configuration> + </component> + </components> + +</component-set> diff --git a/archiva-base/archiva-repository-layer/src/test/resources/scanner-archiva.xml b/archiva-base/archiva-repository-layer/src/test/resources/scanner-archiva.xml index 5a23d4efa..9afb366c3 100644 --- a/archiva-base/archiva-repository-layer/src/test/resources/scanner-archiva.xml +++ b/archiva-base/archiva-repository-layer/src/test/resources/scanner-archiva.xml @@ -75,7 +75,6 @@ </fileType> </fileTypes> <knownContentConsumers> - <knownContentConsumer>sample-known</knownContentConsumer> <knownContentConsumer>update-db-artifact</knownContentConsumer> <knownContentConsumer>create-missing-checksums</knownContentConsumer> <knownContentConsumer>update-db-repository-metadata</knownContentConsumer> |