Examples of Fqn


Examples of org.jboss.cache.Fqn

   @SuppressWarnings("unchecked")
   public void testNodeConvenienceNodeRemoval()
   {
      Cache<Object, Object>[] caches = cachesTL.get();
      // this fqn is relative, but since it is from the root it may as well be absolute
      Fqn fqn = Fqn.fromString("/test/fqn");
      caches[0].getRoot().addChild(fqn);
      assertTrue(caches[0].getRoot().hasChild(fqn));
      assertTrue(caches[1].getRoot().hasChild(fqn));

      assertEquals(true, caches[0].removeNode(fqn));
      assertFalse(caches[0].getRoot().hasChild(fqn));
      assertFalse(caches[1].getRoot().hasChild(fqn));
      assertEquals(false, caches[0].removeNode(fqn));

      // Confirm it works as expected if the removed node has a child
      Fqn child = Fqn.fromString("/test/fqn/child");
      caches[0].getRoot().addChild(child);
      assertTrue(caches[0].getRoot().hasChild(child));
      assertTrue(caches[1].getRoot().hasChild(child));

      assertEquals(true, caches[0].removeNode(fqn));

Examples of org.jboss.cache.Fqn

      // modify a node - this will trigger NodeModified and NodeModify(pre/post)
      cache.put("Europe/Albania", POPULATION, 3563112);

      // retrieve an attribute - this will trigger NodeVisited
      Fqn key = Fqn.fromString("Europe/Albania");
      assertNotNull("Retrieval error: expected to retrieve " + CURRENCY + " for " + key, cache.get(key, CURRENCY));

      // evict the node - this will trigger NodePassivate, NodeEvicted and NodeEvict(pre/post)
      cache.evict(key);

Examples of org.jboss.cache.Fqn

//      CacheSPI<Object, Object> cache1 = createSyncReplicatedCache();
//      CacheSPI<Object, Object> cache2 = createSyncReplicatedCache();

      TransactionManager tm1 = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();

      Fqn fqn = Fqn.fromString("/test/node");
      String KEY = "key";
      String VALUE1 = "value1";

      tm1.begin();
      cache1.put(fqn, KEY, VALUE1);

Examples of org.jboss.cache.Fqn

   public NodeSPI addChildDirect(Fqn childName)
   {
      if (childName.size() == 0) return this;
      Object directChildName = childName.get(0);
      NodeSpiMock directChild = children.get(directChildName);
      Fqn subFqn = childName.getSubFqn(1, childName.size());
      if (directChild == null)
      {
         directChild = newChild(directChildName);
      }
      return directChild.addChildDirect(subFqn);

Examples of org.jboss.cache.Fqn

      @NodePassivated
      public void nodePassivated(NodeEvent e)
      {
         if (!e.isPre())
            return; // we are not interested in postPassivate event
         Fqn fqn = e.getFqn();
         if (!fqn.isChildOrEquals(BASE))
            return; // don't care about fqn that doesn't belong to me.

         try
         {
            Object bean = cache.get(fqn, "bean");

Examples of org.jboss.cache.Fqn

   {
      MockNodesFixture nodes = new MockNodesFixture();
      expect(spiMock.getNode(fqn)).andReturn(null);
      expect(containerMock.peek(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN)).andReturn(nodes.abNode);

      Fqn firstSearch = Fqn.fromString(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN + "/c/dummy");
      expect(spiMock.getNode(firstSearch)).andReturn(nodes.abcNode);

      ArrayList listReference = new ArrayList();
      expect(containerMock.buildNodeData(Collections.EMPTY_LIST, nodes.abcNode, false)).andReturn(listReference);

Examples of org.jboss.cache.Fqn

      MockNodesFixture nodes = new MockNodesFixture();
      expect(spiMock.getNode(fqn)).andReturn(null);
      expect(containerMock.peek(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN)).andReturn(nodes.adfNode);

      control.checkOrder(false);
      Fqn firstSearch = Fqn.fromString(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN + "/g/dummy");
      expect(spiMock.getNode(firstSearch)).andReturn(null);
      Fqn secondSearch = Fqn.fromString(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN + "/h/dummy");
      expect(spiMock.getNode(secondSearch)).andReturn(null);
      control.checkOrder(true);

      control.replay();
      assert GravitateResult.noDataFound().equals(command.perform(ctx));

Examples of org.jboss.cache.Fqn

      }
   }

   public void testLockReentrancy() throws InterruptedException
   {
      Fqn fqn = Fqn.fromString("/a/b/c");
      NodeSPI node = new NodeInvocationDelegate(new UnversionedNode(fqn));

      assert lm.lock(fqn, WRITE, null);
      assert lm.isLocked(node);

Examples of org.jboss.cache.Fqn

      final CountDownLatch secondCanRead = new CountDownLatch(1);
      final CountDownLatch secondDone = new CountDownLatch(1);
      final CountDownLatch firstCanRollback = new CountDownLatch(1);
      final CountDownLatch firstDone = new CountDownLatch(1);

      final Fqn PARENT = Fqn.fromString("/a");

      // start a first thread and a transaction

      Thread firstThread = new Thread(new Runnable()
      {
         public void run()
         {
            try
            {
               TransactionManager tm = startTransaction();

               // Create an empty parent node and a node with data
               Fqn a1 = Fqn.fromRelativeElements(PARENT, "1");
               cache.put(a1, KEY, VALUE);

               // notify the second thread it can write
               secondCanWrite.countDown();

               // wait until the second thread writes and allows me to rollback or until I timeout
               firstCanRollback.await(3000, TimeUnit.MILLISECONDS);

               tm.rollback();

               assertNull("a1 empty", cache.get(a1, KEY));

               // notify the reading thread
               secondCanRead.countDown();
            }
            catch (AssertionError e)
            {
               writerError = e;
            }
            catch (Throwable t)
            {
               t.printStackTrace();
               writerFailed = true;
            }
            finally
            {
               secondCanWrite.countDown();
               secondCanRead.countDown();
               firstDone.countDown();
            }
         }
      }, "FIRST");
      firstThread.start();

      // start a second thread; no transaction is necessary here

      Thread secondThread = new Thread(new Runnable()
      {
         public void run()
         {
            try
            {
               // wait until the first thread has created PARENT and a child
               secondCanWrite.await();

               // create a second child under parent
               Fqn a2 = Fqn.fromRelativeElements(PARENT, "2");
               try
               {
                  cache.put(a2, KEY, VALUE);
               }
               catch (TimeoutException good)

Examples of org.jboss.cache.Fqn

      byte magic = ois.readByte();
      short ref = ois.readShort();
      assert magic == CacheMarshaller200.MAGICNUMBER_FQN;

      // now the chunks of an Fqn
      Fqn f = cm200.unmarshallFqn(ois, new UnmarshalledReferences());

      assert f.equals(Fqn.fromString("/hello"));
   }
TOP
Copyright © 2018 www.massapi.com. 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.