Package org.xmlBlaster.util.qos

Examples of org.xmlBlaster.util.qos.ClientProperty


       if (value != null)
          value = this.helper.replace(value);
       if (value == null)
         this.clientPropertyMap.remove(key);
       else {
          ClientProperty prop = new ClientProperty(key, null, null, value);
          this.clientPropertyMap.put(key, prop);
       }
    }
View Full Code Here


     */
     public synchronized void putRaw(String key, String value) {
        if (value == null)
          this.clientPropertyMap.remove(key);
        else {
           ClientProperty prop = new ClientProperty(key, null, null, value);
           this.clientPropertyMap.put(key, prop);
        }
     }
View Full Code Here

      MsgQosData qos = new MsgQosData(this.glob, MethodName.UPDATE);

      qos.setState("AA");
      assertEquals("state", "AA", qos.getState());

      ClientProperty cp = new ClientProperty("aKey", "byte[]", Constants.ENCODING_BASE64, "bla");
      qos.addClientProperty(cp);
      Hashtable jxPath = qos.toJXPath();
      String value = (String)jxPath.get("/qos/clientProperty[@name='aKey']/text()");
      String bla = Base64.encode("bla".getBytes());
      assertEquals("JXPATH", bla, value);
View Full Code Here

      return buf.toString();
   }
  
   public String update(String cbSessionId, UpdateKey updateKey, InputStream is, UpdateQos updateQos) throws XmlBlasterException, IOException {
     
      ClientProperty prop = updateQos.getClientProperty(Constants.addJmsPrefix("interrupted", log));
      boolean doInterrupt = false;
      if (prop != null)
         doInterrupt = prop.getBooleanValue();
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      byte[] buf = new byte[300];
      int count = 0;
      String name = updateQos.getClientProperty("nameOfTest", "");
      boolean isException = "testException".equals(name);
View Full Code Here

     
      sqlRow.setAttribute("attr1", "value1");
      sqlRow.setAttribute("attr2", "value2");
      sqlRow.setAttribute("attr3", "value3");
      sqlRow.setCaseSensitive(true);
      ClientProperty col1 = new ClientProperty("dummy1", null, null);
      col1.setValue("valDummy1");
      sqlRow.setColumn(col1);
      ClientProperty col2 = new ClientProperty("dummy2", null, null);
      col2.setValue("valDummy2");
      sqlRow.setColumn(col2);
     
      assertEquals("the caseSensitive has been modified", true, sqlRow.isCaseSensitive());
      assertEquals("The value of the attribute has been modified", "value1", sqlRow.getAttribute("attr1").getStringValue());
      assertEquals("The value of the attribute has been modified", "value2", sqlRow.getAttribute("attr2").getStringValue());
      assertEquals("The value of the attribute has been modified", "value3", sqlRow.getAttribute("attr3").getStringValue());
      assertEquals("The value of the row has been modified", "valDummy1", sqlRow.getColumn("dummy1").getStringValue());
      assertEquals("The value of the row has been modified", "valDummy2", sqlRow.getColumn("dummy2").getStringValue());
      assertEquals("The number of attributes has been modified", 3, sqlRow.getAttributeNames().length);
      assertEquals("The value of columns has been modified", 2, sqlRow.getColumnNames().length);
     
      SqlRow row2 = sqlRow.cloneRow();

      assertEquals("the caseSensitive has been modified", true, row2.isCaseSensitive());
      assertEquals("The value of the attribute has been modified", "value1", row2.getAttribute("attr1").getStringValue());
      assertEquals("The value of the attribute has been modified", "value2", row2.getAttribute("attr2").getStringValue());
      assertEquals("The value of the attribute has been modified", "value3", row2.getAttribute("attr3").getStringValue());
      assertEquals("The value of the row has been modified", "valDummy1", row2.getColumn("dummy1").getStringValue());
      assertEquals("The value of the row has been modified", "valDummy2", row2.getColumn("dummy2").getStringValue());
      assertEquals("The number of attributes has been modified", 3, row2.getAttributeNames().length);
      assertEquals("The value of columns has been modified", 2, row2.getColumnNames().length);
     
      row2.setCaseSensitive(false);
      row2.setAttribute("attr1", "newValue1");
      row2.setAttribute("attr4", "newValue4");
      row2.renameColumn("dummy1", "newDummy1");
     
      assertEquals("the caseSensitive has been modified", true, sqlRow.isCaseSensitive());
      assertEquals("The value of the attribute has been modified", "value1", sqlRow.getAttribute("attr1").getStringValue());
      assertEquals("The value of the row has been modified", "valDummy1", sqlRow.getColumn("dummy1").getStringValue());
     
      log.info(row2.toXml(""));
      assertEquals("the caseSensitive has been modified", false, row2.isCaseSensitive());
      assertEquals("The value of the attribute has been modified", "newValue1", row2.getAttribute("attr1").getStringValue());
      Object obj = row2.getColumn("dummy1");
      assertNull("The value of the row has been modified", obj);
      assertEquals("The value of the row has been modified", "valDummy1", row2.getColumn("newDummy1").getStringValue());
     
      ClientProperty tmpCol = row2.getColumn("dummy2");
      tmpCol.setValue("newValueDummy2");
      assertEquals("the content of the column has been modified", "valDummy2", sqlRow.getColumn("dummy2").getStringValue());
      assertEquals("the content of the column has been modified", "newValueDummy2", row2.getColumn("dummy2").getStringValue());
     
      ClientProperty tmpAttr = row2.getAttribute("attr3");
      tmpAttr.setValue("newValueAttr3");
      assertEquals("the content of the attribute has been modified", "value3", sqlRow.getAttribute("attr3").getStringValue());
      assertEquals("the content of the attribute has been modified", "newValueAttr3", row2.getAttribute("attr3").getStringValue());
     
     
      log.info("SUCCESS");
View Full Code Here

         long waitingDelay = 4000L;
        
         String cmd = "maxEntries=4&maxSize=-1&consumable=true&waitingDelay=1000";
         Map props = StringPairTokenizer.parseToStringClientPropertyPairs(cmd, "&", "=");
        
         ClientProperty prop = (ClientProperty)props.get("maxEntries");
         assertNotNull("property should not be null", prop);
         maxEntries = prop.getIntValue();
         assertEquals("maxEntries", 4, maxEntries);
        
         prop = (ClientProperty)props.get("maxSize");
         assertNotNull("property should not be null", prop);
         maxSize = prop.getLongValue();
         assertEquals("maxSize", -1L, maxSize);

         prop = (ClientProperty)props.get("consumable");
         assertNotNull("property should not be null", prop);
         consumable = prop.getBooleanValue();
         assertEquals("consumable", true, consumable);

         prop = (ClientProperty)props.get("waitingDelay");
         assertNotNull("property should not be null", prop);
         waitingDelay = prop.getLongValue();
         assertEquals("waitingDelay", 1000L, waitingDelay);
      }
      catch (Exception ex) {
         ex.printStackTrace();
         assertTrue("an exception should not occur here", false);
View Full Code Here

    */
   private void setupDataSets() {
      ArrayList datas = new ArrayList();
      Map map;
      String encoding = null;
      ClientProperty prop1, prop2, prop3;
      prop1 = new ClientProperty("age"   , "integer", encoding, "23"         );
      prop2 = new ClientProperty("city"  ,      null, encoding, "London"     );
      prop3 = new ClientProperty("amount""double", encoding, "100.1234567");
     
      // set : 0  (0:0:0)
      map = new HashMap();
      datas.add(map);
     
View Full Code Here

      StringBuffer buffer = new StringBuffer("[");
      Object[] keys = map.keySet().toArray();
      for (int i=0; i < keys.length; i++) {
         if (i != 0) buffer.append(";");
         buffer.append(keys[i]).append("=");
         ClientProperty cp = (ClientProperty)map.get(keys[i]);
         String tmp = "null";
         if (cp != null) tmp = cp.getStringValue();
         buffer.append(tmp);
      }
      buffer.append("]");
      return buffer.toString();
   }
View Full Code Here

      // If clientProperty is base64 encoded we print the real value as well:
      Map map = updateQos.getClientProperties();
      Iterator it = map.values().iterator();
      while (it.hasNext()) {
         ClientProperty clientProperty = (ClientProperty)it.next();
         if (clientProperty.isBase64()) {
            if (dumpToConsole) {
               System.out.println("\nClientProperty decoded: " + clientProperty.getName() + "='" + clientProperty.getStringValue() + "'");
            }
         }
      }

      if (dumpToConsole) {
View Full Code Here

      try {
         String name = "one";
         String value = "some value";
         String encoding = null; // no encoding
         String type = null; // this is a string
         ClientProperty prop = new ClientProperty(name, type, encoding, value);
        
         this.dbStorage.addProperty(prop);
         try {
            this.dbStorage.addProperty(prop);
            assertTrue("an exception shall occur when trying to a addProperty on a property which has already been stored", false);
         }
         catch (Exception ex) {
            log.info("An exception is ok at this location since the entry existed already.");
         }
         try {
            this.dbStorage.put(prop);
         }
         catch (Exception ex) {
            assertTrue("an exception shall not occur when trying to a put on an entry which already exists", false);
         }
         String newTxt = "THIS IS ANOTHER VALUE";
         prop.setValue(newTxt, null);
         this.dbStorage.put(prop);
        
         ClientProperty prop1 = this.dbStorage.getProperty(name);
         assertTrue("The property has been stored, it shall not be null when doing a 'get'", prop1 != null);
         assertEquals("comparing the two values", prop.getValueRaw(), prop1.getValueRaw());

         this.dbStorage.remove(name);
         prop1 = this.dbStorage.getProperty(name);
         assertTrue("The property has been removed, it should now be null.", prop1 == null);
        
         this.dbStorage.put(new ClientProperty("2-two", null, null, "2"));
         this.dbStorage.put(new ClientProperty("4-four", null, null, "4"));
         this.dbStorage.addProperty(new ClientProperty("5-five", null, null, "5"));
         this.dbStorage.addProperty(new ClientProperty("3-three", null, null, "3"));

         Set set = this.dbStorage.getKeys();
         assertEquals("Wrong number of keys found", 4, set.size());
        
         assertTrue("Wrong content", set.contains("2-two"));
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.qos.ClientProperty

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.