You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hivemind.apache.org by hl...@apache.org on 2004/05/21 20:46:20 UTC

cvs commit: jakarta-hivemind/framework/src/test/hivemind/test LocatableFixture.java TestHiveMindFindLocation.java FrameworkTestCase.java

hlship      2004/05/21 11:46:20

  Modified:    framework/src/test/hivemind/test
                        TestHiveMindFindLocation.java
                        FrameworkTestCase.java
  Added:       framework/src/test/hivemind/test LocatableFixture.java
  Log:
  Tweak the unit tests to work around current directory issues caused by building under Ant.
  
  Revision  Changes    Path
  1.6       +4 -19     jakarta-hivemind/framework/src/test/hivemind/test/TestHiveMindFindLocation.java
  
  Index: TestHiveMindFindLocation.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/TestHiveMindFindLocation.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestHiveMindFindLocation.java	28 Feb 2004 00:34:37 -0000	1.5
  +++ TestHiveMindFindLocation.java	21 May 2004 18:46:20 -0000	1.6
  @@ -28,21 +28,6 @@
    */
   public class TestHiveMindFindLocation extends FrameworkTestCase
   {
  -    private static class TestLocatable implements Locatable
  -    {
  -        private Location _l;
  -
  -        TestLocatable(Location l)
  -        {
  -            _l = l;
  -        }
  -
  -        public Location getLocation()
  -        {
  -            return _l;
  -        }
  -    }
  -
       public void testEmpty()
       {
           assertNull(HiveMind.findLocation(new Object[] {
  @@ -65,7 +50,7 @@
       public void testLocatable()
       {
           Location l1 = new LocationImpl(null);
  -        Locatable l2 = new TestLocatable(l1);
  +        Locatable l2 = new LocatableFixture(l1);
   
           assertSame(l1, HiveMind.findLocation(new Object[] { l2 }));
       }
  @@ -73,8 +58,8 @@
       public void testNullLocatable()
       {
           Location l1 = new LocationImpl(null);
  -        Locatable l2 = new TestLocatable(null);
  -        Locatable l3 = new TestLocatable(l1);
  +        Locatable l2 = new LocatableFixture(null);
  +        Locatable l3 = new LocatableFixture(l1);
   
           assertSame(l1, HiveMind.findLocation(new Object[] { l2, l3 }));
       }
  
  
  
  1.6       +9 -12     jakarta-hivemind/framework/src/test/hivemind/test/FrameworkTestCase.java
  
  Index: FrameworkTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/FrameworkTestCase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FrameworkTestCase.java	26 Feb 2004 23:08:01 -0000	1.5
  +++ FrameworkTestCase.java	21 May 2004 18:46:20 -0000	1.6
  @@ -32,27 +32,24 @@
   {
       protected ClassResolver _resolver = new DefaultClassResolver();
   
  -    private static final boolean UNIT_TEST_FROM_IDE = Boolean.getBoolean("unit-test-from-ide");
  +    private static final String FRAMEWORK_ROOT = System.getProperty("FRAMEWORK_ROOT", "./");
   
       protected String getFrameworkPath(String path)
       {
  -        if (UNIT_TEST_FROM_IDE)
  -            return "framework/" + path;
  -
  -        return path;
  +        return FRAMEWORK_ROOT + path;
       }
   
       protected ModuleDescriptor parse(String file) throws Exception
       {
           Resource location = getResource(file);
   
  -		RegistryAssemblyImpl assembly = new RegistryAssemblyImpl();
  -		DescriptorParser p = new DescriptorParser(assembly);
  -		
  -        ModuleDescriptor result =  p.parse(location, _resolver);
  -        
  +        RegistryAssemblyImpl assembly = new RegistryAssemblyImpl();
  +        DescriptorParser p = new DescriptorParser(assembly);
  +
  +        ModuleDescriptor result = p.parse(location, _resolver);
  +
           assembly.performPostProcessing();
  -        
  +
           return result;
       }
   
  
  
  
  1.1                  jakarta-hivemind/framework/src/test/hivemind/test/LocatableFixture.java
  
  Index: LocatableFixture.java
  ===================================================================
  // Copyright 2004 The Apache Software Foundation
  //
  // Licensed 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.
  
  package hivemind.test;
  
  import org.apache.hivemind.Locatable;
  import org.apache.hivemind.Location;
  
  /**
   * Used with {@link hivemind.test.TestHiveMindFindLocation}.
   *
   * @author Howard Lewis Ship
   * @version $Id: LocatableFixture.java,v 1.1 2004/05/21 18:46:20 hlship Exp $
   */
  public class LocatableFixture implements Locatable
  {
      private Location _l;
  
      LocatableFixture(Location l)
      {
          _l = l;
      }
  
      public Location getLocation()
      {
          return _l;
      }
  }
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-cvs-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-cvs-help@jakarta.apache.org