Package org.xmlBlaster.client.key

Examples of org.xmlBlaster.client.key.PublishKey


            ConnectQos qos = new ConnectQos(con.getGlobal(), name, passwd);
            con.connect(qos, this)// Login to xmlBlaster, register for updates


            PublishKey pk = new PublishKey(con.getGlobal(), "AllProtocols", "text/xml", "1.0");
            pk.setClientTags("<org.xmlBlaster><demo/></org.xmlBlaster>");
            PublishQos pq = new PublishQos(con.getGlobal());
            MsgUnit msgUnit = new MsgUnit(pk, "Hi", pq);
            con.publish(msgUnit);

View Full Code Here


   private void doPublish(byte[] content, int maxChunkSize, boolean doInterrupt, String name) throws XmlBlasterException {
      log.info("Publishing for '" + name + "'");
      // Global glob = this.global.getClone(null);
      Global glob = this.connGlobal;
      I_XmlBlasterAccess conn = glob.getXmlBlasterAccess();
      PublishKey key = new PublishKey(glob, this.oid);
      PublishQos qos = new PublishQos(glob);
      qos.setPersistent(true);
      if (doInterrupt)
         qos.addClientProperty("interrupted", true);
      qos.addClientProperty("nameOfTest", name);
      qos.addClientProperty(Constants.addJmsPrefix(XBConnectionMetaData.JMSX_MAX_CHUNK_SIZE, log), maxChunkSize);
      ByteArrayInputStream bais = new ByteArrayInputStream(content);
      conn.publishStream(bais, key.getData(), qos.getData(), maxChunkSize, null);
   }
