]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1025] remove model fields that are not used for clarity
authorBrett Porter <brett@apache.org>
Wed, 2 Dec 2009 10:23:42 +0000 (10:23 +0000)
committerBrett Porter <brett@apache.org>
Wed, 2 Dec 2009 10:23:42 +0000 (10:23 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@886101 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java
archiva-modules/archiva-base/archiva-model/pom.xml
archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
archiva-modules/archiva-base/archiva-model/src/test/java/org/apache/maven/archiva/model/ArchivaArtifactTest.java [deleted file]
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/ArtifactsProcessedConstraint.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/AllTests.java
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ArtifactsProcessedConstraintTest.java [deleted file]
archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoArtifactDAOTest.java
archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorTest.java

index db22000062e234febc850e258dd8bc12b6acd74e..6ddd82eac0320a1d9e22ab00426d0274b6d2bc22 100644 (file)
@@ -19,6 +19,11 @@ package org.apache.maven.archiva.consumers.database;
  * under the License.
  */
 
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
 import org.apache.maven.archiva.configuration.FileTypes;
@@ -41,11 +46,6 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationExce
 import org.codehaus.plexus.registry.Registry;
 import org.codehaus.plexus.registry.RegistryListener;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
 /**
  * ArtifactUpdateDatabaseConsumer - Take an artifact off of disk and put it into the repository.
  *
@@ -193,8 +193,6 @@ public class ArtifactUpdateDatabaseConsumer
 
             artifact.getModel().setLastModified( new Date( artifactFile.lastModified() ) );
             artifact.getModel().setSize( artifactFile.length() );
-            artifact.getModel().setOrigin( "FileSystem" );
-            artifact.getModel().setWhenProcessed( null );
             
             // set this to when the artifact was first discovered in the repo
             if ( artifact.getModel().getWhenGathered() == null )
index 90249d6b872e45dce437c7502aa4a94bfcf8e980..d6c78b7b78cb8efe66eda6d7cc6c824c5c82c4ba 100755 (executable)
@@ -70,7 +70,7 @@
         <groupId>org.codehaus.modello</groupId>
         <artifactId>modello-maven-plugin</artifactId>
         <configuration>
-          <version>1.2.1</version>
+          <version>1.3.0</version>
           <packageWithVersion>false</packageWithVersion>
           <models>
             <model>src/main/mdo/archiva-base.xml</model>
index 0c9a400f0aadf099ccabd51ece172d2d1daed7b6..e4947df6701dbe7c01b129ba6c0eb7b6e61b6ae5 100644 (file)
@@ -5,7 +5,10 @@
        xsd.target-namespace="http://archiva.apache.org/model/1.2.0">
   <id>archiva-base-model</id>
   <name>ArchivaBaseModel</name>
-  <version>1.2.1</version>
+  <!-- Note that we've outright removed old model information instead of setting the finish version to be 1.2.1.
+  if for any reason this model needs to be retained for some other use (eg, migration), then those may need to be
+  restored. Otherwise, the previous archiva-model artifact can be used if necessary -->
+  <version>1.3.0</version>
   <description>Archiva Model</description>
   <defaults>
     <default>
             The size of the artifact on disk.
           </description>
         </field>
-        <field stash.maxSize="16">
-          <name>platform</name>
-          <identifier>false</identifier>
-          <version>1.0.0+</version>
-          <type>String</type>
-          <required>true</required>
-          <description>
-            The platform of this artifact. (default: "java")
-          </description>
-          <defaultValue>java</defaultValue>
-        </field>
-        <field>
-          <name>whenIndexed</name>
-          <identifier>false</identifier>
-          <version>1.0.0+</version>
-          <type>Date</type>
-          <required>false</required>
-          <description>
-            The timestamp when this artifact was indexed.
-          </description>
-        </field>
-        <field>
-          <name>whenProcessed</name>
-          <identifier>false</identifier>
-          <version>1.0.0+</version>
-          <type>Date</type>
-          <required>false</required>
-          <description>
-            When this artifact's contents was processed.
-          </description>
-        </field>
-        <field>
-          <name>origin</name>
-          <identifier>false</identifier>
-          <version>1.0.0+</version>
-          <type>String</type>
-          <required>false</required>
-          <description>
-            The origin of this artifact. (Filesystem, Proxy, Deploy)
-          </description>
-        </field>
         <field>
           <name>whenGathered</name>
           <identifier>false</identifier>
     private static final long serialVersionUID = -6292417108113887384L;
           ]]></code>
         </codeSegment>
-        <codeSegment>
-          <version>1.0.0+</version>
-          <code><![CDATA[
-    /**
-     * Identify if this artifact's contents have been processed or not.
-     * 
-     * @return true if the artifact's contents have been processed.
-     */
-    public boolean isProcessed()
-    {
-        return !(whenProcessed == null);
-    }          
-          ]]></code>
-        </codeSegment>
       </codeSegments>
     </class>
 
             The size of the artifact on disk.
           </description>
         </field>
