Package org.xmlBlaster.client.key

Examples of org.xmlBlaster.client.key.GetKey


         doPublish(3, oid);
         assertEquals("wrong number of updates received", 3, this.updateInterceptor.waitOnUpdate(500L));
         this.updateInterceptor.clear();

         String getOid = "__cmd:client/" + this.sessionName + "/?dispatcherActive=one,two,three";
         MsgUnit[] msg = this.glob.getXmlBlasterAccess().get(new GetKey(this.glob, getOid), new GetQos(this.glob));
         assertEquals("wrong number of messages returned", 1, msg.length);
         for (int i=0; i < msg.length; i++) {
            log.info("testActivationFlag: dispatcherActive: (" + i + ") : '" + msg[i].getContentStr() + "'");
            assertEquals("wrong return value", "true", msg[i].getContentStr());
         }
     
         getOid = "__cmd:client/" + this.sessionName + "/?dispatcherActive=false";
         doPublish(-1, getOid);

         getOid = "__cmd:client/" + this.sessionName + "/?dispatcherActive";
         msg = this.glob.getXmlBlasterAccess().get(new GetKey(this.glob, getOid), new GetQos(this.glob));
         assertEquals("wrong number of messages returned", 1, msg.length);
         for (int i=0; i < msg.length; i++) {
            log.info("testActivationFlag: dispatcherActive (result): (" + i + ") : '" + msg[i].getContentStr() + "'");
            assertEquals("wrong return value", "false", msg[i].getContentStr());
         }

         doPublish(4, oid);
         doPublish(5, oid);
         int numArrived = this.updateInterceptor.waitOnUpdate(2000L);
         assertEquals("wrong number of messages arrived", 0, numArrived);
                 
         getOid = "__cmd:client/" + this.sessionName + "/?dispatcherActive=true";
         doPublish(-1, getOid);

         getOid = "__cmd:client/" + this.sessionName + "/?dispatcherActive";
         msg = this.glob.getXmlBlasterAccess().get(new GetKey(this.glob, getOid), new GetQos(this.glob));
         assertEquals("wrong number of messages returned", 1, msg.length);
         for (int i=0; i < msg.length; i++) {
            log.info("testActivationFlag: dispatcherActive (result): (" + i + ") : '" + msg[i].getContentStr() + "'");
            assertEquals("wrong return value", "true", msg[i].getContentStr());
         }
View Full Code Here


         // getQos.setHistoryQos(historyQos);
         QuerySpecQos querySpecQos = new QuerySpecQos(this.glob, "QueueQuery", "1.0", "maxEntries=3&maxSize=-1&consumable=false&waitingDelay=0");
         getQos.addQuerySpec(querySpecQos);

         getOid = "__cmd:client/" + this.sessionName + "/?cbQueueEntries";
         MsgUnit[] mu = this.glob.getXmlBlasterAccess().get(new GetKey(this.glob, getOid), getQos);
         assertEquals("wrong number of retreived entries", 3, mu.length);
        
      }
      catch (XmlBlasterException ex) {
         ex.printStackTrace();
View Full Code Here

      // inhibit delivery of subscribed messages ...
      String getOid = "__cmd:client/" + this.sessionName + "/?dispatcherActive=" + doDispatch;
      doPublish(-1, getOid);
      // query with a given GetQos ...        
      getOid = "__cmd:client/" + this.sessionName + "/?dispatcherActive";
      MsgUnit[] msg = this.glob.getXmlBlasterAccess().get(new GetKey(this.glob, getOid), new GetQos(this.glob));
      assertEquals("wrong number of messages returned", 1, msg.length);
      assertEquals("wrong return value", "" + doDispatch, msg[0].getContentStr());
   }
