org.apache.commons.jci
Class ReloadingClassLoaderRemoveTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.commons.jci.ReloadingClassLoaderRemoveTestCase
All Implemented Interfaces:
junit.framework.Test

public class ReloadingClassLoaderRemoveTestCase
extends junit.framework.TestCase

Test ReloadingClassLoader's removeResourceStore(ResourceStore) method.


Constructor Summary
ReloadingClassLoaderRemoveTestCase()
           
 
Method Summary
protected  void setUp()
           
protected  void tearDown()
           
 void testLoadClassAfterResourceStoreRemoved()
          Test that a class can't be loaded after the ResourceStore containing it has been removed.
 void testRemoveStoreNotFoundClassLoaderHasStores()
          Test trying to remove a ResourceStore from the ReloadingClassLoader which can't be found - when the ClassLoader DOES contain other ResourceStore.
 void testRemoveStoreNotFoundClassLoaderNoStores()
          Test trying to remove a ResourceStore from the ReloadingClassLoader which can't be found - when the ClassLoader contains NO other ResourceStore.
 void testRemoveStoresFour()
          Test trying to remove the fourth ResourceStore added Bug: ReloadingClassLoader addes ResourceStore at the start of the array.
 void testRemoveStoresOne()
          Test trying to remove the first ResourceStore added Bug: ReloadingClassLoader addes ResourceStore at the start of the array.
 void testRemoveStoresThree()
          Test trying to remove the third ResourceStore added Bug: In this scenario the two System.arraycopy() statements don't copy the correct ResourceStore - it creates a new array where the first resource store is null and copies store3 and store2 to their same positions
 void testRemoveStoresTwo()
          Test trying to remove the second ResourceStore added Bug: ReloadingClassLoader addes ResourceStore at the start of the array.
 
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReloadingClassLoaderRemoveTestCase

public ReloadingClassLoaderRemoveTestCase()
                                   throws Exception
Throws:
Exception
Method Detail

setUp

protected void setUp()
              throws Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception

tearDown

protected void tearDown()
                 throws Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
Exception

testRemoveStoreNotFoundClassLoaderNoStores

public void testRemoveStoreNotFoundClassLoaderNoStores()
Test trying to remove a ResourceStore from the ReloadingClassLoader which can't be found - when the ClassLoader contains NO other ResourceStore. Bug: The While loop in the removeResourceStore() throws an ArrayOutOfBoundsException


testRemoveStoreNotFoundClassLoaderHasStores

public void testRemoveStoreNotFoundClassLoaderHasStores()
Test trying to remove a ResourceStore from the ReloadingClassLoader which can't be found - when the ClassLoader DOES contain other ResourceStore. Bug: The While loop in the removeResourceStore() throws an ArrayOutOfBoundsException


testRemoveStoresOne

public void testRemoveStoresOne()
Test trying to remove the first ResourceStore added Bug: ReloadingClassLoader addes ResourceStore at the start of the array. Removing the first one added (last in array) causes the second System.arraycopy() statement to throw a ArrayIndexOutOfBoundsException because the destination array position in the new smaller array is too large.


testRemoveStoresTwo

public void testRemoveStoresTwo()
Test trying to remove the second ResourceStore added Bug: ReloadingClassLoader addes ResourceStore at the start of the array. Removing the first one added (last in array) causes the second System.arraycopy() statement to throw a ArrayIndexOutOfBoundsException (??not sure why??)


testRemoveStoresThree

public void testRemoveStoresThree()
Test trying to remove the third ResourceStore added Bug: In this scenario the two System.arraycopy() statements don't copy the correct ResourceStore - it creates a new array where the first resource store is null and copies store3 and store2 to their same positions


testRemoveStoresFour

public void testRemoveStoresFour()
Test trying to remove the fourth ResourceStore added Bug: ReloadingClassLoader addes ResourceStore at the start of the array. Removing the last one added (first in array) causes the first System.arraycopy() statement to throw a ArrayIndexOutOfBoundsException because the length to copy is -1


testLoadClassAfterResourceStoreRemoved

public void testLoadClassAfterResourceStoreRemoved()
Test that a class can't be loaded after the ResourceStore containing it has been removed. Bug: When theres a single ResourceStore in the ClassLoader and its removed a new "delegate" ClassLoader with the new ResourceStore array isn't being created - which means that calling loadClass() still returns the classes from the removed ResourceStore rather than throwing a ClassNotFoundException



Copyright © 2004–2013 The Apache Software Foundation. All rights reserved.