Return-Path: Delivered-To: apmail-avalon-cvs-archive@avalon.apache.org Received: (qmail 80713 invoked by uid 500); 11 Jul 2003 20:03:25 -0000 Mailing-List: contact cvs-help@avalon.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon CVS List" Reply-To: "Avalon Developers List" Delivered-To: mailing list cvs@avalon.apache.org Received: (qmail 80640 invoked by uid 500); 11 Jul 2003 20:03:24 -0000 Received: (qmail 80541 invoked from network); 11 Jul 2003 20:03:23 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 11 Jul 2003 20:03:23 -0000 Received: (qmail 2238 invoked by uid 1152); 11 Jul 2003 20:03:22 -0000 Date: 11 Jul 2003 20:03:22 -0000 Message-ID: <20030711200322.2237.qmail@icarus.apache.org> From: bloritsch@apache.org To: avalon-sandbox-cvs@apache.org Subject: cvs commit: avalon-sandbox/meta/api/src/test/org/apache/avalon/meta/info/test ServiceTestCase.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N bloritsch 2003/07/11 13:03:22 Modified: meta/api/src/java/org/apache/avalon/meta/info Service.java Added: meta/api/src/test/org/apache/avalon/meta/info/test ServiceTestCase.java Log: Add testing for the Service Revision Changes Path 1.3 +4 -4 avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/Service.java Index: Service.java =================================================================== RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/Service.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Service.java 10 Jul 2003 21:01:09 -0000 1.2 +++ Service.java 11 Jul 2003 20:03:22 -0000 1.3 @@ -97,7 +97,7 @@ * supplied properties argument. * * @param reference the versioned classname - * @param attributes the set of attributes to assign to the descriptor + * @param entries the set of attributes to assign to the descriptor */ public Service( final ReferenceDescriptor reference, @@ -199,7 +199,7 @@ */ public boolean matches( final ReferenceDescriptor reference ) { - return reference.equals( getReference() ); + return m_reference.matches( reference ); } /** @@ -208,7 +208,7 @@ */ public int hashCode() { - return getClassname().hashCode() + getVersion().hashCode(); + return m_reference.hashCode(); } /** 1.1 avalon-sandbox/meta/api/src/test/org/apache/avalon/meta/info/test/ServiceTestCase.java Index: ServiceTestCase.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation. For more information on the Apache Software Foundation, please see . */ package org.apache.avalon.meta.info.test; import org.apache.avalon.meta.info.Descriptor; import org.apache.avalon.meta.info.Service; import org.apache.avalon.meta.info.ReferenceDescriptor; import org.apache.avalon.meta.info.EntryDescriptor; import org.apache.avalon.framework.Version; /** * ServiceTestCase does XYZ * * @author Berin Loritsch * @version CVS $ Revision: 1.1 $ */ public class ServiceTestCase extends AbstractDescriptorTestCase { private ReferenceDescriptor m_reference; private EntryDescriptor[] m_entries; public ServiceTestCase( String name ) { super( name ); } protected Descriptor getDescriptor() { return new Service(m_reference, m_entries, getProperties()); } public void setUp() { m_reference = new ReferenceDescriptor(ServiceTestCase.class.getName(), Version.getVersion("1.2.3")); m_entries = new EntryDescriptor[] { new EntryDescriptor("key", String.class.getName()) }; } public void testConstructor() { try { new Service(null); fail("Did not throw the expected NullPointerException"); } catch(NullPointerException npe) { // Sucess! } } protected void checkDescriptor(Descriptor desc) { super.checkDescriptor(desc); Service service = (Service)desc; assertEquals( m_reference, service.getReference()); assertEquals( m_reference.getClassname(), service.getClassname()); assertEquals( m_reference.getVersion(), service.getVersion()); assertEquals( m_entries.length, service.getEntries().length ); assertTrue( service.matches(m_reference)); EntryDescriptor[] serviceEntries = service.getEntries(); for (int i = 0; i < m_entries.length; i++) { assertEquals( m_entries[i], serviceEntries[i]); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org For additional commands, e-mail: cvs-help@avalon.apache.org