From: Olivier Lamy Date: Fri, 16 Sep 2011 07:42:25 +0000 (+0000) Subject: [MRM-1003] Repackage sources from org.apache.maven.archiva.. to org.apache.archiva... X-Git-Tag: archiva-1.4-M1~265 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7a01a324d629018c2a6506363d756f5fa15237dc;p=archiva.git [MRM-1003] Repackage sources from org.apache.maven.archiva.. to org.apache.archiva.. : archiva-common module git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1171418 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java index e7850b525..5b8a6dd24 100644 --- a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java +++ b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java @@ -22,7 +22,7 @@ package org.apache.archiva.converter.artifact; import junit.framework.TestCase; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.commons.io.FileUtils; -import org.apache.maven.archiva.common.utils.FileUtil; +import org.apache.archiva.common.utils.FileUtil; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.metadata.ArtifactMetadata; diff --git a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/AbstractChecksumTestCase.java b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/AbstractChecksumTestCase.java index 6f8d285a0..812cc708b 100644 --- a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/AbstractChecksumTestCase.java +++ b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/AbstractChecksumTestCase.java @@ -22,7 +22,7 @@ package org.apache.archiva.checksum; import java.io.File; import junit.framework.TestCase; -import org.apache.maven.archiva.common.utils.FileUtil; +import org.apache.archiva.common.utils.FileUtil; /** * AbstractChecksumTestCase diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/ArchivaException.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/ArchivaException.java new file mode 100644 index 000000000..5ff2220bb --- /dev/null +++ b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/ArchivaException.java @@ -0,0 +1,39 @@ +package org.apache.archiva.common; + +/* + * 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. + */ + +/** + * ArchivaException + * + * @version $Id$ + */ +public class ArchivaException + extends Exception +{ + public ArchivaException( String message, Throwable cause ) + { + super( message, cause ); + } + + public ArchivaException( String message ) + { + super( message ); + } +} diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/FileTypeUtils.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/FileTypeUtils.java new file mode 100644 index 000000000..b0621bb3a --- /dev/null +++ b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/FileTypeUtils.java @@ -0,0 +1,39 @@ +package org.apache.archiva.common; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Arrays; +import java.util.List; + +/** + * @author Olivier Lamy + * @since 1.4 + */ +public class FileTypeUtils +{ + + /** + * Default exclusions from artifact consumers that are using the file types. Note that this is simplistic in the + * case of the support files (based on extension) as it is elsewhere - it may be better to match these to actual + * artifacts and exclude later during scanning. + */ + public static final List DEFAULT_EXCLUSIONS = + Arrays.asList( "**/maven-metadata.xml", "**/maven-metadata-*.xml", "**/*.sha1", "**/*.asc", "**/*.md5", + "**/*.pgp", "**/.index/**", "**/.indexer/**" ); +} diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/BaseFile.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/BaseFile.java new file mode 100644 index 000000000..fc10f950c --- /dev/null +++ b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/BaseFile.java @@ -0,0 +1,104 @@ +package org.apache.archiva.common.utils; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.net.URI; + +/** + * BaseFile - convenient File object that tracks the Base Directory and can provide relative path values + * for the file object based on that Base Directory value. + * + * @version $Id$ + */ +public class BaseFile + extends File +{ + private File baseDir; + + public BaseFile( File pathFile ) + { + this( pathFile.getAbsolutePath() ); + } + + public BaseFile( File repoDir, File pathFile ) + { + this( repoDir, PathUtil.getRelative( repoDir.getAbsolutePath(), pathFile ) ); + } + + public BaseFile( File parent, String child ) + { + super( parent, child ); + this.baseDir = parent; + } + + public BaseFile( String pathname ) + { + super( pathname ); + + // Calculate the top level directory. + + File parent = this; + while ( parent.getParentFile() != null ) + { + parent = parent.getParentFile(); + } + + this.baseDir = parent; + } + + public BaseFile( String repoDir, File pathFile ) + { + this( new File( repoDir ), pathFile ); + } + + public BaseFile( String parent, String child ) + { + super( parent, child ); + this.baseDir = new File( parent ); + } + + public BaseFile( URI uri ) + { + super( uri ); // only to satisfy java compiler. + throw new IllegalStateException( "The " + BaseFile.class.getName() + + " object does not support URI construction." ); + } + + public File getBaseDir() + { + return baseDir; + } + + public String getRelativePath() + { + return PathUtil.getRelative( this.baseDir.getAbsolutePath(), this ); + } + + public void setBaseDir( File baseDir ) + { + this.baseDir = baseDir; + } + + public void setBaseDir( String repoDir ) + { + setBaseDir( new File( repoDir ) ); + } +} diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/DateUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/DateUtil.java new file mode 100644 index 000000000..f146906b5 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/DateUtil.java @@ -0,0 +1,129 @@ +package org.apache.archiva.common.utils; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +/** + * DateUtil - some (not-so) common date utility methods. + * + * @version $Id$ + */ +public class DateUtil +{ + public static String getDuration( long duration ) + { + return getDuration( new Date( 0 ), new Date( duration ) ); + } + + public static String getDuration( long ms1, long ms2 ) + { + return getDuration( new Date( ms1 ), new Date( ms2 ) ); + } + + public static String getDuration( Date d1, Date d2 ) + { + Calendar cal1 = new GregorianCalendar(); + cal1.setTime( d1 ); + + Calendar cal2 = new GregorianCalendar(); + cal2.setTime( d2 ); + + return getDuration( cal1, cal2 ); + } + + public static String getDuration( Calendar cal1, Calendar cal2 ) + { + int year1 = cal1.get( Calendar.YEAR ); + int day1 = cal1.get( Calendar.DAY_OF_YEAR ); + int hour1 = cal1.get( Calendar.HOUR_OF_DAY ); + int min1 = cal1.get( Calendar.MINUTE ); + int sec1 = cal1.get( Calendar.SECOND ); + int ms1 = cal1.get( Calendar.MILLISECOND ); + + int year2 = cal2.get( Calendar.YEAR ); + int day2 = cal2.get( Calendar.DAY_OF_YEAR ); + int hour2 = cal2.get( Calendar.HOUR_OF_DAY ); + int min2 = cal2.get( Calendar.MINUTE ); + int sec2 = cal2.get( Calendar.SECOND ); + int ms2 = cal2.get( Calendar.MILLISECOND ); + + int leftDays = ( day1 - day2 ) + ( year1 - year2 ) * 365; + int leftHours = hour2 - hour1; + int leftMins = min2 - min1; + int leftSeconds = sec2 - sec1; + int leftMilliSeconds = ms2 - ms1; + + if ( leftMilliSeconds < 0 ) + { + leftMilliSeconds += 1000; + --leftSeconds; + } + + if ( leftSeconds < 0 ) + { + leftSeconds += 60; + --leftMins; + } + + if ( leftMins < 0 ) + { + leftMins += 60; + --leftHours; + } + + if ( leftHours < 0 ) + { + leftHours += 24; + --leftDays; + } + + StringBuffer interval = new StringBuffer(); + + appendInterval( interval, leftDays, "Day" ); + appendInterval( interval, leftHours, "Hour" ); + appendInterval( interval, leftMins, "Minute" ); + appendInterval( interval, leftSeconds, "Second" ); + appendInterval( interval, leftMilliSeconds, "Millisecond" ); + + return interval.toString(); + } + + private static void appendInterval( StringBuffer interval, int count, String type ) + { + if ( count > 0 ) + { + if ( interval.length() > 0 ) + { + interval.append( " " ); + } + + interval.append( count ); + interval.append( " " ).append( type ); + if ( count > 1 ) + { + interval.append( "s" ); + } + } + } + +} diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/FileUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/FileUtil.java new file mode 100644 index 000000000..d60a3a53d --- /dev/null +++ b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/FileUtil.java @@ -0,0 +1,36 @@ +package org.apache.archiva.common.utils; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +public class FileUtil +{ + public static String getBasedir() + { + String basedir = System.getProperty( "basedir" ); + if ( basedir == null ) + { + basedir = new File( "" ).getAbsolutePath(); + } + + return basedir; + } +} \ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/PathUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/PathUtil.java new file mode 100644 index 000000000..1c35c600b --- /dev/null +++ b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/PathUtil.java @@ -0,0 +1,106 @@ +package org.apache.archiva.common.utils; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.commons.lang.StringUtils; + +import java.io.File; +import java.net.MalformedURLException; + +/** + * PathUtil - simple utility methods for path manipulation. + * + * @version $Id$ + */ +public class PathUtil +{ + public static String toUrl( String path ) + { + // Is our work already done for us? + if ( path.startsWith( "file:/" ) ) + { + return path; + } + + return toUrl( new File( path ) ); + } + + public static String toUrl( File file ) + { + try + { + return file.toURL().toExternalForm(); + } + catch ( MalformedURLException e ) + { + String pathCorrected = StringUtils.replaceChars( file.getAbsolutePath(), '\\', '/' ); + if ( pathCorrected.startsWith( "file:/" ) ) + { + return pathCorrected; + } + + return "file://" + pathCorrected; + } + } + + /** + * Given a basedir and a child file, return the relative path to the child. + * + * @param basedir the basedir. + * @param file the file to get the relative path for. + * @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character) + */ + public static String getRelative( String basedir, File file ) + { + return getRelative( basedir, file.getAbsolutePath() ); + } + + /** + * Given a basedir and a child file, return the relative path to the child. + * + * @param basedir the basedir. + * @param child the child path (can be a full path) + * @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character) + */ + public static String getRelative( String basedir, String child ) + { + if ( basedir.endsWith( "/" ) || basedir.endsWith( "\\" ) ) + { + basedir = basedir.substring( 0, basedir.length() - 1 ); + } + + if ( child.startsWith( basedir ) ) + { + // simple solution. + return child.substring( basedir.length() + 1 ); + } + + String absoluteBasedir = new File( basedir ).getAbsolutePath(); + if ( child.startsWith( absoluteBasedir ) ) + { + // resolved basedir solution. + return child.substring( absoluteBasedir.length() + 1 ); + } + + // File is not within basedir. + throw new IllegalStateException( "Unable to obtain relative path of file " + child + + ", it is not within basedir " + basedir + "." ); + } +} diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/Slf4JPlexusLogger.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/Slf4JPlexusLogger.java new file mode 100644 index 000000000..097bd54ea --- /dev/null +++ b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/Slf4JPlexusLogger.java @@ -0,0 +1,129 @@ +package org.apache.archiva.common.utils; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Slf4JPlexusLogger - temporary logger to provide an Slf4j Logger to those components + * outside of the archiva codebase that require a plexus logger. + * + * @version $Id$ + */ +public class Slf4JPlexusLogger implements org.codehaus.plexus.logging.Logger { + private Logger log; + + public Slf4JPlexusLogger(Class clazz) { + log = LoggerFactory.getLogger(clazz); + } + + public Slf4JPlexusLogger(String name) { + log = LoggerFactory.getLogger(name); + } + + public void debug(String message) { + log.debug(message); + } + + public void debug(String message, Throwable throwable) { + log.debug(message, throwable); + } + + public void error(String message) { + log.error(message); + } + + public void error(String message, Throwable throwable) { + log.error(message, throwable); + } + + public void fatalError(String message) { + log.error(message); + } + + public void fatalError(String message, Throwable throwable) { + log.error(message, throwable); + } + + public org.codehaus.plexus.logging.Logger getChildLogger(String name) { + return new Slf4JPlexusLogger(log.getName() + "." + name); + } + + public String getName() { + return log.getName(); + } + + public int getThreshold() { + if (log.isTraceEnabled()) { + return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG; + } else if (log.isDebugEnabled()) { + return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG; + } else if (log.isInfoEnabled()) { + return org.codehaus.plexus.logging.Logger.LEVEL_INFO; + } else if (log.isWarnEnabled()) { + return org.codehaus.plexus.logging.Logger.LEVEL_WARN; + } else if (log.isErrorEnabled()) { + return org.codehaus.plexus.logging.Logger.LEVEL_ERROR; + } + + return org.codehaus.plexus.logging.Logger.LEVEL_DISABLED; + } + + public void info(String message) { + log.info(message); + } + + public void info(String message, Throwable throwable) { + log.info(message, throwable); + } + + public boolean isDebugEnabled() { + return log.isDebugEnabled(); + } + + public boolean isErrorEnabled() { + return log.isErrorEnabled(); + } + + public boolean isFatalErrorEnabled() { + return log.isErrorEnabled(); + } + + public boolean isInfoEnabled() { + return log.isInfoEnabled(); + } + + public boolean isWarnEnabled() { + return log.isWarnEnabled(); + } + + public void setThreshold(int threshold) { + /* do nothing */ + } + + public void warn(String message) { + log.warn(message); + } + + public void warn(String message, Throwable throwable) { + log.warn(message, throwable); + } +} diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/VersionComparator.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/VersionComparator.java new file mode 100644 index 000000000..6a790cda5 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/VersionComparator.java @@ -0,0 +1,259 @@ +package org.apache.archiva.common.utils; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.math.NumberUtils; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; + +/** + * VersionComparator - compare the parts of two version strings. + *

+ * Technique. + *

+ * * Split the version strings into parts by splitting on "-._" first, then breaking apart words from numbers. + *

+ * + * "1.0" = "1", "0" + * "1.0-alpha-1" = "1", "0", "alpha", "1" + * "2.0-rc2" = "2", "0", "rc", "2" + * "1.3-m2" = "1", "3", "m", "3" + * + *

+ * compare each part individually, and when they do not match, perform the following test. + *

+ * Numbers are calculated per normal comparison rules. + * Words that are part of the "special word list" will be treated as their index within that heirarchy. + * Words that cannot be identified as special, are treated using normal case-insensitive comparison rules. + * + * @version $Id$ + */ +public class VersionComparator + implements Comparator +{ + private static Comparator INSTANCE = new VersionComparator(); + + private List specialWords; + + public VersionComparator() + { + specialWords = new ArrayList(); + + // ids that refer to LATEST + specialWords.add( "final" ); + specialWords.add( "release" ); + specialWords.add( "current" ); + specialWords.add( "latest" ); + specialWords.add( "g" ); + specialWords.add( "gold" ); + specialWords.add( "fcs" ); + + // ids that are for a release cycle. + specialWords.add( "a" ); + specialWords.add( "alpha" ); + specialWords.add( "b" ); + specialWords.add( "beta" ); + specialWords.add( "pre" ); + specialWords.add( "rc" ); + specialWords.add( "m" ); + specialWords.add( "milestone" ); + + // ids that are for dev / debug cycles. + specialWords.add( "dev" ); + specialWords.add( "test" ); + specialWords.add( "debug" ); + specialWords.add( "unofficial" ); + specialWords.add( "nightly" ); + specialWords.add( "incubating" ); + specialWords.add( "incubator" ); + specialWords.add( "snapshot" ); + } + + public static Comparator getInstance() + { + return INSTANCE; + } + + public int compare( String o1, String o2 ) + { + if ( o1 == null && o2 == null ) + { + return 0; + } + + if ( o1 == null ) + { + return 1; + } + + if ( o2 == null ) + { + return -1; + } + + String[] parts1 = toParts( o1 ); + String[] parts2 = toParts( o2 ); + + int diff; + int partLen = Math.max( parts1.length, parts2.length ); + for ( int i = 0; i < partLen; i++ ) + { + diff = comparePart( safePart( parts1, i ), safePart( parts2, i ) ); + if ( diff != 0 ) + { + return diff; + } + } + + diff = parts2.length - parts1.length; + + if ( diff != 0 ) + { + return diff; + } + + return o1.compareToIgnoreCase( o2 ); + } + + private String safePart( String[] parts, int idx ) + { + if ( idx < parts.length ) + { + return parts[idx]; + } + + return "0"; + } + + private int comparePart( String s1, String s2 ) + { + boolean is1Num = NumberUtils.isNumber( s1 ); + boolean is2Num = NumberUtils.isNumber( s2 ); + + // (Special Case) Test for numbers both first. + if ( is1Num && is2Num ) + { + int i1 = NumberUtils.toInt( s1 ); + int i2 = NumberUtils.toInt( s2 ); + + return i1 - i2; + } + + // Test for text both next. + if ( !is1Num && !is2Num ) + { + int idx1 = specialWords.indexOf( s1.toLowerCase() ); + int idx2 = specialWords.indexOf( s2.toLowerCase() ); + + // Only operate perform index based operation, if both strings + // are found in the specialWords index. + if ( idx1 >= 0 && idx2 >= 0 ) + { + return idx1 - idx2; + } + } + + // Comparing text to num + if ( !is1Num && is2Num ) + { + return -1; + } + + // Comparing num to text + if ( is1Num && !is2Num ) + { + return 1; + } + + // Return comparison of strings themselves. + return s1.compareToIgnoreCase( s2 ); + } + + public static String[] toParts( String version ) + { + if ( StringUtils.isBlank( version ) ) + { + return ArrayUtils.EMPTY_STRING_ARRAY; + } + + int modeOther = 0; + int modeDigit = 1; + int modeText = 2; + + List parts = new ArrayList(); + int len = version.length(); + int i = 0; + int start = 0; + int mode = modeOther; + + while ( i < len ) + { + char c = version.charAt( i ); + + if ( Character.isDigit( c ) ) + { + if ( mode != modeDigit ) + { + if ( mode != modeOther ) + { + parts.add( version.substring( start, i ) ); + } + mode = modeDigit; + start = i; + } + } + else if ( Character.isLetter( c ) ) + { + if ( mode != modeText ) + { + if ( mode != modeOther ) + { + parts.add( version.substring( start, i ) ); + } + mode = modeText; + start = i; + } + } + else + { + // Other. + if ( mode != modeOther ) + { + parts.add( version.substring( start, i ) ); + mode = modeOther; + } + } + + i++; + } + + // Add remainder + if ( mode != modeOther ) + { + parts.add( version.substring( start, i ) ); + } + + return parts.toArray( new String[parts.size()] ); + } +} diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/VersionUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/VersionUtil.java new file mode 100644 index 000000000..fe9fd59a8 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/VersionUtil.java @@ -0,0 +1,207 @@ +package org.apache.archiva.common.utils; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.commons.lang.StringUtils; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Version utility methods. + * + * @version $Id$ + */ +public class VersionUtil +{ + /** + * These are the version patterns found in the filenames of the various artifact's versions IDs. + * These patterns are all tackling lowercase version IDs. + */ + private static final String versionPatterns[] = new String[] { + "([0-9][_.0-9a-z]*)", + "(snapshot)", + "(g?[_.0-9ab]*(pre|rc|g|m)[_.0-9]*)", + "(dev[_.0-9]*)", + "(alpha[_.0-9]*)", + "(beta[_.0-9]*)", + "(rc[_.0-9]*)", +// "(test[_.0-9]*)", -- omitted for MRM-681, can be reinstated as part of MRM-712 + "(debug[_.0-9]*)", + "(unofficial[_.0-9]*)", + "(current)", + "(latest)", + "(fcs)", + "(release[_.0-9]*)", + "(nightly)", + "(final)", + "(incubating)", + "(incubator)", + "([ab][_.0-9]+)" }; + + public static final String SNAPSHOT = "SNAPSHOT"; + + public static final Pattern UNIQUE_SNAPSHOT_PATTERN = Pattern.compile( "^(.*)-([0-9]{8}\\.[0-9]{6})-([0-9]+)$" ); + + public static final Pattern TIMESTAMP_PATTERN = Pattern.compile( "^([0-9]{8})\\.([0-9]{6})$" ); + + public static final Pattern GENERIC_SNAPSHOT_PATTERN = Pattern.compile( "^(.*)-" + SNAPSHOT ); + + private static final Pattern VERSION_MEGA_PATTERN = Pattern.compile( StringUtils.join( versionPatterns, '|' ), Pattern.CASE_INSENSITIVE ); + + /** + *

+ * Tests if the unknown string contains elements that identify it as a version string (or not). + *

+ * + *

+ * The algorithm tests each part of the string that is delimited by a '-' (dash) character. + * If 75% or more of the sections are identified as 'version' strings, the result is + * determined to be of a high probability to be version identifier string. + *

+ * + * @param unknown the unknown string to test. + * @return true if the unknown string is likely a version string. + */ + public static boolean isVersion( String unknown ) + { + String versionParts[] = StringUtils.split( unknown, '-' ); + + Matcher mat; + + int countValidParts = 0; + + for ( int i = 0; i < versionParts.length; i++ ) + { + String part = versionParts[i]; + mat = VERSION_MEGA_PATTERN.matcher( part ); + + if ( mat.matches() ) + { + if ( i == 0 ) // loosen rule to return true if first token matches + { + return true; + } + countValidParts++; + } + } + + /* Calculate version probability as true if 3/4's of the input string has pieces of + * of known version identifier strings. + */ + int threshold = (int) Math.floor( Math.max( (double) 1.0, (double) ( versionParts.length * 0.75 ) ) ); + + return ( countValidParts >= threshold ); + } + + /** + *

+ * Tests if the identifier is a known simple version keyword. + *

+ * + *

+ * This method is different from {@link #isVersion(String)} in that it tests the whole input string in + * one go as a simple identifier. (eg "alpha", "1.0", "beta", "debug", "latest", "rc#", etc...) + *

+ * + * @param identifier the identifier to test. + * @return true if the unknown string is likely a version string. + */ + public static boolean isSimpleVersionKeyword( String identifier ) + { + Matcher mat = VERSION_MEGA_PATTERN.matcher( identifier ); + + return mat.matches(); + } + + public static boolean isSnapshot( String version ) + { + Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version ); + if ( m.matches() ) + { + return true; + } + else + { + return isGenericSnapshot(version); + } + } + + public static String getBaseVersion( String version ) + { + Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version ); + if ( m.matches() ) + { + return m.group( 1 ) + "-" + SNAPSHOT; + } + else + { + return version; + } + } + + /** + *

+ * Get the release version of the snapshot version. + *

+ * + *

+ * If snapshot version is 1.0-SNAPSHOT, then release version would be 1.0 + * And if snapshot version is 1.0-20070113.163208-1.jar, then release version would still be 1.0 + *

+ * + * @param snapshotVersion + * @return + */ + public static String getReleaseVersion( String snapshotVersion ) + { + Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( snapshotVersion ); + + if( isGenericSnapshot( snapshotVersion ) ) + { + m = GENERIC_SNAPSHOT_PATTERN.matcher( snapshotVersion ); + } + + if ( m.matches() ) + { + return m.group( 1 ); + } + else + { + return snapshotVersion; + } + } + + public static boolean isUniqueSnapshot( String version ) + { + Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version ); + if( m.matches() ) + { + return true; + } + + return false; + } + + public static boolean isGenericSnapshot( String version ) + { + return version.endsWith( SNAPSHOT ); + } +} diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/ArchivaException.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/ArchivaException.java deleted file mode 100644 index 3b2b92544..000000000 --- a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/ArchivaException.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.apache.maven.archiva.common; - -/* - * 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. - */ - -/** - * ArchivaException - * - * @version $Id$ - */ -public class ArchivaException - extends Exception -{ - public ArchivaException( String message, Throwable cause ) - { - super( message, cause ); - } - - public ArchivaException( String message ) - { - super( message ); - } -} diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/FileTypeUtils.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/FileTypeUtils.java deleted file mode 100644 index d6d11cc93..000000000 --- a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/FileTypeUtils.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.apache.maven.archiva.common; -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.Arrays; -import java.util.List; - -/** - * @author Olivier Lamy - * @since 1.4 - */ -public class FileTypeUtils -{ - - /** - * Default exclusions from artifact consumers that are using the file types. Note that this is simplistic in the - * case of the support files (based on extension) as it is elsewhere - it may be better to match these to actual - * artifacts and exclude later during scanning. - */ - public static final List DEFAULT_EXCLUSIONS = - Arrays.asList( "**/maven-metadata.xml", "**/maven-metadata-*.xml", "**/*.sha1", "**/*.asc", "**/*.md5", - "**/*.pgp", "**/.index/**", "**/.indexer/**" ); -} diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/BaseFile.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/BaseFile.java deleted file mode 100644 index 2a5ebf059..000000000 --- a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/BaseFile.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.apache.maven.archiva.common.utils; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.net.URI; - -/** - * BaseFile - convenient File object that tracks the Base Directory and can provide relative path values - * for the file object based on that Base Directory value. - * - * @version $Id$ - */ -public class BaseFile - extends File -{ - private File baseDir; - - public BaseFile( File pathFile ) - { - this( pathFile.getAbsolutePath() ); - } - - public BaseFile( File repoDir, File pathFile ) - { - this( repoDir, PathUtil.getRelative( repoDir.getAbsolutePath(), pathFile ) ); - } - - public BaseFile( File parent, String child ) - { - super( parent, child ); - this.baseDir = parent; - } - - public BaseFile( String pathname ) - { - super( pathname ); - - // Calculate the top level directory. - - File parent = this; - while ( parent.getParentFile() != null ) - { - parent = parent.getParentFile(); - } - - this.baseDir = parent; - } - - public BaseFile( String repoDir, File pathFile ) - { - this( new File( repoDir ), pathFile ); - } - - public BaseFile( String parent, String child ) - { - super( parent, child ); - this.baseDir = new File( parent ); - } - - public BaseFile( URI uri ) - { - super( uri ); // only to satisfy java compiler. - throw new IllegalStateException( "The " + BaseFile.class.getName() - + " object does not support URI construction." ); - } - - public File getBaseDir() - { - return baseDir; - } - - public String getRelativePath() - { - return PathUtil.getRelative( this.baseDir.getAbsolutePath(), this ); - } - - public void setBaseDir( File baseDir ) - { - this.baseDir = baseDir; - } - - public void setBaseDir( String repoDir ) - { - setBaseDir( new File( repoDir ) ); - } -} diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/DateUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/DateUtil.java deleted file mode 100644 index 7e3dc2377..000000000 --- a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/DateUtil.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.apache.maven.archiva.common.utils; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; - -/** - * DateUtil - some (not-so) common date utility methods. - * - * @version $Id$ - */ -public class DateUtil -{ - public static String getDuration( long duration ) - { - return getDuration( new Date( 0 ), new Date( duration ) ); - } - - public static String getDuration( long ms1, long ms2 ) - { - return getDuration( new Date( ms1 ), new Date( ms2 ) ); - } - - public static String getDuration( Date d1, Date d2 ) - { - Calendar cal1 = new GregorianCalendar(); - cal1.setTime( d1 ); - - Calendar cal2 = new GregorianCalendar(); - cal2.setTime( d2 ); - - return getDuration( cal1, cal2 ); - } - - public static String getDuration( Calendar cal1, Calendar cal2 ) - { - int year1 = cal1.get( Calendar.YEAR ); - int day1 = cal1.get( Calendar.DAY_OF_YEAR ); - int hour1 = cal1.get( Calendar.HOUR_OF_DAY ); - int min1 = cal1.get( Calendar.MINUTE ); - int sec1 = cal1.get( Calendar.SECOND ); - int ms1 = cal1.get( Calendar.MILLISECOND ); - - int year2 = cal2.get( Calendar.YEAR ); - int day2 = cal2.get( Calendar.DAY_OF_YEAR ); - int hour2 = cal2.get( Calendar.HOUR_OF_DAY ); - int min2 = cal2.get( Calendar.MINUTE ); - int sec2 = cal2.get( Calendar.SECOND ); - int ms2 = cal2.get( Calendar.MILLISECOND ); - - int leftDays = ( day1 - day2 ) + ( year1 - year2 ) * 365; - int leftHours = hour2 - hour1; - int leftMins = min2 - min1; - int leftSeconds = sec2 - sec1; - int leftMilliSeconds = ms2 - ms1; - - if ( leftMilliSeconds < 0 ) - { - leftMilliSeconds += 1000; - --leftSeconds; - } - - if ( leftSeconds < 0 ) - { - leftSeconds += 60; - --leftMins; - } - - if ( leftMins < 0 ) - { - leftMins += 60; - --leftHours; - } - - if ( leftHours < 0 ) - { - leftHours += 24; - --leftDays; - } - - StringBuffer interval = new StringBuffer(); - - appendInterval( interval, leftDays, "Day" ); - appendInterval( interval, leftHours, "Hour" ); - appendInterval( interval, leftMins, "Minute" ); - appendInterval( interval, leftSeconds, "Second" ); - appendInterval( interval, leftMilliSeconds, "Millisecond" ); - - return interval.toString(); - } - - private static void appendInterval( StringBuffer interval, int count, String type ) - { - if ( count > 0 ) - { - if ( interval.length() > 0 ) - { - interval.append( " " ); - } - - interval.append( count ); - interval.append( " " ).append( type ); - if ( count > 1 ) - { - interval.append( "s" ); - } - } - } - -} diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/FileUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/FileUtil.java deleted file mode 100644 index 8c451dc28..000000000 --- a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/FileUtil.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.apache.maven.archiva.common.utils; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; - -public class FileUtil -{ - public static String getBasedir() - { - String basedir = System.getProperty( "basedir" ); - if ( basedir == null ) - { - basedir = new File( "" ).getAbsolutePath(); - } - - return basedir; - } -} \ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/PathUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/PathUtil.java deleted file mode 100644 index 34905ecff..000000000 --- a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/PathUtil.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.apache.maven.archiva.common.utils; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.commons.lang.StringUtils; - -import java.io.File; -import java.net.MalformedURLException; - -/** - * PathUtil - simple utility methods for path manipulation. - * - * @version $Id$ - */ -public class PathUtil -{ - public static String toUrl( String path ) - { - // Is our work already done for us? - if ( path.startsWith( "file:/" ) ) - { - return path; - } - - return toUrl( new File( path ) ); - } - - public static String toUrl( File file ) - { - try - { - return file.toURL().toExternalForm(); - } - catch ( MalformedURLException e ) - { - String pathCorrected = StringUtils.replaceChars( file.getAbsolutePath(), '\\', '/' ); - if ( pathCorrected.startsWith( "file:/" ) ) - { - return pathCorrected; - } - - return "file://" + pathCorrected; - } - } - - /** - * Given a basedir and a child file, return the relative path to the child. - * - * @param basedir the basedir. - * @param file the file to get the relative path for. - * @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character) - */ - public static String getRelative( String basedir, File file ) - { - return getRelative( basedir, file.getAbsolutePath() ); - } - - /** - * Given a basedir and a child file, return the relative path to the child. - * - * @param basedir the basedir. - * @param child the child path (can be a full path) - * @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character) - */ - public static String getRelative( String basedir, String child ) - { - if ( basedir.endsWith( "/" ) || basedir.endsWith( "\\" ) ) - { - basedir = basedir.substring( 0, basedir.length() - 1 ); - } - - if ( child.startsWith( basedir ) ) - { - // simple solution. - return child.substring( basedir.length() + 1 ); - } - - String absoluteBasedir = new File( basedir ).getAbsolutePath(); - if ( child.startsWith( absoluteBasedir ) ) - { - // resolved basedir solution. - return child.substring( absoluteBasedir.length() + 1 ); - } - - // File is not within basedir. - throw new IllegalStateException( "Unable to obtain relative path of file " + child - + ", it is not within basedir " + basedir + "." ); - } -} diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/Slf4JPlexusLogger.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/Slf4JPlexusLogger.java deleted file mode 100644 index 9e0a93fad..000000000 --- a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/Slf4JPlexusLogger.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.apache.maven.archiva.common.utils; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Slf4JPlexusLogger - temporary logger to provide an Slf4j Logger to those components - * outside of the archiva codebase that require a plexus logger. - * - * @version $Id$ - */ -public class Slf4JPlexusLogger implements org.codehaus.plexus.logging.Logger { - private Logger log; - - public Slf4JPlexusLogger(Class clazz) { - log = LoggerFactory.getLogger(clazz); - } - - public Slf4JPlexusLogger(String name) { - log = LoggerFactory.getLogger(name); - } - - public void debug(String message) { - log.debug(message); - } - - public void debug(String message, Throwable throwable) { - log.debug(message, throwable); - } - - public void error(String message) { - log.error(message); - } - - public void error(String message, Throwable throwable) { - log.error(message, throwable); - } - - public void fatalError(String message) { - log.error(message); - } - - public void fatalError(String message, Throwable throwable) { - log.error(message, throwable); - } - - public org.codehaus.plexus.logging.Logger getChildLogger(String name) { - return new Slf4JPlexusLogger(log.getName() + "." + name); - } - - public String getName() { - return log.getName(); - } - - public int getThreshold() { - if (log.isTraceEnabled()) { - return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG; - } else if (log.isDebugEnabled()) { - return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG; - } else if (log.isInfoEnabled()) { - return org.codehaus.plexus.logging.Logger.LEVEL_INFO; - } else if (log.isWarnEnabled()) { - return org.codehaus.plexus.logging.Logger.LEVEL_WARN; - } else if (log.isErrorEnabled()) { - return org.codehaus.plexus.logging.Logger.LEVEL_ERROR; - } - - return org.codehaus.plexus.logging.Logger.LEVEL_DISABLED; - } - - public void info(String message) { - log.info(message); - } - - public void info(String message, Throwable throwable) { - log.info(message, throwable); - } - - public boolean isDebugEnabled() { - return log.isDebugEnabled(); - } - - public boolean isErrorEnabled() { - return log.isErrorEnabled(); - } - - public boolean isFatalErrorEnabled() { - return log.isErrorEnabled(); - } - - public boolean isInfoEnabled() { - return log.isInfoEnabled(); - } - - public boolean isWarnEnabled() { - return log.isWarnEnabled(); - } - - public void setThreshold(int threshold) { - /* do nothing */ - } - - public void warn(String message) { - log.warn(message); - } - - public void warn(String message, Throwable throwable) { - log.warn(message, throwable); - } -} diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/VersionComparator.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/VersionComparator.java deleted file mode 100644 index fee56a145..000000000 --- a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/VersionComparator.java +++ /dev/null @@ -1,259 +0,0 @@ -package org.apache.maven.archiva.common.utils; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.math.NumberUtils; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; - -/** - * VersionComparator - compare the parts of two version strings. - *

- * Technique. - *

- * * Split the version strings into parts by splitting on "-._" first, then breaking apart words from numbers. - *

- * - * "1.0" = "1", "0" - * "1.0-alpha-1" = "1", "0", "alpha", "1" - * "2.0-rc2" = "2", "0", "rc", "2" - * "1.3-m2" = "1", "3", "m", "3" - * - *

- * compare each part individually, and when they do not match, perform the following test. - *

- * Numbers are calculated per normal comparison rules. - * Words that are part of the "special word list" will be treated as their index within that heirarchy. - * Words that cannot be identified as special, are treated using normal case-insensitive comparison rules. - * - * @version $Id$ - */ -public class VersionComparator - implements Comparator -{ - private static Comparator INSTANCE = new VersionComparator(); - - private List specialWords; - - public VersionComparator() - { - specialWords = new ArrayList(); - - // ids that refer to LATEST - specialWords.add( "final" ); - specialWords.add( "release" ); - specialWords.add( "current" ); - specialWords.add( "latest" ); - specialWords.add( "g" ); - specialWords.add( "gold" ); - specialWords.add( "fcs" ); - - // ids that are for a release cycle. - specialWords.add( "a" ); - specialWords.add( "alpha" ); - specialWords.add( "b" ); - specialWords.add( "beta" ); - specialWords.add( "pre" ); - specialWords.add( "rc" ); - specialWords.add( "m" ); - specialWords.add( "milestone" ); - - // ids that are for dev / debug cycles. - specialWords.add( "dev" ); - specialWords.add( "test" ); - specialWords.add( "debug" ); - specialWords.add( "unofficial" ); - specialWords.add( "nightly" ); - specialWords.add( "incubating" ); - specialWords.add( "incubator" ); - specialWords.add( "snapshot" ); - } - - public static Comparator getInstance() - { - return INSTANCE; - } - - public int compare( String o1, String o2 ) - { - if ( o1 == null && o2 == null ) - { - return 0; - } - - if ( o1 == null ) - { - return 1; - } - - if ( o2 == null ) - { - return -1; - } - - String[] parts1 = toParts( o1 ); - String[] parts2 = toParts( o2 ); - - int diff; - int partLen = Math.max( parts1.length, parts2.length ); - for ( int i = 0; i < partLen; i++ ) - { - diff = comparePart( safePart( parts1, i ), safePart( parts2, i ) ); - if ( diff != 0 ) - { - return diff; - } - } - - diff = parts2.length - parts1.length; - - if ( diff != 0 ) - { - return diff; - } - - return o1.compareToIgnoreCase( o2 ); - } - - private String safePart( String[] parts, int idx ) - { - if ( idx < parts.length ) - { - return parts[idx]; - } - - return "0"; - } - - private int comparePart( String s1, String s2 ) - { - boolean is1Num = NumberUtils.isNumber( s1 ); - boolean is2Num = NumberUtils.isNumber( s2 ); - - // (Special Case) Test for numbers both first. - if ( is1Num && is2Num ) - { - int i1 = NumberUtils.toInt( s1 ); - int i2 = NumberUtils.toInt( s2 ); - - return i1 - i2; - } - - // Test for text both next. - if ( !is1Num && !is2Num ) - { - int idx1 = specialWords.indexOf( s1.toLowerCase() ); - int idx2 = specialWords.indexOf( s2.toLowerCase() ); - - // Only operate perform index based operation, if both strings - // are found in the specialWords index. - if ( idx1 >= 0 && idx2 >= 0 ) - { - return idx1 - idx2; - } - } - - // Comparing text to num - if ( !is1Num && is2Num ) - { - return -1; - } - - // Comparing num to text - if ( is1Num && !is2Num ) - { - return 1; - } - - // Return comparison of strings themselves. - return s1.compareToIgnoreCase( s2 ); - } - - public static String[] toParts( String version ) - { - if ( StringUtils.isBlank( version ) ) - { - return ArrayUtils.EMPTY_STRING_ARRAY; - } - - int modeOther = 0; - int modeDigit = 1; - int modeText = 2; - - List parts = new ArrayList(); - int len = version.length(); - int i = 0; - int start = 0; - int mode = modeOther; - - while ( i < len ) - { - char c = version.charAt( i ); - - if ( Character.isDigit( c ) ) - { - if ( mode != modeDigit ) - { - if ( mode != modeOther ) - { - parts.add( version.substring( start, i ) ); - } - mode = modeDigit; - start = i; - } - } - else if ( Character.isLetter( c ) ) - { - if ( mode != modeText ) - { - if ( mode != modeOther ) - { - parts.add( version.substring( start, i ) ); - } - mode = modeText; - start = i; - } - } - else - { - // Other. - if ( mode != modeOther ) - { - parts.add( version.substring( start, i ) ); - mode = modeOther; - } - } - - i++; - } - - // Add remainder - if ( mode != modeOther ) - { - parts.add( version.substring( start, i ) ); - } - - return parts.toArray( new String[parts.size()] ); - } -} diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/VersionUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/VersionUtil.java deleted file mode 100644 index 3cbcb8d8f..000000000 --- a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/VersionUtil.java +++ /dev/null @@ -1,207 +0,0 @@ -package org.apache.maven.archiva.common.utils; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.commons.lang.StringUtils; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Version utility methods. - * - * @version $Id$ - */ -public class VersionUtil -{ - /** - * These are the version patterns found in the filenames of the various artifact's versions IDs. - * These patterns are all tackling lowercase version IDs. - */ - private static final String versionPatterns[] = new String[] { - "([0-9][_.0-9a-z]*)", - "(snapshot)", - "(g?[_.0-9ab]*(pre|rc|g|m)[_.0-9]*)", - "(dev[_.0-9]*)", - "(alpha[_.0-9]*)", - "(beta[_.0-9]*)", - "(rc[_.0-9]*)", -// "(test[_.0-9]*)", -- omitted for MRM-681, can be reinstated as part of MRM-712 - "(debug[_.0-9]*)", - "(unofficial[_.0-9]*)", - "(current)", - "(latest)", - "(fcs)", - "(release[_.0-9]*)", - "(nightly)", - "(final)", - "(incubating)", - "(incubator)", - "([ab][_.0-9]+)" }; - - public static final String SNAPSHOT = "SNAPSHOT"; - - public static final Pattern UNIQUE_SNAPSHOT_PATTERN = Pattern.compile( "^(.*)-([0-9]{8}\\.[0-9]{6})-([0-9]+)$" ); - - public static final Pattern TIMESTAMP_PATTERN = Pattern.compile( "^([0-9]{8})\\.([0-9]{6})$" ); - - public static final Pattern GENERIC_SNAPSHOT_PATTERN = Pattern.compile( "^(.*)-" + SNAPSHOT ); - - private static final Pattern VERSION_MEGA_PATTERN = Pattern.compile( StringUtils.join( versionPatterns, '|' ), Pattern.CASE_INSENSITIVE ); - - /** - *

- * Tests if the unknown string contains elements that identify it as a version string (or not). - *

- * - *

- * The algorithm tests each part of the string that is delimited by a '-' (dash) character. - * If 75% or more of the sections are identified as 'version' strings, the result is - * determined to be of a high probability to be version identifier string. - *

- * - * @param unknown the unknown string to test. - * @return true if the unknown string is likely a version string. - */ - public static boolean isVersion( String unknown ) - { - String versionParts[] = StringUtils.split( unknown, '-' ); - - Matcher mat; - - int countValidParts = 0; - - for ( int i = 0; i < versionParts.length; i++ ) - { - String part = versionParts[i]; - mat = VERSION_MEGA_PATTERN.matcher( part ); - - if ( mat.matches() ) - { - if ( i == 0 ) // loosen rule to return true if first token matches - { - return true; - } - countValidParts++; - } - } - - /* Calculate version probability as true if 3/4's of the input string has pieces of - * of known version identifier strings. - */ - int threshold = (int) Math.floor( Math.max( (double) 1.0, (double) ( versionParts.length * 0.75 ) ) ); - - return ( countValidParts >= threshold ); - } - - /** - *

- * Tests if the identifier is a known simple version keyword. - *

- * - *

- * This method is different from {@link #isVersion(String)} in that it tests the whole input string in - * one go as a simple identifier. (eg "alpha", "1.0", "beta", "debug", "latest", "rc#", etc...) - *

- * - * @param identifier the identifier to test. - * @return true if the unknown string is likely a version string. - */ - public static boolean isSimpleVersionKeyword( String identifier ) - { - Matcher mat = VERSION_MEGA_PATTERN.matcher( identifier ); - - return mat.matches(); - } - - public static boolean isSnapshot( String version ) - { - Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version ); - if ( m.matches() ) - { - return true; - } - else - { - return isGenericSnapshot(version); - } - } - - public static String getBaseVersion( String version ) - { - Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version ); - if ( m.matches() ) - { - return m.group( 1 ) + "-" + SNAPSHOT; - } - else - { - return version; - } - } - - /** - *

- * Get the release version of the snapshot version. - *

- * - *

- * If snapshot version is 1.0-SNAPSHOT, then release version would be 1.0 - * And if snapshot version is 1.0-20070113.163208-1.jar, then release version would still be 1.0 - *

- * - * @param snapshotVersion - * @return - */ - public static String getReleaseVersion( String snapshotVersion ) - { - Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( snapshotVersion ); - - if( isGenericSnapshot( snapshotVersion ) ) - { - m = GENERIC_SNAPSHOT_PATTERN.matcher( snapshotVersion ); - } - - if ( m.matches() ) - { - return m.group( 1 ); - } - else - { - return snapshotVersion; - } - } - - public static boolean isUniqueSnapshot( String version ) - { - Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version ); - if( m.matches() ) - { - return true; - } - - return false; - } - - public static boolean isGenericSnapshot( String version ) - { - return version.endsWith( SNAPSHOT ); - } -} diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/BaseFileTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/BaseFileTest.java new file mode 100644 index 000000000..2808f49f4 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/BaseFileTest.java @@ -0,0 +1,131 @@ +package org.apache.archiva.common.utils; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.commons.lang.StringUtils; + +import junit.framework.TestCase; + +import java.io.File; + +/** + * BaseFileTest + * + * @version $Id$ + */ +public class BaseFileTest + extends TestCase +{ + public void testFileString() + { + File repoDir = new File( "/home/user/foo/repository" ); + String pathFile = "path/to/resource.xml"; + BaseFile file = new BaseFile( repoDir, pathFile ); + + assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file ); + assertRelativePath( "path/to/resource.xml", file ); + assertBasedir( "/home/user/foo/repository", file ); + } + + public void testFileFile() + { + File repoDir = new File( "/home/user/foo/repository" ); + File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" ); + BaseFile file = new BaseFile( repoDir, pathFile ); + + assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file ); + assertRelativePath( "path/to/resource.xml", file ); + assertBasedir( "/home/user/foo/repository", file ); + } + + public void testStringFile() + { + String repoDir = "/home/user/foo/repository"; + File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" ); + BaseFile file = new BaseFile( repoDir, pathFile ); + + assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file ); + assertRelativePath( "path/to/resource.xml", file ); + assertBasedir( "/home/user/foo/repository", file ); + } + + public void testFileThenSetBaseString() + { + String repoDir = "/home/user/foo/repository"; + File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" ); + BaseFile file = new BaseFile( pathFile ); + file.setBaseDir( repoDir ); + + assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file ); + assertRelativePath( "path/to/resource.xml", file ); + assertBasedir( "/home/user/foo/repository", file ); + } + + public void testFileThenSetBaseFile() + { + File repoDir = new File( "/home/user/foo/repository" ); + File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" ); + BaseFile file = new BaseFile( pathFile ); + file.setBaseDir( repoDir ); + + assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file ); + assertRelativePath( "path/to/resource.xml", file ); + assertBasedir( "/home/user/foo/repository", file ); + } + + public void testStringThenSetBaseString() + { + String repoDir = "/home/user/foo/repository"; + String pathFile = "/home/user/foo/repository/path/to/resource.xml"; + BaseFile file = new BaseFile( pathFile ); + file.setBaseDir( repoDir ); + + assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file ); + assertRelativePath( "path/to/resource.xml", file ); + assertBasedir( "/home/user/foo/repository", file ); + } + + public void testStringThenSetBaseFile() + { + File repoDir = new File( "/home/user/foo/repository" ); + String pathFile = "/home/user/foo/repository/path/to/resource.xml"; + BaseFile file = new BaseFile( pathFile ); + file.setBaseDir( repoDir ); + + assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file ); + assertRelativePath( "path/to/resource.xml", file ); + assertBasedir( "/home/user/foo/repository", file ); + } + + private void assertAbsolutePath( String expectedPath, BaseFile actualFile ) + { + assertEquals( new File( expectedPath ).getAbsolutePath(), actualFile.getAbsolutePath() ); + } + + private void assertRelativePath( String expectedPath, BaseFile actualFile ) + { + assertEquals( expectedPath, StringUtils.replace( actualFile.getRelativePath(), "\\", "/" ) ); + } + + private void assertBasedir( String expectedPath, BaseFile actualFile ) + { + assertEquals( new File( expectedPath ), actualFile.getBaseDir() ); + } +} diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/DateUtilTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/DateUtilTest.java new file mode 100644 index 000000000..56f843c1a --- /dev/null +++ b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/DateUtilTest.java @@ -0,0 +1,68 @@ +package org.apache.archiva.common.utils; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import junit.framework.TestCase; + +/** + * DateUtilTest + * + * @version $Id$ + */ +public class DateUtilTest extends TestCase +{ + private void assertDuration( String expectedDuration, String startTimestamp, String endTimestamp ) + throws ParseException + { + SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss SSS" ); + Date startDate = sdf.parse( startTimestamp ); + Date endDate = sdf.parse( endTimestamp ); + +// System.out.println( "Date: " + endTimestamp + " - " + startTimestamp + " = " +// + ( endDate.getTime() - startDate.getTime() ) + " ms" ); + + assertEquals( expectedDuration, DateUtil.getDuration( startDate, endDate ) ); + } + + public void testGetDurationDifference() throws ParseException + { + assertDuration( "2 Seconds", "2006-08-22 13:00:02 0000", + "2006-08-22 13:00:04 0000" ); + + assertDuration( "12 Minutes 12 Seconds 234 Milliseconds", "2006-08-22 13:12:02 0000", + "2006-08-22 13:24:14 0234" ); + + assertDuration( "12 Minutes 501 Milliseconds", "2006-08-22 13:12:01 0500", + "2006-08-22 13:24:02 0001" ); + } + + public void testGetDurationDirect() throws ParseException + { + assertEquals( "2 Seconds", DateUtil.getDuration( 2000 ) ); + + assertEquals( "12 Minutes 12 Seconds 234 Milliseconds", DateUtil.getDuration( 732234 ) ); + + assertEquals( "12 Minutes 501 Milliseconds", DateUtil.getDuration( 720501 ) ); + } +} diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/PathUtilTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/PathUtilTest.java new file mode 100644 index 000000000..0a7d8555d --- /dev/null +++ b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/PathUtilTest.java @@ -0,0 +1,93 @@ +package org.apache.archiva.common.utils; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.commons.lang.StringUtils; + +import java.io.File; + +import junit.framework.TestCase; + +/** + * PathUtilTest + * + * @version $Id$ + */ +public class PathUtilTest + extends TestCase +{ + public void testToRelativeWithoutSlash() + { + assertEquals( "path/to/resource.xml", PathUtil.getRelative( "/home/user/foo/repository", + "/home/user/foo/repository/path/to/resource.xml" ) ); + } + + public void testToRelativeWithSlash() + { + assertEquals( "path/to/resource.xml", PathUtil.getRelative( "/home/user/foo/repository/", + "/home/user/foo/repository/path/to/resource.xml" ) ); + } + + public void testToUrlRelativePath() + { + File workingDir = new File( "." ); + + String workingDirname = StringUtils.replaceChars( workingDir.getAbsolutePath(), '\\', '/' ); + + // Some JVM's retain the "." at the end of the path. Drop it. + if ( workingDirname.endsWith( "/." ) ) + { + workingDirname = workingDirname.substring( 0, workingDirname.length() - 2 ); + } + + if ( !workingDirname.startsWith( "/" ) ) + { + workingDirname = "/" + workingDirname; + } + + String path = "path/to/resource.xml"; + String expectedPath = "file:" + workingDirname + "/" + path; + + assertEquals( expectedPath, PathUtil.toUrl( path ) ); + } + + public void testToUrlUsingFileUrl() + { + File workingDir = new File( "." ); + + String workingDirname = StringUtils.replaceChars( workingDir.getAbsolutePath(), '\\', '/' ); + + // Some JVM's retain the "." at the end of the path. Drop it. + if ( workingDirname.endsWith( "/." ) ) + { + workingDirname = workingDirname.substring( 0, workingDirname.length() - 2 ); + } + + if ( !workingDirname.startsWith( "/" ) ) + { + workingDirname = "/" + workingDirname; + } + + String path = "path/to/resource.xml"; + String expectedPath = "file:" + workingDirname + "/" + path; + + assertEquals( expectedPath, PathUtil.toUrl( expectedPath ) ); + } +} diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/ResourceUtils.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/ResourceUtils.java new file mode 100644 index 000000000..5ba7912ca --- /dev/null +++ b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/ResourceUtils.java @@ -0,0 +1,90 @@ +package org.apache.archiva.common.utils; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.commons.lang.StringUtils; + +import java.io.File; +import java.io.IOException; +import java.net.URL; + +/** + * ResourceUtils + */ +public class ResourceUtils +{ + /** + * Lookup resource at the given path relative to the root of the classpath and if it exists return a file object + * that can be used to access it. + *

+ * At test time the contents of both the src/resources and test/resources dirs are available at the root of the + * classpath. + *

+ * To retrieve the file src/test/resources/sometest/test.properties use getResource("/sometest/test.properties"). + * + * @param resourcePath the path to the resource relative to the root of the classpath + * @return File a file object pointing to the resource on the classpath or null if the resource cannot be found + */ + public static File getResource( String resourcePath ) + throws IOException + { + return getResource( resourcePath, null ); + } + + /** + * Lookup resource at the given path relative to the root of the classpath and if it exists return a file object + * that can be used to access it. + *

+ * At test time the contents of both the src/resources and test/resources dirs are available at the root of the + * classpath. + *

+ * To retrieve the file src/test/resources/sometest/test.properties use getResource("/sometest/test.properties"). + * + * @param resourcePath the path to the resource relative to the root of the classpath + * @param classloader the classloader who's classpath should be searched for the resource + * @return File a file object pointing to the resource on the classpath or null if the resource cannot be found + */ + public static File getResource( String resourcePath, ClassLoader classloader ) + throws IOException + { + File testResource = null; + + if ( StringUtils.isNotBlank( resourcePath ) ) + { + // make sure the retrieval is relative to the root of the classpath + resourcePath = resourcePath.startsWith( "/" ) ? resourcePath : "/" + resourcePath; + + URL resourceUrl = getResourceUrl( resourcePath, classloader ); + if ( resourceUrl == null ) + { + throw new IOException( "Could not find test resource at path '" + resourcePath + "'" ); + } + testResource = new File( resourceUrl.getFile() ); + } + + return testResource; + } + + private static URL getResourceUrl( String resourcePath, ClassLoader classloader ) + { + return classloader != null ? classloader.getResource( resourcePath ) + : ResourceUtils.class.getResource( resourcePath ); + } +} diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/VersionComparatorTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/VersionComparatorTest.java new file mode 100644 index 000000000..01e9e1132 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/VersionComparatorTest.java @@ -0,0 +1,130 @@ +package org.apache.archiva.common.utils; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import junit.framework.TestCase; + +/** + * VersionComparatorTest + * + * @version $Id$ + */ +public class VersionComparatorTest + extends TestCase +{ + public void testComparator() + { + /* Sort order is oldest to newest */ + + assertSort( new String[] { "1.0", "3.0", "2.0" }, new String[] { "1.0", "2.0", "3.0" } ); + assertSort( new String[] { "1.5", "1.2", "1.0" }, new String[] { "1.0", "1.2", "1.5" } ); + + assertSort( new String[] { "1.5-SNAPSHOT", "1.2", "1.20" }, new String[] { "1.2", "1.5-SNAPSHOT", "1.20" } ); + + assertSort( new String[] { "1.1", "1.0-SNAPSHOT", "1.1-m6", "1.1-rc1" }, new String[] { + "1.0-SNAPSHOT", + "1.1-rc1", + "1.1-m6", + "1.1" } ); + + assertSort( new String[] { "1.1-m6", "1.0-SNAPSHOT", "1.1-rc1", "1.1" }, new String[] { + "1.0-SNAPSHOT", + "1.1-rc1", + "1.1-m6", + "1.1" } ); + + assertSort( new String[] { "2.0.5", "2.0.4-SNAPSHOT", "2.0", "2.0-rc1" }, new String[] { + "2.0-rc1", + "2.0", + "2.0.4-SNAPSHOT", + "2.0.5" } ); + + assertSort( new String[] { "1.0-alpha-1", "1.0-alpha-22", "1.0-alpha-10", "1.0-alpha-9" }, new String[] { + "1.0-alpha-1", + "1.0-alpha-9", + "1.0-alpha-10", + "1.0-alpha-22" } ); + + assertSort( new String[] { "1.0-alpha1", "1.0-alpha22", "1.0-alpha10", "1.0-alpha9" }, new String[] { + "1.0-alpha1", + "1.0-alpha9", + "1.0-alpha10", + "1.0-alpha22" } ); + + assertSort( new String[] { "1.0-1", "1.0-22", "1.0-10", "1.0-9" }, new String[] { + "1.0-1", + "1.0-9", + "1.0-10", + "1.0-22" } ); + + assertSort( new String[] { "alpha-1", "alpha-22", "alpha-10", "alpha-9" }, new String[] { + "alpha-1", + "alpha-9", + "alpha-10", + "alpha-22" } ); + + assertSort( new String[] { "1.0.1", "1.0.22", "1.0.10", "1.0.9" }, new String[] { + "1.0.1", + "1.0.9", + "1.0.10", + "1.0.22" } ); + + + // TODO: write more unit tests. + } + + private void assertSort( String[] rawVersions, String[] expectedSort ) + { + List versions = new ArrayList(); + versions.addAll( Arrays.asList( rawVersions ) ); + + Collections.sort( versions, VersionComparator.getInstance() ); + + assertEquals( "Versions.size()", expectedSort.length, versions.size() ); + for ( int i = 0; i < expectedSort.length; i++ ) + { + assertEquals( "Sorted Versions[" + i + "]", expectedSort[i], (String) versions.get( i ) ); + } + } + + public void testToParts() + { + assertParts( "1.0", new String[] { "1", "0" } ); + assertParts( "1.0-alpha-1", new String[] { "1", "0", "alpha", "1" } ); + assertParts( "2.0-rc2", new String[] { "2", "0", "rc", "2" } ); + assertParts( "1.3-m6", new String[] { "1", "3", "m", "6" } ); + } + + private void assertParts( String version, String[] expectedParts ) + { + String actualParts[] = VersionComparator.toParts( version ); + assertEquals( "Parts.length", expectedParts.length, actualParts.length ); + + for ( int i = 0; i < expectedParts.length; i++ ) + { + assertEquals( "parts[" + i + "]", expectedParts[i], actualParts[i] ); + } + } +} diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/VersionUtilTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/VersionUtilTest.java new file mode 100644 index 000000000..154cab2a8 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/VersionUtilTest.java @@ -0,0 +1,94 @@ +package org.apache.archiva.common.utils; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import junit.framework.TestCase; + +public class VersionUtilTest extends TestCase +{ + + public void testIsVersion() + { + // 0% + assertFalse( VersionUtil.isVersion( "project" ) ); + + // 0% + assertFalse( VersionUtil.isVersion( "project-not-version" ) ); + + // 50% + assertFalse( VersionUtil.isVersion( "project-ver-1.0-dev" ) ); + + // > 75% + assertTrue( VersionUtil.isVersion( "project-1.0-alpha" ) ); + + // 75% + assertTrue( VersionUtil.isVersion( "project-1.0-latest-nightly" ) ); + + // >75% + assertTrue( VersionUtil.isVersion( "1.0-project-unofficial-nightly-alpha-release" ) ); + + //only first token matches + assertTrue( VersionUtil.isVersion( "1.0-project-my-own-version" ) ); + + } + + public void testIsSimpleVersionKeyword() + { + assertTrue( VersionUtil.isSimpleVersionKeyword( "rc4.34" ) ); + + assertTrue( VersionUtil.isSimpleVersionKeyword( "beta" ) ); + + assertFalse( VersionUtil.isSimpleVersionKeyword( "1.0-SNAPSHOT" ) ); + } + + public void testIsSnapshot() + { + assertTrue( VersionUtil.isSnapshot( "1.0-20070113.163208-99" ) ); + + assertTrue( VersionUtil.isSnapshot( "1.0-SNAPSHOT" ) ); + + assertFalse( VersionUtil.isSnapshot( "1.0-beta1" ) ); + } + + public void testGetBaseVersion() + { + assertEquals( VersionUtil.getBaseVersion( "1.3.2-20090420.083501-3" ), "1.3.2-SNAPSHOT" ); + } + + public void testGetReleaseVersion() + { + assertEquals( VersionUtil.getReleaseVersion( "1.3.2-20090420.083501-3" ), "1.3.2" ); + } + + public void testIsUniqueSnapshot() + { + assertTrue( VersionUtil.isUniqueSnapshot( "1.3.2-20090420.083501-3" ) ); + + assertFalse( VersionUtil.isUniqueSnapshot( "1.3.2" ) ); + } + + public void testIsGenericSnapshot() + { + assertFalse( VersionUtil.isGenericSnapshot( "1.3.2-20090420.083501-3" ) ); + + assertTrue( VersionUtil.isGenericSnapshot( "1.3.2-SNAPSHOT" ) ); + } + +} diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java deleted file mode 100644 index 75694041c..000000000 --- a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java +++ /dev/null @@ -1,131 +0,0 @@ -package org.apache.maven.archiva.common.utils; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.commons.lang.StringUtils; - -import junit.framework.TestCase; - -import java.io.File; - -/** - * BaseFileTest - * - * @version $Id$ - */ -public class BaseFileTest - extends TestCase -{ - public void testFileString() - { - File repoDir = new File( "/home/user/foo/repository" ); - String pathFile = "path/to/resource.xml"; - BaseFile file = new BaseFile( repoDir, pathFile ); - - assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file ); - assertRelativePath( "path/to/resource.xml", file ); - assertBasedir( "/home/user/foo/repository", file ); - } - - public void testFileFile() - { - File repoDir = new File( "/home/user/foo/repository" ); - File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" ); - BaseFile file = new BaseFile( repoDir, pathFile ); - - assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file ); - assertRelativePath( "path/to/resource.xml", file ); - assertBasedir( "/home/user/foo/repository", file ); - } - - public void testStringFile() - { - String repoDir = "/home/user/foo/repository"; - File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" ); - BaseFile file = new BaseFile( repoDir, pathFile ); - - assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file ); - assertRelativePath( "path/to/resource.xml", file ); - assertBasedir( "/home/user/foo/repository", file ); - } - - public void testFileThenSetBaseString() - { - String repoDir = "/home/user/foo/repository"; - File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" ); - BaseFile file = new BaseFile( pathFile ); - file.setBaseDir( repoDir ); - - assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file ); - assertRelativePath( "path/to/resource.xml", file ); - assertBasedir( "/home/user/foo/repository", file ); - } - - public void testFileThenSetBaseFile() - { - File repoDir = new File( "/home/user/foo/repository" ); - File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" ); - BaseFile file = new BaseFile( pathFile ); - file.setBaseDir( repoDir ); - - assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file ); - assertRelativePath( "path/to/resource.xml", file ); - assertBasedir( "/home/user/foo/repository", file ); - } - - public void testStringThenSetBaseString() - { - String repoDir = "/home/user/foo/repository"; - String pathFile = "/home/user/foo/repository/path/to/resource.xml"; - BaseFile file = new BaseFile( pathFile ); - file.setBaseDir( repoDir ); - - assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file ); - assertRelativePath( "path/to/resource.xml", file ); - assertBasedir( "/home/user/foo/repository", file ); - } - - public void testStringThenSetBaseFile() - { - File repoDir = new File( "/home/user/foo/repository" ); - String pathFile = "/home/user/foo/repository/path/to/resource.xml"; - BaseFile file = new BaseFile( pathFile ); - file.setBaseDir( repoDir ); - - assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file ); - assertRelativePath( "path/to/resource.xml", file ); - assertBasedir( "/home/user/foo/repository", file ); - } - - private void assertAbsolutePath( String expectedPath, BaseFile actualFile ) - { - assertEquals( new File( expectedPath ).getAbsolutePath(), actualFile.getAbsolutePath() ); - } - - private void assertRelativePath( String expectedPath, BaseFile actualFile ) - { - assertEquals( expectedPath, StringUtils.replace( actualFile.getRelativePath(), "\\", "/" ) ); - } - - private void assertBasedir( String expectedPath, BaseFile actualFile ) - { - assertEquals( new File( expectedPath ), actualFile.getBaseDir() ); - } -} diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/DateUtilTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/DateUtilTest.java deleted file mode 100644 index ff43aee73..000000000 --- a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/DateUtilTest.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.apache.maven.archiva.common.utils; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -import junit.framework.TestCase; - -/** - * DateUtilTest - * - * @version $Id$ - */ -public class DateUtilTest extends TestCase -{ - private void assertDuration( String expectedDuration, String startTimestamp, String endTimestamp ) - throws ParseException - { - SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss SSS" ); - Date startDate = sdf.parse( startTimestamp ); - Date endDate = sdf.parse( endTimestamp ); - -// System.out.println( "Date: " + endTimestamp + " - " + startTimestamp + " = " -// + ( endDate.getTime() - startDate.getTime() ) + " ms" ); - - assertEquals( expectedDuration, DateUtil.getDuration( startDate, endDate ) ); - } - - public void testGetDurationDifference() throws ParseException - { - assertDuration( "2 Seconds", "2006-08-22 13:00:02 0000", - "2006-08-22 13:00:04 0000" ); - - assertDuration( "12 Minutes 12 Seconds 234 Milliseconds", "2006-08-22 13:12:02 0000", - "2006-08-22 13:24:14 0234" ); - - assertDuration( "12 Minutes 501 Milliseconds", "2006-08-22 13:12:01 0500", - "2006-08-22 13:24:02 0001" ); - } - - public void testGetDurationDirect() throws ParseException - { - assertEquals( "2 Seconds", DateUtil.getDuration( 2000 ) ); - - assertEquals( "12 Minutes 12 Seconds 234 Milliseconds", DateUtil.getDuration( 732234 ) ); - - assertEquals( "12 Minutes 501 Milliseconds", DateUtil.getDuration( 720501 ) ); - } -} diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/PathUtilTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/PathUtilTest.java deleted file mode 100644 index 1713c86a4..000000000 --- a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/PathUtilTest.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.apache.maven.archiva.common.utils; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.commons.lang.StringUtils; - -import java.io.File; - -import junit.framework.TestCase; - -/** - * PathUtilTest - * - * @version $Id$ - */ -public class PathUtilTest - extends TestCase -{ - public void testToRelativeWithoutSlash() - { - assertEquals( "path/to/resource.xml", PathUtil.getRelative( "/home/user/foo/repository", - "/home/user/foo/repository/path/to/resource.xml" ) ); - } - - public void testToRelativeWithSlash() - { - assertEquals( "path/to/resource.xml", PathUtil.getRelative( "/home/user/foo/repository/", - "/home/user/foo/repository/path/to/resource.xml" ) ); - } - - public void testToUrlRelativePath() - { - File workingDir = new File( "." ); - - String workingDirname = StringUtils.replaceChars( workingDir.getAbsolutePath(), '\\', '/' ); - - // Some JVM's retain the "." at the end of the path. Drop it. - if ( workingDirname.endsWith( "/." ) ) - { - workingDirname = workingDirname.substring( 0, workingDirname.length() - 2 ); - } - - if ( !workingDirname.startsWith( "/" ) ) - { - workingDirname = "/" + workingDirname; - } - - String path = "path/to/resource.xml"; - String expectedPath = "file:" + workingDirname + "/" + path; - - assertEquals( expectedPath, PathUtil.toUrl( path ) ); - } - - public void testToUrlUsingFileUrl() - { - File workingDir = new File( "." ); - - String workingDirname = StringUtils.replaceChars( workingDir.getAbsolutePath(), '\\', '/' ); - - // Some JVM's retain the "." at the end of the path. Drop it. - if ( workingDirname.endsWith( "/." ) ) - { - workingDirname = workingDirname.substring( 0, workingDirname.length() - 2 ); - } - - if ( !workingDirname.startsWith( "/" ) ) - { - workingDirname = "/" + workingDirname; - } - - String path = "path/to/resource.xml"; - String expectedPath = "file:" + workingDirname + "/" + path; - - assertEquals( expectedPath, PathUtil.toUrl( expectedPath ) ); - } -} diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/ResourceUtils.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/ResourceUtils.java deleted file mode 100644 index db2a0dc27..000000000 --- a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/ResourceUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.apache.maven.archiva.common.utils; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.commons.lang.StringUtils; - -import java.io.File; -import java.io.IOException; -import java.net.URL; - -/** - * ResourceUtils - */ -public class ResourceUtils -{ - /** - * Lookup resource at the given path relative to the root of the classpath and if it exists return a file object - * that can be used to access it. - *

- * At test time the contents of both the src/resources and test/resources dirs are available at the root of the - * classpath. - *

- * To retrieve the file src/test/resources/sometest/test.properties use getResource("/sometest/test.properties"). - * - * @param resourcePath the path to the resource relative to the root of the classpath - * @return File a file object pointing to the resource on the classpath or null if the resource cannot be found - */ - public static File getResource( String resourcePath ) - throws IOException - { - return getResource( resourcePath, null ); - } - - /** - * Lookup resource at the given path relative to the root of the classpath and if it exists return a file object - * that can be used to access it. - *

- * At test time the contents of both the src/resources and test/resources dirs are available at the root of the - * classpath. - *

- * To retrieve the file src/test/resources/sometest/test.properties use getResource("/sometest/test.properties"). - * - * @param resourcePath the path to the resource relative to the root of the classpath - * @param classloader the classloader who's classpath should be searched for the resource - * @return File a file object pointing to the resource on the classpath or null if the resource cannot be found - */ - public static File getResource( String resourcePath, ClassLoader classloader ) - throws IOException - { - File testResource = null; - - if ( StringUtils.isNotBlank( resourcePath ) ) - { - // make sure the retrieval is relative to the root of the classpath - resourcePath = resourcePath.startsWith( "/" ) ? resourcePath : "/" + resourcePath; - - URL resourceUrl = getResourceUrl( resourcePath, classloader ); - if ( resourceUrl == null ) - { - throw new IOException( "Could not find test resource at path '" + resourcePath + "'" ); - } - testResource = new File( resourceUrl.getFile() ); - } - - return testResource; - } - - private static URL getResourceUrl( String resourcePath, ClassLoader classloader ) - { - return classloader != null ? classloader.getResource( resourcePath ) - : ResourceUtils.class.getResource( resourcePath ); - } -} diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/VersionComparatorTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/VersionComparatorTest.java deleted file mode 100644 index b28e78026..000000000 --- a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/VersionComparatorTest.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.apache.maven.archiva.common.utils; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import junit.framework.TestCase; - -/** - * VersionComparatorTest - * - * @version $Id$ - */ -public class VersionComparatorTest - extends TestCase -{ - public void testComparator() - { - /* Sort order is oldest to newest */ - - assertSort( new String[] { "1.0", "3.0", "2.0" }, new String[] { "1.0", "2.0", "3.0" } ); - assertSort( new String[] { "1.5", "1.2", "1.0" }, new String[] { "1.0", "1.2", "1.5" } ); - - assertSort( new String[] { "1.5-SNAPSHOT", "1.2", "1.20" }, new String[] { "1.2", "1.5-SNAPSHOT", "1.20" } ); - - assertSort( new String[] { "1.1", "1.0-SNAPSHOT", "1.1-m6", "1.1-rc1" }, new String[] { - "1.0-SNAPSHOT", - "1.1-rc1", - "1.1-m6", - "1.1" } ); - - assertSort( new String[] { "1.1-m6", "1.0-SNAPSHOT", "1.1-rc1", "1.1" }, new String[] { - "1.0-SNAPSHOT", - "1.1-rc1", - "1.1-m6", - "1.1" } ); - - assertSort( new String[] { "2.0.5", "2.0.4-SNAPSHOT", "2.0", "2.0-rc1" }, new String[] { - "2.0-rc1", - "2.0", - "2.0.4-SNAPSHOT", - "2.0.5" } ); - - assertSort( new String[] { "1.0-alpha-1", "1.0-alpha-22", "1.0-alpha-10", "1.0-alpha-9" }, new String[] { - "1.0-alpha-1", - "1.0-alpha-9", - "1.0-alpha-10", - "1.0-alpha-22" } ); - - assertSort( new String[] { "1.0-alpha1", "1.0-alpha22", "1.0-alpha10", "1.0-alpha9" }, new String[] { - "1.0-alpha1", - "1.0-alpha9", - "1.0-alpha10", - "1.0-alpha22" } ); - - assertSort( new String[] { "1.0-1", "1.0-22", "1.0-10", "1.0-9" }, new String[] { - "1.0-1", - "1.0-9", - "1.0-10", - "1.0-22" } ); - - assertSort( new String[] { "alpha-1", "alpha-22", "alpha-10", "alpha-9" }, new String[] { - "alpha-1", - "alpha-9", - "alpha-10", - "alpha-22" } ); - - assertSort( new String[] { "1.0.1", "1.0.22", "1.0.10", "1.0.9" }, new String[] { - "1.0.1", - "1.0.9", - "1.0.10", - "1.0.22" } ); - - - // TODO: write more unit tests. - } - - private void assertSort( String[] rawVersions, String[] expectedSort ) - { - List versions = new ArrayList(); - versions.addAll( Arrays.asList( rawVersions ) ); - - Collections.sort( versions, VersionComparator.getInstance() ); - - assertEquals( "Versions.size()", expectedSort.length, versions.size() ); - for ( int i = 0; i < expectedSort.length; i++ ) - { - assertEquals( "Sorted Versions[" + i + "]", expectedSort[i], (String) versions.get( i ) ); - } - } - - public void testToParts() - { - assertParts( "1.0", new String[] { "1", "0" } ); - assertParts( "1.0-alpha-1", new String[] { "1", "0", "alpha", "1" } ); - assertParts( "2.0-rc2", new String[] { "2", "0", "rc", "2" } ); - assertParts( "1.3-m6", new String[] { "1", "3", "m", "6" } ); - } - - private void assertParts( String version, String[] expectedParts ) - { - String actualParts[] = VersionComparator.toParts( version ); - assertEquals( "Parts.length", expectedParts.length, actualParts.length ); - - for ( int i = 0; i < expectedParts.length; i++ ) - { - assertEquals( "parts[" + i + "]", expectedParts[i], actualParts[i] ); - } - } -} diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/VersionUtilTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/VersionUtilTest.java deleted file mode 100644 index ca1f29cf1..000000000 --- a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/VersionUtilTest.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.apache.maven.archiva.common.utils; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import junit.framework.TestCase; - -public class VersionUtilTest extends TestCase -{ - - public void testIsVersion() - { - // 0% - assertFalse( VersionUtil.isVersion( "project" ) ); - - // 0% - assertFalse( VersionUtil.isVersion( "project-not-version" ) ); - - // 50% - assertFalse( VersionUtil.isVersion( "project-ver-1.0-dev" ) ); - - // > 75% - assertTrue( VersionUtil.isVersion( "project-1.0-alpha" ) ); - - // 75% - assertTrue( VersionUtil.isVersion( "project-1.0-latest-nightly" ) ); - - // >75% - assertTrue( VersionUtil.isVersion( "1.0-project-unofficial-nightly-alpha-release" ) ); - - //only first token matches - assertTrue( VersionUtil.isVersion( "1.0-project-my-own-version" ) ); - - } - - public void testIsSimpleVersionKeyword() - { - assertTrue( VersionUtil.isSimpleVersionKeyword( "rc4.34" ) ); - - assertTrue( VersionUtil.isSimpleVersionKeyword( "beta" ) ); - - assertFalse( VersionUtil.isSimpleVersionKeyword( "1.0-SNAPSHOT" ) ); - } - - public void testIsSnapshot() - { - assertTrue( VersionUtil.isSnapshot( "1.0-20070113.163208-99" ) ); - - assertTrue( VersionUtil.isSnapshot( "1.0-SNAPSHOT" ) ); - - assertFalse( VersionUtil.isSnapshot( "1.0-beta1" ) ); - } - - public void testGetBaseVersion() - { - assertEquals( VersionUtil.getBaseVersion( "1.3.2-20090420.083501-3" ), "1.3.2-SNAPSHOT" ); - } - - public void testGetReleaseVersion() - { - assertEquals( VersionUtil.getReleaseVersion( "1.3.2-20090420.083501-3" ), "1.3.2" ); - } - - public void testIsUniqueSnapshot() - { - assertTrue( VersionUtil.isUniqueSnapshot( "1.3.2-20090420.083501-3" ) ); - - assertFalse( VersionUtil.isUniqueSnapshot( "1.3.2" ) ); - } - - public void testIsGenericSnapshot() - { - assertFalse( VersionUtil.isGenericSnapshot( "1.3.2-20090420.083501-3" ) ); - - assertTrue( VersionUtil.isGenericSnapshot( "1.3.2-SNAPSHOT" ) ); - } - -} diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java index 35ae50d0e..304f74267 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java @@ -22,7 +22,7 @@ package org.apache.maven.archiva.configuration; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.Predicate; import org.apache.commons.configuration.CombinedConfiguration; -import org.apache.maven.archiva.common.FileTypeUtils; +import org.apache.archiva.common.FileTypeUtils; import org.apache.maven.archiva.configuration.functors.FiletypeSelectionPredicate; import org.apache.maven.archiva.configuration.io.registry.ConfigurationRegistryReader; import org.codehaus.plexus.registry.Registry; @@ -37,7 +37,6 @@ import javax.inject.Inject; import javax.inject.Named; import java.lang.reflect.Field; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java index 5587db04f..b5e16bf8c 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java @@ -22,7 +22,7 @@ package org.apache.maven.archiva.configuration; import junit.framework.TestCase; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.utils.FileUtil; +import org.apache.archiva.common.utils.FileUtil; import org.codehaus.plexus.registry.RegistryException; import org.codehaus.redback.components.springutils.ComponentContainer; import org.custommonkey.xmlunit.XMLAssert; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/AbstractMonitoredConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/AbstractMonitoredConsumer.java index 55a94261a..e0ae5fe82 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/AbstractMonitoredConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/AbstractMonitoredConsumer.java @@ -19,7 +19,7 @@ package org.apache.maven.archiva.consumers; * under the License. */ -import org.apache.maven.archiva.common.FileTypeUtils; +import org.apache.archiva.common.FileTypeUtils; import java.util.HashSet; import java.util.Iterator; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerException.java b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerException.java index 20786a1ee..e401e21af 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerException.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerException.java @@ -19,7 +19,7 @@ package org.apache.maven.archiva.consumers; * under the License. */ -import org.apache.maven.archiva.common.ArchivaException; +import org.apache.archiva.common.ArchivaException; /** * ConsumerException - details about the failure of a consumer. diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/functors/ConsumerWantsFilePredicate.java b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/functors/ConsumerWantsFilePredicate.java index 112cc4709..65f29c55d 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/functors/ConsumerWantsFilePredicate.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/functors/ConsumerWantsFilePredicate.java @@ -23,7 +23,7 @@ import java.util.List; import org.apache.commons.collections.Predicate; import org.apache.commons.io.FilenameUtils; -import org.apache.maven.archiva.common.utils.BaseFile; +import org.apache.archiva.common.utils.BaseFile; import org.apache.maven.archiva.consumers.RepositoryContentConsumer; import org.codehaus.plexus.util.SelectorUtils; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java index 8a9413228..d5fcf122a 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java @@ -25,8 +25,8 @@ import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; import org.apache.archiva.metadata.repository.MetadataRepository; import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.repository.events.RepositoryListener; -import org.apache.maven.archiva.common.utils.VersionComparator; -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.VersionComparator; +import org.apache.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.model.ArchivaArtifact; import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.model.ProjectReference; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java index 3930589e0..ab4d61a93 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java @@ -22,8 +22,8 @@ package org.apache.maven.archiva.consumers.core.repository; import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.repository.events.RepositoryListener; import org.apache.commons.lang.time.DateUtils; -import org.apache.maven.archiva.common.utils.VersionComparator; -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.VersionComparator; +import org.apache.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.model.VersionedReference; import org.apache.maven.archiva.repository.ContentNotFoundException; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java index 63a362c76..c1f031dc5 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java @@ -21,8 +21,8 @@ package org.apache.maven.archiva.consumers.core.repository; import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.repository.events.RepositoryListener; -import org.apache.maven.archiva.common.utils.VersionComparator; -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.VersionComparator; +import org.apache.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.model.VersionedReference; import org.apache.maven.archiva.repository.ContentNotFoundException; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/AbstractArtifactConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/AbstractArtifactConsumerTest.java index 882d53407..3a4316e8a 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/AbstractArtifactConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/AbstractArtifactConsumerTest.java @@ -20,7 +20,7 @@ package org.apache.maven.archiva.consumers.core; */ import junit.framework.TestCase; -import org.apache.maven.archiva.common.utils.BaseFile; +import org.apache.archiva.common.utils.BaseFile; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.FileType; import org.apache.maven.archiva.configuration.FileTypes; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java index aff3735e7..37006627e 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java @@ -24,7 +24,7 @@ import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; import org.apache.archiva.metadata.repository.TestRepositorySessionFactory; import org.apache.commons.io.FileUtils; -import org.apache.maven.archiva.common.utils.BaseFile; +import org.apache.archiva.common.utils.BaseFile; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.FileType; import org.apache.maven.archiva.configuration.FileTypes; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/resources/META-INF/spring-context.xml index cf23270e5..53f71aa72 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/resources/META-INF/spring-context.xml @@ -35,7 +35,7 @@ - + org.sonatype.nexus.index.DefaultNexusIndexer \ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java index 98e708817..bd1cba860 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java @@ -30,7 +30,7 @@ import org.apache.archiva.metadata.repository.RepositorySessionFactory; import org.apache.archiva.metadata.repository.storage.RepositoryStorage; import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException; import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException; -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.ConfigurationNames; import org.apache.maven.archiva.configuration.FileTypes; diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java index 85d8a1dfa..34594a061 100644 --- a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java +++ b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java @@ -25,7 +25,7 @@ import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.archiva.converter.RepositoryConversionException; import org.apache.archiva.repository.scanner.RepositoryScanner; import org.apache.archiva.repository.scanner.RepositoryScannerException; -import org.apache.maven.archiva.common.utils.PathUtil; +import org.apache.archiva.common.utils.PathUtil; import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer; import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; import org.apache.maven.artifact.repository.ArtifactRepository; diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-indexer/src/main/resources/META-INF/spring-context.xml index 7530b546c..39041ba0a 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/resources/META-INF/spring-context.xml @@ -31,7 +31,7 @@ - + org.sonatype.nexus.index.DefaultNexusIndexer diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractNexusRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractNexusRepositorySearch.java index 701d39786..2ca7f5c03 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractNexusRepositorySearch.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractNexusRepositorySearch.java @@ -25,7 +25,7 @@ import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.SystemUtils; -import org.apache.maven.archiva.common.utils.FileUtil; +import org.apache.archiva.common.utils.FileUtil; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java index 2f7da7585..c04c89b10 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java @@ -20,7 +20,7 @@ package org.apache.archiva.indexer.search; */ import org.apache.archiva.indexer.util.SearchUtil; -import org.apache.maven.archiva.common.utils.FileUtil; +import org.apache.archiva.common.utils.FileUtil; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java b/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java index baf086296..a68490aa4 100644 --- a/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java +++ b/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java @@ -20,7 +20,7 @@ package org.apache.maven.archiva.model; */ import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.VersionUtil; /** * ArchivaArtifact - Mutable artifact object. diff --git a/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/AbstractUpdatePolicy.java b/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/AbstractUpdatePolicy.java index 06486113e..dbfc5588d 100644 --- a/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/AbstractUpdatePolicy.java +++ b/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/AbstractUpdatePolicy.java @@ -26,7 +26,7 @@ import java.util.List; import java.util.Properties; import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.VersionUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/PolicyConfigurationException.java b/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/PolicyConfigurationException.java index c19682cf3..e384c0d5d 100644 --- a/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/PolicyConfigurationException.java +++ b/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/PolicyConfigurationException.java @@ -19,7 +19,7 @@ package org.apache.maven.archiva.policies; * under the License. */ -import org.apache.maven.archiva.common.ArchivaException; +import org.apache.archiva.common.ArchivaException; /** * PolicyConfigurationException is thrown when a policy cannot be executed due to a diff --git a/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/PolicyViolationException.java b/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/PolicyViolationException.java index 3c1481fa5..602f8abc6 100644 --- a/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/PolicyViolationException.java +++ b/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/PolicyViolationException.java @@ -19,7 +19,7 @@ package org.apache.maven.archiva.policies; * under the License. */ -import org.apache.maven.archiva.common.ArchivaException; +import org.apache.archiva.common.ArchivaException; /** * PolicyViolationException diff --git a/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/ProxyDownloadException.java b/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/ProxyDownloadException.java index 845df4ecb..c0aad19c1 100644 --- a/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/ProxyDownloadException.java +++ b/archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/ProxyDownloadException.java @@ -19,7 +19,7 @@ package org.apache.maven.archiva.policies; * under the License. */ -import org.apache.maven.archiva.common.ArchivaException; +import org.apache.archiva.common.ArchivaException; import java.util.Collections; import java.util.Map; diff --git a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ChecksumPolicyTest.java b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ChecksumPolicyTest.java index 215d68017..478333b6a 100644 --- a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ChecksumPolicyTest.java +++ b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ChecksumPolicyTest.java @@ -20,7 +20,7 @@ package org.apache.maven.archiva.policies; */ import org.apache.commons.io.FileUtils; -import org.apache.maven.archiva.common.utils.FileUtil; +import org.apache.archiva.common.utils.FileUtil; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java index d6ddb995a..6b9f15cd2 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java @@ -19,7 +19,7 @@ package org.apache.maven.archiva.proxy; * under the License. */ -import org.apache.maven.archiva.common.utils.PathUtil; +import org.apache.archiva.common.utils.PathUtil; import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.policies.CachedFailuresPolicy; import org.apache.maven.archiva.policies.ChecksumPolicy; diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java index e021d96b2..6ba9fecbf 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java @@ -20,7 +20,7 @@ package org.apache.maven.archiva.proxy; */ import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration; import org.apache.maven.archiva.model.ArchivaRepositoryMetadata; import org.apache.maven.archiva.model.Plugin; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java index a691b13e4..36559edcd 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java @@ -23,7 +23,7 @@ import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator; import org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider; import org.apache.archiva.metadata.repository.storage.maven2.Maven2RepositoryPathTranslator; import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.model.ArchivaArtifact; import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.model.ProjectReference; @@ -31,11 +31,9 @@ import org.apache.maven.archiva.model.VersionedReference; import org.apache.maven.archiva.repository.layout.LayoutException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.context.ApplicationContext; import javax.annotation.PostConstruct; import javax.inject.Inject; -import java.util.ArrayList; import java.util.List; /** diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/FilenameParser.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/FilenameParser.java index 1e2a09e8c..2b1d1b5b8 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/FilenameParser.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/FilenameParser.java @@ -19,7 +19,7 @@ package org.apache.maven.archiva.repository.content; * under the License. */ -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.VersionUtil; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java index b6cef14b2..b2770ec42 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java @@ -22,7 +22,7 @@ package org.apache.maven.archiva.repository.content; import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.metadata.repository.storage.maven2.DefaultArtifactMappingProvider; import org.apache.commons.io.FileUtils; -import org.apache.maven.archiva.common.utils.PathUtil; +import org.apache.archiva.common.utils.PathUtil; import org.apache.maven.archiva.configuration.FileTypes; import org.apache.maven.archiva.model.ArchivaArtifact; import org.apache.maven.archiva.model.ArtifactReference; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java index 82a6f74b2..a02347cc0 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java @@ -22,7 +22,7 @@ package org.apache.maven.archiva.repository.content; import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.utils.PathUtil; +import org.apache.archiva.common.utils.PathUtil; import org.apache.maven.archiva.configuration.FileTypes; import org.apache.maven.archiva.model.ArchivaArtifact; import org.apache.maven.archiva.model.ArtifactReference; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LayoutException.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LayoutException.java index adfceeacb..cf7b1bee6 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LayoutException.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LayoutException.java @@ -19,7 +19,7 @@ package org.apache.maven.archiva.repository.layout; * under the License. */ -import org.apache.maven.archiva.common.ArchivaException; +import org.apache.archiva.common.ArchivaException; /** * LayoutException diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java index ace302fcb..defd49dae 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java @@ -26,9 +26,9 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang.time.DateUtils; -import org.apache.maven.archiva.common.utils.PathUtil; -import org.apache.maven.archiva.common.utils.VersionComparator; -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.PathUtil; +import org.apache.archiva.common.utils.VersionComparator; +import org.apache.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.ConfigurationNames; import org.apache.maven.archiva.configuration.FileTypes; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContentTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContentTest.java index 07b2ff1b4..4471b11b7 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContentTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContentTest.java @@ -20,7 +20,7 @@ package org.apache.maven.archiva.repository.content; */ import org.apache.archiva.admin.model.beans.ManagedRepository; -import org.apache.maven.archiva.common.utils.VersionComparator; +import org.apache.archiva.common.utils.VersionComparator; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.FileType; import org.apache.maven.archiva.configuration.FileTypes; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContentTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContentTest.java index c19dc0f55..07127fcf3 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContentTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContentTest.java @@ -20,7 +20,7 @@ package org.apache.maven.archiva.repository.content; */ import org.apache.archiva.admin.model.beans.ManagedRepository; -import org.apache.maven.archiva.common.utils.VersionComparator; +import org.apache.archiva.common.utils.VersionComparator; import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.model.ProjectReference; import org.apache.maven.archiva.model.VersionedReference; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java index 6305cf1b6..29ce2123f 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java @@ -20,7 +20,7 @@ package org.apache.maven.archiva.repository.content; */ import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.utils.FileUtil; +import org.apache.archiva.common.utils.FileUtil; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java index 1d172d5e1..f3b664c5b 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java @@ -22,7 +22,7 @@ package org.apache.maven.archiva.repository.metadata; import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.utils.VersionComparator; +import org.apache.archiva.common.utils.VersionComparator; import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration; import org.apache.maven.archiva.model.ProjectReference; import org.apache.maven.archiva.model.VersionedReference; diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java index cf8f6b877..7a0c387a4 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java @@ -28,7 +28,7 @@ import org.apache.archiva.repository.scanner.functors.TriggerScanCompletedClosur import org.apache.commons.collections.Closure; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.functors.IfClosure; -import org.apache.maven.archiva.common.utils.BaseFile; +import org.apache.archiva.common.utils.BaseFile; import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer; import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; import org.apache.maven.archiva.consumers.functors.ConsumerWantsFilePredicate; diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java index 702f2ad28..5a836214f 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java @@ -176,7 +176,7 @@ public class RepositoryScanStatistics } buf.append( "\n Duration : " ); - buf.append( org.apache.maven.archiva.common.utils.DateUtil.getDuration( this.getDuration() ) ); + buf.append( org.apache.archiva.common.utils.DateUtil.getDuration( this.getDuration() ) ); buf.append( "\n When Gathered : " ); if ( this.getWhenGathered() == null ) { @@ -197,7 +197,7 @@ public class RepositoryScanStatistics } buf.append( "\n Avg Time Per File : " ); - buf.append( org.apache.maven.archiva.common.utils.DateUtil.getDuration( averageMsPerFile ) ); + buf.append( org.apache.archiva.common.utils.DateUtil.getDuration( averageMsPerFile ) ); buf.append( "\n______________________________________________________________" ); return buf.toString(); diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java index 9707253da..e0f628e60 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java @@ -27,7 +27,7 @@ import org.apache.commons.collections.Closure; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.functors.IfClosure; import org.apache.commons.lang.SystemUtils; -import org.apache.maven.archiva.common.utils.BaseFile; +import org.apache.archiva.common.utils.BaseFile; import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer; import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; import org.apache.maven.archiva.consumers.functors.ConsumerWantsFilePredicate; diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java index e0b3c681b..370a28df2 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java @@ -20,12 +20,11 @@ package org.apache.archiva.repository.scanner.functors; */ import org.apache.commons.collections.Closure; -import org.apache.maven.archiva.common.utils.BaseFile; +import org.apache.archiva.common.utils.BaseFile; import org.apache.maven.archiva.consumers.RepositoryContentConsumer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.HashMap; import java.util.Map; /** diff --git a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CopyFileEventTest.java b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CopyFileEventTest.java index 96db6e4fa..d832ec40c 100644 --- a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CopyFileEventTest.java +++ b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CopyFileEventTest.java @@ -20,7 +20,7 @@ package org.apache.archiva.transaction; */ import org.apache.commons.io.FileUtils; -import org.apache.maven.archiva.common.utils.FileUtil; +import org.apache.archiva.common.utils.FileUtil; import java.io.File; import java.io.IOException; diff --git a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CreateFileEventTest.java b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CreateFileEventTest.java index fda168c1c..9d23fe9ae 100644 --- a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CreateFileEventTest.java +++ b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CreateFileEventTest.java @@ -22,7 +22,7 @@ package org.apache.archiva.transaction; import java.io.File; import org.apache.commons.io.FileUtils; -import org.apache.maven.archiva.common.utils.FileUtil; +import org.apache.archiva.common.utils.FileUtil; /** */ diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/archiva/xml/XMLException.java b/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/archiva/xml/XMLException.java index 72492789c..8557b4345 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/archiva/xml/XMLException.java +++ b/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/archiva/xml/XMLException.java @@ -19,7 +19,7 @@ package org.apache.archiva.xml; * under the License. */ -import org.apache.maven.archiva.common.ArchivaException; +import org.apache.archiva.common.ArchivaException; /** * XMLException diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/resources/META-INF/spring-context.xml index 32a077bab..514ebba08 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/resources/META-INF/spring-context.xml @@ -29,7 +29,7 @@ - + org.sonatype.nexus.index.DefaultNexusIndexer diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryArchivaTaskScheduler.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryArchivaTaskScheduler.java index c9cb9b24c..875fccc86 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryArchivaTaskScheduler.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryArchivaTaskScheduler.java @@ -25,7 +25,7 @@ import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.metadata.repository.RepositorySessionFactory; import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager; import org.apache.archiva.scheduler.ArchivaTaskScheduler; -import org.apache.maven.archiva.common.ArchivaException; +import org.apache.archiva.common.ArchivaException; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.ConfigurationEvent; import org.apache.maven.archiva.configuration.ConfigurationListener; @@ -34,9 +34,6 @@ import org.codehaus.plexus.taskqueue.TaskQueue; import org.codehaus.plexus.taskqueue.TaskQueueException; import org.codehaus.redback.components.scheduler.CronExpressionValidator; import org.codehaus.redback.components.scheduler.Scheduler; -import org.quartz.CronTrigger; -import org.quartz.JobDataMap; -import org.quartz.JobDetail; import org.quartz.SchedulerException; import org.quartz.impl.JobDetailImpl; import org.quartz.impl.triggers.CronTriggerImpl; 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 893d29736..2e61044df 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 @@ -31,7 +31,7 @@ import org.apache.archiva.rest.api.services.RepositoryGroupService; import org.apache.archiva.rest.api.services.SearchService; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.WebClient; -import org.apache.maven.archiva.common.utils.FileUtil; +import org.apache.archiva.common.utils.FileUtil; import org.codehaus.redback.rest.services.AbstractRestServicesTest; import java.io.File; diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java index 0dacb9d67..3181c800d 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java @@ -24,7 +24,7 @@ import org.apache.archiva.rest.api.services.ManagedRepositoriesService; import org.apache.archiva.rest.api.services.RepositoriesService; import org.apache.cxf.jaxrs.client.ServerWebApplicationException; import org.apache.cxf.jaxrs.client.WebClient; -import org.apache.maven.archiva.common.utils.FileUtil; +import org.apache.archiva.common.utils.FileUtil; import org.junit.Test; import java.io.File; diff --git a/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/ArchivaSecurityException.java b/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/ArchivaSecurityException.java index 07a4355db..5d87d6b49 100644 --- a/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/ArchivaSecurityException.java +++ b/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/ArchivaSecurityException.java @@ -19,7 +19,7 @@ package org.apache.archiva.security; * under the License. */ -import org.apache.maven.archiva.common.ArchivaException; +import org.apache.archiva.common.ArchivaException; /** * ArchivaSecurityException diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java index 5532f8c08..da4bcce25 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java @@ -22,7 +22,7 @@ package org.apache.archiva.web.startup; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler; -import org.apache.maven.archiva.common.ArchivaException; +import org.apache.archiva.common.ArchivaException; import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.context.IndexingContext; import org.codehaus.plexus.taskqueue.Task; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java index 2e1d8db01..9d1714edb 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java @@ -22,7 +22,7 @@ package org.apache.archiva.web.startup; import org.apache.archiva.security.common.ArchivaRoleConstants; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.ArchivaException; +import org.apache.archiva.common.ArchivaException; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.ConfigurationNames; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/tags/DependencyTree.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/tags/DependencyTree.java index 5afa4e2f1..577ebfc85 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/tags/DependencyTree.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/tags/DependencyTree.java @@ -22,7 +22,7 @@ package org.apache.archiva.web.tags; import com.opensymphony.xwork2.ActionContext; import org.apache.archiva.dependency.tree.maven2.DependencyTreeBuilder; import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.ArchivaException; +import org.apache.archiva.common.ArchivaException; import org.apache.maven.archiva.model.Keys; import org.apache.archiva.security.ArchivaXworkUser; import org.apache.archiva.security.UserRepositories; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/tags/DependencyTreeTag.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/tags/DependencyTreeTag.java index f96a7dff3..ef3452f1d 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/tags/DependencyTreeTag.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/tags/DependencyTreeTag.java @@ -22,7 +22,7 @@ package org.apache.archiva.web.tags; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.IteratorUtils; import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.ArchivaException; +import org.apache.archiva.common.ArchivaException; import org.apache.archiva.web.tags.DependencyTree.TreeEntry; import org.springframework.beans.BeansException; import org.springframework.web.context.WebApplicationContext; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java index 43498a077..014b4633a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java @@ -39,8 +39,8 @@ import org.apache.archiva.security.ArchivaSecurityException; import org.apache.archiva.security.PrincipalNotFoundException; import org.apache.archiva.security.UserRepositories; import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.utils.VersionComparator; -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.VersionComparator; +import org.apache.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.model.ArchivaRepositoryMetadata; import org.apache.maven.archiva.model.VersionedReference; import org.apache.maven.archiva.repository.ContentNotFoundException; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java index 1c44b3d8f..add160b14 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java @@ -38,8 +38,8 @@ import org.apache.archiva.security.UserRepositories; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.utils.VersionComparator; -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.VersionComparator; +import org.apache.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.model.ArchivaRepositoryMetadata; import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.model.SnapshotVersion; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/tags/DependencyTreeTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/tags/DependencyTreeTest.java index bbd6ffd3f..09cdd69e4 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/tags/DependencyTreeTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/tags/DependencyTreeTest.java @@ -31,7 +31,7 @@ import org.apache.archiva.metadata.model.ProjectVersionMetadata; import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.metadata.repository.memory.TestMetadataResolver; import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory; -import org.apache.maven.archiva.common.ArchivaException; +import org.apache.archiva.common.ArchivaException; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/ShowArtifactActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/ShowArtifactActionTest.java index c715d06b9..59565efb6 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/ShowArtifactActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/ShowArtifactActionTest.java @@ -33,7 +33,7 @@ import org.apache.archiva.metadata.repository.memory.TestMetadataResolver; import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory; import org.apache.archiva.metadata.repository.storage.maven2.MavenArtifactFacet; import org.apache.archiva.reports.RepositoryProblemFacet; -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java index c8b86a289..7901a2732 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java @@ -31,7 +31,7 @@ import org.apache.archiva.checksum.ChecksummedFile; import org.apache.archiva.scheduler.ArchivaTaskScheduler; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.utils.FileUtil; +import org.apache.archiva.common.utils.FileUtil; import org.apache.maven.archiva.model.ArchivaRepositoryMetadata; import org.apache.maven.archiva.model.SnapshotVersion; import org.apache.maven.archiva.repository.ManagedRepositoryContent; diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java index 8d8082aad..46828f134 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java @@ -37,8 +37,8 @@ import org.apache.jackrabbit.webdav.DavServletResponse; import org.apache.jackrabbit.webdav.DavSession; import org.apache.jackrabbit.webdav.lock.LockManager; import org.apache.jackrabbit.webdav.lock.SimpleLockManager; -import org.apache.maven.archiva.common.utils.PathUtil; -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.PathUtil; +import org.apache.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration; import org.apache.maven.archiva.model.ArchivaRepositoryMetadata; diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DefaultDependencyTreeBuilder.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DefaultDependencyTreeBuilder.java index 8a78ed3d6..c9e048406 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DefaultDependencyTreeBuilder.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DefaultDependencyTreeBuilder.java @@ -29,7 +29,7 @@ import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator; import org.apache.archiva.metadata.repository.storage.maven2.RepositoryModelResolver; import org.apache.archiva.proxy.common.WagonFactory; import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.utils.Slf4JPlexusLogger; +import org.apache.archiva.common.utils.Slf4JPlexusLogger; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.configuration.NetworkProxyConfiguration; diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryPathTranslator.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryPathTranslator.java index e66f66504..4dbab61fe 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryPathTranslator.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryPathTranslator.java @@ -21,14 +21,12 @@ package org.apache.archiva.metadata.repository.storage.maven2; import org.apache.archiva.metadata.model.ArtifactMetadata; import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator; -import org.apache.maven.archiva.common.utils.VersionUtil; -import org.springframework.context.ApplicationContext; +import org.apache.archiva.common.utils.VersionUtil; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import javax.inject.Inject; import java.io.File; -import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; 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 f3473db7c..1a104c09e 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 @@ -31,7 +31,7 @@ import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataI import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException; import org.apache.archiva.proxy.common.WagonFactory; import org.apache.archiva.reports.RepositoryProblemFacet; -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.configuration.NetworkProxyConfiguration; 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 e5932b272..d3b8bfc2c 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 @@ -29,7 +29,7 @@ import org.apache.archiva.proxy.common.WagonFactory; import org.apache.archiva.proxy.common.WagonFactoryException; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; import org.apache.archiva.xml.XMLException; 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 72132cf9f..4bb7a277d 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 @@ -32,7 +32,7 @@ import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataI import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException; import org.apache.archiva.proxy.common.WagonFactory; import org.apache.commons.io.FileUtils; -import org.apache.maven.archiva.common.utils.FileUtil; +import org.apache.archiva.common.utils.FileUtil; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; diff --git a/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java b/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java index 863fdfa5f..483cdf2e8 100644 --- a/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java +++ b/archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java @@ -25,8 +25,8 @@ import org.apache.archiva.metadata.repository.filter.Filter; import org.apache.archiva.metadata.repository.filter.IncludesFilter; import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator; import org.apache.commons.io.IOUtils; -import org.apache.maven.archiva.common.utils.VersionComparator; -import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.archiva.common.utils.VersionComparator; +import org.apache.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;