You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Stephen McConnell <mc...@apache.org> on 2004/09/03 17:52:32 UTC
[patch] repository-spi
The patch bring a test case into operation that was previously filtered
out of the test run and fixes the bug in the artifact descriptor class.
C:\dev\avalon\runtime\repository\spi>svn diff
Index: src/test/org/apache/avalon/repository/meta/MetaTest.java
===================================================================
--- src/test/org/apache/avalon/repository/meta/MetaTest.java
(revision 37479)
+++ src/test/org/apache/avalon/repository/meta/MetaTest.java (working
copy)
@@ -25,7 +25,9 @@
import junit.framework.TestCase;
+import org.apache.avalon.repository.Artifact;
+
/**
*
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development
Team</a>
@@ -85,18 +87,26 @@
public void testIntegrity() throws Exception
{
- String domain = "aaa";
- String version = "123";
+ String metadomain = "aaa";
+ String metaversion = "123";
+ String metabuild = "789";
+ String group = "bbb";
+ String name = "ccc";
+ String version = "ddd";
Attributes attributes = new BasicAttributes();
- attributes.put( ArtifactDescriptor.DOMAIN_KEY, domain );
- attributes.put( ArtifactDescriptor.VERSION_KEY, version );
+ attributes.put( ArtifactDescriptor.DOMAIN_KEY, metadomain );
+ attributes.put( ArtifactDescriptor.VERSION_KEY, metaversion );
+ attributes.put( ArtifactDescriptor.BUILD_KEY, metabuild );
+ attributes.put( Artifact.GROUP_KEY, group );
+ attributes.put( Artifact.NAME_KEY, name );
+ attributes.put( Artifact.VERSION_KEY, version );
try
{
ArtifactDescriptor meta = new ArtifactDescriptor(
attributes );
- assertEquals( "domain", meta.getDomain(), domain );
- assertEquals( "version", meta.getVersion(), version );
+ assertEquals( "domain", meta.getDomain(), metadomain );
+ assertEquals( "version", meta.getVersion(), metaversion );
assertEquals( "equals", meta, meta );
}
catch( Throwable e )
Index:
src/java/org/apache/avalon/repository/meta/ArtifactDescriptor.java
===================================================================
--- src/java/org/apache/avalon/repository/meta/ArtifactDescriptor.java
(revision 37479)
+++ src/java/org/apache/avalon/repository/meta/ArtifactDescriptor.java
(working copy)
@@ -48,10 +48,6 @@
private final String c_domain;
private final String c_version;
-
- private final String m_group;
- private final String m_name;
- private final String m_version;
private final String m_build;
private final Artifact m_artifact;
@@ -92,13 +88,14 @@
throw new MetaException( error );
}
- m_group = getAttribute( attributes, Artifact.GROUP_KEY, ""
);
- m_name = getAttribute( attributes, Artifact.NAME_KEY, "" );
- m_version = getAttribute( attributes, Artifact.VERSION_KEY,
"" );
m_build = getAttribute( attributes, BUILD_KEY, "" );
- m_artifact = Artifact.createArtifact( m_group, m_name,
m_version );
+ String group = getAttribute( attributes,
Artifact.GROUP_KEY, "" );
+ String name = getAttribute( attributes, Artifact.NAME_KEY,
"" );
+ String version = getAttribute( attributes,
Artifact.VERSION_KEY, "" );
+ m_artifact = Artifact.createArtifact( group, name, version
);
+
}
catch( NamingException e )
{
@@ -167,9 +164,8 @@
ArtifactDescriptor meta = (ArtifactDescriptor) other;
isEqual = isEqual && c_domain.equals( meta.c_domain );
isEqual = isEqual && c_version.equals( meta.c_version );
- isEqual = isEqual && m_group.equals( meta.m_version );
- isEqual = isEqual && m_name.equals( meta.m_name );
- isEqual = isEqual && m_version.equals( meta.m_version );
+ isEqual = isEqual && m_build.equals( meta.m_build );
+ isEqual = isEqual && m_artifact.equals( meta.m_artifact );
}
return isEqual;
}
@@ -186,12 +182,10 @@
hash >>>= 13;
hash ^= c_version.hashCode();
hash >>>= 13;
- hash ^= m_group.hashCode();
- hash >>>= 13;
- hash ^= m_version.hashCode();
- hash >>>= 13;
hash ^= m_build.hashCode();
hash >>>= 13;
+ hash ^= m_artifact.hashCode();
+ hash >>>= 13;
return hash;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org