-        <field>
-          <name>whenIndexed</name>
-          <identifier>false</identifier>
-          <version>1.0.0+</version>
-          <type>Date</type>
-          <required>false</required>
-          <description>
-            The timestamp when this artifact was indexed.
-          </description>
-        </field>
-        <field>
-          <name>origin</name>
-          <identifier>false</identifier>
-          <version>1.0.0+</version>
-          <type>String</type>
-          <required>false</required>
-          <description>
-            The origin of this artifact. (Filesystem, Proxy, Deploy)
-          </description>
-        </field>
       </fields>
       <codeSegments>
         <codeSegment>
diff --git a/archiva-modules/archiva-base/archiva-model/src/test/java/org/apache/maven/archiva/model/ArchivaArtifactTest.java b/archiva-modules/archiva-base/archiva-model/src/test/java/org/apache/maven/archiva/model/ArchivaArtifactTest.java
deleted file mode 100644 (file)
index 3ad4d44..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-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 java.util.Date;
-
-import org.codehaus.plexus.spring.PlexusInSpringTestCase;
-
-/**
- * ArchivaModelClonerTest
- *
- * @version $Id: ArchivaModelClonerTest.java 525951 2007-04-05 20:11:19Z joakime $
- */
-public class ArchivaArtifactTest
-    extends PlexusInSpringTestCase
-{
-    public void testArtifactModelProcessed()
-    {
-        ArchivaArtifactModel model = new ArchivaArtifactModel();
-
-        assertNull( "whenProcessed", model.getWhenProcessed() );
-        assertFalse( "isProcessed", model.isProcessed() );
-
-        model.setWhenProcessed( new Date() );
-
-        assertTrue( "isProcessed", model.isProcessed() );
-    }
-
-}
index a6fc50b82a77ec82bfadc2e41fd89398d7674136..e587bdd74338427d921cc6ca5efbcfaa5f91feef 100644 (file)
@@ -19,6 +19,9 @@ package org.apache.maven.archiva.repository.metadata;
  * under the License.
  */
 
+import java.io.File;
+import java.util.Date;
+
 import org.apache.commons.lang.math.NumberUtils;
 import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
 import org.apache.maven.archiva.model.Plugin;
@@ -27,9 +30,6 @@ import org.apache.maven.archiva.xml.XMLException;
 import org.apache.maven.archiva.xml.XMLReader;
 import org.dom4j.Element;
 
-import java.io.File;
-import java.util.Date;
-
 /**
  * RepositoryMetadataReader - read maven-metadata.xml files.
  *
@@ -60,7 +60,6 @@ public class RepositoryMetadataReader
             metadata.setVersion( xml.getElementText( "//metadata/version" ) );
             metadata.setFileLastModified( new Date( metadataFile.lastModified() ) );
             metadata.setFileSize( metadataFile.length() );
-            metadata.setWhenIndexed( null );
 
             metadata.setLastUpdated( xml.getElementText( "//metadata/versioning/lastUpdated" ) );
             metadata.setLatestVersion( xml.getElementText( "//metadata/versioning/latest" ) );
index 5c234e209034070716925ce3176fe3777df9c1ae..324964c15a5bba2e567e3a1cfa676671a27a6c6a 100644 (file)
@@ -19,10 +19,10 @@ package org.apache.maven.archiva.database.constraints;
  * under the License.
  */
 
-import org.apache.maven.archiva.database.Constraint;
-
 import java.util.Date;
 
