Package org.xmlBlaster.util

Examples of org.xmlBlaster.util.Timestamp


                      "   </TestSub-AGENT>" +
                      "</key>";
      senderContent = "Yeahh, i'm the new content";
      try {
         MsgUnit msgUnit = new MsgUnit(xmlKey, senderContent.getBytes(), "<qos></qos>");
         sentTimestamp = new Timestamp();
         PublishReturnQos tmp = senderConnection.publish(msgUnit);
         assertEquals("Wrong publishOid", publishOid, tmp.getKeyOid());
         log.info("Success: Publishing done, returned oid=" + publishOid);
      } catch(XmlBlasterException e) {
         log.warning("XmlBlasterException: " + e.getMessage());
View Full Code Here


                      "   </TestSubNoInitial-AGENT>" +
                      "</key>";
      senderContent = "Yeahh, i'm the new content";
      try {
         MsgUnit msgUnit = new MsgUnit(xmlKey, senderContent.getBytes(), "<qos></qos>");
         sentTimestamp = new Timestamp();
         PublishReturnQos tmp = senderConnection.publish(msgUnit);
         assertEquals("Wrong publishOid", publishOid, tmp.getKeyOid());
         log.info("Success: Publishing done, returned oid=" + publishOid);
      } catch(XmlBlasterException e) {
         log.warning("XmlBlasterException: " + e.getMessage());
View Full Code Here

      ME = "MsgUnitWrapperTest.testSerialize()";
      System.out.println("***" + ME);

      try {
         PublishKey publishKey = new PublishKey(glob, "HA", "text/xy", "1.7");
         Timestamp timestamp = new Timestamp();
         String xml =
            "<qos>\n" +
            "   <destination queryType='EXACT' forceQueuing='true'>\n" +
            "      Tim\n" +
            "   </destination>\n" +
            "   <destination queryType='EXACT'>\n" +
            "      Ben\n" +
            "   </destination>\n" +
            "   <sender>\n" +
            "      Gesa\n" +
            "   </sender>\n" +
            "   <priority>7</priority>\n" +
            "   <expiration lifeTime='2400' remainingLife='12000'/>\n" +
            "   <rcvTimestamp nanos='" + timestamp.getTimestamp() + "'/>\n" + // if from persistent store
            "   <persistent/>\n" +
            "   <forceUpdate>false</forceUpdate>\n" +
            "   <route>\n" +
            "      <node id='bilbo' stratum='2' timestamp='9408630500' dirtyRead='true'/>\n" +
            "      <node id='frodo' stratum='1' timestamp='9408630538' dirtyRead='false'/>\n" +
            "      <node id='heron' stratum='0' timestamp='9408630564'/>\n" +
            "   </route>\n" +
            "   <topic readonly='true'/>\n" +
            "</qos>\n";

         PublishQosServer publishQosServer = new PublishQosServer(glob, xml, true); // true prevents new timestamp
         MsgUnit msgUnit = new MsgUnit(publishKey.getData(), "HO".getBytes(), publishQosServer.getData());
         StorageId storageId = new StorageId(glob, "mystore", "someid");
         MsgUnitWrapper msgUnitWrapper = new MsgUnitWrapper(glob, msgUnit, storageId);

         I_EntryFactory factory = glob.getEntryFactory(); // storageId.getStrippedId()

         /* MsgUnitWrapper.getOwnerCache() fails with this test as RequestBroker is unknown
         msgUnitWrapper.incrementReferenceCounter(4);
         assertEquals("", 4, msgUnitWrapper.getReferenceCounter());
         msgUnitWrapper.incrementReferenceCounter(-4);
         assertEquals("", 0, msgUnitWrapper.getReferenceCounter());
         */

         int priority = msgUnitWrapper.getPriority();
         long uniqueId = msgUnitWrapper.getUniqueId();
         String type = msgUnitWrapper.getEmbeddedType();
         boolean persistent = msgUnitWrapper.isPersistent();
         long sizeInBytes = msgUnitWrapper.getSizeInBytes();
         byte[] blob = factory.toBlob(msgUnitWrapper);

         MsgUnitWrapper newWrapper = (MsgUnitWrapper)factory.createEntry(priority,
                                        uniqueId, type, persistent, sizeInBytes, new ByteArrayInputStream(blob), storageId);
         assertEquals("", msgUnitWrapper.getPriority(), newWrapper.getPriority());
         assertEquals("", msgUnitWrapper.getReferenceCounter(), newWrapper.getReferenceCounter()); // A reference counter is reset to 0 when loaded from persistence
         assertEquals("", msgUnitWrapper.isExpired(), newWrapper.isExpired());
         assertEquals("", msgUnitWrapper.isPersistent(), newWrapper.isPersistent());
         assertEquals("", msgUnitWrapper.getMsgUnit().getContentStr(), newWrapper.getMsgUnit().getContentStr());
         assertEquals("", msgUnitWrapper.getKeyOid(), newWrapper.getKeyOid());
         assertEquals("", msgUnitWrapper.getContentMime(), newWrapper.getContentMime());
         assertEquals("", msgUnitWrapper.getContentMimeExtended(), newWrapper.getContentMimeExtended());
         assertEquals("", msgUnitWrapper.getDomain(), newWrapper.getDomain());
         assertEquals("", msgUnitWrapper.getSizeInBytes(), newWrapper.getSizeInBytes());
         assertEquals("", msgUnitWrapper.getUniqueId(), newWrapper.getUniqueId());
         assertEquals("", msgUnitWrapper.getLogId(), newWrapper.getLogId());
         assertEquals("", msgUnitWrapper.isInternal(), newWrapper.isInternal());
         assertEquals("", msgUnitWrapper.getEmbeddedType(), newWrapper.getEmbeddedType());

         MsgQosData qos = newWrapper.getMsgQosData();
         assertEquals("", false, qos.isVolatile());
         assertEquals("", true, qos.isPersistent());
         assertEquals("", true, qos.isReadonly());
         assertEquals("", "Gesa", qos.getSender().getLoginName());

         assertEquals("", 3, qos.getRouteNodes().length);
         assertEquals("", 2, qos.getRouteNodes()[0].getStratum());
         assertEquals("", 0, qos.getRouteNodes()[2].getStratum());
         assertEquals("", 9408630500L, qos.getRouteNodes()[0].getTimestamp().getTimestamp());
         assertEquals("", true, qos.getRouteNodes()[0].getDirtyRead());
         assertEquals("", false, qos.getRouteNodes()[1].getDirtyRead());
         assertEquals("", false, qos.getRouteNodes()[2].getDirtyRead());

         assertEquals("", PriorityEnum.HIGH_PRIORITY.toString(), qos.getPriority().toString());
         assertEquals("", timestamp.getTimestamp(), qos.getRcvTimestamp().getTimestamp());
         System.out.println("SUCCESS BEFORE: " + msgUnitWrapper.toXml());
         System.out.println("SUCCESS AFTER: " + newWrapper.toXml());

         // The remaing life changes so we can't compare the XML strings directly:
View Full Code Here

      String content = "SomethingFancy";
      String queryStr = "/qos";
      String qos = "<qos/>";
     
      MsgUnit msgUnit = new MsgUnit("<key oid='Hello'/>", content, qos);
      msgUnit.getQosData().setRcvTimestamp(new Timestamp());
      SessionInfo sessionInfo = null;

      PluginInfo info = new PluginInfo(glob, null, "XPathFilter", "1.0");
      info.getParameters().put(XPathFilter.MATCH_AGAINST_QOS, ""+true);
      filter.init(glob, info);
View Full Code Here

         "  </xsl:template>" +
         "</xsl:stylesheet>");
     
      try {
         MsgUnit msgUnit = new MsgUnit("<key oid='Hello'/>", content, qos);
         msgUnit.getQosData().setRcvTimestamp(new Timestamp());
         SessionInfo sessionInfo = null;
  
         PluginInfo info = new PluginInfo(glob, null, "XPathFilter", "1.0");
         info.getParameters().put(XPathFilter.XSL_CONTENT_TRANSFORMER_FILE_NAME, xslFile);
         filter.init(glob, info);
View Full Code Here

    */
   public String publish(String changeKey, byte[] out, Map attrMap) throws Exception {
      // this is only for testing purposes
      if (this.throwAwayMessages) {
         log.fine("The message '" + changeKey + "' has been thrown away (not published)");
         return (new Timestamp()).toString() + "thrownAway";
      }
      long t0 = System.currentTimeMillis();
      if (out == null) out = "".getBytes();
      out = MomEventEngine.compress(out, attrMap, this.compressSize, null);

View Full Code Here

   /**
    * @see org.xmlBlaster.contrib.replication.impl.ReplManagerPluginMBean#broadcastSql(java.lang.String, java.lang.String)
    */
   public void broadcastSql(String repl, String sql) throws Exception {
      final boolean highPrio = true;
      String requestId = "" + new Timestamp().getTimestamp();
      String replicationPrefix = VersionTransformerCache.stripReplicationPrefix(repl);
      sendBroadcastRequest(replicationPrefix, sql, highPrio, requestId);
   }
View Full Code Here

     
      XBMessageProducer producer = new XBMessageProducer(session, dest);
      producer.setPriority(PriorityEnum.HIGH_PRIORITY.getInt());
      producer.setDeliveryMode(DeliveryMode.PERSISTENT);
     
      String dumpId = "" + new Timestamp().getTimestamp();
      // now read the file which has been generated
      String filename = null;
      if (shortFilename != null) {
         log.info("sending initial file '" + shortFilename + "' for user '" + SpecificDefault.toString(slaveSessionNames+ "'");
         if (this.initialCmdPath != null)
View Full Code Here

   public final String initialCommand(String[] slaveNames, String completeFilename, ConnectionInfo connInfo, String version) throws Exception {
      if (this.initialCmd == null)
         return null;
      String filename = null;
      if (completeFilename == null) {
         filename = "" + (new Timestamp()).getTimestamp() + ".dmp";
         completeFilename = this.initialCmdPath + File.separator + filename;
      }
      // String cmd = this.initialCmd + " \"" + completeFilename + "\"";
      String cmd = this.initialCmd + " " + completeFilename;
      if (version != null)
View Full Code Here

      if (extraOffset == null) extraOffset = "";
      String offset = Constants.OFFSET + extraOffset;
     
      boolean forceReadable = true;

      Timestamp ts = new Timestamp(msgUnitWrapperUniqueId);

      sb.append(offset).append("<MsgQueueUpdateEntry");
      sb.append(" id='").append(uniqueIdTimestamp.getTimestamp()).append("'");
      sb.append(" storageId='").append(getStorageId()).append("'");
      sb.append(offset).append(" keyOid='").append(getKeyOid()).append("'");
      sb.append(" msgUnitRcvTimestamp='").append(msgUnitWrapperUniqueId).append("'");
      sb.append(" msgUnitRcvTimestampStr='").append(ts.toString()).append("'");
      sb.append(offset).append(" sender='").append(getSender()).append("'");
      sb.append(" receiver='").append(getReceiver().getAbsoluteName()).append("'");
      sb.append(offset).append(" persistent='").append(isPersistent()).append("'");
      sb.append(" subscriptionId='").append(getSubscriptionId()).append("'");
      sb.append(" redeliverCounter='").append(getRedeliverCounter()).append("'");
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.Timestamp

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.