Package org.jboss.cache

Examples of org.jboss.cache.Fqn


   }

   public void testNotifyNodeMoved()
   {
      assert allEventsListener.nodeMovedEvent == null;
      Fqn second = Fqn.fromString("/a/s/f");
      notifier.notifyNodeMoved(fqn, second, true, ctx);
      assert allEventsListener.nodeMovedEvent != null;
      assert allEventsListener.nodeMovedEvent.getFqn().equals(fqn);
      assert allEventsListener.nodeMovedEvent.getTargetFqn().equals(second);
      assert allEventsListener.nodeMovedEvent.getType() == Event.Type.NODE_MOVED;


            {Fqn.fromString("/a/b/c/d///"), true},
            {Fqn.fromString("/a/b/c/:/e"), false},};

      for (Object[] aData : data)
      {
         Fqn fqn = (Fqn) aData[0];
         boolean expected = (Boolean) aData[1];
         assertEquals(fqn.toString(), expected, fcl.isCharacterPortableTree(fqn));
      }
   }

      Object custom1 = clazz.newInstance();

      clazz = cl2.loadFoo();
      Object custom2 = clazz.newInstance();

      Fqn base = Fqn.fromString("/aop");
      Fqn fqn = Fqn.fromRelativeElements(base, custom1);
      replListener2.expect(PutKeyValueCommand.class);
      cache1.put(fqn, "key", "value");
      replListener2.waitForReplicationToOccur();

      Fqn fqn2 = Fqn.fromRelativeElements(base, custom2);
      Object val = cache2.get(fqn2, "key");
      assertEquals("value", val);
   }

      c2 = null;
   }

   public void testUseOfInvalidRegion()
   {
      Fqn fqn = Fqn.fromString("/a/b/c/d");
      c1.getRegion(fqn.getParent(), true).registerContextClassLoader(getClass().getClassLoader());
      c2.getRegion(fqn.getParent(), true).registerContextClassLoader(getClass().getClassLoader());

      replListener2.expect(PutKeyValueCommand.class);
      // write something; will cause a stale region to be stored in C2's cache marshaller
      c1.put(fqn, "k", "v");
      assert c1.get(fqn, "k").equals("v");

      replListener2.waitForReplicationToOccur(250);

      // assert that this made it to c2
      assert c2.get(fqn, "k").equals("v");

      // c2's cache marshaller's thread local would be polluted now.

      // restart c1 so that it forces a state transfer from c2
      c1.destroy();
      c1.create();
      Region r = c1.getRegion(fqn.getParent(), true);
      r.registerContextClassLoader(getClass().getClassLoader());
      r.deactivate();
      c1.start();

      TestingUtil.blockUntilViewsReceived(60000, c1, c2);

      r = null;
   }

   public void testGetAllMarshallingRegions()
   {
      Fqn fqn1 = Fqn.fromString("/a/b/c");
      Fqn fqn2 = Fqn.fromString("/a/b");
      Fqn fqn3 = Fqn.fromString("/aop");

      List<Region> expected = new ArrayList<Region>(4);

      Region region = r.getRegion(DEFAULT_REGION, true);
      region.registerContextClassLoader(getClass().getClassLoader());

      assertFalse("Should not be expecting any more regions", expectedRegions.hasNext());
   }

   public void testNoDefaultRegion()
   {
      Fqn fqn1 = Fqn.fromString("/a/b/c");
      Fqn fqn2 = Fqn.fromString("/a/b/");

      r.getRegion(fqn1, true);
      r.getRegion(fqn2, true);

      Region region = null;

      return cache;
   }

   public void testTransferToInactiveRegion()
   {
      Fqn f = Fqn.fromString("/a/b");

      caches.get(0).put(f, "k", "v");

      assertEquals("v", caches.get(0).get(f, "k"));
      assertEquals("v", caches.get(1).get(f, "k"));

      configureCache(
            "cache.async.put=false\n" +
                  "cache.async.pollWait=10000\n" +
                  "", true);
      CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
      Fqn fqn = Fqn.fromString("/a/b/c/d");
      HashMap<Object, Object> map = new HashMap<Object, Object>();
      map.put("c", "d");
      // Three kinds of puts!
      Modification mod = new Modification(Modification.ModificationType.PUT_KEY_VALUE, fqn, "e", "f");
      loader.put(fqn, map);

      configureCache(
            "cache.async.queueSize=1\n" +
                  "cache.async.pollWait=10\n" +
                  "", true);
      CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
      Fqn fqn = Fqn.fromString("/bound");
      loader.remove(fqn);
      // You can't really see it block though :-/
      for (int i = 0; i < 50; i++)
      {
         cache.put(fqn, "key" + i, "value1");

   }

   public void testStoreState() throws Exception
   {
      configureCache("", false);
      Fqn X = Fqn.fromString("/x");
      CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
      loader.remove(X);
      cache.put(X, "key1", "value1");
      ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
      MarshalledValueOutputStream os = new MarshalledValueOutputStream(baos);

TOP

Related Classes of org.jboss.cache.Fqn

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.