diff options
Diffstat (limited to 'archiva-modules')
126 files changed, 1124 insertions, 434 deletions
diff --git a/archiva-modules/archiva-base/archiva-checksum/pom.xml b/archiva-modules/archiva-base/archiva-checksum/pom.xml index 09dbbd5e0..a027079a9 100644 --- a/archiva-modules/archiva-base/archiva-checksum/pom.xml +++ b/archiva-modules/archiva-base/archiva-checksum/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-checksum</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-common/pom.xml b/archiva-modules/archiva-base/archiva-common/pom.xml index f1d819e0e..a81e4c625 100644 --- a/archiva-modules/archiva-base/archiva-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-common/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-common</artifactId> diff --git a/archiva-modules/archiva-base/archiva-configuration/pom.xml b/archiva-modules/archiva-base/archiva-configuration/pom.xml index d137199bd..6eb89237e 100644 --- a/archiva-modules/archiva-base/archiva-configuration/pom.xml +++ b/archiva-modules/archiva-base/archiva-configuration/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-configuration</artifactId> @@ -169,7 +169,7 @@ </execution> </executions> <configuration> - <version>1.4.1</version> + <version>1.4.2</version> <models> <model>src/main/mdo/configuration.mdo</model> </models> diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java index f37171afa..44f25212b 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java @@ -162,6 +162,9 @@ public class DefaultArchivaConfiguration private static final String KEY = "org.apache.archiva"; + // Section used for default only configuration + private static final String KEY_DEFAULT_ONLY = "org.apache.archiva_default"; + @Override public Configuration getConfiguration() { @@ -183,6 +186,11 @@ public class DefaultArchivaConfiguration return configuration; } + private boolean hasConfigVersionChanged(Configuration current, Registry defaultOnlyConfiguration) { + return current==null || current.getVersion()==null || + !current.getVersion().trim().equals(defaultOnlyConfiguration.getString("version","").trim()); + } + @SuppressWarnings("unchecked") private Configuration load() { @@ -200,6 +208,7 @@ public class DefaultArchivaConfiguration Configuration config = new ConfigurationRegistryReader().read( subset ); + config.getRepositoryGroups(); config.getRepositoryGroupsAsMap(); if ( !config.getRepositories().isEmpty() ) @@ -363,9 +372,63 @@ public class DefaultArchivaConfiguration } } + + return config; } + /* + * Updates the checkpath list for repositories. + * + * We are replacing existing ones and adding new ones. This allows to update the list with new releases. + * + * We are also updating existing remote repositories, if they exist already. + * + * This update method should only be called, if the config version changes to avoid overwriting + * user repository settings all the time. + */ + private void updateCheckPathDefaults(Configuration config, Registry defaultConfiguration) { + List<RepositoryCheckPath> existingCheckPathList = config.getArchivaDefaultConfiguration().getDefaultCheckPaths(); + HashMap<String, RepositoryCheckPath> existingCheckPaths = new HashMap<>(); + HashMap<String, RepositoryCheckPath> newCheckPaths = new HashMap<>(); + for (RepositoryCheckPath path : config.getArchivaDefaultConfiguration().getDefaultCheckPaths()) { + existingCheckPaths.put(path.getUrl(), path); + } + List defaultCheckPathsSubsets = defaultConfiguration.getSubsetList("archivaDefaultConfiguration.defaultCheckPaths.defaultCheckPath" ); + for ( Iterator i = defaultCheckPathsSubsets.iterator(); i.hasNext(); ) + { + RepositoryCheckPath v = readRepositoryCheckPath( (Registry) i.next() ); + if (existingCheckPaths.containsKey(v.getUrl())) { + existingCheckPathList.remove(existingCheckPaths.get(v.getUrl())); + } + existingCheckPathList.add(v); + newCheckPaths.put(v.getUrl(), v); + } + // Remote repositories update + for (RemoteRepositoryConfiguration remoteRepositoryConfiguration : config.getRemoteRepositories()) { + String url = remoteRepositoryConfiguration.getUrl().toLowerCase(); + if (newCheckPaths.containsKey(url)) { + String currentPath = remoteRepositoryConfiguration.getCheckPath(); + String newPath = newCheckPaths.get(url).getPath(); + log.info("Updating connection check path for repository {}, from '{}' to '{}'.", remoteRepositoryConfiguration.getId(), + currentPath, newPath); + remoteRepositoryConfiguration.setCheckPath(newPath); + } + } + } + + private RepositoryCheckPath readRepositoryCheckPath( Registry registry ) + { + RepositoryCheckPath value = new RepositoryCheckPath(); + + String url = registry.getString( "url", value.getUrl() ); + + value.setUrl( url ); + String path = registry.getString( "path", value.getPath() ); + value.setPath( path ); + return value; + } + private Policy findPolicy( String policyId ) { if ( MapUtils.isEmpty( prePolicies ) ) @@ -439,6 +502,25 @@ public class DefaultArchivaConfiguration return registry.getSubset( KEY ); } + /* + * Reads the default only configuration into a special prefix. This allows to check for changes + * of the default configuration. + */ + private Registry readDefaultOnlyConfiguration() + { + registry.removeSubset(KEY_DEFAULT_ONLY); + try + { + registry.addConfigurationFromResource( "org/apache/archiva/configuration/default-archiva.xml", KEY_DEFAULT_ONLY); + } + catch ( RegistryException e ) + { + throw new ConfigurationRuntimeException( + "Fatal error: Unable to find the built-in default configuration and load it into the registry", e ); + } + return registry.getSubset(KEY_DEFAULT_ONLY); + } + @SuppressWarnings("unchecked") @Override public synchronized void save( Configuration configuration ) @@ -527,6 +609,9 @@ public class DefaultArchivaConfiguration section.removeSubset( "repositoryScanning.invalidContentConsumers" ); } } + if (configuration.getArchivaRuntimeConfiguration()!=null) { + section.removeSubset("archivaRuntimeConfiguration.defaultCheckPaths"); + } new ConfigurationRegistryWriter().write( configuration, section ); section.save(); @@ -736,7 +821,7 @@ public class DefaultArchivaConfiguration } /** - * upgrade from 1.3 + * Handle upgrade to newer version */ private void handleUpgradeConfiguration() throws RegistryException, IndeterminateConfigurationException @@ -781,8 +866,24 @@ public class DefaultArchivaConfiguration knowContentConsumers.add( "duplicate-artifacts" ); configuration.getRepositoryScanning().setKnownContentConsumers( knowContentConsumers ); } - // save ?? - //save( configuration ); + + Registry defaultOnlyConfiguration = readDefaultOnlyConfiguration(); + // Currently we check only for configuration version change, not certain version numbers. + if (hasConfigVersionChanged(configuration, defaultOnlyConfiguration)) { + updateCheckPathDefaults(configuration, defaultOnlyConfiguration); + String newVersion = defaultOnlyConfiguration.getString("version"); + if (newVersion==null) { + throw new IndeterminateConfigurationException("The default configuration has no version information!"); + } + configuration.setVersion(newVersion); + try { + save(configuration); + } catch (IndeterminateConfigurationException e) { + log.error("Error occured during configuration update to new version: {}", e.getMessage()); + } catch (RegistryException e) { + log.error("Error occured during configuration update to new version: {}", e.getMessage()); + } + } } @Override diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo index fc5169ff2..494af1204 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo @@ -197,6 +197,15 @@ The list of ProxyConnectorRuleConfigurations. </description> </field> + <field> + <name>archivaDefaultConfiguration</name> + <version>1.4.2+</version> + <association> + <type>ArchivaDefaultConfiguration</type> + <multiplicity>1</multiplicity> + </association> + <description>Archiva default settings.</description> + </field> </fields> <codeSegments> <codeSegment> @@ -597,12 +606,18 @@ <name>extraHeaders</name> <version>1.4.0+</version> <type>Map</type> - <description>Additionnal http headers to add to url when requesting remote repositories.</description> + <description>Additional http headers to add to url when requesting remote repositories.</description> <association xml.mapStyle="inline"> <type>String</type> <multiplicity>*</multiplicity> </association> </field> + <field> + <name>checkPath</name> + <version>1.4.2+</version> + <type>String</type> + <description>The path to check the repository availability (relative to the repository URL). Some repositories do not allow browsing, so a certain artifact must be checked.</description> + </field> </fields> <codeSegments> <codeSegment> @@ -877,6 +892,30 @@ </field> </fields> </class> + <class> + <name>RepositoryCheckPath</name> + <version>1.4.2+</version> + <fields > + <field > + <name>url</name> + <version>1.4.2+</version> + <type>String</type> + <required>true</required> + <description> + The URL for which this path should be used + </description> + </field> + <field> + <name>path</name> + <version>1.4.2+</version> + <type>String</type> + <required>true</required> + <description> + The path to use for checking the repository connection. + </description> + </field> + </fields> + </class> <!-- ____ _ @@ -1584,6 +1623,25 @@ </class> <class> + <name>ArchivaDefaultConfiguration</name> + <version>1.4.2+</version> + <description> + Archiva default settings. + </description> + <fields> + <field> + <name>defaultCheckPaths</name> + <description>The default check paths for certain remote repositories</description> + <version>1.4.2+</version> + <association> + <type>RepositoryCheckPath</type> + <multiplicity>*</multiplicity> + </association> + </field> + </fields> + </class> + + <class> <name>LdapConfiguration</name> <version>1.4.0+</version> <description> @@ -1670,7 +1728,7 @@ <name>extraProperties</name> <version>1.4.0+</version> <type>Map</type> - <description>Additionnal properties to use for ldap connection.</description> + <description>Additional properties to use for ldap connection.</description> <association xml.mapStyle="inline"> <type>String</type> <multiplicity>*</multiplicity> diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/resources/org/apache/archiva/configuration/default-archiva.xml b/archiva-modules/archiva-base/archiva-configuration/src/main/resources/org/apache/archiva/configuration/default-archiva.xml index a74f09ceb..877b6a59b 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/resources/org/apache/archiva/configuration/default-archiva.xml +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/resources/org/apache/archiva/configuration/default-archiva.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <configuration> - <version>2</version> + <version>3</version> <managedRepositories> <managedRepository> <id>internal</id> @@ -151,5 +151,17 @@ </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> diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java index 03bb489b2..15080d873 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java @@ -814,7 +814,6 @@ public class ArchivaConfigurationTest { ArchivaConfiguration archivaConfiguration = lookup( ArchivaConfiguration.class, "test-configuration" ); - archivaConfiguration.reload(); Configuration configuration = archivaConfiguration.getConfiguration(); assertConfiguration( configuration, 2, 2, 2 ); assertEquals( "check remote repositories", 2, configuration.getRemoteRepositories().size() ); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml index 44fbd4bc7..598ffa1f4 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-consumers</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-consumer-api</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml index f171e6c09..f8af4626c 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-consumers</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-consumer-archetype</artifactId> <packaging>maven-archetype</packaging> @@ -31,7 +31,8 @@ <description>Simple archetype to create archiva consumers</description> <properties> <archivaVersion>${project.version}</archivaVersion> - <archetypeVersion>2.2</archetypeVersion> + <archetypeVersion>2.4</archetypeVersion> + <mavenInvokerVersion>2.2</mavenInvokerVersion> </properties> <dependencies> <!-- Used by the archetype, so needed to be built before integration @@ -78,11 +79,19 @@ <scope>test</scope> </dependency> + <!-- for some reasons needed by the archetype --> + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + <version>1.9</version> + <scope>test</scope> + </dependency> + <!-- for some reasons this help sonar to run --> <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-junit4</artifactId> - <version>2.18.1</version> + <version>2.20</version> <scope>test</scope> </dependency> @@ -134,6 +143,13 @@ <settingsFile>${basedir}/src/test/test-settings.xml</settingsFile> <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath> </configuration> + <dependencies> + <dependency> + <groupId>org.apache.maven.shared</groupId> + <artifactId>maven-invoker</artifactId> + <version>${mavenInvokerVersion}</version> + </dependency> + </dependencies> </plugin> </plugins> </pluginManagement> @@ -152,6 +168,13 @@ <settingsFile>${basedir}/src/test/ci-test-settings.xml</settingsFile> <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath> </configuration> + <dependencies> + <dependency> + <groupId>org.apache.maven.shared</groupId> + <artifactId>maven-invoker</artifactId> + <version>${mavenInvokerVersion}</version> + </dependency> + </dependencies> </plugin> </plugins> </pluginManagement> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resourcesstatic/archetype-resources/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resourcesstatic/archetype-resources/pom.xml index b4ce052e8..fb1586e88 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resourcesstatic/archetype-resources/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resourcesstatic/archetype-resources/pom.xml @@ -235,7 +235,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>3.2</version> + <version>3.5.1</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -250,7 +250,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>2.18.1</version> + <version>2.20</version> </plugin> </plugins> </pluginManagement> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml index ea427f5c9..ff3eb2249 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-consumers</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-core-consumers</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml index dd4810e03..d71f5e1bb 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-consumers</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-lucene-consumers</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/log4j2-test.xml new file mode 100644 index 000000000..282cfa5d9 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/log4j2-test.xml @@ -0,0 +1,41 @@ +<?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> + <appenders> + <Console name="console" target="SYSTEM_OUT"> + <PatternLayout pattern="%d [%t] %-5p %c %x - %m%n"/> + </Console> + </appenders> + <loggers> + + <logger name="org.springframework" level="error"/> + + <!-- + <logger name="org.apache.http" level="debug"/> + --> + <root level="info"> + <appender-ref ref="console"/> + </root> + </loggers> +</configuration> + + diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml index 563bacba6..099d2b83c 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml @@ -23,7 +23,7 @@ <parent> <artifactId>archiva-consumers</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-metadata-consumer</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/pom.xml index 78da54d36..88ffcaf20 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-consumers</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-signature-consumers</artifactId> diff --git a/archiva-modules/archiva-base/archiva-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/pom.xml index 44bc41fc3..f4cfc9053 100644 --- a/archiva-modules/archiva-base/archiva-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-consumers</artifactId> diff --git a/archiva-modules/archiva-base/archiva-converter/pom.xml b/archiva-modules/archiva-base/archiva-converter/pom.xml index a041773ed..8d729fbc5 100644 --- a/archiva-modules/archiva-base/archiva-converter/pom.xml +++ b/archiva-modules/archiva-base/archiva-converter/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-converter</artifactId> diff --git a/archiva-modules/archiva-base/archiva-filelock/pom.xml b/archiva-modules/archiva-base/archiva-filelock/pom.xml index d094b834a..5829da297 100644 --- a/archiva-modules/archiva-base/archiva-filelock/pom.xml +++ b/archiva-modules/archiva-base/archiva-filelock/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-filelock</artifactId> diff --git a/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTimeoutTest.java b/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTimeoutTest.java index 281d13105..666efee18 100644 --- a/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTimeoutTest.java +++ b/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTimeoutTest.java @@ -30,6 +30,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.inject.Inject; import javax.inject.Named; import java.io.File; +import java.io.IOException; +import java.nio.file.FileSystemException; import java.nio.file.Files; import java.nio.file.StandardCopyOption; @@ -62,17 +64,29 @@ public class DefaultFileLockManagerTimeoutTest throws Throwable { - File file = new File( System.getProperty( "buildDirectory" ), "foo.txt" ); + try { + File file = new File(System.getProperty("buildDirectory"), "foo.txt"); - Files.deleteIfExists( file.toPath() ); + Files.deleteIfExists(file.toPath()); - File largeJar = new File( System.getProperty( "basedir" ), "src/test/cassandra-all-2.0.3.jar" ); + File largeJar = new File(System.getProperty("basedir"), "src/test/cassandra-all-2.0.3.jar"); - Lock lock = fileLockManager.writeFileLock( file ); + Lock lock = fileLockManager.writeFileLock(file); - Files.copy( largeJar.toPath(), lock.getFile().toPath(), StandardCopyOption.REPLACE_EXISTING ); + try { + Files.copy(largeJar.toPath(), lock.getFile().toPath(), StandardCopyOption.REPLACE_EXISTING); + } catch (IOException e) { + logger.warn("Copy failed "+e.getMessage()); + // On windows a FileSystemException is thrown + // We ignore this + } - lock = fileLockManager.writeFileLock( file ); + lock = fileLockManager.writeFileLock(file); + } catch (FileSystemException ex) { + logger.error("Exception from filesystem "+ex.getMessage()); + ex.printStackTrace(); + throw ex; + } } diff --git a/archiva-modules/archiva-base/archiva-indexer/pom.xml b/archiva-modules/archiva-base/archiva-indexer/pom.xml index 99b4bc2ac..4e0a4d0ce 100644 --- a/archiva-modules/archiva-base/archiva-indexer/pom.xml +++ b/archiva-modules/archiva-base/archiva-indexer/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-indexer</artifactId> diff --git a/archiva-modules/archiva-base/archiva-maven2-metadata/pom.xml b/archiva-modules/archiva-base/archiva-maven2-metadata/pom.xml index 8127dcfd8..84edf97a6 100644 --- a/archiva-modules/archiva-base/archiva-maven2-metadata/pom.xml +++ b/archiva-modules/archiva-base/archiva-maven2-metadata/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-maven2-metadata</artifactId> diff --git a/archiva-modules/archiva-base/archiva-maven2-model/pom.xml b/archiva-modules/archiva-base/archiva-maven2-model/pom.xml index 82fcdc9cd..0198eb4ca 100644 --- a/archiva-modules/archiva-base/archiva-maven2-model/pom.xml +++ b/archiva-modules/archiva-base/archiva-maven2-model/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-maven2-model</artifactId> diff --git a/archiva-modules/archiva-base/archiva-mock/pom.xml b/archiva-modules/archiva-base/archiva-mock/pom.xml index da7bbd983..229eab4ff 100644 --- a/archiva-modules/archiva-base/archiva-mock/pom.xml +++ b/archiva-modules/archiva-base/archiva-mock/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-mock</artifactId> diff --git a/archiva-modules/archiva-base/archiva-model/pom.xml b/archiva-modules/archiva-base/archiva-model/pom.xml index 7b9cb4d9a..93e3e9ad6 100755 --- a/archiva-modules/archiva-base/archiva-model/pom.xml +++ b/archiva-modules/archiva-base/archiva-model/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-model</artifactId> diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml b/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml index cb386290a..fe40f6284 100644 --- a/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml +++ b/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-plexus-bridge</artifactId> diff --git a/archiva-modules/archiva-base/archiva-policies/pom.xml b/archiva-modules/archiva-base/archiva-policies/pom.xml index 8f95a10a1..947daa4c5 100644 --- a/archiva-modules/archiva-base/archiva-policies/pom.xml +++ b/archiva-modules/archiva-base/archiva-policies/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-policies</artifactId> diff --git a/archiva-modules/archiva-base/archiva-proxy-api/pom.xml b/archiva-modules/archiva-base/archiva-proxy-api/pom.xml index d017dc809..f0d8ab086 100644 --- a/archiva-modules/archiva-base/archiva-proxy-api/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy-api/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>archiva-base</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-proxy-api</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml b/archiva-modules/archiva-base/archiva-proxy-common/pom.xml index 8fcc96dcb..5fa20f65d 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy-common/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>archiva-base</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-proxy-common</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml index c5ccbdfa0..a474f97e8 100644 --- a/archiva-modules/archiva-base/archiva-proxy/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-proxy</artifactId> diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java index f0ca4f596..d85d5016e 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java @@ -38,8 +38,10 @@ import org.apache.archiva.policies.SnapshotsPolicy; import org.apache.archiva.repository.ManagedRepositoryContent; import org.assertj.core.api.Assertions; import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.handler.AbstractHandler; import org.junit.After; import org.junit.Before; @@ -164,11 +166,13 @@ public class HttpProxyTransferTest } }; - server = new Server( 0 ); + server = new Server( ); + ServerConnector serverConnector = new ServerConnector( server, new HttpConnectionFactory()); + server.addConnector( serverConnector ); server.setHandler( handler ); server.start(); - int port = server.getConnectors()[0].getLocalPort(); + int port = serverConnector.getLocalPort(); NetworkProxyConfiguration proxyConfig = new NetworkProxyConfiguration(); proxyConfig.setHost( "localhost" ); diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml index 9ef18f1a5..a57c21fb2 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-repository-admin</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-repository-admin-api</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RemoteRepository.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RemoteRepository.java index db8021d86..fd07ce9ac 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RemoteRepository.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RemoteRepository.java @@ -19,6 +19,8 @@ package org.apache.archiva.admin.model.beans; * under the License. */ +import org.apache.commons.lang.StringUtils; + import javax.xml.bind.annotation.XmlRootElement; import java.io.Serializable; import java.util.ArrayList; @@ -45,6 +47,12 @@ public class RemoteRepository private int timeout = 60; /** + * @since 2.2.3 + * The path to use for checking availability of the remote repository + */ + private String checkPath; + + /** * Activate download of remote index if remoteIndexUrl is set too. */ private boolean downloadRemoteIndex = false; @@ -112,7 +120,7 @@ public class RemoteRepository int timeout ) { super( id, name, layout ); - this.url = url; + this.url = StringUtils.stripEnd(url,"/"); this.userName = userName; this.password = password; this.timeout = timeout; @@ -135,7 +143,7 @@ public class RemoteRepository public void setUrl( String url ) { - this.url = url; + this.url = StringUtils.stripEnd(url,"/"); } public String getUserName() @@ -314,6 +322,22 @@ public class RemoteRepository } } + public void setCheckPath(String checkPath) { + if (checkPath==null) { + this.checkPath=""; + } else if (checkPath.startsWith("/")) { + this.checkPath = StringUtils.removeStart(checkPath, "/"); + while(this.checkPath.startsWith("/")) { + this.checkPath = StringUtils.removeStart(checkPath, "/"); + } + } else { + this.checkPath = checkPath; + } + } + + public String getCheckPath() { + return checkPath; + } @Override public String toString() @@ -333,6 +357,7 @@ public class RemoteRepository sb.append( ", downloadRemoteIndexOnStartup=" ).append( downloadRemoteIndexOnStartup ); sb.append( ", extraParameters=" ).append( extraParameters ); sb.append( ", extraHeaders=" ).append( extraHeaders ); + sb.append( ", checkPath=").append(checkPath); sb.append( '}' ); return sb.toString(); } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml index cfee935fa..ae8230a51 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-repository-admin</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-repository-admin-default</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java index 9f6a20b9d..8f390530b 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java @@ -29,6 +29,7 @@ import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.ProxyConnectorConfiguration; import org.apache.archiva.configuration.RemoteRepositoryConfiguration; +import org.apache.archiva.configuration.RepositoryCheckPath; import org.apache.archiva.metadata.model.facets.AuditEvent; import org.apache.commons.lang.StringUtils; import org.apache.maven.index.NexusIndexer; @@ -137,6 +138,7 @@ public class DefaultRemoteRepositoryAdmin remoteRepository.setDescription( repositoryConfiguration.getDescription() ); remoteRepository.setExtraHeaders( repositoryConfiguration.getExtraHeaders() ); remoteRepository.setExtraParameters( repositoryConfiguration.getExtraParameters() ); + remoteRepository.setCheckPath(repositoryConfiguration.getCheckPath()); remoteRepositories.add( remoteRepository ); } return remoteRepositories; @@ -170,7 +172,19 @@ public class DefaultRemoteRepositoryAdmin } //MRM-752 - url needs trimming - remoteRepository.setUrl( StringUtils.trim( remoteRepository.getUrl() ) ); + //MRM-1940 - URL should not end with a slash + remoteRepository.setUrl( StringUtils.stripEnd(StringUtils.trim( remoteRepository.getUrl() ), "/")); + + if (StringUtils.isEmpty(remoteRepository.getCheckPath())) { + String checkUrl = remoteRepository.getUrl().toLowerCase(); + for (RepositoryCheckPath path : getArchivaConfiguration ().getConfiguration().getArchivaDefaultConfiguration().getDefaultCheckPaths()) { + log.debug("Checking path for urls: {} <-> {}", checkUrl, path.getUrl()); + if (checkUrl.startsWith(path.getUrl())) { + remoteRepository.setCheckPath(path.getPath()); + break; + } + } + } RemoteRepositoryConfiguration remoteRepositoryConfiguration = getRemoteRepositoryConfiguration( remoteRepository ); @@ -365,6 +379,7 @@ public class DefaultRemoteRepositoryAdmin remoteRepositoryConfiguration.setDescription( remoteRepository.getDescription() ); remoteRepositoryConfiguration.setExtraHeaders( remoteRepository.getExtraHeaders() ); remoteRepositoryConfiguration.setExtraParameters( remoteRepository.getExtraParameters() ); + remoteRepositoryConfiguration.setCheckPath(remoteRepository.getCheckPath()); return remoteRepositoryConfiguration; } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java index 3da5a37ea..3ce727c71 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java @@ -42,6 +42,7 @@ import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.inject.Named; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.List; @@ -389,6 +390,7 @@ public class DefaultRedbackRuntimeConfigurationAdmin properties.remove( UserConfigurationKeys.LDAP_AUTHENTICATION_METHOD ); properties.remove( UserConfigurationKeys.LDAP_WRITABLE ); properties.remove( UserConfigurationKeys.LDAP_GROUPS_USE_ROLENAME ); + // cleanup groups <-> role mapping /**for ( Map.Entry<String, String> entry : new HashMap<String, String>( properties ).entrySet() ) { @@ -690,10 +692,13 @@ public class DefaultRedbackRuntimeConfigurationAdmin @Override public List<String> getList( String key ) { + RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration(); + if (conf.getConfigurationProperties().containsKey(key)) { + return Arrays.asList(conf.getConfigurationProperties().get(key).split(",")); + } + List<String> value = userConfiguration.getList( key ); - RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration(); - // TODO concat values conf.getConfigurationProperties().put( key, "" ); try { diff --git a/archiva-modules/archiva-base/archiva-repository-admin/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/pom.xml index 26897e99f..f7047344c 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-repository-admin</artifactId> <name>Archiva Base :: Repository Admin</name> diff --git a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml index 5e3bffa99..2bfb418d6 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-repository-layer</artifactId> diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml b/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml index f56113330..8bb08b9f7 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml @@ -23,7 +23,7 @@ <parent> <artifactId>archiva-base</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-repository-scanner</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-security-common/pom.xml b/archiva-modules/archiva-base/archiva-security-common/pom.xml index ce06d77d4..00823b572 100644 --- a/archiva-modules/archiva-base/archiva-security-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-security-common/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>archiva-base</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-security-common</artifactId> diff --git a/archiva-modules/archiva-base/archiva-test-utils/pom.xml b/archiva-modules/archiva-base/archiva-test-utils/pom.xml index a8e43432d..bb9700158 100644 --- a/archiva-modules/archiva-base/archiva-test-utils/pom.xml +++ b/archiva-modules/archiva-base/archiva-test-utils/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>archiva-base</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-test-utils</artifactId> diff --git a/archiva-modules/archiva-base/archiva-transaction/pom.xml b/archiva-modules/archiva-base/archiva-transaction/pom.xml index 5aa07fa99..f15b31f09 100644 --- a/archiva-modules/archiva-base/archiva-transaction/pom.xml +++ b/archiva-modules/archiva-base/archiva-transaction/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-transaction</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-base/archiva-xml-tools/pom.xml b/archiva-modules/archiva-base/archiva-xml-tools/pom.xml index ec4ba217f..b91c663bb 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/pom.xml +++ b/archiva-modules/archiva-base/archiva-xml-tools/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-xml-tools</artifactId> diff --git a/archiva-modules/archiva-base/pom.xml b/archiva-modules/archiva-base/pom.xml index dd9fa56e5..e78f79b76 100644 --- a/archiva-modules/archiva-base/pom.xml +++ b/archiva-modules/archiva-base/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-modules</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-base</artifactId> diff --git a/archiva-modules/archiva-karaf/archiva-features/pom.xml b/archiva-modules/archiva-karaf/archiva-features/pom.xml index 718b030b0..aadfb3677 100644 --- a/archiva-modules/archiva-karaf/archiva-features/pom.xml +++ b/archiva-modules/archiva-karaf/archiva-features/pom.xml @@ -21,7 +21,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-karaf</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.archiva.karaf</groupId> diff --git a/archiva-modules/archiva-karaf/pom.xml b/archiva-modules/archiva-karaf/pom.xml index e813c1442..ff50a8dd0 100644 --- a/archiva-modules/archiva-karaf/pom.xml +++ b/archiva-modules/archiva-karaf/pom.xml @@ -21,7 +21,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-modules</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-karaf</artifactId> diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-api/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-api/pom.xml index 3272ce41c..38b1af312 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-api/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-api/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>archiva-scheduler</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-scheduler-api</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml index bad98fcce..33f967fc7 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>archiva-scheduler</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-scheduler-indexing</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java index 6a1210d1a..7e95b4f26 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java @@ -18,11 +18,11 @@ package org.apache.archiva.scheduler.indexing; * under the License. */ -import junit.framework.TestCase; import org.apache.archiva.admin.model.beans.RemoteRepository; import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.common.utils.FileUtil; +import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanQuery; import org.apache.maven.index.FlatSearchRequest; @@ -30,12 +30,12 @@ import org.apache.maven.index.FlatSearchResponse; import org.apache.maven.index.MAVEN; import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.expr.StringSearchExpression; -import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.servlet.DefaultServlet; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; -import static org.assertj.core.api.Assertions.assertThat; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -50,7 +50,8 @@ import java.io.File; import java.io.IOException; import java.util.Arrays; import java.util.concurrent.TimeUnit; -import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; + +import static org.assertj.core.api.Assertions.assertThat; /** * @author Olivier Lamy @@ -61,6 +62,7 @@ public class DownloadRemoteIndexTaskTest { private Server server; + private ServerConnector serverConnector; private int port; @@ -81,12 +83,12 @@ public class DownloadRemoteIndexTaskTest public void initialize() throws Exception { - server = new Server( 0 ); + server = new Server( ); + serverConnector = new ServerConnector( server, new HttpConnectionFactory()); + server.addConnector( serverConnector ); createContext( server, new File( "src/test/" ) ); - this.server.start(); - Connector connector = this.server.getConnectors()[0]; - this.port = connector.getLocalPort(); + this.port = serverConnector.getLocalPort(); log.info( "start server on port {}", this.port ); nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); } diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/resources/log4j2-test.xml index 6e3ef0ff3..c7f86dd6b 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/resources/log4j2-test.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/resources/log4j2-test.xml @@ -19,7 +19,7 @@ --> -<configuration status="debug"> +<configuration> <appenders> <Console name="console" target="SYSTEM_OUT"> <PatternLayout pattern="%d [%t] %-5p %c %x - %m%n"/> @@ -29,7 +29,7 @@ <logger name="org.springframework" level="error"/> - <logger name="org.apache.archiva.scheduler.indexing" level="debug"/> + <logger name="org.apache.archiva.scheduler.indexing" level="info"/> <!-- <logger name="org.apache.http" level="debug"/> --> diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml index 369ac9a59..122542a6b 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>archiva-scheduler</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-scheduler-repository-api</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml index 2102d954e..881d68981 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>archiva-scheduler</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-scheduler-repository</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/archiva-scheduler/pom.xml b/archiva-modules/archiva-scheduler/pom.xml index 88b411657..91eaa582a 100644 --- a/archiva-modules/archiva-scheduler/pom.xml +++ b/archiva-modules/archiva-scheduler/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-modules</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-scheduler</artifactId> diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml index 00e6fe9fe..cdbae6562 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>archiva-rest</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-rest-api</artifactId> <!-- DO NOT USE bundle packaging generated documentation is not included in the jar !!! --> diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml index 3436e6af6..456e3a1cc 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-rest</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-rest-services</artifactId> <packaging>bundle</packaging> @@ -396,24 +396,14 @@ </dependency> <dependency> - <groupId>org.apache.tomcat.embed</groupId> - <artifactId>tomcat-embed-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.tomcat</groupId> - <artifactId>tomcat-juli</artifactId> - <scope>test</scope> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-server</artifactId> + <version>${jettyVersion}</version> </dependency> <dependency> - <groupId>org.apache.tomcat.embed</groupId> - <artifactId>tomcat-embed-logging-juli</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.tomcat</groupId> - <artifactId>tomcat-jsp-api</artifactId> - <scope>test</scope> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-servlet</artifactId> + <version>${jettyVersion}</version> </dependency> <dependency> <groupId>xerces</groupId> @@ -467,6 +457,10 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> + <includes> + <include>**/*Tests.java</include> + <include>**/*Test.java</include> + </includes> <argLine>-Xmx512m -Xms512m -server -XX:MaxPermSize=256m ${jacocoagent}</argLine> <systemPropertyVariables> <appserver.base>${project.build.directory}/appserver-base</appserver.base> diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java index 682c367bb..e2efea419 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java @@ -1093,15 +1093,16 @@ public class DefaultBrowseService } } - protected List<ArtifactContentEntry> readFileEntries( File file, String filterPath, String repoId ) + protected List<ArtifactContentEntry> readFileEntries(final File file, final String filterPath, final String repoId ) throws IOException { + String cleanedfilterPath = filterPath==null ? "" : (StringUtils.startsWith(filterPath, "/") ? + StringUtils.substringAfter(filterPath, "/") : filterPath); Map<String, ArtifactContentEntry> artifactContentEntryMap = new HashMap<>(); - int filterDepth = StringUtils.countMatches( filterPath, "/" ); - /*if ( filterDepth == 0 ) - { - filterDepth = 1; - }*/ + int filterDepth = StringUtils.countMatches( cleanedfilterPath, "/" ); + if (!StringUtils.endsWith(cleanedfilterPath,"/") && !StringUtils.isEmpty(cleanedfilterPath)) { + filterDepth++; + } JarFile jarFile = new JarFile( file ); try { @@ -1113,7 +1114,7 @@ public class DefaultBrowseService StringUtils.substringBeforeLast( currentEntry.getName(), "/" ) : currentEntry.getName(); String entryRootPath = getRootPath( cleanedEntryName ); int depth = StringUtils.countMatches( cleanedEntryName, "/" ); - if ( StringUtils.isEmpty( filterPath ) // + if ( StringUtils.isEmpty( cleanedfilterPath ) // && !artifactContentEntryMap.containsKey( entryRootPath ) // && depth == filterDepth ) { @@ -1124,7 +1125,7 @@ public class DefaultBrowseService } else { - if ( StringUtils.startsWith( cleanedEntryName, filterPath ) // + if ( StringUtils.startsWith( cleanedEntryName, cleanedfilterPath ) // && ( depth == filterDepth || ( !currentEntry.isDirectory() && depth == filterDepth ) ) ) { artifactContentEntryMap.put( cleanedEntryName, new ArtifactContentEntry( cleanedEntryName, @@ -1134,7 +1135,7 @@ public class DefaultBrowseService } } - if ( StringUtils.isNotEmpty( filterPath ) ) + if ( StringUtils.isNotEmpty( cleanedfilterPath ) ) { Map<String, ArtifactContentEntry> filteredArtifactContentEntryMap = new HashMap<>(); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java index 4cab81d47..208400c83 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java @@ -18,26 +18,25 @@ package org.apache.archiva.rest.services; * under the License. */ -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - import org.apache.archiva.rest.api.services.ArchivaRestServiceException; -import org.springframework.stereotype.Service; - -import javax.inject.Inject; - import org.apache.archiva.rest.api.services.PluginsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; import org.springframework.core.io.Resource; +import org.springframework.stereotype.Service; + +import javax.inject.Inject; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; /** * @author Eric Barboni * @since 1.4.0 */ -@Service("pluginsService#rest") +@Service( "pluginsService#rest" ) public class DefaultPluginsServices implements PluginsService { @@ -46,7 +45,7 @@ public class DefaultPluginsServices private List<String> adminFeatures = new ArrayList<>(); - private ApplicationContext appCont; + private ApplicationContext applicationContext; private Logger log = LoggerFactory.getLogger( getClass() ); @@ -56,11 +55,14 @@ public class DefaultPluginsServices public DefaultPluginsServices( ApplicationContext applicationContext ) throws IOException { - this.appCont = applicationContext; + log.debug( "init DefaultPluginsServices" ); + this.applicationContext = applicationContext; // rebuild - feed( repositoryType, "repository" ); - feed( adminFeatures, "features" ); + repositoryType = feed( "repository" ); + log.debug( "feed {}:{}", "repository" , repositoryType); + adminFeatures = feed( "features" ); + log.debug( "feed {}:{}", "features", adminFeatures ); StringBuilder sb = new StringBuilder(); for ( String repoType : repositoryType ) { @@ -81,27 +83,29 @@ public class DefaultPluginsServices } } - private void feed( List<String> repository, String key ) + private List<String> feed( String key ) throws IOException { log.info( "Feeding: {}", key ); - repository.clear(); - Resource[] xmlResources; - - xmlResources = appCont.getResources( "/**/" + key + "/**/main.js" ); + Resource[] xmlResources = applicationContext.getResources( "/**/" + key + "/**/main.js" ); + if (xmlResources == null) + { + return Collections.emptyList(); + } + List<String> repository = new ArrayList<>( xmlResources.length ); for ( Resource rc : xmlResources ) { String tmp = rc.getURL().toString(); tmp = tmp.substring( tmp.lastIndexOf( key ) + key.length() + 1, tmp.length() - 8 ); repository.add( "archiva/admin/" + key + "/" + tmp + "/main" ); } - + return repository; } @Override public String getAdminPlugins() throws ArchivaRestServiceException { - return adminPlugins; + return adminPlugins; } } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java index 5a7948719..59358dddf 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java @@ -38,11 +38,14 @@ import org.apache.maven.wagon.proxy.ProxyInfo; import org.apache.maven.wagon.repository.Repository; import org.springframework.stereotype.Service; +import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.ws.rs.core.Response; import java.net.URL; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * @author Olivier Lamy @@ -51,8 +54,7 @@ import java.util.List; @Service( "remoteRepositoriesService#rest" ) public class DefaultRemoteRepositoriesService extends AbstractRestService - implements RemoteRepositoriesService -{ + implements RemoteRepositoriesService { @Inject private RemoteRepositoryAdmin remoteRepositoryAdmin; @@ -67,32 +69,26 @@ public class DefaultRemoteRepositoriesService int checkReadTimeout = 10000; int checkTimeout = 9000; + @Override public List<RemoteRepository> getRemoteRepositories() - throws ArchivaRestServiceException - { - try - { + throws ArchivaRestServiceException { + try { List<RemoteRepository> remoteRepositories = remoteRepositoryAdmin.getRemoteRepositories(); return remoteRepositories == null ? Collections.<RemoteRepository>emptyList() : remoteRepositories; - } - catch ( RepositoryAdminException e ) - { - log.error( e.getMessage(), e ); - throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName(), e ); + } catch (RepositoryAdminException e) { + log.error(e.getMessage(), e); + throw new ArchivaRestServiceException(e.getMessage(), e.getFieldName(), e); } } @Override - public RemoteRepository getRemoteRepository( String repositoryId ) - throws ArchivaRestServiceException - { + public RemoteRepository getRemoteRepository(String repositoryId) + throws ArchivaRestServiceException { List<RemoteRepository> remoteRepositories = getRemoteRepositories(); - for ( RemoteRepository repository : remoteRepositories ) - { - if ( StringUtils.equals( repositoryId, repository.getId() ) ) - { + for (RemoteRepository repository : remoteRepositories) { + if (StringUtils.equals(repositoryId, repository.getId())) { return repository; } } @@ -100,121 +96,106 @@ public class DefaultRemoteRepositoriesService } @Override - public Boolean deleteRemoteRepository( String repositoryId ) - throws ArchivaRestServiceException - { - try - { - return remoteRepositoryAdmin.deleteRemoteRepository( repositoryId, getAuditInformation() ); - } - catch ( RepositoryAdminException e ) - { - log.error( e.getMessage(), e ); - throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName(), e ); + public Boolean deleteRemoteRepository(String repositoryId) + throws ArchivaRestServiceException { + try { + return remoteRepositoryAdmin.deleteRemoteRepository(repositoryId, getAuditInformation()); + } catch (RepositoryAdminException e) { + log.error(e.getMessage(), e); + throw new ArchivaRestServiceException(e.getMessage(), e.getFieldName(), e); } } @Override - public Boolean addRemoteRepository( RemoteRepository remoteRepository ) - throws ArchivaRestServiceException - { - try - { - return remoteRepositoryAdmin.addRemoteRepository( remoteRepository, getAuditInformation() ); - } - catch ( RepositoryAdminException e ) - { - log.error( e.getMessage(), e ); - throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName(), e ); + public Boolean addRemoteRepository(RemoteRepository remoteRepository) + throws ArchivaRestServiceException { + try { + return remoteRepositoryAdmin.addRemoteRepository(remoteRepository, getAuditInformation()); + } catch (RepositoryAdminException e) { + log.error(e.getMessage(), e); + throw new ArchivaRestServiceException(e.getMessage(), e.getFieldName(), e); } } @Override - public Boolean updateRemoteRepository( RemoteRepository remoteRepository ) - throws ArchivaRestServiceException - { - try - { - return remoteRepositoryAdmin.updateRemoteRepository( remoteRepository, getAuditInformation() ); - } - catch ( RepositoryAdminException e ) - { - log.error( e.getMessage(), e ); - throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName(), e ); + public Boolean updateRemoteRepository(RemoteRepository remoteRepository) + throws ArchivaRestServiceException { + try { + return remoteRepositoryAdmin.updateRemoteRepository(remoteRepository, getAuditInformation()); + } catch (RepositoryAdminException e) { + log.error(e.getMessage(), e); + throw new ArchivaRestServiceException(e.getMessage(), e.getFieldName(), e); } } @Override - public Boolean checkRemoteConnectivity( String repositoryId ) - throws ArchivaRestServiceException - { - try - { - RemoteRepository remoteRepository = remoteRepositoryAdmin.getRemoteRepository( repositoryId ); - if ( remoteRepository == null ) - { - log.warn( "ignore scheduleDownloadRemote for repo with id {} as not exists", repositoryId ); + public Boolean checkRemoteConnectivity(String repositoryId) + throws ArchivaRestServiceException { + try { + RemoteRepository remoteRepository = remoteRepositoryAdmin.getRemoteRepository(repositoryId); + if (remoteRepository == null) { + log.warn("ignore scheduleDownloadRemote for repo with id {} as not exists", repositoryId); return Boolean.FALSE; } NetworkProxy networkProxy = null; - if ( StringUtils.isNotBlank( remoteRepository.getRemoteDownloadNetworkProxyId() ) ) - { - networkProxy = networkProxyAdmin.getNetworkProxy( remoteRepository.getRemoteDownloadNetworkProxyId() ); - if ( networkProxy == null ) - { + if (StringUtils.isNotBlank(remoteRepository.getRemoteDownloadNetworkProxyId())) { + networkProxy = networkProxyAdmin.getNetworkProxy(remoteRepository.getRemoteDownloadNetworkProxyId()); + if (networkProxy == null) { log.warn( - "your remote repository is configured to download remote index trought a proxy we cannot find id:{}", - remoteRepository.getRemoteDownloadNetworkProxyId() ); + "your remote repository is configured to download remote index trought a proxy we cannot find id:{}", + remoteRepository.getRemoteDownloadNetworkProxyId()); } } - String wagonProtocol = new URL( remoteRepository.getUrl() ).getProtocol(); + String wagonProtocol = new URL(remoteRepository.getUrl()).getProtocol(); final Wagon wagon = - wagonFactory.getWagon( new WagonFactoryRequest( wagonProtocol, remoteRepository.getExtraHeaders() ) // - .networkProxy( networkProxy ) ); + wagonFactory.getWagon(new WagonFactoryRequest(wagonProtocol, remoteRepository.getExtraHeaders()) // + .networkProxy(networkProxy)); // hardcoded value as it's a check of the remote repo connectivity - wagon.setReadTimeout( checkReadTimeout ); - wagon.setTimeout( checkTimeout ); + wagon.setReadTimeout(checkReadTimeout); + wagon.setTimeout(checkTimeout); - if ( wagon instanceof AbstractHttpClientWagon ) - { + if (wagon instanceof AbstractHttpClientWagon) { HttpMethodConfiguration httpMethodConfiguration = new HttpMethodConfiguration() // - .setUsePreemptive( true ) // - .setReadTimeout( checkReadTimeout ); - HttpConfiguration httpConfiguration = new HttpConfiguration().setGet( httpMethodConfiguration ); - AbstractHttpClientWagon.class.cast( wagon ).setHttpConfiguration( httpConfiguration ); + .setUsePreemptive(true) // + .setReadTimeout(checkReadTimeout); + HttpConfiguration httpConfiguration = new HttpConfiguration().setGet(httpMethodConfiguration); + AbstractHttpClientWagon.class.cast(wagon).setHttpConfiguration(httpConfiguration); } - + ProxyInfo proxyInfo = null; - if ( networkProxy != null ) - { + if (networkProxy != null) { proxyInfo = new ProxyInfo(); - proxyInfo.setType( networkProxy.getProtocol() ); - proxyInfo.setHost( networkProxy.getHost() ); - proxyInfo.setPort( networkProxy.getPort() ); - proxyInfo.setUserName( networkProxy.getUsername() ); - proxyInfo.setPassword( networkProxy.getPassword() ); - } - - wagon.connect( new Repository( remoteRepository.getId(), remoteRepository.getUrl() ), proxyInfo ); - - // we only check connectivity as remote repo can be empty - // MRM-1909: Wagon implementation appends a slash already - wagon.getFileList( "" ); + proxyInfo.setType(networkProxy.getProtocol()); + proxyInfo.setHost(networkProxy.getHost()); + proxyInfo.setPort(networkProxy.getPort()); + proxyInfo.setUserName(networkProxy.getUsername()); + proxyInfo.setPassword(networkProxy.getPassword()); + } + String url = StringUtils.stripEnd(remoteRepository.getUrl(), "/"); + wagon.connect(new Repository(remoteRepository.getId(), url), proxyInfo); + + // MRM-1933, there are certain servers that do not allow browsing + if (!(StringUtils.isEmpty(remoteRepository.getCheckPath()) || + "/".equals(remoteRepository.getCheckPath()))) { + return wagon.resourceExists(remoteRepository.getCheckPath()); + } else { + // we only check connectivity as remote repo can be empty + // MRM-1909: Wagon implementation appends a slash already + wagon.getFileList(""); + } return Boolean.TRUE; - } - catch ( TransferFailedException e ) - { - log.info( "TransferFailedException :{}", e.getMessage() ); + } catch (TransferFailedException e) { + log.info("TransferFailedException :{}", e.getMessage()); + return Boolean.FALSE; + } catch (Exception e) { + // This service returns either true or false, Exception cannot be handled by the clients + log.debug("Exception occured on connectivity test.", e); + log.info("Connection exception: {}", e.getMessage()); return Boolean.FALSE; - } - catch ( Exception e ) - { - throw new ArchivaRestServiceException( e.getMessage(), - Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); } } @@ -234,4 +215,5 @@ public class DefaultRemoteRepositoriesService public void setCheckTimeout(int checkTimeout) { this.checkTimeout = checkTimeout; } + } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml index 77d365cbc..c9e677db6 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml @@ -52,6 +52,7 @@ <ref bean="jsonProvider"/> <ref bean="authenticationInterceptor#rest"/> <ref bean="permissionInterceptor#rest"/> + <ref bean="requestValidationInterceptor#rest" /> <ref bean="archivaRestServiceExceptionMapper"/> </jaxrs:providers> diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java index 2453e6af8..0d924f723 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java @@ -138,6 +138,7 @@ public abstract class AbstractArchivaRestTest { WebClient.client( service ).header( "Authorization", authzHeader ); } + WebClient.client(service).header("Referer","http://localhost:"+port); WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000 ); WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE ); WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE ); @@ -200,6 +201,7 @@ public abstract class AbstractArchivaRestTest Collections.singletonList( new JacksonJaxbJsonProvider() ) ); WebClient.client( service ).header( "Authorization", authorizationHeader ); + WebClient.client(service).header("Referer","http://localhost:"+port); WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 ); WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE ); WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE ); @@ -214,6 +216,7 @@ public abstract class AbstractArchivaRestTest Collections.singletonList( new JacksonJaxbJsonProvider() ) ); WebClient.client( service ).header( "Authorization", authorizationHeader ); + WebClient.client(service).header("Referer","http://localhost:"+port); WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 ); WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE ); WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE ); @@ -231,6 +234,8 @@ public abstract class AbstractArchivaRestTest WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE ); WebClient.client( service ).header( "Authorization", authorizationHeader ); + WebClient.client(service).header("Referer","http://localhost:"+port); + WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 ); return service; } @@ -246,6 +251,7 @@ public abstract class AbstractArchivaRestTest WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE ); WebClient.client( service ).header( "Authorization", authorizationHeader ); + WebClient.client(service).header("Referer","http://localhost:"+port); WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 ); return service; } @@ -262,6 +268,8 @@ public abstract class AbstractArchivaRestTest { WebClient.client( service ).header( "Authorization", authzHeader ); } + // Set the Referer header to your archiva server url + WebClient.client(service).header("Referer","http://localhost:"+port); WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000 ); if ( useXml ) @@ -291,6 +299,8 @@ public abstract class AbstractArchivaRestTest { WebClient.client( service ).header( "Authorization", authzHeader ); } + // Set the Referer header to your archiva server url + WebClient.client(service).header("Referer","http://localhost:"+port); // to configure read timeout WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000 ); // if you want to use json as exchange format xml is supported too @@ -312,6 +322,7 @@ public abstract class AbstractArchivaRestTest { WebClient.client( service ).header( "Authorization", authzHeader ); } + WebClient.client(service).header("Referer","http://localhost:"+port); WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000 ); WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE ); WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE ); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArtifactContentEntriesTests.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArtifactContentEntriesTests.java index 721cfb277..461cb8018 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArtifactContentEntriesTests.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArtifactContentEntriesTests.java @@ -20,6 +20,7 @@ package org.apache.archiva.rest.services; import junit.framework.TestCase; import org.apache.archiva.rest.api.model.ArtifactContentEntry; +import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -34,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; /** * @author Olivier Lamy */ -@RunWith( JUnit4.class ) +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class ArtifactContentEntriesTests extends TestCase { diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java index 3d284e452..d3d667283 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java @@ -161,10 +161,62 @@ public class RemoteRepositoriesServiceTest } + /* + * Check maven repository + */ + @Test + public void checkRemoteConnectivity2() + throws Exception { + RemoteRepositoriesService service = getRemoteRepositoriesService(); + + WebClient.client(service).header("Authorization", authorizationHeader); + + int initialSize = service.getRemoteRepositories().size(); + + service.addRemoteRepository(getRemoteMavenRepository()); + + assertTrue(service.checkRemoteConnectivity("id-maven1")); + + } + + + /* + * Check oracle repository that allows not browsing (MRM-1933) + */ + @Test + public void checkRemoteConnectivity3() + throws Exception { + RemoteRepositoriesService service = getRemoteRepositoriesService(); + + WebClient.client(service).header("Authorization", authorizationHeader); + WebClient.client(service).accept("application/json"); + + int initialSize = service.getRemoteRepositories().size(); + + service.addRemoteRepository(getRemoteOracleRepository()); + + assertTrue(service.checkRemoteConnectivity("id-oracle")); + + } + RemoteRepository getRemoteRepository() { return new RemoteRepository( "id-new", "new one", "http://foo.com", "default", "foo", "foopassword", 120, "cool repo" ); } + + RemoteRepository getRemoteMavenRepository() + { + return new RemoteRepository( "id-maven1", "Maven1", "http://repo.maven.apache.org/maven2", "default", "foo", "foopassword", 120, + "cool repo3" ); + } + + + RemoteRepository getRemoteOracleRepository() + { + return new RemoteRepository( "id-oracle", "Oracle", "http://download.oracle.com/maven", "default", "foo", "foopassword", 120, + "cool repo4" ); + } + } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoryGroupServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoryGroupServiceTest.java index 017505859..1fee4a342 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoryGroupServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoryGroupServiceTest.java @@ -39,6 +39,8 @@ public class RepositoryGroupServiceTest { RepositoryGroupService service = getRepositoryGroupService(); WebClient.client( service ).header( "Authorization", authorizationHeader ); + WebClient.client(service).header("Referer","http://localhost:"+port); + WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 ); assertTrue( service.getRepositoriesGroups().isEmpty() ); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml index 27d764d58..ceea546a8 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml @@ -84,6 +84,21 @@ <constructor-arg value="${appserver.base}/jcr"/> </bean> + <bean name="commons-configuration" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry" + init-method="initialize"> + <property name="properties"> + <value> + <![CDATA[ + <configuration> + <system/> + <properties fileName="${basedir}/src/test/resources/security.properties" config-optional="true" + config-at="org.apache.archiva.redback"/> + </configuration> + ]]> + </value> + </property> + </bean> + <alias name="userConfiguration#redback" alias="userConfiguration#default"/> <alias name="authorizer#rbac" alias="authorizer#default"/> diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml index a7e013916..1c258ef1e 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml @@ -19,7 +19,7 @@ --> -<configuration status="debug"> +<configuration> <!-- status="debug" --> <appenders> <Console name="console" target="SYSTEM_OUT"> <PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%L] [%t] %-5level %logger{3} - %msg%n}" /> @@ -27,13 +27,10 @@ </appenders> <loggers> - <logger name="org.codehaus.redback.rest.services" level="error"/> - + <logger name="org.apache.archiva.redback.rest.services" level="error"/> <logger name="JPOX" level="error"/> - - + <logger name="org.apache.archiva.rest.services" level="info"/> <logger name="org.springframework" level="error"/> - <logger name="org.apache.commons.configuration" level="error"/> <root level="info"> diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/security.properties b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/security.properties new file mode 100644 index 000000000..3607f9f6f --- /dev/null +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/security.properties @@ -0,0 +1,19 @@ +# +# 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. +# +rest.csrffilter.disableTokenValidation=true diff --git a/archiva-modules/archiva-web/archiva-rest/pom.xml b/archiva-modules/archiva-web/archiva-rest/pom.xml index 39248b3e9..f1f4a594f 100644 --- a/archiva-modules/archiva-web/archiva-rest/pom.xml +++ b/archiva-modules/archiva-web/archiva-rest/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-web</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-rest</artifactId> <name>Archiva Web :: REST support</name> diff --git a/archiva-modules/archiva-web/archiva-rss/pom.xml b/archiva-modules/archiva-web/archiva-rss/pom.xml index 908e584af..a7bcf7602 100644 --- a/archiva-modules/archiva-web/archiva-rss/pom.xml +++ b/archiva-modules/archiva-web/archiva-rss/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>archiva-web</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-rss</artifactId> diff --git a/archiva-modules/archiva-web/archiva-security/pom.xml b/archiva-modules/archiva-web/archiva-security/pom.xml index 3f20162c8..064af5676 100644 --- a/archiva-modules/archiva-web/archiva-security/pom.xml +++ b/archiva-modules/archiva-web/archiva-security/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-web</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-security</artifactId> @@ -47,7 +47,7 @@ </dependency> <dependency> <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> + <artifactId>javax.servlet-api</artifactId> <scope>provided</scope> </dependency> <dependency> diff --git a/archiva-modules/archiva-web/archiva-test-mocks/pom.xml b/archiva-modules/archiva-web/archiva-test-mocks/pom.xml index aafcdf65b..b25a684a1 100644 --- a/archiva-modules/archiva-web/archiva-test-mocks/pom.xml +++ b/archiva-modules/archiva-web/archiva-test-mocks/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-web</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-test-mocks</artifactId> diff --git a/archiva-modules/archiva-web/archiva-web-common/pom.xml b/archiva-modules/archiva-web/archiva-web-common/pom.xml index 971da5c73..4b79066c4 100644 --- a/archiva-modules/archiva-web/archiva-web-common/pom.xml +++ b/archiva-modules/archiva-web/archiva-web-common/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-web</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-web-common</artifactId> @@ -186,11 +186,6 @@ <artifactId>audit</artifactId> </dependency> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <scope>provided</scope> - </dependency> - <dependency> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> </dependency> @@ -234,13 +229,18 @@ </dependency> <dependency> <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> + <artifactId>javax.servlet-api</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> </dependency> <dependency> + <groupId>javax.mail</groupId> + <artifactId>mail</artifactId> + <scope>provided</scope> + </dependency> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties index 5b8e0c7b7..eb4dc0351 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties @@ -172,8 +172,9 @@ remoterepository.download.remote.full=Full download ? remoterepository.download.remote.scheduled=Download Remote Index of repository {0} scheduled. remoterepository.delete.confirm=Are you sure to delete Remote Repository {0} ? remoterepository.deleted=Remote repository {0}\u00c2\u00a0deleted. -remoteRepository.extraParametersEntries=Additionnal url parameters -remoteRepository.extraHeadersEntries=Additionnal Http Headers +remoteRepository.extraParametersEntries=Additional url parameters +remoteRepository.extraHeadersEntries=Additional Http Headers +remoteRepository.checkPath=Connection Check Path remoteRepository.timeout.help.title=Download Timeout remoteRepository.timeout.help.content=Timeout in secondes for downloading files from remote repository. remoteRepository.userName.help.title=Username @@ -197,6 +198,11 @@ remoteRepository.extraParametersEntries.help.content=Key/Value pair you want to remoteRepository.extraHeadersEntries.help.title=Extra HTTP Headers remoteRepository.extraHeadersEntries.help.content=Key/Value pair HTTP headers you want to add when asking the remote repository. remoterepository.remotecheck=Remote Check +remoteRepository.checkPath.help.title=Connection Check Path +remoteRepository.checkPath.help.content=Path relative to the repository URL that is used to check the connection to the \ + remote repository. Some repositories may not allow to browse the root directory. So if this path is set, the repository is \ + considered online if the resources exists. + @@ -614,40 +620,40 @@ archiva.redback.usermanager.ldap=LDAP User Manager archiva.redback.usermanager.jdo=Database User Manager archiva.redback.usermanager.jpa=Database JPA User Manager redback.runtime.properties.help.title=Property Description -security.policy.password.rule.alphacount.enabled.help.content=Minimum of letter characters in the password. -security.policy.password.rule.reuse.enabled.help.content=Prevent reuse of previous passwords. +security.policy.password.rule.alphacount.enabled.help.content=If true, minimum number of letter characters in new passwords will be checked. +security.policy.password.rule.reuse.enabled.help.content=If true, reuse of passwords will be checked. email.validation.subject.help.content=Subject of the validation email. -security.policy.password.previous.count.help.content=Number of previous password verified when verifying not reused. +security.policy.password.previous.count.help.content=This is the number of previous passwords a new password is matched against. The password is rejected if one of the previous passwords matches. security.policy.password.expiration.days.help.content=Number of days before password expiration. email.validation.timeout.help.content=Timeout (in minutes) for the key generated for an email validation to remain valid. -security.policy.password.rule.alphanumeric.enabled.help.content=Minimum number of characters in the password rule enabled. -security.policy.password.rule.alphacount.minimum.help.content=Minimum number of characters in the password. -ldap.config.max.result.count.help.content=Maximum of result when searching users in LDAP. -security.policy.password.rule.numericalcount.enabled.help.content=Minimum of number characters in the password. -security.policy.allowed.login.attempt.help.content=Maximum number of login attempt before loking account. +security.policy.password.rule.alphanumeric.enabled.help.content=If true, only alphanumeric values in new passwords are allowed. +security.policy.password.rule.alphacount.minimum.help.content=Minimum number of letter characters in the password. +ldap.config.max.result.count.help.content=Maximum number of results when searching users in LDAP (0 means no limit). +security.policy.password.rule.numericalcount.enabled.help.content=If true, new passwords must contain a minimum number of numerical characters. +security.policy.allowed.login.attempt.help.content=Maximum number of unsuccessful login attempts before locking account. security.rememberme.enabled.help.content=Enable rememberme on login. security.rememberme.timeout.help.content=Timeout in days for rememberme cookie. security.rememberme.path.help.content=Path for rememberme cookie. -security.rememberme.secure.help.content=rememberme cookie secured. -security.rememberme.domain.help.content=rememberme cookie domain. -security.policy.unlockable.accounts.help.content=Non lockable accounts. +security.rememberme.secure.help.content=If true, the rememberme cookie is set as secure. +security.rememberme.domain.help.content=Name of the rememberme cookie domain. +security.policy.unlockable.accounts.help.content=Comma separated list of User-IDs, that cannot be locked. ldap.config.groups.class.help.content=The name of the objectClass in the ldap server used to identify groups. The default is groupOfUniqueNames. ldap.config.groups.member.help.content=The name of the attribute on a group that contains the user DN of group members. The default is uniqueMember. -ldap.config.mapper.attribute.fullname.help.content=The name of the attribute on a user that contains the users fullName. -security.policy.password.rule.characterlength.enabled.help.content=Character length password rule enabled. -security.policy.password.rule.musthave.enabled.help.content=Password mandatory rule enabled. +ldap.config.mapper.attribute.fullname.help.content=The name of the attribute on a user that contains the users full name. +security.policy.password.rule.characterlength.enabled.help.content=If true, minimum and maximum number of characters in new passwords are checked. +security.policy.password.rule.musthave.enabled.help.content=If true, each user must have a password. security.policy.password.rule.numericalcount.minimum.help.content=Minimum number of numerical characters in the password. -redback.default.admin.help.content=Id of the administrator user. +redback.default.admin.help.content=User-Id of the primary administrator. security.policy.password.rule.characterlength.minimum.help.content=Minimum size of the password. -ldap.config.mapper.attribute.user.object.class.help.content=the objectClass used in the ldap server for indentifying users, most commonly inetOrgPerson. +ldap.config.mapper.attribute.user.object.class.help.content=The objectClass used in the ldap server for identifying users, most commonly inetOrgPerson. ldap.config.mapper.attribute.password.help.content=The name of the attribute containing the users password, used for the authentiction using the user manager and not the ldap bind authenticator. -security.policy.password.rule.nowhitespace.enabled.help.content=Enabled no whitespace in password rule. -security.policy.password.expiration.enabled.help.content=Enable password expiration. -ldap.config.mapper.attribute.user.id.help.content=The name of the attribute containing the users userId, most commonly cn or sn. +security.policy.password.rule.nowhitespace.enabled.help.content=If true, no whitespace is allowed in passwords. +security.policy.password.expiration.enabled.help.content=If true, password expiration is enabled. +ldap.config.mapper.attribute.user.id.help.content=The name of the attribute containing the users User-ID, most commonly cn or sn. security.policy.password.rule.characterlength.maximum.help.content=Maximum size of the password. -security.signon.timeout.help.content=not used. +security.signon.timeout.help.content=Not used. ldap.config.mapper.attribute.email.help.content=The name of the attribute on a user that contains the email address. -email.validation.required.help.content=If all email addresses (from new user registration) require an account validation email. +email.validation.required.help.content=If true, all email addresses (from new user registration) require an account validation email. redback.runtime.properties.title=Properties redback.runtime.ldap.port.label=port redback.runtime.ldap.host.label=host @@ -671,6 +677,14 @@ redback.runtime.ldap.checkServer=Verify LDAP configuration on server side. redback.runtime.useUsersCache.label=Use a cache for users. redback.runtime.users.cache.title=Users Cache +ldap.config.dn.help.content=The name of the attribute containing the DN +ldap.config.user.attribute.help.content=The name of the RDN attribute in the DN of the user object containing the User-ID (e.g. for cn=usr1,ou=users,ou=tst,ou=org, the value would be cn) +redback.default.role.guest.id.help.content=The User-ID of the guest user +rest.baseUrl.help.content=URL that is used as base url for validating REST requests. If empty, the URL ist determined automatically. +rest.csrffilter.absentorigin.deny.help.content=If true and no Origin/Referer header can be found on REST requests, the requests will be denied. Default: true. +rest.csrffilter.disableTokenValidation.help.content=If true, token based origin validation of REST requests will be omitted. Default: false. +rest.csrffilter.enabled.help.content=If true, validation of REST requests will be validated based on header values, otherwise no validation is done at all. Default: true. + archiva.redback.rbacmanager.ldap=LDAP RBac Manager archiva.redback.rbacmanager.jdo=Database RBac Manager archiva.redback.rbacmanager.jpa=Database JPA RBac Manager diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/RuntimeInfoServiceTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/RuntimeInfoServiceTest.java index fce64f4e2..d4dd7b2fb 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/RuntimeInfoServiceTest.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/RuntimeInfoServiceTest.java @@ -25,6 +25,7 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.archiva.redback.rest.services.AbstractRestServicesTest; +import org.apache.cxf.jaxrs.client.WebClient; import org.junit.Before; import org.junit.Test; @@ -84,6 +85,7 @@ public class RuntimeInfoServiceTest RuntimeInfoService.class, Collections.singletonList( new JacksonJaxbJsonProvider() ) ); + WebClient.client(service).header("Referer","http://localhost"); ApplicationRuntimeInfo applicationRuntimeInfo = service.getApplicationRuntimeInfo( "en" ); assertEquals( System.getProperty( "expectedVersion" ), applicationRuntimeInfo.getVersion() ); diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java index 227da18bc..f04148cbd 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java @@ -173,6 +173,8 @@ public abstract class AbstractDownloadTest Collections.singletonList( new JacksonJaxbJsonProvider() ) ); WebClient.client( service ).header( "Authorization", authorizationHeader ); + WebClient.client(service).header("Referer","http://localhost:"+port); + WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L ); return service; } @@ -185,6 +187,8 @@ public abstract class AbstractDownloadTest Collections.singletonList( new JacksonJaxbJsonProvider() ) ); WebClient.client( service ).header( "Authorization", authorizationHeader ); + WebClient.client(service).header("Referer","http://localhost:"+port); + WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L ); return service; } @@ -197,6 +201,8 @@ public abstract class AbstractDownloadTest Collections.singletonList( new JacksonJaxbJsonProvider() ) ); WebClient.client( service ).header( "Authorization", authorizationHeader ); + WebClient.client(service).header("Referer","http://localhost:"+port); + WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L ); return service; } @@ -210,6 +216,8 @@ public abstract class AbstractDownloadTest Collections.singletonList( new JacksonJaxbJsonProvider() ) ); WebClient.client( service ).header( "Authorization", authorizationHeader ); + WebClient.client(service).header("Referer","http://localhost:"+port); + WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L ); return service; } @@ -222,6 +230,8 @@ public abstract class AbstractDownloadTest Collections.singletonList( new JacksonJaxbJsonProvider() ) ); WebClient.client( service ).header( "Authorization", authorizationHeader ); + WebClient.client(service).header("Referer","http://localhost:"+port); + WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L ); return service; } @@ -234,6 +244,8 @@ public abstract class AbstractDownloadTest Collections.singletonList( new JacksonJaxbJsonProvider() ) ); WebClient.client( service ).header( "Authorization", authorizationHeader ); + WebClient.client(service).header("Referer","http://localhost:"+port); + WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L ); return service; } @@ -252,6 +264,8 @@ public abstract class AbstractDownloadTest RoleManagementService.class, Collections.singletonList( new JacksonJaxbJsonProvider() ) ); + WebClient.client(service).header("Referer","http://localhost:"+port); + // for debuging purpose WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 3000000L ); @@ -268,6 +282,8 @@ public abstract class AbstractDownloadTest JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/redbackServices/", UserService.class, Collections.singletonList( new JacksonJaxbJsonProvider() ) ); + WebClient.client(service).header("Referer","http://localhost:"+port); + // for debuging purpose WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 3000000L ); diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java index b009e8c71..eae41013f 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java @@ -25,7 +25,9 @@ import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner; import org.apache.commons.io.FileUtils; import org.apache.maven.wagon.providers.http.HttpWagon; import org.apache.maven.wagon.repository.Repository; +import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.junit.After; @@ -96,7 +98,9 @@ public class DownloadArtifactsTest // repo handler - this.repoServer = new Server( 0 ); + this.repoServer = new Server( ); + ServerConnector repoServerConnector = new ServerConnector( this.repoServer, new HttpConnectionFactory()); + this.repoServer.addConnector( repoServerConnector ); ServletHolder shRepo = new ServletHolder( RepoServlet.class ); ServletContextHandler contextRepo = new ServletContextHandler(); @@ -105,12 +109,16 @@ public class DownloadArtifactsTest contextRepo.addServlet( shRepo, "/*" ); repoServer.setHandler( contextRepo ); + repoServer.start(); - this.repoServerPort = repoServer.getConnectors()[0].getLocalPort(); + this.repoServerPort = repoServerConnector.getLocalPort(); //redirect handler - this.redirectServer = new Server( 0 ); + this.redirectServer = new Server( ); + ServerConnector redirectServerConnector = new ServerConnector( this.redirectServer, new HttpConnectionFactory()); + this.redirectServer.addConnector( redirectServerConnector ); + ServletHolder shRedirect = new ServletHolder( RedirectServlet.class ); ServletContextHandler contextRedirect = new ServletContextHandler(); contextRedirect.setAttribute( "redirectToPort", Integer.toString( this.repoServerPort ) ); @@ -120,7 +128,7 @@ public class DownloadArtifactsTest redirectServer.setHandler( contextRedirect ); redirectServer.start(); - this.redirectPort = redirectServer.getConnectors()[0].getLocalPort(); + this.redirectPort = redirectServerConnector.getLocalPort(); log.info( "redirect server port {}", redirectPort ); } diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/RemoteRepositoryConnectivityCheckTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/RemoteRepositoryConnectivityCheckTest.java index fabe56808..369bb10f8 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/RemoteRepositoryConnectivityCheckTest.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/RemoteRepositoryConnectivityCheckTest.java @@ -24,7 +24,9 @@ import org.apache.archiva.rest.api.services.RemoteRepositoriesService; import org.apache.commons.io.FileUtils; import org.apache.cxf.jaxrs.client.WebClient; import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.handler.DefaultHandler; import org.eclipse.jetty.server.handler.HandlerList; import org.eclipse.jetty.server.handler.ResourceHandler; @@ -71,6 +73,9 @@ public class RemoteRepositoryConnectivityCheckTest Server repoServer = buildStaticServer( new File( System.getProperty( "basedir" ) + "/src/test/repositories/test-repo" ) ); + + ServerConnector serverConnector = new ServerConnector( repoServer, new HttpConnectionFactory()); + repoServer.addConnector( serverConnector ); repoServer.start(); RemoteRepositoriesService service = getRemoteRepositoriesService(); @@ -80,7 +85,7 @@ public class RemoteRepositoryConnectivityCheckTest try { - int repoServerPort = repoServer.getConnectors()[0].getLocalPort(); + int repoServerPort = serverConnector.getLocalPort(); RemoteRepository repo = getRemoteRepository(); @@ -104,6 +109,8 @@ public class RemoteRepositoryConnectivityCheckTest File tmpDir = Files.createTempDirectory( "test" ).toFile(); Server repoServer = buildStaticServer( tmpDir ); + ServerConnector serverConnector = new ServerConnector( repoServer, new HttpConnectionFactory()); + repoServer.addConnector( serverConnector ); repoServer.start(); RemoteRepositoriesService service = getRemoteRepositoriesService(); @@ -113,7 +120,7 @@ public class RemoteRepositoryConnectivityCheckTest try { - int repoServerPort = repoServer.getConnectors()[0].getLocalPort(); + int repoServerPort = serverConnector.getLocalPort(); RemoteRepository repo = getRemoteRepository(); @@ -160,7 +167,7 @@ public class RemoteRepositoryConnectivityCheckTest protected Server buildStaticServer( File path ) { - Server repoServer = new Server( 0 ); + Server repoServer = new Server( ); ResourceHandler resourceHandler = new ResourceHandler(); resourceHandler.setDirectoriesListed( true ); diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java index eda8af6a8..410d6c1a3 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java @@ -22,6 +22,7 @@ package org.apache.archiva.web.rss; import org.apache.archiva.redback.authentication.AuthenticationDataSource; import org.apache.archiva.redback.authentication.AuthenticationException; import org.apache.archiva.redback.authentication.AuthenticationResult; +import org.apache.archiva.redback.authentication.TokenManager; import org.apache.archiva.redback.authorization.AuthorizationException; import org.apache.archiva.redback.authorization.AuthorizationResult; import org.apache.archiva.redback.keys.KeyManager; @@ -703,4 +704,9 @@ public class SecuritySystemStub { return true; } + + @Override + public TokenManager getTokenManager() { + return null; + } } diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/log4j2-test.xml index b80c0b0fa..11ff56844 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/log4j2-test.xml +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/log4j2-test.xml @@ -28,15 +28,15 @@ <loggers> <logger name="org.springframework" level="error"/> - + <logger name="org.apache.archiva" level="error"/> <logger name="org.apache.archiva.web" level="info"/> - <logger name="org.apache.commons.configuration" level="error"/> - - <logger name="org.apache.archiva.scheduler.indexing" level="debug"/> - - <logger name="org.apache.archiva.remotedownload" level="debug"/> - + <logger name="org.apache.archiva.scheduler.indexing" level="info"/> + <logger name="org.apache.archiva.remotedownload" level="info"/> + <logger name="org.apache.jackrabbit" level="error"/> + <logger name="org.quartz" level="error"/> + <logger name="JPOX.RDBMS" level="error"/> + <logger name="JPOX" level="error"/> <root level="info"> <appender-ref ref="console"/> </root> diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/org/apache/archiva/security.properties b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/org/apache/archiva/security.properties new file mode 100644 index 000000000..3607f9f6f --- /dev/null +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/org/apache/archiva/security.properties @@ -0,0 +1,19 @@ +# +# 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. +# +rest.csrffilter.disableTokenValidation=true diff --git a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml index c473eeacd..61eb47a94 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-web</artifactId> - <version>2.2.1-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-webapp-test</artifactId> <packaging>pom</packaging> @@ -36,7 +36,7 @@ <maxWaitTimeInMs>10000</maxWaitTimeInMs> <seleniumPluginVersion>2.3</seleniumPluginVersion> - <selenium-server.version>2.43.1</selenium-server.version> + <selenium-server.version>2.53.1</selenium-server.version> <fluentlenium.version>0.10.2</fluentlenium.version> <browserPath></browserPath> @@ -83,6 +83,22 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.seleniumhq.selenium</groupId> + <artifactId>selenium-remote-driver</artifactId> + <version>${selenium-server.version}</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-exec</artifactId> + <version>1.3</version> + </dependency> + <dependency> + <groupId>org.seleniumhq.selenium</groupId> + <artifactId>htmlunit-driver</artifactId> + <version>2.24</version> + </dependency> + <dependency> <groupId>org.fluentlenium</groupId> @@ -175,18 +191,26 @@ <artifactId>selenium-server</artifactId> <version>${selenium-server.version}</version> </dependency> - <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-remote-driver</artifactId> <version>${selenium-server.version}</version> </dependency> - <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-api</artifactId> <version>${selenium-server.version}</version> </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-exec</artifactId> + <version>1.3</version> + </dependency> + <dependency> + <groupId>org.seleniumhq.selenium</groupId> + <artifactId>htmlunit-driver</artifactId> + <version>2.24</version> + </dependency> </dependencies> </plugin> <plugin> diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java index 481301229..4ed311db2 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverBrowseTest.java @@ -30,11 +30,15 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.ie.InternetExplorerDriver; +import org.openqa.selenium.remote.DesiredCapabilities; +import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.safari.SafariDriver; import java.io.File; import java.io.FileInputStream; import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; import java.util.Properties; import java.util.concurrent.TimeUnit; import org.apache.commons.io.FileUtils; @@ -136,26 +140,36 @@ public class WebDriverBrowseTest } @Override - public WebDriver getDefaultDriver() - { - String seleniumBrowser = System.getProperty( "selenium.browser" ); - - if ( StringUtils.contains( seleniumBrowser, "chrome" ) ) - { - return new ChromeDriver(); - } - - if ( StringUtils.contains( seleniumBrowser, "safari" ) ) - { - return new SafariDriver(); - } - - if ( StringUtils.contains( seleniumBrowser, "iexplore" ) ) - { - return new InternetExplorerDriver(); + public WebDriver getDefaultDriver() { + String seleniumBrowser = System.getProperty("selenium.browser"); + String seleniumHost = System.getProperty("seleniumHost", "localhost"); + int seleniumPort = Integer.getInteger("seleniumPort", 4444); + try { + + if (StringUtils.contains(seleniumBrowser, "chrome")) { + return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"), + DesiredCapabilities.chrome() + ); + } + + if (StringUtils.contains(seleniumBrowser, "safari")) { + return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"), + DesiredCapabilities.safari() + ); + } + + if (StringUtils.contains(seleniumBrowser, "iexplore")) { + return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"), + DesiredCapabilities.internetExplorer() + ); + } + + return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"), + DesiredCapabilities.firefox() + ); + } catch (MalformedURLException e) { + throw new RuntimeException("Initializion of remote driver failed"); } - - return new FirefoxDriver(); } } diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java index 0a4c1adb3..deec6c0e2 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/WebDriverTest.java @@ -29,13 +29,18 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.ie.InternetExplorerDriver; +import org.openqa.selenium.remote.DesiredCapabilities; +import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.safari.SafariDriver; import java.io.File; import java.io.FileInputStream; import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; import java.util.Properties; import java.util.concurrent.TimeUnit; + import org.apache.commons.io.FileUtils; import org.fluentlenium.core.Fluent; import org.junit.Before; @@ -44,86 +49,86 @@ import org.junit.Before; * @author Olivier Lamy */ public class WebDriverTest - extends FluentTest -{ + extends FluentTest { @Override - public Fluent takeScreenShot( String fileName ) - { - try - { + public Fluent takeScreenShot(String fileName) { + try { // save html to have a minimum feedback if jenkins firefox not up - File fileNameHTML = new File( fileName + ".html" ); - FileUtils.writeStringToFile( fileNameHTML, getDriver().getPageSource() ); - } - catch ( IOException e ) - { - System.out.print( e.getMessage() ); + File fileNameHTML = new File(fileName + ".html"); + FileUtils.writeStringToFile(fileNameHTML, getDriver().getPageSource()); + } catch (IOException e) { + System.out.print(e.getMessage()); e.printStackTrace(); } - return super.takeScreenShot( fileName ); + return super.takeScreenShot(fileName); } - + @Before - public void init() - { - setSnapshotMode( Mode.TAKE_SNAPSHOT_ON_FAIL ); - setSnapshotPath( new File( "target", "errorshtmlsnap" ).getAbsolutePath() ); + public void init() { + setSnapshotMode(Mode.TAKE_SNAPSHOT_ON_FAIL); + setSnapshotPath(new File("target", "errorshtmlsnap").getAbsolutePath()); } - + @Test public void simpletest() - throws Exception - { - + throws Exception { + Properties tomcatPortProperties = new Properties(); tomcatPortProperties.load( - new FileInputStream( new File( System.getProperty( "tomcat.propertiesPortFilePath" ) ) ) ); + new FileInputStream(new File(System.getProperty("tomcat.propertiesPortFilePath")))); + + int tomcatPort = Integer.parseInt(tomcatPortProperties.getProperty("tomcat.maven.http.port")); - int tomcatPort = Integer.parseInt( tomcatPortProperties.getProperty( "tomcat.maven.http.port" ) ); + goTo("http://localhost:" + tomcatPort + "/archiva/index.html?request_lang=en"); - goTo( "http://localhost:" + tomcatPort + "/archiva/index.html?request_lang=en" ); - // wait until topbar-menu-container is feeded await().atMost(5, TimeUnit.SECONDS).until("#topbar-menu").isPresent(); - - FluentList<FluentWebElement> elements = find( "#create-admin-link-a" ); - if ( !elements.isEmpty() && elements.get( 0 ).isDisplayed() ) - { - WebElement webElement = elements.get( 0 ).getElement(); - Assert.assertEquals( "Create Admin User", webElement.getText() ); - } - else - { - elements = find( "#login-link-a" ); - WebElement webElement = elements.get( 0 ).getElement(); - Assert.assertEquals( "LOGIN", webElement.getText() ); + FluentList<FluentWebElement> elements = find("#create-admin-link-a"); + + if (!elements.isEmpty() && elements.get(0).isDisplayed()) { + WebElement webElement = elements.get(0).getElement(); + Assert.assertEquals("Create Admin User", webElement.getText()); + } else { + elements = find("#login-link-a"); + WebElement webElement = elements.get(0).getElement(); + Assert.assertEquals("LOGIN", webElement.getText()); } } @Override - public WebDriver getDefaultDriver() - { - String seleniumBrowser = System.getProperty( "selenium.browser" ); + public WebDriver getDefaultDriver() { + String seleniumBrowser = System.getProperty("selenium.browser"); + String seleniumHost = System.getProperty("seleniumHost", "localhost"); + int seleniumPort = Integer.getInteger("seleniumPort", 4444); + try { - if ( StringUtils.contains( seleniumBrowser, "chrome" ) ) - { - return new ChromeDriver(); - } + if (StringUtils.contains(seleniumBrowser, "chrome")) { + return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"), + DesiredCapabilities.chrome() + ); + } - if ( StringUtils.contains( seleniumBrowser, "safari" ) ) - { - return new SafariDriver(); - } + if (StringUtils.contains(seleniumBrowser, "safari")) { + return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"), + DesiredCapabilities.safari() + ); + } - if ( StringUtils.contains( seleniumBrowser, "iexplore" ) ) - { - return new InternetExplorerDriver(); - } + if (StringUtils.contains(seleniumBrowser, "iexplore")) { + return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"), + DesiredCapabilities.internetExplorer() + ); + } - return new FirefoxDriver(); + return new RemoteWebDriver(new URL("http://" + seleniumHost + ":" + seleniumPort + "/wd/hub"), + DesiredCapabilities.firefox() + ); + } catch (MalformedURLException e) { + throw new RuntimeException("Initializion of remote driver failed"); + } } } diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index 734a59768..9dc3eb80c 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-web</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-webapp</artifactId> <packaging>war</packaging> diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml index e1ac74b03..72d2debd4 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml @@ -51,7 +51,7 @@ </init-param> <init-param> <param-name>forceEncoding</param-name> - <param-value>true</param-value> + <param-value>false</param-value> </init-param> </filter> diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js index 3a6cb5ff3..abfb373b3 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js @@ -692,7 +692,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { RemoteRepository=function(id,name,layout,indexDirectory,url,userName,password,timeout,downloadRemoteIndex,remoteIndexUrl, remoteDownloadNetworkProxyId,cronExpression,remoteDownloadTimeout,downloadRemoteIndexOnStartup, - description,extraParametersEntries,extraHeadersEntries){ + description,extraParametersEntries,extraHeadersEntries,checkPath){ var self=this; @@ -774,6 +774,9 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { self.modified(true); }); + this.checkPath=ko.observable(checkPath); + this.checkPath.subscribe(function(newValue){self.modified(true)}); + this.modified=ko.observable(false); } @@ -799,7 +802,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { return new RemoteRepository(data.id,data.name,data.layout,data.indexDirectory,data.url,data.userName,data.password, data.timeout,data.downloadRemoteIndex,data.remoteIndexUrl,data.remoteDownloadNetworkProxyId, data.cronExpression,data.remoteDownloadTimeout,data.downloadRemoteIndexOnStartup,data.description, - extraParametersEntries,extraHeadersEntries); + extraParametersEntries,extraHeadersEntries,data.checkPath); } mapRemoteRepositories=function(data){ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js index 1d7dc714d..4a72ce817 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js @@ -37,7 +37,7 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa var kUser = new User(user.username, user.password, user.confirmPassword,user.fullName,user.email,user.permanent,user.validated, user.timestampAccountCreation,user.timestampLastLogin,user.timestampLastPasswordChange,user.locked, - user.passwordChangeRequired,null,user.readOnly,user.userManagerId); + user.passwordChangeRequired,null,user.readOnly,user.userManagerId, user.validationToken); kUser.rememberme(user.rememberme()); var userJson=ko.toJSON(kUser); @@ -73,7 +73,7 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa } var kUser = new User(user.username, user.password, user.confirmPassword,user.fullName,user.email,user.permanent,user.validated, user.timestampAccountCreation,user.timestampLastLogin,user.timestampLastPasswordChange,user.locked, - user.passwordChangeRequired,null,user.readOnly,user.userManagerId); + user.passwordChangeRequired,null,user.readOnly,user.userManagerId, user.validationToken); $.log("user.rememberme:"+user.rememberme); @@ -861,6 +861,21 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa return $.inArray(karmaName,window.redbackModel.operatioNames)>=0; }; + addValidationTokenHeader=function(user) { + if(user) { + if (user.validationToken) { + $.log("Adding validation token "+user.validationToken); + $.ajaxSetup({ + beforeSend: function (xhr) { + xhr.setRequestHeader('X-XSRF-TOKEN', user.validationToken); + } + }); + } else { + $.log("No validation token in user object "+user.username+", "+user.validationToken); + } + } + }; + startArchivaApplication=function(){ $.log("startArchivaApplication"); @@ -897,6 +912,9 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa window.redbackModel.password=user.password(); loginCall(user.username(),user.password(),user.rememberme() ,successLoginCallbackFn,errorLoginCallbackFn,completeLoginCallbackFn); + } else { + // Token for origin validation + addValidationTokenHeader(user); } }; @@ -919,6 +937,7 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa } if (logged == true) { var user = mapUser(result); + addValidationTokenHeader(user); if (user.passwordChangeRequired()==true){ changePasswordBox(true,false,user); @@ -949,6 +968,8 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa } clearForm("#user-login-form"); decorateMenuWithKarma(user); + + // Token for origin validation $("#login-welcome" ).show(); $("#welcome-label" ).html( $.i18n.prop("user.login.welcome",user.username())); return; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/redback/user.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/redback/user.js index 758a56a94..4a8f0ccdc 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/redback/user.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/redback/user.js @@ -36,9 +36,11 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,purl) { * @param ownerViewModel * @param readOnly * @param uuserManagerId + * @param validationToken */ User=function(username, password, confirmPassword,fullName,email,permanent,validated,timestampAccountCreation, - timestampLastLogin,timestampLastPasswordChange,locked,passwordChangeRequired,ownerViewModel,readOnly,userManagerId) { + timestampLastLogin,timestampLastPasswordChange,locked,passwordChangeRequired,ownerViewModel,readOnly, + userManagerId,validationToken) { var self=this; // Potentially Editable Field. this.username = ko.observable(username); @@ -84,6 +86,8 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,purl) { this.rememberme=ko.observable(false); + this.validationToken=validationToken; + this.logged=false; this.remove = function() { @@ -145,17 +149,20 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,purl) { var created = result; if (created == true) { displaySuccessMessage( $.i18n.prop("user.admin.created")); - var onSuccessCall=function(){ + var onSuccessCall=function(result){ + var logUser = mapUser(result); + currentAdminUser.validationToken=logUser.validationToken; reccordLoginCookie(currentAdminUser); + addValidationTokenHeader(currentAdminUser); window.archivaModel.adminExists=true; screenChange(); checkCreateAdminLink(); checkSecurityLinks(); + if(succesCallbackFn){ + succesCallbackFn(); + } } loginCall(currentAdminUser.username(), currentAdminUser.password(),false,onSuccessCall); - if(succesCallbackFn){ - succesCallbackFn(); - } return this; } else { displayErrorMessage("admin user not created"); @@ -318,6 +325,7 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,purl) { } }); + $("#username").prop('disabled',true); // desactivate roles pill when adding user $("#edit_user_details_pills_headers").hide(); @@ -757,7 +765,8 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,purl) { mapUser=function(data) { return new User(data.username, data.password, null,data.fullName,data.email,data.permanent,data.validated, data.timestampAccountCreation,data.timestampLastLogin,data.timestampLastPasswordChange, - data.locked,data.passwordChangeRequired,self,data.readOnly,data.userManagerId); + data.locked,data.passwordChangeRequired,self,data.readOnly,data.userManagerId, + data.validationToken); } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html index 3d16cf84f..c23158e95 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html @@ -733,6 +733,20 @@ </div> </div> + <div class="control-group"> + <label class="control-label" for="checkPath">${$.i18n.prop('remoteRepository.checkPath')}</label> + + <div class="controls"> + <input type="text" class="input-xxlarge" id="checkPath" name="checkPath" + data-bind="value: remoteRepository.checkPath"/> + <a class="btn btn-warning btn-mini popover-doc" id="remoteRepository-checkPath-info-button" + data-original-title="${$.i18n.prop('remoteRepository.checkPath.help.title')}" + data-content="${$.i18n.prop('remoteRepository.checkPath.help.content')}"> + <i class="icon-question-sign icon-white"></i> + </a> + </div> + </div> + <div class="row-fluid"> <div class="control-group span6"> <strong>${$.i18n.prop('remoteRepository.extraParametersEntries')}</strong> diff --git a/archiva-modules/archiva-web/archiva-webdav/pom.xml b/archiva-modules/archiva-web/archiva-webdav/pom.xml index ec877a212..fdf11ddf0 100644 --- a/archiva-modules/archiva-web/archiva-webdav/pom.xml +++ b/archiva-modules/archiva-web/archiva-webdav/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-web</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-webdav</artifactId> @@ -165,6 +165,11 @@ <scope>test</scope> </dependency> <dependency> + <groupId>javax.mail</groupId> + <artifactId>mail</artifactId> + <scope>provided</scope> + </dependency> + <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-server</artifactId> <scope>test</scope> diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java index 0c0a7183c..42146c031 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java @@ -28,7 +28,9 @@ import org.apache.archiva.policies.ChecksumPolicy; import org.apache.archiva.policies.ReleasesPolicy; import org.apache.archiva.policies.SnapshotsPolicy; import org.apache.commons.io.FileUtils; +import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.servlet.DefaultServlet; import org.eclipse.jetty.servlet.ServletContextHandler; @@ -137,7 +139,9 @@ public abstract class AbstractRepositoryServletProxiedTestCase repo.root.mkdirs(); } - repo.server = new Server( 0 ); + repo.server = new Server( ); + ServerConnector serverConnector = new ServerConnector( repo.server, new HttpConnectionFactory()); + repo.server.addConnector( serverConnector ); ContextHandlerCollection contexts = new ContextHandlerCollection(); repo.server.setHandler( contexts ); @@ -154,7 +158,7 @@ public abstract class AbstractRepositoryServletProxiedTestCase repo.server.start(); - int port = repo.server.getConnectors()[0].getLocalPort(); + int port = serverConnector.getLocalPort(); repo.url = "http://localhost:" + port + repo.context; log.info( "Remote HTTP Server started on {}", repo.url ); diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionProviderTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionProviderTest.java index b657c082b..30a1049d6 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionProviderTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionProviderTest.java @@ -20,46 +20,30 @@ package org.apache.archiva.webdav; */ import junit.framework.TestCase; +import org.apache.archiva.redback.authentication.AuthenticationDataSource; import org.apache.archiva.redback.authentication.AuthenticationException; +import org.apache.archiva.redback.authentication.AuthenticationResult; +import org.apache.archiva.redback.authorization.AuthorizationException; +import org.apache.archiva.redback.authorization.UnauthorizedException; +import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator; import org.apache.archiva.redback.policy.AccountLockedException; import org.apache.archiva.redback.policy.MustChangePasswordException; +import org.apache.archiva.redback.system.SecuritySession; import org.apache.archiva.redback.users.User; +import org.apache.archiva.security.ServletAuthenticator; +import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner; import org.apache.jackrabbit.webdav.DavSessionProvider; import org.apache.jackrabbit.webdav.WebdavRequest; import org.apache.jackrabbit.webdav.WebdavRequestImpl; -import org.apache.archiva.security.ServletAuthenticator; -import org.apache.archiva.redback.authentication.AuthenticationDataSource; -import org.apache.archiva.redback.authentication.AuthenticationResult; -import org.apache.archiva.redback.authorization.AuthorizationException; -import org.apache.archiva.redback.authorization.UnauthorizedException; -import org.apache.archiva.redback.system.SecuritySession; -import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.mock.web.MockHttpServletRequest; -import javax.servlet.AsyncContext; -import javax.servlet.DispatcherType; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletInputStream; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import javax.servlet.http.Part; -import java.io.BufferedReader; import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.security.Principal; -import java.util.Collection; -import java.util.Enumeration; -import java.util.Locale; -import java.util.Map; -import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; @RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class ArchivaDavSessionProviderTest @@ -76,7 +60,7 @@ public class ArchivaDavSessionProviderTest { super.setUp(); sessionProvider = new ArchivaDavSessionProvider( new ServletAuthenticatorMock(), new HttpAuthenticatorMock() ); - request = new WebdavRequestImpl( new HttpServletRequestMock(), null ); + request = new WebdavRequestImpl( new MockHttpServletRequest(), null ); } @Test @@ -101,11 +85,31 @@ public class ArchivaDavSessionProviderTest } @SuppressWarnings( "unchecked" ) + /* private class HttpServletRequestMock implements HttpServletRequest { @Override + public long getContentLengthLong() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + @Override + public String changeSessionId() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + @Override + public <T extends HttpUpgradeHandler> T upgrade( Class<T> handlerClass ) + throws IOException, ServletException + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + @Override public boolean authenticate( HttpServletResponse httpServletResponse ) throws IOException, ServletException { @@ -513,6 +517,7 @@ public class ArchivaDavSessionProviderTest } } + */ private class ServletAuthenticatorMock implements ServletAuthenticator { diff --git a/archiva-modules/archiva-web/pom.xml b/archiva-modules/archiva-web/pom.xml index de43f61d3..0df3ad6f2 100644 --- a/archiva-modules/archiva-web/pom.xml +++ b/archiva-modules/archiva-web/pom.xml @@ -19,7 +19,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-modules</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>archiva-web</artifactId> diff --git a/archiva-modules/metadata/metadata-model-maven2/pom.xml b/archiva-modules/metadata/metadata-model-maven2/pom.xml index 3d58d66c4..ad10ffbcb 100644 --- a/archiva-modules/metadata/metadata-model-maven2/pom.xml +++ b/archiva-modules/metadata/metadata-model-maven2/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>metadata</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>metadata-model-maven2</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/metadata/metadata-model/pom.xml b/archiva-modules/metadata/metadata-model/pom.xml index 3d528341e..3ddf05645 100644 --- a/archiva-modules/metadata/metadata-model/pom.xml +++ b/archiva-modules/metadata/metadata-model/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>metadata</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>metadata-model</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/metadata/metadata-repository-api/pom.xml b/archiva-modules/metadata/metadata-repository-api/pom.xml index 2191f0ee0..5cc507898 100644 --- a/archiva-modules/metadata/metadata-repository-api/pom.xml +++ b/archiva-modules/metadata/metadata-repository-api/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>metadata</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>metadata-repository-api</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/metadata/pom.xml b/archiva-modules/metadata/pom.xml index 9ad7b4ac4..5ce399dea 100644 --- a/archiva-modules/metadata/pom.xml +++ b/archiva-modules/metadata/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>archiva-modules</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>metadata</artifactId> <name>Archiva :: Metadata</name> diff --git a/archiva-modules/metadata/test-repository/pom.xml b/archiva-modules/metadata/test-repository/pom.xml index f002fd225..7313a1c8a 100644 --- a/archiva-modules/metadata/test-repository/pom.xml +++ b/archiva-modules/metadata/test-repository/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>metadata</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>test-repository</artifactId> <name>Archiva Metadata :: Repository for Testing</name> diff --git a/archiva-modules/plugins/audit/pom.xml b/archiva-modules/plugins/audit/pom.xml index eb048db75..cf37c0d6f 100644 --- a/archiva-modules/plugins/audit/pom.xml +++ b/archiva-modules/plugins/audit/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>plugins</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>audit</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/plugins/generic-metadata-support/pom.xml b/archiva-modules/plugins/generic-metadata-support/pom.xml index bb1abadc4..64120b412 100644 --- a/archiva-modules/plugins/generic-metadata-support/pom.xml +++ b/archiva-modules/plugins/generic-metadata-support/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>plugins</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>generic-metadata-support</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/plugins/maven2-repository/pom.xml b/archiva-modules/plugins/maven2-repository/pom.xml index c77e2ff65..4c978436b 100644 --- a/archiva-modules/plugins/maven2-repository/pom.xml +++ b/archiva-modules/plugins/maven2-repository/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>plugins</artifactId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>maven2-repository</artifactId> <packaging>bundle</packaging> @@ -304,6 +304,8 @@ <exclude>src/test/resources/m1-repo-filelist.txt</exclude> <exclude>src/test/repositories/**</exclude> <exclude>src/test/expected-poms/**</exclude> + <exclude>src/test/resources/resolver-status.properties</exclude> + <exclude>src/test/resources/test01.properties</exclude> </excludes> </configuration> </plugin> diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java index 58a4dee56..efdb46087 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java @@ -148,6 +148,9 @@ public class Maven2RepositoryStorage private static final String METADATA_FILENAME = METADATA_FILENAME_START + ".xml"; + // This array must be lexically sorted + private static final String[] IGNORED_FILES = { METADATA_FILENAME, "resolver-status.properties" }; + private static final MavenXpp3Reader MAVEN_XPP_3_READER = new MavenXpp3Reader(); @@ -615,13 +618,25 @@ public class Maven2RepositoryStorage List<ArtifactMetadata> artifacts = new ArrayList<>(); if ( files != null ) { + int errorCount=0; for ( File file : files ) { - ArtifactMetadata metadata = - getArtifactFromFile( readMetadataRequest.getRepositoryId(), readMetadataRequest.getNamespace(), - readMetadataRequest.getProjectId(), readMetadataRequest.getProjectVersion(), - file ); - artifacts.add( metadata ); + try { + ArtifactMetadata metadata = + getArtifactFromFile(readMetadataRequest.getRepositoryId(), readMetadataRequest.getNamespace(), + readMetadataRequest.getProjectId(), readMetadataRequest.getProjectVersion(), + file); + artifacts.add(metadata); + } catch (Exception ex) { + LOGGER.error("Error while retrieving metadata of file {} (Project: {}, Repository: {}): {}", + file.getName(), readMetadataRequest.getProjectId(), readMetadataRequest.getRepositoryId(), + ex.getMessage()); + errorCount++; + } + } + // We throw only an error, if the number of errors equals the number of files + if (errorCount>0 && errorCount==files.length) { + throw new RepositoryStorageRuntimeException(readMetadataRequest.getRepositoryId(), "Could not retrieve metadata of the files"); } } return artifacts; @@ -1016,7 +1031,7 @@ public class Maven2RepositoryStorage { return false; } - else if ( name.equals( METADATA_FILENAME ) ) + else if ( Arrays.binarySearch(IGNORED_FILES, name)>=0 ) { return false; } diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java index 0cb92646a..b84a859b9 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java @@ -413,15 +413,30 @@ public class RepositoryModelResolver return connected; } - private File transferChecksum( Wagon wagon, RemoteRepository remoteRepository, String remotePath, File resource, - File tmpDirectory, String ext ) + /** + * + * @param wagon The wagon instance that should be connected. + * @param remoteRepository The repository from where the checksum file should be retrieved + * @param remotePath The remote path of the artifact (without extension) + * @param resource The local artifact (without extension) + * @param workingDir The working directory where the downloaded file should be placed to + * @param ext The extension of th checksum file + * @return The file where the data has been downloaded to. + * @throws AuthorizationException + * @throws TransferFailedException + * @throws ResourceDoesNotExistException + */ + private File transferChecksum( final Wagon wagon, final RemoteRepository remoteRepository, + final String remotePath, final File resource, + final File workingDir, final String ext ) throws AuthorizationException, TransferFailedException, ResourceDoesNotExistException { - File destFile = new File( tmpDirectory, resource.getName() + ext ); + File destFile = new File( workingDir, resource.getName() + ext ); + String remoteChecksumPath = remotePath + ext; - log.info( "Retrieving {} from {}", remotePath, remoteRepository.getName() ); + log.info( "Retrieving {} from {}", remoteChecksumPath, remoteRepository.getName() ); - wagon.get( addParameters( remotePath, remoteRepository ), destFile ); + wagon.get( addParameters( remoteChecksumPath, remoteRepository ), destFile ); log.debug( "Downloaded successfully." ); diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilderTestMaven3.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilderTestMaven3.java index c277434d8..93f6bc7fb 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilderTestMaven3.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilderTestMaven3.java @@ -101,11 +101,14 @@ public class DependencyTreeBuilderTestMaven3 builder.buildDependencyTree( Collections.singletonList( TEST_REPO_ID ), TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION ); - assertThat( treeEntries ).isNotNull().isNotEmpty().contains( - new TreeEntry( new Artifact( TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION, "", "" ) ) ); + Artifact artifact = new Artifact( TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION, "", "" ); + artifact.setFileExtension("jar"); + assertThat( treeEntries ).isNotNull().isNotEmpty().contains(new TreeEntry(artifact) ); + artifact = new Artifact( "commons-lang", "commons-lang", "2.2", "compile", "" ); + artifact.setFileExtension("jar"); assertThat( treeEntries.get( 0 ).getChilds() ).isNotNull().isNotEmpty().contains( - new TreeEntry( new Artifact( "commons-lang", "commons-lang", "2.2", "compile", "" ) ) ); + new TreeEntry(artifact) ); } diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java index 3f3b8e2dc..24e9b2609 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java @@ -52,6 +52,12 @@ import javax.inject.Inject; import javax.inject.Named; import java.io.File; import java.io.IOException; +import java.net.URL; +import java.nio.file.CopyOption; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -324,6 +330,90 @@ public class Maven2RepositoryMetadataResolverTest assertEquals( "pom", facet.getType() ); } + @Test + public void testGetArtifactMetadataSnapshotsMRM1859() + throws Exception + { + Path repoDir = Paths.get("target/test-repository/com/example/test/test-artifact/1.0-SNAPSHOT"); + URL url = Thread.currentThread().getContextClassLoader().getResource("resolver-status.properties"); + Path resFile = Paths.get(url.toURI()); + Path destFile = repoDir.resolve(resFile.getFileName()); + Files.copy(resFile, destFile, StandardCopyOption.REPLACE_EXISTING); + URL url2 = Thread.currentThread().getContextClassLoader().getResource("test01.properties"); + Path resFile2 = Paths.get(url2.toURI()); + Path destFile2 = repoDir.resolve(resFile2.getFileName()); + Files.copy(resFile2, destFile2, StandardCopyOption.REPLACE_EXISTING); + + try { + + + Collection<ArtifactMetadata> testArtifacts = storage.readArtifactsMetadata( + new ReadMetadataRequest(TEST_REPO_ID, "com.example.test", "test-artifact", "1.0-SNAPSHOT", ALL)); + List<ArtifactMetadata> artifacts = new ArrayList<>(testArtifacts); + Collections.sort(artifacts, new Comparator<ArtifactMetadata>() { + @Override + public int compare(ArtifactMetadata o1, ArtifactMetadata o2) { + return o1.getId().compareTo(o2.getId()); + } + }); + + assertEquals(6, artifacts.size()); + + ArtifactMetadata artifactMetadata = artifacts.get(0); + assertEquals("test-artifact-1.0-20100308.230825-1.jar", artifactMetadata.getId()); + MavenArtifactFacet facet = (MavenArtifactFacet) artifactMetadata.getFacet(MavenArtifactFacet.FACET_ID); + assertEquals(1, facet.getBuildNumber()); + assertEquals("20100308.230825", facet.getTimestamp()); + assertNull(facet.getClassifier()); + assertEquals("jar", facet.getType()); + + artifactMetadata = artifacts.get(1); + assertEquals("test-artifact-1.0-20100308.230825-1.pom", artifactMetadata.getId()); + facet = (MavenArtifactFacet) artifactMetadata.getFacet(MavenArtifactFacet.FACET_ID); + assertEquals(1, facet.getBuildNumber()); + assertEquals("20100308.230825", facet.getTimestamp()); + assertNull(facet.getClassifier()); + assertEquals("pom", facet.getType()); + + artifactMetadata = artifacts.get(2); + assertEquals("test-artifact-1.0-20100310.014828-2-javadoc.jar", artifactMetadata.getId()); + facet = (MavenArtifactFacet) artifactMetadata.getFacet(MavenArtifactFacet.FACET_ID); + assertEquals(2, facet.getBuildNumber()); + assertEquals("20100310.014828", facet.getTimestamp()); + assertEquals("javadoc", facet.getClassifier()); + assertEquals("javadoc", facet.getType()); + + artifactMetadata = artifacts.get(3); + assertEquals("test-artifact-1.0-20100310.014828-2-sources.jar", artifactMetadata.getId()); + facet = (MavenArtifactFacet) artifactMetadata.getFacet(MavenArtifactFacet.FACET_ID); + assertEquals(2, facet.getBuildNumber()); + assertEquals("20100310.014828", facet.getTimestamp()); + assertEquals("sources", facet.getClassifier()); + assertEquals("java-source", facet.getType()); + + artifactMetadata = artifacts.get(4); + assertEquals("test-artifact-1.0-20100310.014828-2.jar", artifactMetadata.getId()); + facet = (MavenArtifactFacet) artifactMetadata.getFacet(MavenArtifactFacet.FACET_ID); + assertEquals(2, facet.getBuildNumber()); + assertEquals("20100310.014828", facet.getTimestamp()); + assertNull(facet.getClassifier()); + assertEquals("jar", facet.getType()); + + artifactMetadata = artifacts.get(5); + assertEquals("test-artifact-1.0-20100310.014828-2.pom", artifactMetadata.getId()); + facet = (MavenArtifactFacet) artifactMetadata.getFacet(MavenArtifactFacet.FACET_ID); + assertEquals(2, facet.getBuildNumber()); + assertEquals("20100310.014828", facet.getTimestamp()); + assertNull(facet.getClassifier()); + assertEquals("pom", facet.getType()); + + } finally { + Files.delete(destFile); + Files.delete(destFile2); + } + + } + private void assertDependency( Dependency dependency, String groupId, String artifactId, String version ) { assertDependency( dependency, groupId, artifactId, version, "compile" ); diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-a/1.0/test-artifact-module-a-1.0.pom.md5 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-a/1.0/test-artifact-module-a-1.0.pom.md5 new file mode 100644 index 000000000..40dc44a73 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-a/1.0/test-artifact-module-a-1.0.pom.md5 @@ -0,0 +1 @@ +61a4d030260fc6bee0681cf99ba54674 test-artifact-module-a-1.0.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-a/1.0/test-artifact-module-a-1.0.pom.sha1 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-a/1.0/test-artifact-module-a-1.0.pom.sha1 new file mode 100644 index 000000000..59d811196 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-a/1.0/test-artifact-module-a-1.0.pom.sha1 @@ -0,0 +1 @@ +6f54bc4223bc39d7880420f66baa3a24d7f9c181 test-artifact-module-a-1.0.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-b/1.0/test-artifact-module-b-1.0.pom.md5 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-b/1.0/test-artifact-module-b-1.0.pom.md5 new file mode 100644 index 000000000..c087db3b9 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-b/1.0/test-artifact-module-b-1.0.pom.md5 @@ -0,0 +1 @@ +daa5fa59239b1a81d7c04aea1c235aad test-artifact-module-b-1.0.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-b/1.0/test-artifact-module-b-1.0.pom.sha1 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-b/1.0/test-artifact-module-b-1.0.pom.sha1 new file mode 100644 index 000000000..3315ef896 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-b/1.0/test-artifact-module-b-1.0.pom.sha1 @@ -0,0 +1 @@ +3d0a66ad4f202b823feb367c46c7574cbb0301c8 test-artifact-module-b-1.0.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-parent/1/test-artifact-parent-1.pom.md5 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-parent/1/test-artifact-parent-1.pom.md5 new file mode 100644 index 000000000..98587da1d --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-parent/1/test-artifact-parent-1.pom.md5 @@ -0,0 +1 @@ +92c60efe85e23fe5afd8a854cea87209 test-artifact-parent-1.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-parent/1/test-artifact-parent-1.pom.sha1 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-parent/1/test-artifact-parent-1.pom.sha1 new file mode 100644 index 000000000..a0bcb35bd --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-parent/1/test-artifact-parent-1.pom.sha1 @@ -0,0 +1 @@ +6eca3509acf66023c29e2bc17f73e79d1d1a341a test-artifact-parent-1.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-root/1.0/test-artifact-root-1.0.pom.md5 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-root/1.0/test-artifact-root-1.0.pom.md5 new file mode 100644 index 000000000..8870d46d1 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-root/1.0/test-artifact-root-1.0.pom.md5 @@ -0,0 +1 @@ +034449f8696981edce2485b841a02a47 test-artifact-root-1.0.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-root/1.0/test-artifact-root-1.0.pom.sha1 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-root/1.0/test-artifact-root-1.0.pom.sha1 new file mode 100644 index 000000000..eba419703 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-root/1.0/test-artifact-root-1.0.pom.sha1 @@ -0,0 +1 @@ +bef26aec1a0714cec7fa56cdbb7ebcdb452295eb test-artifact-root-1.0.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-module-a/1.1-SNAPSHOT/test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom.md5 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-module-a/1.1-SNAPSHOT/test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom.md5 new file mode 100644 index 000000000..a36564b4f --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-module-a/1.1-SNAPSHOT/test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom.md5 @@ -0,0 +1 @@ +3b689a3c3cacecdf4371c342606211f1 test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-module-a/1.1-SNAPSHOT/test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom.sha1 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-module-a/1.1-SNAPSHOT/test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom.sha1 new file mode 100644 index 000000000..e9d1ab6f9 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-module-a/1.1-SNAPSHOT/test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom.sha1 @@ -0,0 +1 @@ +b401e87baeeb0174efd85eaf327d9c98efe79cf1 test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-root/1.1-SNAPSHOT/test-snapshot-artifact-root-1.1-20100310.014828-2.pom.md5 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-root/1.1-SNAPSHOT/test-snapshot-artifact-root-1.1-20100310.014828-2.pom.md5 new file mode 100644 index 000000000..278e71bca --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-root/1.1-SNAPSHOT/test-snapshot-artifact-root-1.1-20100310.014828-2.pom.md5 @@ -0,0 +1 @@ +0c304367d7a99291eb8292b1fe7114a2 test-snapshot-artifact-root-1.1-20100310.014828-2.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-root/1.1-SNAPSHOT/test-snapshot-artifact-root-1.1-20100310.014828-2.pom.sha1 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-root/1.1-SNAPSHOT/test-snapshot-artifact-root-1.1-20100310.014828-2.pom.sha1 new file mode 100644 index 000000000..3fe44e181 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-root/1.1-SNAPSHOT/test-snapshot-artifact-root-1.1-20100310.014828-2.pom.sha1 @@ -0,0 +1 @@ +e5e6ca9ae3628ae474c155619467848dc900b8cf test-snapshot-artifact-root-1.1-20100310.014828-2.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/resolver-status.properties b/archiva-modules/plugins/maven2-repository/src/test/resources/resolver-status.properties new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/resolver-status.properties diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/test01.properties b/archiva-modules/plugins/maven2-repository/src/test/resources/test01.properties new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/test01.properties diff --git a/archiva-modules/plugins/metadata-store-cassandra/pom.xml b/archiva-modules/plugins/metadata-store-cassandra/pom.xml index 451686d29..3e32549d1 100644 --- a/archiva-modules/plugins/metadata-store-cassandra/pom.xml +++ b/archiva-modules/plugins/metadata-store-cassandra/pom.xml @@ -23,7 +23,7 @@ <parent> <artifactId>plugins</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>metadata-store-cassandra</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/plugins/metadata-store-file/pom.xml b/archiva-modules/plugins/metadata-store-file/pom.xml index c68a0ed6a..2fcf7eb41 100644 --- a/archiva-modules/plugins/metadata-store-file/pom.xml +++ b/archiva-modules/plugins/metadata-store-file/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>plugins</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>metadata-store-file</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/plugins/metadata-store-jcr/pom.xml b/archiva-modules/plugins/metadata-store-jcr/pom.xml index 4b5aa528d..8fa30860c 100644 --- a/archiva-modules/plugins/metadata-store-jcr/pom.xml +++ b/archiva-modules/plugins/metadata-store-jcr/pom.xml @@ -23,7 +23,7 @@ <parent> <artifactId>plugins</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>metadata-store-jcr</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/plugins/pom.xml b/archiva-modules/plugins/pom.xml index 84da29235..039d7e14c 100644 --- a/archiva-modules/plugins/pom.xml +++ b/archiva-modules/plugins/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>archiva-modules</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>plugins</artifactId> <name>Archiva :: Core Plugins</name> diff --git a/archiva-modules/plugins/problem-reports/pom.xml b/archiva-modules/plugins/problem-reports/pom.xml index f93da1991..20db52b92 100644 --- a/archiva-modules/plugins/problem-reports/pom.xml +++ b/archiva-modules/plugins/problem-reports/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>plugins</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>problem-reports</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/plugins/repository-statistics/pom.xml b/archiva-modules/plugins/repository-statistics/pom.xml index 2513d4b28..2d20acacb 100644 --- a/archiva-modules/plugins/repository-statistics/pom.xml +++ b/archiva-modules/plugins/repository-statistics/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>plugins</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <artifactId>repository-statistics</artifactId> <packaging>bundle</packaging> diff --git a/archiva-modules/plugins/stage-repository-merge/pom.xml b/archiva-modules/plugins/stage-repository-merge/pom.xml index a050b363c..d425434e0 100644 --- a/archiva-modules/plugins/stage-repository-merge/pom.xml +++ b/archiva-modules/plugins/stage-repository-merge/pom.xml @@ -22,7 +22,7 @@ <parent> <artifactId>plugins</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <groupId>org.apache.archiva</groupId> <artifactId>stage-repository-merge</artifactId> diff --git a/archiva-modules/plugins/stage-repository-merge/src/test/resources/log4j2-test.xml b/archiva-modules/plugins/stage-repository-merge/src/test/resources/log4j2-test.xml index 1ce090b03..84243affe 100644 --- a/archiva-modules/plugins/stage-repository-merge/src/test/resources/log4j2-test.xml +++ b/archiva-modules/plugins/stage-repository-merge/src/test/resources/log4j2-test.xml @@ -19,7 +19,7 @@ --> -<configuration status="debug"> +<configuration> <appenders> <Console name="console" target="SYSTEM_OUT"> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> @@ -31,7 +31,6 @@ <logger name="org.springframework" level="error"/> - <root level="info"> <appender-ref ref="console"/> </root> diff --git a/archiva-modules/pom.xml b/archiva-modules/pom.xml index 656d1856e..ad65c36f9 100644 --- a/archiva-modules/pom.xml +++ b/archiva-modules/pom.xml @@ -21,7 +21,7 @@ <parent> <artifactId>archiva</artifactId> <groupId>org.apache.archiva</groupId> - <version>2.2.2-SNAPSHOT</version> + <version>3.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-modules</artifactId> @@ -98,7 +98,7 @@ <inherited>false</inherited> <configuration> <notimestamp>true</notimestamp> - <source>1.5</source> + <source>1.7</source> <links> <link>http://java.sun.com/j2se/1.5.0/docs/api</link> <link>http://commons.apache.org/collections/apidocs-COLLECTIONS_3_0/</link> |