+import org.apache.maven.archiva.database.Constraint;
+
 /**
  * ArtifactsProcessedConstraint 
  *
@@ -34,18 +34,6 @@ public class ArtifactsProcessedConstraint
 {
     private String whereClause;
 
-    public ArtifactsProcessedConstraint( boolean isProcessed )
-    {
-        if ( isProcessed )
-        {
-            whereClause = "whenProcessed != null";
-        }
-        else
-        {
-            whereClause = "whenProcessed == null";
-        }
-    }
-
     /**
      * A Constraint showing artifacts processed since date provided.
      * @param since
index f2394570bc6beee73c771fdee145be5b8027d5c2..a9b926e373370b0bb57718258fb3707057c90bae 100644 (file)
@@ -34,7 +34,6 @@ public class AllTests
     {
         TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.database.constraints" );
         //$JUnit-BEGIN$
-        suite.addTestSuite( ArtifactsProcessedConstraintTest.class );
         suite.addTestSuite( ArtifactsByChecksumConstraintTest.class );
         suite.addTestSuite( OlderArtifactsByAgeConstraintTest.class );
         suite.addTestSuite( UniqueGroupIdConstraintTest.class );
diff --git a/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ArtifactsProcessedConstraintTest.java b/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/ArtifactsProcessedConstraintTest.java
deleted file mode 100644 (file)
index 65719df..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-package org.apache.maven.archiva.database.constraints;
-
-/*
- * 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.Date;
-import java.util.List;
-
-import org.apache.maven.archiva.database.AbstractArchivaDatabaseTestCase;
-import org.apache.maven.archiva.database.ArtifactDAO;
-import org.apache.maven.archiva.model.ArchivaArtifact;
-
-/**
- * ArtifactsProcessedConstraintTest 
- *
- * @version $Id$
- */
-public class ArtifactsProcessedConstraintTest
-    extends AbstractArchivaDatabaseTestCase
-{
-    public ArchivaArtifact createArtifact( String groupId, String artifactId, String version, String whenProcessed )
-        throws Exception
-    {
-        ArchivaArtifact artifact = dao.getArtifactDAO().createArtifact( groupId, artifactId, version, "", "jar", "testrepo" );
-        assertNotNull( "Artifact should not be null.", artifact );
-        Date dateWhenProcessed = null;
-
-        if ( whenProcessed != null )
-        {
-            dateWhenProcessed = toDate( whenProcessed );
-        }
-
-        artifact.getModel().setWhenProcessed( dateWhenProcessed );
-
-        // Satisfy table / column requirements.
-        artifact.getModel().setLastModified( new Date() );
-
-        return artifact;
-    }
-
-    public void assertResults( String type, List<ArchivaArtifact> results, String expectedArtifacts[] )
-    {
-        assertNotNull( "Results[" + type + "] should not be null.", results );
-        assertEquals( "Results[" + type + "].size", expectedArtifacts.length, results.size() );
-
-        for ( int i = 0; i < expectedArtifacts.length; i++ )
-        {
-            String artifactId = expectedArtifacts[i];
-
-            int found = 0;
-            for ( ArchivaArtifact artifact : results )
-            {
-                if ( artifactId.equals( artifact.getArtifactId() ) )
-                {
-                    found++;
-                }
-            }
-
-            if ( found <= 0 )
-            {
-                fail( "Results[" + type + "] - Did not find expected artifact ID [" + artifactId + "]" );
-            }
-
-            if ( found > 1 )
-            {
-                fail( "Results[" + type + "] - Expected to find 1 copy of artifact ID [" + artifactId
-                    + "], yet found <" + found + "> instead." );
-            }
-        }
-    }
-
-    @Override
-    protected void setUp()
-        throws Exception
-    {
-        super.setUp();
-
-        ArtifactDAO adao = dao.getArtifactDAO();
-        assertNotNull( "Artifact DAO should not be null.", adao );
-
-        adao.saveArtifact( createArtifact( "org.apache.maven.archiva", "archiva-common", "1.0-SNAPSHOT", null ) );
-        adao.saveArtifact( createArtifact( "org.apache.maven.archiva", "archiva-utils", "1.0-SNAPSHOT",
-                                           "2006/08/22 19:01:00" ) );
-        adao.saveArtifact( createArtifact( "org.apache.maven.archiva", "archiva-old", "0.1", "2004/02/15 9:01:00" ) );
-        adao.saveArtifact( createArtifact( "org.apache.maven.archiva", "archiva-database", "1.0-SNAPSHOT", null ) );
-    }
-
-    public void testNotProcessed()
-        throws Exception
-    {
-        List<ArchivaArtifact> results = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( false ) );
-        assertResults( "not-processed", results, new String[] { "archiva-common", "archiva-database" } );
-    }
-
-    public void testProcessed()
-        throws Exception
-    {
-        List<ArchivaArtifact> results = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( true ) );
-        assertResults( "processed", results, new String[] { "archiva-utils", "archiva-old" } );
-    }
-
-    public void testSinceRecent()
-        throws Exception
-    {
-        Date since = toDate( "2006/01/01 12:00:00" );
-        List<ArchivaArtifact> results = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( since ) );
-        assertResults( "processed", results, new String[] { "archiva-utils" } );
-    }
-
-    public void testSinceOld()
-        throws Exception
-    {
-        Date since = toDate( "2001/01/01 12:00:00" );
-        List<ArchivaArtifact> results = dao.getArtifactDAO().queryArtifacts( new ArtifactsProcessedConstraint( since ) );
-        assertResults( "processed", results, new String[] { "archiva-utils", "archiva-old" } );
-    }
-}
index a21e3ecb25a1693f7cfe81be9a9756020816386c..987880fbb894fc753c53b9abcb72826472646717 100644 (file)
@@ -21,7 +21,6 @@ package org.apache.maven.archiva.database.jdo;
 
 import java.util.Date;
 import java.util.List;
