6 Replies Latest reply on Apr 5, 2006 3:02 PM by Manik Surtani

    CacheStoreInterceptor -- how is putDataEraseMethodLocal hand

    Elias Ross Master


      The following test for a CacheLoader

       public void testPut3() throws CacheException {
       final String NODE="/a/b/c";
       final String KEY="key";
       cache.remove(NODE);
       addDelay();
       Map m = new HashMap();
       m.put("a", "b");
       m.put("c", "d");
       Map m2 = new HashMap();
       m2.put("e", "f");
       m2.put("g", "h");
       cache.put(NODE, m);
       assertEquals(m, cache.get(NODE).getData());
       cache.evict(Fqn.fromString(NODE));
       assertEquals(m, cache.get(NODE).getData());
       cache.evict(Fqn.fromString(NODE));
       cache.put(NODE, m2);
       assertEquals(m2, cache.get(NODE).getData());
       }


      Fails to run:
      expected:<{a=b, c=d}> but was:<{jboss:internal:uninitialized=null}>
      


      I went around and fixed CacheLoaderInterceptor to do the right thing (no, I don't think it was my own regression...) However, it then was giving me this:

      junit.framework.AssertionFailedError: expected:<{g=h, e=f}> but was:<{a=b, c=d, g=h, e=f}>
       at org.jboss.cache.loader.CacheLoaderTestsBase.testPut3(CacheLoaderTestsBase.java:154)
      


      It appears to be an issue with how putDataEraseMethodLocal is treated exactly the same as putDataMethodLocal. Basically, the old values are not replaced. The "easy" fix is to do "convertMethodCallToModification" and apply the changes as a modification list.

      Anyway, I'm opening another issue on this, and should have a patch in a bit.