View Full Code Here

         // query with a given GetQos ...        
         GetQos getQos = new GetQos(this.glob);
         QuerySpecQos querySpecQos = new QuerySpecQos(this.glob, "QueueQuery", "1.0", "maxEntries=" + maxEntries + "&maxSize=-1&consumable=" + consumable + "&waitingDelay=" + waitingDelay);
         getQos.addQuerySpec(querySpecQos);
         String getOid = "__cmd:client/" + this.sessionName + "/?cbQueueEntries";
         MsgUnit[] mu = this.glob.getXmlBlasterAccess().get(new GetKey(this.glob, getOid), getQos);
         assertEquals("an exception occured when it should not", false, pubThread.hasException());
         assertEquals("wrong number of retreived entries", entriesExpected, mu.length);

         assertEquals("messages should not arrive here", 0, this.updateInterceptor.count());
         doActivateDispatch(true);
View Full Code Here

            assertEquals("wrong message sequence (number of entries arrived: " + msg.length + ") ", i+(int)exLimit, msg[i].getContentInt());
         }
      }
      if ((long)msg.length != exLimit*2) {
         try {
            GetKey getKey = new GetKey(this.glob, "__cmd?dump");
            GetQos getQos = new GetQos(this.glob);
            MsgUnit[] tmp = this.glob.getXmlBlasterAccess().get(getKey, getQos);
            if (tmp.length > 0)
               log.info(tmp[0].getContentStr());
         }
View Full Code Here

         PublishQos pq = new PublishQos(glob);
         MsgUnit msgUnit = new MsgUnit(pk, "<news type='sport'/>".getBytes(), pq);
         con.publish(msgUnit);


         GetKey gk = new GetKey(glob, "HelloWorldMime");
         GetQos gq = new GetQos(glob);
         gq.addAccessFilter(new AccessFilterQos(glob, "XPathFilter", "1.0", "/news[@type='sport']"));
         MsgUnit[] msgs = con.get(gk, gq);

         log.info("Accessed xmlBlaster message synchronous with get() with content '" + new String(msgs[0].getContent()) + "'");
View Full Code Here

         // TODO cache the queryKey here
         GetQos getQos = new GetQos(this.global);
         QuerySpecQos querySpecQos = new QuerySpecQos(this.global, "QueueQuery", "1.0", "maxEntries=1&maxSize=-1&consumable=true&waitingDelay=" + delay + "&subscriptionId=" + this.subscribeReturnQos.getSubscriptionId());
         getQos.addQuerySpec(querySpecQos);
         String getOid = "__cmd:" + this.session.sessionName + "/?callbackQueueEntries";
         MsgUnit[] mu = this.global.getXmlBlasterAccess().get(new GetKey(this.global, getOid), getQos);
         if (mu == null || mu.length < 1 || mu[0] == null) return null;
         String sender = mu[0].getQosData().getSender().getAbsoluteName();
         return MessageHelper.convertFromMsgUnit(this.session, sender, mu[0]);
      }
      catch (XmlBlasterException ex) {
View Full Code Here

      catch (Exception e) {
         log.severe(e.toString());
         e.printStackTrace();
      }

      GetKey xmlKeyWr = new GetKey(glob, xmlKey, queryType);
      GetQos xmlQos = new GetQos(glob);
      MsgUnit[] msgs = xmlBlasterConnection.get(xmlKeyWr.toXml(), xmlQos.toXml());
      log.info("Got " + msgs.length + " messages for '" + xmlKey + "'");
      for (int ii=0; ii<msgs.length; ii++) {
         System.out.println("\n" + msgs[ii].toXml());
      }
View Full Code Here

   /**
    * @see I_XmlBlasterAccess#refreshSession()
    */
   public void refreshSession() throws XmlBlasterException {
      GetKey gk = new GetKey(glob, "__refresh");
      GetQos gq = new GetQos(glob);
      get(gk, gq);
   }
View Full Code Here

   /**
    * @see I_XmlBlasterAccess#get(GetKey, GetQos)
    */
   public MsgUnit[] get(java.lang.String xmlKey, java.lang.String qos) throws XmlBlasterException {
      return get(new GetKey(glob, glob.getQueryKeyFactory().readObject(xmlKey)),
                 new GetQos(glob, glob.getQueryQosFactory().readObject(qos)) );
   }
View Full Code Here

TOP

Related Classes of org.xmlBlaster.client.key.GetKey

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.