ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Maves <nathan.ma...@gmail.com>
Subject Re: SoftCacheTest is Failing
Date Wed, 23 Dec 2009 23:21:53 GMT
Dan,

What release did you check out?  What does your env look like?  OS?
Java version?

I have not seen a test failing in any of the beta builds.

Nathan

On Wed, Dec 23, 2009 at 11:30 AM, Dan Forward
<dan-nabble@forwardhome.com> wrote:
>
> I just checked out the latest code for iBATIS 3 and discovered that a unit
> test fails while building.
>
> ------------------------------------------------------------
> Tests run: 4, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 5.006 sec
> <<< FAILURE!
> shouldDemonstrateObjectsBeingCollectedAsNeeded(org.apache.ibatis.cache.SoftCacheTest)
> Time elapsed: 4.96 sec  <<< FAILURE!
> java.lang.AssertionError:
>        at org.junit.Assert.fail(Assert.java:71)
>        at org.junit.Assert.assertTrue(Assert.java:34)
>        at org.junit.Assert.assertTrue(Assert.java:43)
>        at
> org.apache.ibatis.cache.SoftCacheTest.shouldDemonstrateObjectsBeingCollectedAsNeeded(SoftCacheTest.java:21)
> ------------------------------------------------------------
>
> It seems that this test attempts to fill the cache beyond the limits of
> available memory, then checks whether the size of the cache is smaller than
> the number of items added. The cache is filled with 300,000 byte arrays that
> are 5001 bytes in size.
>
> I set the limit to 3,000,000 and told the loop to break as soon as the size
> of the cache was less than the number entered, and discovered that it
> happened after 326,315 entries and approximately 6 seconds on my machine.
> The test I used is below.
>
> @Test
> public void shouldDemonstrateObjectsBeingCollectedAsNeeded() throws
> Exception {
>        final int N = 3000000;
>        SoftCache cache = new SoftCache(new PerpetualCache("default"));
>        for (int i = 0; i < N; i++) {
>          byte[] array = new byte[5001]; //waste a bunch of memory
>          array[5000] = 1;
>          cache.putObject(i, array);
>          Object value = cache.getObject(i);
>          if (cache.getSize() < i + 1) {
>                  System.out.println("Cache exceeded with " + (i + 1) + " entries.");
>                  break;
>          }
>        }
>        assertTrue(cache.getSize() < N);
> }
>
> --
> View this message in context: http://old.nabble.com/SoftCacheTest-is-Failing-tp26905687p26905687.html
> Sent from the iBATIS - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: dev-help@ibatis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ibatis.apache.org
For additional commands, e-mail: dev-help@ibatis.apache.org


Mime
View raw message