View Full Code Here

   public void testNormalMessage() {
      int maxChunkSize = 500;
      byte[] content = createRandomContent(maxChunkSize);
      try {
         this.updateInterceptor.clear();
         this.connGlobal.getXmlBlasterAccess().publish(new MsgUnit(new PublishKey(this.connGlobal, this.oid), content, new PublishQos(this.connGlobal)));
         int ret = this.updateInterceptor.waitOnUpdate(this.delay, 1);
         assertEquals("wrong number of updates when testing testSingleChunk", 1, ret);
         Msg[] msgs = this.updateInterceptor.getMsgs();
         assertEquals("wrong number of msg entries when testing testSingleChunk", 1, msgs.length);
         assertEquals("Wrong size of returned buffer", content.length, msgs[0].getContent().length);
View Full Code Here

          log.severe("setUp() - login failed: " + e.toString());
          e.printStackTrace();
          fail("setUp() - login failed: " + e.toString());
      }

      publishKeyWrapper = new PublishKey(glob, "emptyOid", contentMime);
      publishKeyWrapper.setClientTags("<TestFailSafeAsync-AGENT id='192.168.124.10' subId='1' type='generic'/>");
      /*
         String xmlKey = "<key oid='" + oid + "' contentMime='" + contentMime + "'>\n" +
                         "   <TestFailSafeAsync-AGENT id='192.168.124.10' subId='1' type='generic'>" +
                         "   </TestFailSafeAsync-AGENT>" +
View Full Code Here

    */
   public PublishReturnQos publishMsg(String publishOid, String content) {
      log.info("Sending a message '" + content + "'");
      try {
         // Publish a volatile message
         PublishKey pk = new PublishKey(glob, publishOid, "text/xml", "1.0");
         PublishQos pq = new PublishQos(glob);
         MsgUnit msgUnit = new MsgUnit(pk, content, pq);
         PublishReturnQos publishReturnQos = con.publish(msgUnit);
         assertEquals("Retunred oid is invalid", publishOid, publishReturnQos.getKeyOid());
         log.info("Sending of '" + content + "' done, returned oid=" + publishOid + " " + msgUnit.toXml());
View Full Code Here

   public void testPublish()
   {
      log.info("Publishing a message ...");
      numReceived = 0;

      PublishKey key = new PublishKey(glob, "", contentMime, contentMimeExtended);
      key.setClientTags("<location dest='agent-192.168.10.218' driver='PSD1'></location>");
      PublishQos qos = new PublishQos(glob);
      senderContent = "some content";
      try {
         MsgUnit msgUnit = new MsgUnit(key.toXml(), senderContent.getBytes(), qos.toXml());
         sentTimestamp = new Timestamp();
         publishOid = con.publish(msgUnit).getKeyOid();
         log.info("Success: Publishing done, returned oid=" + publishOid);
      } catch(XmlBlasterException e) {
         log.warning("XmlBlasterException: " + e.getMessage());
View Full Code Here

         ConnectQos connQos = new ConnectQos(glob, "clientProperty", passwd);
         if (log.isLoggable(Level.FINE)) log.fine("the connect qos is: " + connQos.toXml());
         senderConnection.connect(connQos, this); // Login to xmlBlaster

         // publish
         PublishKey key = new PublishKey(this.glob, "clientProp");
         PublishQos qos = new PublishQos(this.glob);
         qos.addClientProperty("oneKey", "oneValue");
         qos.addClientProperty("twoKey", "twoValue");
         qos.addClientProperty("threeKey", new Integer(55));
         MsgUnit msg = new MsgUnit(key, "message".getBytes(), qos);
View Full Code Here

      numReceived = 0;
      try {
         PublishQos publishQos = new PublishQos(glob);
         msgUnit = new MsgUnit(msgUnit, null, null, publishQos.getData());
         if (ptp) {
            PublishKey pk = new PublishKey(glob);
            PublishQos pq = new PublishQos(glob);
            pq.addDestination(new Destination(new SessionName(glob, secondName)));
            msgUnit = new MsgUnit(msgUnit, pk.getData(), null, pq.getData());
         }
         publishOid = callbackConnection.publish(msgUnit).getKeyOid();
         log.info("Success: Publish " + msgUnit.getKey() + " done");
         if (!ptp)
            assertEquals("oid is different", firstOid, publishOid);
View Full Code Here

         }

         // First test subscribe ...
         {
            System.err.println("->Publish to avalon ...");
            PublishKey avalon_pk = new PublishKey(glob, oid, "text/plain", "1.0", domain);
            PublishQos avalon_pq = new PublishQos(glob);
            MsgUnit avalon_msgUnit = new MsgUnit(avalon_pk, contentStr, avalon_pq);
            PublishReturnQos avalon_prq = avalonCon.publish(avalon_msgUnit);
            assertEquals("oid changed", oid, avalon_prq.getKeyOid());


            try { Thread.sleep(2000); } catch( InterruptedException i) {}
            if (1 != updateCounterBilbo) log.severe("Did not expect " + updateCounterBilbo + " updates");
            assertEquals("message from avalon", 1, updateCounterBilbo);
            if (1 != updateCounterBilbo2) log.severe("Did not expect " + updateCounterBilbo2 + " updates");
            assertEquals("message from avalon #2", 1, updateCounterBilbo2);
            updateCounterBilbo = 0;
            updateCounterBilbo2 = 0;
         }

         System.err.println("->testSubscribeTwice done, SUCCESS.");

         // ... and now test unSubscribe
         {
            System.err.println("->UnSubscribe from bilbo ...");
            UnSubscribeKey usk = new UnSubscribeKey(glob, oid);
            usk.setDomain(domain);
            UnSubscribeQos usq = new UnSubscribeQos(glob);
            UnSubscribeReturnQos[] usrq = bilboCon.unSubscribe(usk, usq);
            assertEquals("", 1, usrq.length);

            System.err.println("->Publish to avalon ...");
            PublishKey avalon_pk = new PublishKey(glob, oid, "text/plain", "1.0", domain);
            PublishQos avalon_pq = new PublishQos(glob);
            MsgUnit avalon_msgUnit = new MsgUnit(avalon_pk, contentStr, avalon_pq);
            PublishReturnQos avalon_prq = avalonCon.publish(avalon_msgUnit);
            assertEquals("oid changed", oid, avalon_prq.getKeyOid());
View Full Code Here

                     return "";
                  }
               });

            System.err.println("->Publish to avalon #" + ii + " ...");
            PublishKey avalon_pk = new PublishKey(glob, oid, "text/plain", "1.0", domain);
            PublishQos avalon_pq = new PublishQos(glob);
            MsgUnit avalon_msgUnit = new MsgUnit(avalon_pk, contentStr, avalon_pq);
            PublishReturnQos avalon_prq = avalonCon.publish(avalon_msgUnit);
            assertEquals("oid changed", oid, avalon_prq.getKeyOid());
View Full Code Here

TOP

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

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.