You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by jo...@apache.org on 2007/04/03 17:22:01 UTC
svn commit: r525176 [9/12] - in
/maven/archiva/branches/archiva-jpox-database-refactor: ./
archiva-api/src/main/java/org/apache/maven/archiva/configuration/
archiva-api/src/main/java/org/apache/maven/archiva/consumers/
archiva-api/src/main/java/org/apa...
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,330 @@
+package org.apache.maven.archiva.indexer.bytecode;
+
+/*
+ * 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.lucene.search.BooleanClause;
+import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.MatchAllDocsQuery;
+import org.apache.maven.archiva.indexer.AbstractSearchTestCase;
+import org.apache.maven.archiva.indexer.ArtifactKeys;
+import org.apache.maven.archiva.indexer.RepositoryContentIndex;
+import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
+import org.apache.maven.archiva.indexer.RepositoryIndexSearchException;
+import org.apache.maven.archiva.indexer.lucene.LuceneIndexHandlers;
+import org.apache.maven.archiva.indexer.lucene.LuceneQuery;
+import org.apache.maven.archiva.model.ArchivaArtifact;
+import org.apache.maven.archiva.model.ArchivaRepository;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * BytecodeSearchTest
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class BytecodeSearchTest extends AbstractSearchTestCase
+{
+ public String getIndexName()
+ {
+ return "bytecode";
+ }
+
+ public LuceneIndexHandlers getIndexHandler()
+ {
+ return new BytecodeHandlers();
+ }
+
+ public RepositoryContentIndex createIndex( RepositoryContentIndexFactory indexFactory, ArchivaRepository repository )
+ {
+ return indexFactory.createBytecodeIndex( repository );
+ }
+
+ protected Map createSampleRecordsMap()
+ {
+ Map records = new HashMap();
+
+ Map artifactDumps = getArchivaArtifactDumpMap();
+ for ( Iterator iter = artifactDumps.entrySet().iterator(); iter.hasNext(); )
+ {
+ Map.Entry entry = (Map.Entry) iter.next();
+ ArchivaArtifact artifact = (ArchivaArtifact) entry.getValue();
+ File dumpFile = getDumpFile( artifact );
+ BytecodeRecord record = BytecodeRecordLoader.loadRecord( dumpFile, artifact );
+ records.put( entry.getKey(), record );
+ }
+
+ return records;
+ }
+
+ public void testExactMatchVersionSimple() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.VERSION_EXACT, new String[] { "archiva-common" }, "1.0" );
+ }
+
+ public void testExactMatchVersionSnapshot() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.VERSION_EXACT, new String[] { "continuum-webapp" }, "1.0.3-SNAPSHOT" );
+ }
+
+ public void testExactMatchVersionAlphaSnapshot() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.VERSION_EXACT, new String[] { "redback-authorization-open" },
+ "1.0-alpha-1-SNAPSHOT" );
+ }
+
+ public void testExactMatchVersionTimestampedSnapshot() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.VERSION_EXACT, new String[] { "wagon-provider-api" },
+ "1.0-beta-3-20070209.213958-2" );
+ }
+
+ public void testExactMatchVersionInvalid() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatchNoResults( ArtifactKeys.VERSION_EXACT, "foo" );
+ }
+
+ public void testExactMatchGroupIdOrgApacheMavenArchiva() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.GROUPID_EXACT, new String[] { "archiva-common" },
+ "org.apache.maven.archiva" );
+ }
+
+ public void testExactMatchGroupIdOrgApacheMaven() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.GROUPID_EXACT, new String[] { "maven-archetype-simple" },
+ "org.apache.maven" );
+ }
+
+ public void testExactMatchGroupIdInvalid() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatchNoResults( ArtifactKeys.GROUPID_EXACT, "foo" );
+ }
+
+ public void testExactMatchArtifactIdArchivaCommon() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.ARTIFACTID_EXACT, new String[] { "archiva-common" }, "archiva-common" );
+ }
+
+ public void testExactMatchArtifactIdTestNg() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.ARTIFACTID_EXACT, new String[] { "testng" }, "testng" );
+ }
+
+ public void testExactMatchArtifactIdInvalid() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatchNoResults( ArtifactKeys.ARTIFACTID_EXACT, "foo" );
+ }
+
+ public void testExactMatchTypeJar() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.TYPE, ( new String[] { "archiva-common", "redback-authorization-open",
+ "testng", "wagon-provider-api" } ), "jar" );
+ }
+
+ public void testExactMatchTypeWar() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.TYPE, ( new String[] { "continuum-webapp" } ), "war" );
+ }
+
+ /* TODO: Fix 'maven-plugin' type
+ public void testExactMatchTypePlugin() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.TYPE, ( new String[] { "maven-help-plugin" } ), "maven-plugin" );
+ } */
+
+ /* TODO: Fix 'maven-archetype' type
+ public void testExactMatchTypeArchetype() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.TYPE, ( new String[] { "maven-archetype-simple" } ), "maven-archetype" );
+ }
+ */
+
+ public void testExactMatchTypeInvalid() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatchNoResults( ArtifactKeys.TYPE, "foo" );
+ }
+
+ public void testMatchGroupIdOrgApacheMaven() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.GROUPID, new String[] { "archiva-common", "continuum-webapp",
+ "maven-archetype-simple", "maven-help-plugin", "wagon-provider-api" }, "org.apache.maven" );
+ }
+
+ public void testMatchGroupIdMaven() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.GROUPID, new String[] { "archiva-common", "continuum-webapp",
+ "maven-archetype-simple", "maven-help-plugin", "wagon-provider-api" }, "maven" );
+ }
+
+ public void testMatchGroupIdMavenMixed() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.GROUPID, new String[] { "archiva-common", "continuum-webapp",
+ "maven-archetype-simple", "maven-help-plugin", "wagon-provider-api" }, "Maven" );
+ }
+
+ public void testMatchGroupIdInvalid() throws Exception
+ {
+ assertQueryMatchNoResults( ArtifactKeys.GROUPID, "foo" );
+ }
+
+ public void testMatchArtifactIdPlugin() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.ARTIFACTID, new String[] { "maven-help-plugin" }, "plugin" );
+ }
+
+ public void testMatchArtifactIdMaven() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.ARTIFACTID, new String[] { "maven-help-plugin", "maven-archetype-simple" },
+ "maven" );
+ }
+
+ public void testMatchArtifactIdHelp() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.ARTIFACTID, new String[] { "maven-help-plugin" }, "help" );
+ }
+
+ public void testMatchVersionOne() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.VERSION, new String[] { "daytrader-ear", "testng", "archiva-common",
+ "redback-authorization-open", "maven-archetype-simple", "continuum-webapp", "wagon-provider-api" }, "1" );
+ }
+
+ public void testMatchVersionOneOh() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.VERSION, new String[] { "archiva-common", "continuum-webapp",
+ "maven-archetype-simple", "redback-authorization-open", "wagon-provider-api" }, "1.0" );
+ }
+
+ public void testMatchVersionSnapshotLower() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.VERSION, new String[] { "continuum-webapp", "redback-authorization-open" },
+ "snapshot" );
+ }
+
+ public void testMatchVersionSnapshotUpper() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.VERSION, new String[] { "continuum-webapp", "redback-authorization-open" },
+ "SNAPSHOT" );
+ }
+
+ public void testMatchVersionAlpha() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.VERSION,
+ new String[] { "maven-archetype-simple", "redback-authorization-open" }, "alpha" );
+ }
+
+ public void testMatchVersionOneAlpha() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.VERSION, new String[] { "redback-authorization-open" }, "1.0-alpha-1" );
+ }
+
+ public void testMatchVersionInvalid() throws Exception
+ {
+ assertQueryMatchNoResults( ArtifactKeys.VERSION, "255" );
+ }
+
+ public void testMatchClassifierNotJdk15() throws Exception
+ {
+ BooleanQuery bQuery = new BooleanQuery();
+ bQuery.add( new MatchAllDocsQuery(), BooleanClause.Occur.MUST );
+ bQuery.add( createMatchQuery( ArtifactKeys.CLASSIFIER, "jdk15" ), BooleanClause.Occur.MUST_NOT );
+ List results = index.search( new LuceneQuery( bQuery ) );
+
+ assertResults( new String[] { "archiva-common", "continuum-webapp", "redback-authorization-open",
+ "daytrader-ear", "maven-archetype-simple", "maven-help-plugin", "wagon-provider-api" }, results );
+ }
+
+ public void testMatchClassifierJdk15() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.CLASSIFIER, new String[] { "testng" }, "jdk15" );
+ }
+
+ public void testMatchClassifierInvalid() throws Exception
+ {
+ assertQueryMatchNoResults( ArtifactKeys.CLASSIFIER, "redo" );
+ }
+
+ public void testMatchClassSessionListener() throws Exception
+ {
+ assertQueryMatch( BytecodeKeys.CLASSES, new String[] { "wagon-provider-api" }, "wagon.events.SessionListener" );
+ }
+
+ /* TODO: Suffix searching does not seem to work.
+ public void testMatchClassUtil() throws Exception
+ {
+ assertQueryMatch( BytecodeKeys.CLASSES, new String[] { "archiva-common", "continuum-webapp", "testng",
+ "wagon-provider-api" }, "Util" );
+ }
+ */
+
+ public void testMatchClassWagon() throws Exception
+ {
+ assertQueryMatch( BytecodeKeys.CLASSES, new String[] { "wagon-provider-api" }, "Wagon" );
+ }
+
+ /* TODO: Suffix searching does not seem to work.
+ public void testMatchClassMojoAllUpper() throws Exception
+ {
+ assertQueryMatch( BytecodeKeys.CLASSES, new String[] { "maven-help-plugin" }, "MOJO" );
+ }
+ */
+
+ /* TODO: Suffix searching does not seem to work.
+ public void testMatchClassMojo() throws Exception
+ {
+ assertQueryMatch( BytecodeKeys.CLASSES, new String[] { "maven-help-plugin" }, "Mojo" );
+ }
+ */
+
+ public void testMatchClassInvalid() throws Exception
+ {
+ assertQueryMatchNoResults( BytecodeKeys.CLASSES, "Destruct|Button" );
+ }
+
+ public void testMatchFilesManifestMf() throws Exception
+ {
+ assertQueryMatch( BytecodeKeys.FILES, new String[] { "daytrader-ear", "maven-archetype-simple",
+ "redback-authorization-open", "maven-help-plugin", "archiva-common", "wagon-provider-api",
+ "continuum-webapp", "testng" }, "MANIFEST.MF" );
+ }
+
+ public void testMatchFilesMetaInf() throws Exception
+ {
+ assertQueryMatch( BytecodeKeys.FILES, new String[] { "daytrader-ear", "maven-archetype-simple",
+ "redback-authorization-open", "maven-help-plugin", "archiva-common", "wagon-provider-api",
+ "continuum-webapp", "testng" }, "META-INF" );
+ }
+
+ public void testMatchFilesPluginXml() throws Exception
+ {
+ assertQueryMatch( BytecodeKeys.FILES, new String[] { "maven-help-plugin" }, "plugin.xml" );
+ }
+
+ public void testMatchFilesInvalid() throws Exception
+ {
+ assertQueryMatchNoResults( BytecodeKeys.FILES, "Veni Vidi Castratavi Illegitimos" );
+ }
+
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/AllTests.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/AllTests.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/AllTests.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/AllTests.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,44 @@
+package org.apache.maven.archiva.indexer.hashcodes;
+
+/*
+ * 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.Test;
+import junit.framework.TestSuite;
+
+/**
+ * AllTests - conveinence test suite for IDE users.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AllTests
+{
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.indexer.hashcodes" );
+ //$JUnit-BEGIN$
+ suite.addTestSuite( HashcodesIndexTest.class );
+ suite.addTestSuite( HashcodesSearchTest.class );
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/AllTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/AllTests.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/AllTests.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,65 @@
+package org.apache.maven.archiva.indexer.hashcodes;
+
+/*
+ * 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.maven.archiva.indexer.AbstractIndexCreationTestCase;
+import org.apache.maven.archiva.indexer.RepositoryContentIndex;
+import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
+import org.apache.maven.archiva.indexer.lucene.LuceneIndexHandlers;
+import org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentRecord;
+import org.apache.maven.archiva.model.ArchivaArtifact;
+import org.apache.maven.archiva.model.ArchivaRepository;
+
+/**
+ * HashcodesIndexTest
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class HashcodesIndexTest extends AbstractIndexCreationTestCase
+{
+ public String getIndexName()
+ {
+ return "hashcodes";
+ }
+
+ public LuceneIndexHandlers getIndexHandler()
+ {
+ return new HashcodesHandlers();
+ }
+
+ public RepositoryContentIndex createIndex( RepositoryContentIndexFactory indexFactory, ArchivaRepository repository )
+ {
+ return indexFactory.createHashcodeIndex( repository );
+ }
+
+ protected LuceneRepositoryContentRecord createSimpleRecord()
+ {
+ ArchivaArtifact artifact = new ArchivaArtifact( "com.foo", "projfoo", "1.0", "", "jar" );
+
+ HashcodesRecord record = new HashcodesRecord();
+ record.setArtifact( artifact );
+
+ artifact.getModel().setChecksumSHA1( "c66f18bf192cb613fc2febb4da541a34133eedc2" );
+ artifact.getModel().setChecksumMD5( "3a0adc365f849366cd8b633cad155cb7" );
+
+ return record;
+ }
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesRecordLoader.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesRecordLoader.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesRecordLoader.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesRecordLoader.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,106 @@
+package org.apache.maven.archiva.indexer.hashcodes;
+
+/*
+ * 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.maven.archiva.model.ArchivaArtifact;
+import org.apache.maven.archiva.model.ArchivaArtifactJavaDetails;
+import org.apache.maven.archiva.model.platform.JavaArtifactHelper;
+import org.codehaus.plexus.util.IOUtil;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import junit.framework.AssertionFailedError;
+
+/**
+ * HashcodesRecordLoader
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class HashcodesRecordLoader
+{
+ public static HashcodesRecord loadRecord( File dumpFile, ArchivaArtifact artifact )
+ {
+ HashcodesRecord record = new HashcodesRecord();
+ record.setArtifact( artifact );
+
+ FileReader freader = null;
+ BufferedReader reader = null;
+
+ try
+ {
+ freader = new FileReader( dumpFile );
+ reader = new BufferedReader( freader );
+
+ String line = reader.readLine();
+ while ( line != null )
+ {
+ if ( line.startsWith( "FILENAME|" ) )
+ {
+ String filename = line.substring( "FILENAME|".length() );
+ record.setFilename( filename );
+ }
+ else if ( line.startsWith( "SIZE|" ) )
+ {
+ String size = line.substring( "SIZE|".length() );
+ record.getArtifact().getModel().setSize( Long.parseLong( size ) );
+ }
+ else if ( line.startsWith( "HASH_MD5|" ) )
+ {
+ String md5 = line.substring( "HASH_MD5|".length() );
+ record.getArtifact().getModel().setChecksumMD5( md5 );
+ }
+ else if ( line.startsWith( "HASH_SHA1|" ) )
+ {
+ String sha1 = line.substring( "HASH_SHA1|".length() );
+ record.getArtifact().getModel().setChecksumSHA1( sha1 );
+ }
+ else if ( line.startsWith( "HASH_BYTECODE|" ) )
+ {
+ String hash = line.substring( "HASH_BYTECODE|".length() );
+ ArchivaArtifactJavaDetails javaDetails = JavaArtifactHelper.getJavaDetails( record.getArtifact() );
+ javaDetails.setChecksumBytecode( hash );
+ }
+ else if ( line.startsWith( "JDK|" ) )
+ {
+ String jdk = line.substring( "JDK|".length() );
+ ArchivaArtifactJavaDetails javaDetails = JavaArtifactHelper.getJavaDetails( record.getArtifact() );
+ javaDetails.setJdk( jdk );
+ }
+
+ line = reader.readLine();
+ }
+ }
+ catch ( IOException e )
+ {
+ throw new AssertionFailedError( "Unable to load record " + dumpFile + " from disk: " + e.getMessage() );
+ }
+ finally
+ {
+ IOUtil.close( reader );
+ IOUtil.close( freader );
+ }
+
+ return record;
+ }
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesRecordLoader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesRecordLoader.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesRecordLoader.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,290 @@
+package org.apache.maven.archiva.indexer.hashcodes;
+
+/*
+ * 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.lucene.search.BooleanClause;
+import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.MatchAllDocsQuery;
+import org.apache.maven.archiva.indexer.AbstractSearchTestCase;
+import org.apache.maven.archiva.indexer.ArtifactKeys;
+import org.apache.maven.archiva.indexer.RepositoryContentIndex;
+import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
+import org.apache.maven.archiva.indexer.RepositoryIndexSearchException;
+import org.apache.maven.archiva.indexer.lucene.LuceneIndexHandlers;
+import org.apache.maven.archiva.indexer.lucene.LuceneQuery;
+import org.apache.maven.archiva.model.ArchivaArtifact;
+import org.apache.maven.archiva.model.ArchivaRepository;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * HashcodesSearchTest
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class HashcodesSearchTest extends AbstractSearchTestCase
+{
+ public String getIndexName()
+ {
+ return "hashcodes";
+ }
+
+ public LuceneIndexHandlers getIndexHandler()
+ {
+ return new HashcodesHandlers();
+ }
+
+ public RepositoryContentIndex createIndex( RepositoryContentIndexFactory indexFactory, ArchivaRepository repository )
+ {
+ return indexFactory.createHashcodeIndex( repository );
+ }
+
+ protected Map createSampleRecordsMap()
+ {
+ Map records = new HashMap();
+
+ Map artifactDumps = getArchivaArtifactDumpMap();
+ for ( Iterator iter = artifactDumps.entrySet().iterator(); iter.hasNext(); )
+ {
+ Map.Entry entry = (Map.Entry) iter.next();
+ ArchivaArtifact artifact = (ArchivaArtifact) entry.getValue();
+ File dumpFile = getDumpFile( artifact );
+ HashcodesRecord record = HashcodesRecordLoader.loadRecord( dumpFile, artifact );
+ records.put( entry.getKey(), record );
+ }
+
+ return records;
+ }
+
+ public void testExactMatchVersionSimple() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.VERSION_EXACT, new String[] { "archiva-common" }, "1.0" );
+ }
+
+ public void testExactMatchVersionSnapshot() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.VERSION_EXACT, new String[] { "continuum-webapp" }, "1.0.3-SNAPSHOT" );
+ }
+
+ public void testExactMatchVersionAlphaSnapshot() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.VERSION_EXACT, new String[] { "redback-authorization-open" },
+ "1.0-alpha-1-SNAPSHOT" );
+ }
+
+ public void testExactMatchVersionTimestampedSnapshot() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.VERSION_EXACT, new String[] { "wagon-provider-api" },
+ "1.0-beta-3-20070209.213958-2" );
+ }
+
+ public void testExactMatchVersionInvalid() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatchNoResults( ArtifactKeys.VERSION_EXACT, "foo" );
+ }
+
+ public void testExactMatchGroupIdOrgApacheMavenArchiva() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.GROUPID_EXACT, new String[] { "archiva-common" },
+ "org.apache.maven.archiva" );
+ }
+
+ public void testExactMatchGroupIdOrgApacheMaven() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.GROUPID_EXACT, new String[] { "maven-archetype-simple" },
+ "org.apache.maven" );
+ }
+
+ public void testExactMatchGroupIdInvalid() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatchNoResults( ArtifactKeys.GROUPID_EXACT, "foo" );
+ }
+
+ public void testExactMatchArtifactIdArchivaCommon() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.ARTIFACTID_EXACT, new String[] { "archiva-common" }, "archiva-common" );
+ }
+
+ public void testExactMatchArtifactIdTestNg() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.ARTIFACTID_EXACT, new String[] { "testng" }, "testng" );
+ }
+
+ public void testExactMatchArtifactIdInvalid() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatchNoResults( ArtifactKeys.ARTIFACTID_EXACT, "foo" );
+ }
+
+ public void testExactMatchTypeJar() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.TYPE, ( new String[] { "archiva-common", "redback-authorization-open",
+ "testng", "wagon-provider-api" } ), "jar" );
+ }
+
+ public void testExactMatchTypeWar() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.TYPE, ( new String[] { "continuum-webapp" } ), "war" );
+ }
+
+ /* TODO: Fix 'maven-plugin' type
+ public void testExactMatchTypePlugin() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.TYPE, ( new String[] { "maven-help-plugin" } ), "maven-plugin" );
+ } */
+
+ /* TODO: Fix 'maven-archetype' type
+ public void testExactMatchTypeArchetype() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( ArtifactKeys.TYPE, ( new String[] { "maven-archetype-simple" } ), "maven-archetype" );
+ }
+ */
+
+ public void testExactMatchTypeInvalid() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatchNoResults( ArtifactKeys.TYPE, "foo" );
+ }
+
+ public void testExactMatchMd5() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( HashcodesKeys.MD5, ( new String[] { "redback-authorization-open" } ),
+ "f42047fe2e177ac04d0df7aa44d408be" );
+ }
+
+ public void testExactMatchMd5Invalid() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatchNoResults( HashcodesKeys.MD5, "foo" );
+ }
+
+ public void testExactMatchSha1() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatch( HashcodesKeys.SHA1, ( new String[] { "archiva-common" } ),
+ "c2635a1b38bd4520a6604664c04b2b3c32330864" );
+ }
+
+ public void testExactMatchSha1Invalid() throws RepositoryIndexSearchException
+ {
+ assertQueryExactMatchNoResults( HashcodesKeys.SHA1, "foo" );
+ }
+
+ public void testMatchGroupIdOrgApacheMaven() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.GROUPID, new String[] { "archiva-common", "continuum-webapp",
+ "maven-archetype-simple", "maven-help-plugin", "wagon-provider-api" }, "org.apache.maven" );
+ }
+
+ public void testMatchGroupIdMaven() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.GROUPID, new String[] { "archiva-common", "continuum-webapp",
+ "maven-archetype-simple", "maven-help-plugin", "wagon-provider-api" }, "maven" );
+ }
+
+ public void testMatchGroupIdMavenMixed() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.GROUPID, new String[] { "archiva-common", "continuum-webapp",
+ "maven-archetype-simple", "maven-help-plugin", "wagon-provider-api" }, "Maven" );
+ }
+
+ public void testMatchGroupIdInvalid() throws Exception
+ {
+ assertQueryMatchNoResults( ArtifactKeys.GROUPID, "foo" );
+ }
+
+ public void testMatchArtifactIdPlugin() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.ARTIFACTID, new String[] { "maven-help-plugin" }, "plugin" );
+ }
+
+ public void testMatchArtifactIdMaven() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.ARTIFACTID, new String[] { "maven-help-plugin", "maven-archetype-simple" },
+ "maven" );
+ }
+
+ public void testMatchArtifactIdHelp() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.ARTIFACTID, new String[] { "maven-help-plugin" }, "help" );
+ }
+
+ public void testMatchVersionOne() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.VERSION, new String[] { "daytrader-ear", "testng", "archiva-common",
+ "redback-authorization-open", "maven-archetype-simple", "continuum-webapp", "wagon-provider-api" }, "1" );
+ }
+
+ public void testMatchVersionOneOh() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.VERSION, new String[] { "archiva-common", "continuum-webapp",
+ "maven-archetype-simple", "redback-authorization-open", "wagon-provider-api" }, "1.0" );
+ }
+
+ public void testMatchVersionSnapshotLower() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.VERSION, new String[] { "continuum-webapp", "redback-authorization-open" },
+ "snapshot" );
+ }
+
+ public void testMatchVersionSnapshotUpper() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.VERSION, new String[] { "continuum-webapp", "redback-authorization-open" },
+ "SNAPSHOT" );
+ }
+
+ public void testMatchVersionAlpha() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.VERSION,
+ new String[] { "maven-archetype-simple", "redback-authorization-open" }, "alpha" );
+ }
+
+ public void testMatchVersionOneAlpha() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.VERSION, new String[] { "redback-authorization-open" }, "1.0-alpha-1" );
+ }
+
+ public void testMatchVersionInvalid() throws Exception
+ {
+ assertQueryMatchNoResults( ArtifactKeys.VERSION, "255" );
+ }
+
+ public void testMatchClassifierNotJdk15() throws Exception
+ {
+ BooleanQuery bQuery = new BooleanQuery();
+ bQuery.add( new MatchAllDocsQuery(), BooleanClause.Occur.MUST );
+ bQuery.add( createMatchQuery( ArtifactKeys.CLASSIFIER, "jdk15" ), BooleanClause.Occur.MUST_NOT );
+ List results = index.search( new LuceneQuery( bQuery ) );
+
+ assertResults( new String[] { "archiva-common", "continuum-webapp", "redback-authorization-open",
+ "daytrader-ear", "maven-archetype-simple", "maven-help-plugin", "wagon-provider-api" }, results );
+ }
+
+ public void testMatchClassifierJdk15() throws Exception
+ {
+ assertQueryMatch( ArtifactKeys.CLASSIFIER, new String[] { "testng" }, "jdk15" );
+ }
+
+ public void testMatchClassifierInvalid() throws Exception
+ {
+ assertQueryMatchNoResults( ArtifactKeys.CLASSIFIER, "redo" );
+ }
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/query/AllTests.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/query/AllTests.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/query/AllTests.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/query/AllTests.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,43 @@
+package org.apache.maven.archiva.indexer.query;
+
+/*
+ * 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.Test;
+import junit.framework.TestSuite;
+
+/**
+ * AllTests - conveinence test suite for IDE users.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AllTests
+{
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.indexer.query" );
+ //$JUnit-BEGIN$
+ suite.addTestSuite( QueryTest.class );
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/query/AllTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/query/AllTests.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/query/AllTests.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/META-INF/plexus/components.xml?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/META-INF/plexus/components.xml (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/META-INF/plexus/components.xml Tue Apr 3 08:21:33 2007
@@ -0,0 +1,22 @@
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
+ <role-hint>mock</role-hint>
+ <implementation>org.apache.maven.archiva.indexer.MockConfiguration</implementation>
+ </component>
+ <component>
+ <role>org.apache.maven.archiva.indexer.RepositoryContentIndexFactory</role>
+ <role-hint>lucene</role-hint>
+ <implementation>org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentIndexFactory</implementation>
+ <description>Factory for Lucene repository content index instances.</description>
+ <requirements>
+ <requirement>
+ <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
+ <role-hint>mock</role-hint>
+ <field-name>configuration</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ </components>
+</component-set>
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/bytecode/BytecodeIndexTest.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/bytecode/BytecodeIndexTest.xml?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/bytecode/BytecodeIndexTest.xml (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/bytecode/BytecodeIndexTest.xml Tue Apr 3 08:21:33 2007
@@ -0,0 +1,22 @@
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
+ <role-hint>mock</role-hint>
+ <implementation>org.apache.maven.archiva.indexer.MockConfiguration</implementation>
+ </component>
+ <component>
+ <role>org.apache.maven.archiva.indexer.RepositoryContentIndexFactory</role>
+ <role-hint>lucene</role-hint>
+ <implementation>org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentIndexFactory</implementation>
+ <description>Factory for Lucene repository content index instances.</description>
+ <requirements>
+ <requirement>
+ <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
+ <role-hint>mock</role-hint>
+ <field-name>configuration</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ </components>
+</component-set>
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/bytecode/BytecodeIndexTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/bytecode/BytecodeIndexTest.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/bytecode/BytecodeIndexTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.xml?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.xml (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.xml Tue Apr 3 08:21:33 2007
@@ -0,0 +1,22 @@
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
+ <role-hint>mock</role-hint>
+ <implementation>org.apache.maven.archiva.indexer.MockConfiguration</implementation>
+ </component>
+ <component>
+ <role>org.apache.maven.archiva.indexer.RepositoryContentIndexFactory</role>
+ <role-hint>lucene</role-hint>
+ <implementation>org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentIndexFactory</implementation>
+ <description>Factory for Lucene repository content index instances.</description>
+ <requirements>
+ <requirement>
+ <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
+ <role-hint>mock</role-hint>
+ <field-name>configuration</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ </components>
+</component-set>
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.xml?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.xml (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.xml Tue Apr 3 08:21:33 2007
@@ -0,0 +1,22 @@
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
+ <role-hint>mock</role-hint>
+ <implementation>org.apache.maven.archiva.indexer.MockConfiguration</implementation>
+ </component>
+ <component>
+ <role>org.apache.maven.archiva.indexer.RepositoryContentIndexFactory</role>
+ <role-hint>lucene</role-hint>
+ <implementation>org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentIndexFactory</implementation>
+ <description>Factory for Lucene repository content index instances.</description>
+ <requirements>
+ <requirement>
+ <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
+ <role-hint>mock</role-hint>
+ <field-name>configuration</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ </components>
+</component-set>
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.xml?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.xml (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.xml Tue Apr 3 08:21:33 2007
@@ -0,0 +1,22 @@
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
+ <role-hint>mock</role-hint>
+ <implementation>org.apache.maven.archiva.indexer.MockConfiguration</implementation>
+ </component>
+ <component>
+ <role>org.apache.maven.archiva.indexer.RepositoryContentIndexFactory</role>
+ <role-hint>lucene</role-hint>
+ <implementation>org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentIndexFactory</implementation>
+ <description>Factory for Lucene repository content index instances.</description>
+ <requirements>
+ <requirement>
+ <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
+ <role-hint>mock</role-hint>
+ <field-name>configuration</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ </components>
+</component-set>
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-indexer/src/test/resources/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Copied: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java (from r521491, maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ArchivaArtifact.java)
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java?view=diff&rev=525176&p1=maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ArchivaArtifact.java&r1=521491&p2=maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ArchivaArtifact.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java Tue Apr 3 08:21:33 2007
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.repository;
+package org.apache.maven.archiva.model;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,9 +19,7 @@
* under the License.
*/
-import org.apache.maven.archiva.model.ArchivaArtifactModel;
-import org.apache.maven.archiva.model.RepositoryContent;
-import org.apache.maven.archiva.repository.version.VersionUtil;
+import org.apache.maven.archiva.common.utils.VersionUtil;
import org.codehaus.plexus.util.StringUtils;
/**
@@ -33,6 +31,8 @@
public class ArchivaArtifact
{
private ArchivaArtifactModel model;
+
+ private ArchivaArtifactPlatformDetails platformDetails;
private String baseVersion;
@@ -68,7 +68,7 @@
model = new ArchivaArtifactModel();
- if( repository == null )
+ if ( repository == null )
{
model.setContentKey( new RepositoryContent( groupId, artifactId, version ) );
}
@@ -83,6 +83,11 @@
this.baseVersion = VersionUtil.getBaseVersion( version );
}
+ public ArchivaArtifactModel getModel()
+ {
+ return model;
+ }
+
public String getGroupId()
{
return model.getContentKey().getGroupId();
@@ -123,6 +128,95 @@
return StringUtils.isNotEmpty( model.getClassifier() );
}
+ public int hashCode()
+ {
+ final int PRIME = 31;
+ int result = 1;
+ if ( model != null )
+ {
+ RepositoryContent key = model.getContentKey();
+ if ( key != null )
+ {
+ result = PRIME * result + ( ( key.getGroupId() == null ) ? 0 : key.getGroupId().hashCode() );
+ result = PRIME * result + ( ( key.getArtifactId() == null ) ? 0 : key.getArtifactId().hashCode() );
+ result = PRIME * result + ( ( key.getVersion() == null ) ? 0 : key.getVersion().hashCode() );
+ result = PRIME * result + ( ( model.getClassifier() == null ) ? 0 : model.getClassifier().hashCode() );
+ result = PRIME * result + ( ( model.getType() == null ) ? 0 : model.getType().hashCode() );
+ }
+ }
+ return result;
+ }
+
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+
+ if ( obj == null )
+ {
+ return false;
+ }
+
+ if ( getClass() != obj.getClass() )
+ {
+ return false;
+ }
+
+ final ArchivaArtifact other = (ArchivaArtifact) obj;
+
+ if ( model == null )
+ {
+ if ( other.model != null )
+ {
+ return false;
+ }
+ }
+ else
+ {
+ RepositoryContent key = model.getContentKey();
+ RepositoryContent otherkey = other.model.getContentKey();
+
+ if ( key == null )
+ {
+ if ( otherkey != null )
+ {
+ return false;
+ }
+ }
+ else
+ {
+ if ( !equals( key.getGroupId(), otherkey.getGroupId() )
+ || !equals( key.getArtifactId(), otherkey.getArtifactId() )
+ || !equals( key.getVersion(), otherkey.getVersion() )
+ || !equals( model.getClassifier(), other.model.getClassifier() )
+ || !equals( model.getType(), other.model.getType() ) )
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private boolean equals( String left, String right )
+ {
+ if ( left == null )
+ {
+ if ( right != null )
+ {
+ return false;
+ }
+ }
+ else if ( !left.equals( right ) )
+ {
+ return false;
+ }
+ return true;
+ }
+
public String toString()
{
StringBuffer sb = new StringBuffer();
@@ -155,7 +249,16 @@
private boolean empty( String value )
{
- return value == null || value.trim().length() < 1;
+ return ( value == null ) || ( value.trim().length() < 1 );
}
+ public ArchivaArtifactPlatformDetails getPlatformDetails()
+ {
+ return platformDetails;
+ }
+
+ public void setPlatformDetails( ArchivaArtifactPlatformDetails platformDetails )
+ {
+ this.platformDetails = platformDetails;
+ }
}
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifactPlatformDetails.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifactPlatformDetails.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifactPlatformDetails.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifactPlatformDetails.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,31 @@
+package org.apache.maven.archiva.model;
+
+/*
+ * 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.
+ */
+
+/**
+ * A tag for objects that are considered ArchivaArtifactPlatformDetails.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public interface ArchivaArtifactPlatformDetails
+{
+ public String getPlatform();
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifactPlatformDetails.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifactPlatformDetails.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifactPlatformDetails.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java (from r521491, maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ArchivaRepository.java)
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java?view=diff&rev=525176&p1=maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ArchivaRepository.java&r1=521491&p2=maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ArchivaRepository.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java Tue Apr 3 08:21:33 2007
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.repository;
+package org.apache.maven.archiva.model;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,8 +19,7 @@
* under the License.
*/
-import org.apache.maven.archiva.model.ArchivaRepositoryModel;
-import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+
/**
* ArchivaRepository
@@ -30,14 +29,14 @@
*/
public class ArchivaRepository
{
- protected ArtifactRepositoryPolicy releases;
-
- protected ArtifactRepositoryPolicy snapshots;
+// protected ArtifactRepositoryPolicy releases;
+//
+// protected ArtifactRepositoryPolicy snapshots;
private ArchivaRepositoryModel model;
private RepositoryURL url;
-
+
protected boolean blacklisted;
/**
@@ -103,25 +102,25 @@
this.blacklisted = blacklisted;
}
- public ArtifactRepositoryPolicy getReleases()
- {
- return releases;
- }
-
- public void setReleases( ArtifactRepositoryPolicy releases )
- {
- this.releases = releases;
- }
-
- public ArtifactRepositoryPolicy getSnapshots()
- {
- return snapshots;
- }
-
- public void setSnapshots( ArtifactRepositoryPolicy snapshots )
- {
- this.snapshots = snapshots;
- }
+// public ArtifactRepositoryPolicy getReleases()
+// {
+// return releases;
+// }
+//
+// public void setReleases( ArtifactRepositoryPolicy releases )
+// {
+// this.releases = releases;
+// }
+//
+// public ArtifactRepositoryPolicy getSnapshots()
+// {
+// return snapshots;
+// }
+//
+// public void setSnapshots( ArtifactRepositoryPolicy snapshots )
+// {
+// this.snapshots = snapshots;
+// }
public boolean isRemote()
{
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/DependencyScope.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/DependencyScope.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/DependencyScope.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/DependencyScope.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,46 @@
+package org.apache.maven.archiva.model;
+
+/*
+ * 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;
+
+/**
+ * DependencyScope - utility methods and constants for working with scopes.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class DependencyScope
+{
+ public static final String SYSTEM = "system";
+
+ public static final String COMPILE = "compile";
+
+ public static final String PROVIDED = "provided";
+
+ public static final String RUNTIME = "runtime";
+
+ public static final String TEST = "test";
+
+ public static boolean isSystemScoped( Dependency dep )
+ {
+ return StringUtils.equals( SYSTEM, dep.getScope() );
+ }
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/DependencyScope.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/DependencyScope.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/DependencyScope.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/RepositoryURL.java (from r521491, maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryURL.java)
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/RepositoryURL.java?view=diff&rev=525176&p1=maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryURL.java&r1=521491&p2=maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/RepositoryURL.java&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryURL.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/RepositoryURL.java Tue Apr 3 08:21:33 2007
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.repository;
+package org.apache.maven.archiva.model;
/*
* Licensed to the Apache Software Foundation (ASF) under one
Added: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/platform/JavaArtifactHelper.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/platform/JavaArtifactHelper.java?view=auto&rev=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/platform/JavaArtifactHelper.java (added)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/platform/JavaArtifactHelper.java Tue Apr 3 08:21:33 2007
@@ -0,0 +1,44 @@
+package org.apache.maven.archiva.model.platform;
+
+/*
+ * 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.maven.archiva.model.ArchivaArtifact;
+import org.apache.maven.archiva.model.ArchivaArtifactJavaDetails;
+
+/**
+ * Utility methods for working with java platform specific ArchivaArtifacts.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class JavaArtifactHelper
+{
+ public static ArchivaArtifactJavaDetails getJavaDetails( ArchivaArtifact artifact )
+ {
+ ArchivaArtifactJavaDetails javaDetails = (ArchivaArtifactJavaDetails) artifact.getPlatformDetails();
+ if ( javaDetails == null )
+ {
+ javaDetails = new ArchivaArtifactJavaDetails();
+ artifact.setPlatformDetails( javaDetails );
+ }
+
+ return javaDetails;
+ }
+}
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/platform/JavaArtifactHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/platform/JavaArtifactHelper.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/platform/JavaArtifactHelper.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/mdo/archiva-base.xml?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/mdo/archiva-base.xml (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-model/src/main/mdo/archiva-base.xml Tue Apr 3 08:21:33 2007
@@ -295,6 +295,13 @@
<name>ArchivaArtifactModel</name>
<version>1.0.0+</version>
<fields>
+ <!--
+ NOTE TO ARCHIVA DEVELOPERS....
+
+ The ArchivaArtifact object should contain no platform specifics!!
+ Put Java specifics in the ArchivaArtifactJavaDetails object.
+ Put .Net specifics in the ArchivaArtifactDotNetDetails object.
+ -->
<field>
<name>contentKey</name>
<identity>true</identity>
@@ -349,15 +356,35 @@
</description>
</field>
<field>
- <name>checksumBytecode</name>
+ <name>lastModified</name>
+ <identity>false</identity>
+ <version>1.0.0+</version>
+ <type>Date</type>
+ <required>true</required>
+ <description>
+ The Last Modified Timestamp of this artifact.
+ </description>
+ </field>
+ <field jpox.column="FILE_SIZE">
+ <name>size</name>
+ <identity>false</identity>
+ <version>1.0.0+</version>
+ <type>long</type>
+ <required>true</required>
+ <description>
+ The size of the artifact on disk.
+ </description>
+ </field>
+ <field>
+ <name>platform</name>
<identity>false</identity>
<version>1.0.0+</version>
<type>String</type>
- <required>false</required>
+ <required>true</required>
<description>
- The SHA1 checksum for the bytecode in the artifact file. (Can be empty if
- the artifact contains no bytecode)
+ The platform of this artifact. (default: "java")
</description>
+ <defaultValue>java</defaultValue>
</field>
<field>
<name>whenIndexed</name>
@@ -382,6 +409,66 @@
</fields>
</class>
<class stash.storable="true"
+ jpox.table="JAVA_ARTIFACT">
+ <name>ArchivaArtifactJavaDetails</name>
+ <interfaces>
+ <interface>org.apache.maven.archiva.model.ArchivaArtifactPlatformDetails</interface>
+ </interfaces>
+ <version>1.0.0+</version>
+ <fields>
+ <field>
+ <name>contentKey</name>
+ <identity>true</identity>
+ <version>1.0.0+</version>
+ <required>true</required>
+ <association>
+ <type>RepositoryContent</type>
+ <multiplicity>1</multiplicity>
+ </association>
+ <description>
+ The content key for this java artifact details.
+ </description>
+ </field>
+ <field>
+ <name>checksumBytecode</name>
+ <identity>false</identity>
+ <version>1.0.0+</version>
+ <type>String</type>
+ <required>false</required>
+ <description>
+ The SHA1 checksum for the bytecode in the artifact file. (Can be empty if
+ the artifact contains no bytecode)
+ </description>
+ </field>
+ <field>
+ <name>jdk</name>
+ <identity>false</identity>
+ <version>1.0.0+</version>
+ <type>String</type>
+ <required>false</required>
+ <description>
+ The JDK revision of the bytecode. (Can be empty if the artifact contains no bytecode)
+ </description>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <version>1.0.0+</version>
+ <code><![CDATA[
+ /**
+ * Identify this implementation as a set of java details.
+ *
+ * @return the Java platform string
+ */
+ public String getPlatform()
+ {
+ return "java";
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class>
+ <class stash.storable="true"
jpox.table="REPOSITORY_METADATA">
<name>ArchivaRepositoryMetadata</name>
<version>1.0.0+</version>
@@ -423,23 +510,33 @@
</description>
</field>
<field>
- <name>whenIndexed</name>
+ <name>lastModified</name>
<identity>false</identity>
<version>1.0.0+</version>
<type>Date</type>
- <required>false</required>
+ <required>true</required>
<description>
- The timestamp when this artifact was indexed.
+ The Last Modified Timestamp of this artifact.
+ </description>
+ </field>
+ <field jpox.column="FILE_SIZE">
+ <name>size</name>
+ <identity>false</identity>
+ <version>1.0.0+</version>
+ <type>long</type>
+ <required>true</required>
+ <description>
+ The size of the artifact on disk.
</description>
</field>
<field>
- <name>lastUpdated</name>
+ <name>whenIndexed</name>
<identity>false</identity>
<version>1.0.0+</version>
<type>Date</type>
<required>false</required>
<description>
- the timestamp when this artifact was indexed.
+ The timestamp when this artifact was indexed.
</description>
</field>
<field>
@@ -506,6 +603,26 @@
</description>
</field>
<field>
+ <name>name</name>
+ <identity>false</identity>
+ <version>1.0.0+</version>
+ <required>false</required>
+ <type>String</type>
+ <description>
+ The name of this project.
+ </description>
+ </field>
+ <field>
+ <name>description</name>
+ <identity>false</identity>
+ <version>1.0.0+</version>
+ <required>false</required>
+ <type>String</type>
+ <description>
+ The description of this project.
+ </description>
+ </field>
+ <field>
<name>origin</name>
<identity>false</identity>
<version>1.0.0+</version>
@@ -953,14 +1070,14 @@
<fields>
<field>
<name>groupId</name>
- <version>4.0.0</version>
+ <version>1.0.0+</version>
<description><![CDATA[The group ID of the project to exclude.]]></description>
<type>String</type>
<required>true</required>
</field>
<field>
<name>artifactId</name>
- <version>4.0.0</version>
+ <version>1.0.0+</version>
<description><![CDATA[The artifact ID of the project to exclude.]]></description>
<type>String</type>
<required>true</required>
@@ -974,7 +1091,7 @@
<fields>
<field jpox.column="SCM_URL">
<name>connection</name>
- <version>1.0.0</version>
+ <version>1.0.0+</version>
<description><![CDATA[
The source control management system URL
that describes the repository and how to connect to the
@@ -987,7 +1104,7 @@
</field>
<field>
<name>developerConnection</name>
- <version>1.0.0</version>
+ <version>1.0.0+</version>
<description><![CDATA[
Just like <code>connection</code>, but for developers, i.e. this scm connection
will not be read only.
@@ -996,7 +1113,7 @@
</field>
<field>
<name>url</name>
- <version>1.0.0</version>
+ <version>1.0.0+</version>
<description>
<![CDATA[The URL to the project's browsable SCM repository, such as ViewVC or Fisheye.]]></description>
<type>String</type>
@@ -1010,7 +1127,7 @@
<fields>
<field>
<name>id</name>
- <version>4.0.0</version>
+ <version>1.0.0+</version>
<description><![CDATA[
A unique identifier for a repository. This is used to match the repository to configuration in
the <code>settings.xml</code> file, for example.
@@ -1019,7 +1136,7 @@
</field>
<field>
<name>name</name>
- <version>4.0.0</version>
+ <version>1.0.0+</version>
<description><![CDATA[
Human readable name of the repository.
]]></description>
@@ -1027,7 +1144,7 @@
</field>
<field>
<name>url</name>
- <version>4.0.0</version>
+ <version>1.0.0+</version>
<description><![CDATA[
The url of the repository, in the form <code>protocol://hostname/path</code>.
]]></description>
@@ -1035,7 +1152,7 @@
</field>
<field>
<name>layout</name>
- <version>4.0.0</version>
+ <version>1.0.0+</version>
<description><![CDATA[
The type of layout this repository uses for locating and storing artifacts - can be <code>legacy</code> or
<code>default</code>.
Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/pom.xml?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/pom.xml (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/pom.xml Tue Apr 3 08:21:33 2007
@@ -26,13 +26,12 @@
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-repository-layer</artifactId>
<name>Archiva Repository Interface Layer</name>
<dependencies>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
- <artifactId>archiva-common</artifactId>
+ <artifactId>archiva-consumer-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
@@ -40,6 +39,11 @@
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
+ <groupId>org.apache.maven.archiva</groupId>
+ <artifactId>archiva-xml-tools</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
@@ -55,6 +59,7 @@
<version>1.0-alpha-2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
+ <!--
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
@@ -67,6 +72,7 @@
<groupId>org.apache.maven</groupId>
<artifactId>maven-repository-metadata</artifactId>
</dependency>
+ -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
Modified: maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java?view=diff&rev=525176&r1=525175&r2=525176
==============================================================================
--- maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java (original)
+++ maven/archiva/branches/archiva-jpox-database-refactor/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java Tue Apr 3 08:21:33 2007
@@ -19,7 +19,7 @@
* under the License.
*/
-import org.apache.maven.archiva.repository.ArchivaRepository;
+import org.apache.maven.archiva.model.ArchivaRepository;
import java.util.List;