-
 import javax.jdo.JDOHelper;
 import javax.jdo.spi.JDOImplHelper;
 
@@ -67,7 +66,6 @@ public class JdoArtifactDAOTest
 
         // Set some mandatory values
         artifact.getModel().setLastModified( new Date() );
-        artifact.getModel().setOrigin( "test" );
 
         // Save it.
         ArchivaArtifact savedArtifact = artiDao.saveArtifact( artifact );
@@ -90,7 +88,7 @@ public class JdoArtifactDAOTest
         assertEquals( "jar", firstArtifact.getType() );
 
         // Change value and save.
-        savedArtifact.getModel().setOrigin( "changed" );
+        savedArtifact.getModel().setLastModified( new Date() );
         artiDao.saveArtifact( savedArtifact );
 
         // Test that only 1 object is saved.
@@ -103,7 +101,6 @@ public class JdoArtifactDAOTest
 
         // Test expected values.
         assertEquals( "archiva-test-module", actualArtifact.getArtifactId() );
-        assertEquals( "changed", actualArtifact.getModel().getOrigin() );
 
         // Test that only 1 object is saved.
         assertEquals( 1, artiDao.queryArtifacts( null ).size() );
index a79db2a8116438da48ec747a00cef9a1ba5a1065..fe7ce034e6d472f56263d97190d26496688dea81 100644 (file)
@@ -32,7 +32,6 @@ import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.database.ArchivaDAO;
 import org.apache.maven.archiva.database.ArtifactDAO;
-import org.apache.maven.archiva.database.constraints.ArtifactsProcessedConstraint;
 import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.model.RepositoryContentStatistics;
 import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
@@ -174,7 +173,7 @@ public class ArchivaRepositoryScanningTaskExecutorTest
         taskExecutor.executeTask( repoTask );
 
         ArtifactDAO adao = dao.getArtifactDAO();
-        List<ArchivaArtifact> unprocessedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( false ) );
+        List<ArchivaArtifact> unprocessedResultList = adao.queryArtifacts( null );
         
         assertNotNull( unprocessedResultList );
         assertEquals("Incorrect number of unprocessed artifacts detected.", 8, unprocessedResultList.size() );
@@ -215,7 +214,7 @@ public class ArchivaRepositoryScanningTaskExecutorTest
         taskExecutor.executeTask( repoTask );
 
         ArtifactDAO adao = dao.getArtifactDAO();
-        List<ArchivaArtifact> unprocessedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( false ) );
+        List<ArchivaArtifact> unprocessedResultList = adao.queryArtifacts( null );
         
         assertNotNull( unprocessedResultList );
         assertEquals("Incorrect number of unprocessed artifacts detected. No new artifacts should have been found.", 0, unprocessedResultList.size() );
@@ -232,7 +231,7 @@ public class ArchivaRepositoryScanningTaskExecutorTest
         
         taskExecutor.executeTask( repoTask );
         
-        unprocessedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( false ) );
+        unprocessedResultList = adao.queryArtifacts( null );
         assertNotNull( unprocessedResultList );
         assertEquals( "Incorrect number of unprocessed artifacts detected. One new artifact should have been found.", 1, unprocessedResultList.size() );        
     }
@@ -272,7 +271,7 @@ public class ArchivaRepositoryScanningTaskExecutorTest
         taskExecutor.executeTask( repoTask );
 
         ArtifactDAO adao = dao.getArtifactDAO();
-        List<ArchivaArtifact> unprocessedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( false ) );
+        List<ArchivaArtifact> unprocessedResultList = adao.queryArtifacts( null );
         
         assertNotNull( unprocessedResultList );
         assertEquals("Incorrect number of unprocessed artifacts detected.", 8, unprocessedResultList.size() );