Package org.xmlBlaster.util.qos

Examples of org.xmlBlaster.util.qos.ConnectQosData


     
      this.publishQos = this.global.get("publishQos", "<qos/>", null, pluginConfig);

      tmp  = this.global.get("connectQos", (String)null, null, pluginConfig);
      if (tmp != null) {
         ConnectQosData data = this.global.getConnectQosFactory().readObject(tmp);
         this.connectQos = new ConnectQos(this.global, data);
      }
      else {
         String userId = this.global.get("loginName", "_" + this.name, null, pluginConfig);
         String password = this.global.get("password", (String)null, null, pluginConfig);
View Full Code Here


         "   <clientProperty name='StringKey' type='String' encoding='" + Constants.ENCODING_BASE64 + "'>QmxhQmxhQmxh</clientProperty>\n" +
         "   <persistent>true</persistent>\n" +
         "</qos>\n";

         I_ConnectQosFactory factory = this.glob.getConnectQosFactory();
         ConnectQosData qos = factory.readObject(xml); // parse
         assertEquals("", true, qos.getPersistentProp().getValue());
         String newXml = qos.toXml();                  // dump
         qos = factory.readObject(newXml);             // parse again

         if (log.isLoggable(Level.FINE)) log.fine("ORIG=\n" + xml + "\n NEW=\n" + newXml);

         SessionQos sessionQos = qos.getSessionQos();
         assertEquals("sessionTimeout failed", sessionTimeout, sessionQos.getSessionTimeout());
         if (SessionName.useSessionMarker())
            assertEquals("", "/node/avalon/client/joe/session/2", sessionQos.getSessionName().getAbsoluteName());
         else
            assertEquals("", "/node/avalon/client/joe/2", sessionQos.getSessionName().getAbsoluteName());
         assertEquals("", true, sessionQos.hasPublicSessionId());
         assertEquals("", 2L, sessionQos.getPublicSessionId());
         assertEquals("", sessionTimeout, sessionQos.getSessionTimeout());
         assertEquals("", 27, sessionQos.getMaxSessions());
         assertEquals("", true, sessionQos.clearSessions());
         assertEquals("", "xyz", sessionQos.getSecretSessionId());

         assertEquals("", false, qos.isPtpAllowed());
         assertEquals("", true, qos.isClusterNode());
         assertEquals("", true, qos.isReconnected());
         assertEquals("", "/node/heron/instanceId/123445", qos.getInstanceId());
         assertEquals("", false, qos.duplicateUpdates());
         assertEquals("", true, qos.getPersistentProp().getValue());

         {
            ClientQueueProperty prop = qos.getClientQueueProperty();
            assertEquals("", 22L, prop.getMaxEntries());
            assertEquals("", "RAM", prop.getType());
            assertEquals("", "4.0", prop.getVersion());
            assertEquals("", 44L, prop.getMaxBytes());
            AddressBase[] addrArr = prop.getAddresses();
            assertEquals("Address array", 1, addrArr.length);
            AddressBase addr = addrArr[0];
            assertEquals("", "34", addr.getEnv("intKey2", "").getValue());
         }

         {
            CbQueueProperty prop = qos.getSubjectQueueProperty();
            assertEquals("", 1009L, prop.getMaxEntries());
            assertEquals("", "XY", prop.getType());
            assertEquals("", "7.0", prop.getVersion());
            assertEquals("", 4009L, prop.getMaxBytes());
            assertEquals("", 509L, prop.getMaxEntriesCache());
            assertEquals("", 777L, prop.getMaxBytesCache());
            /* Currently deactivated in code
            assertEquals("", 20009L, prop.getStoreSwapLevel());
            assertEquals("", 10000L, prop.getStoreSwapBytes());
            assertEquals("", 20000L, prop.getReloadSwapLevel());
            assertEquals("", 30000L, prop.getReloadSwapBytes());
            */
            assertEquals("", "deadMessage", prop.getOnOverflow());
            assertEquals("", true, qos.hasSubjectQueueProperty());
         }


         {
            CbQueueProperty prop = qos.getSessionCbQueueProperty();
            assertEquals("", 1600L, prop.getMaxEntries());
            AddressBase[] addrArr = prop.getAddresses();
            assertEquals("Address array", 1, addrArr.length);
            AddressBase addr = addrArr[0];
            assertEquals("", 400, addr.getCollectTime());
            assertEquals("", 12, addr.getBurstModeMaxEntries());
            assertEquals("", 24, addr.getBurstModeMaxBytes());
            assertEquals("", "1234", addr.getEnv("intKey1", "").getValue());
            System.out.println("GOT: "+addr.getRawAddress());
            assertEquals("", "http:/www.mars.universe:8080/RPC2", addr.getRawAddress());
         }

         assertEquals("Wrong number of clientProperties", 2, qos.getClientProperties().size());
         {
            String prop = qos.getClientProperty("StringKey", (String)null);
            assertTrue("Missing client property", prop != null);
            assertEquals("Wrong base64 decoding", "BlaBlaBla", prop); // Base64: QmxhQmxhQmxh -> BlaBlaBla
         }

         {
            int prop = qos.getClientProperty("intKey", -1);
            assertEquals("Wrong value", 123, prop);
         }

         //System.out.println(qos.toXml());
        
         // TODO: check all methods !!!

         /*
         protected I_ClientPlugin getPlugin(String mechanism, String version) throws XmlBlasterException
         public String getSecurityData() {
         */
         ServerRef[] refArr = qos.getServerRefs();
         assertEquals("", 3, refArr.length);
         ServerRef ref = qos.getServerRef();
         assertTrue("", ref != null);
         /*
         public ClientQueueProperty getClientQueueProperty() {
         public final I_SecurityQos getSecurityQos() throws XmlBlasterException
         public final String getSecurityPluginType() throws XmlBlasterException
         public final String getSecurityPluginVersion() throws XmlBlasterException
         */
         AddressBase[] addrArr = qos.getAddresses(true);
         assertEquals("Address array", 1, addrArr.length);
         //Address addr = qos.getAddress();
         //assertEquals("", "http:...", addr.getAddress().trim()); // from client queue property
         assertEquals("", false, qos.isPtpAllowed());
         assertEquals("", "joe", qos.getUserId());
      }
      catch (XmlBlasterException e) {
         fail("testParse failed: " + e.toString());
      }

View Full Code Here

         "   </address>\n" +
         "  </queue>\n" +
         " </qos>\n";

         I_ConnectQosFactory factory = this.glob.getConnectQosFactory();
         ConnectQosData qos = factory.readObject(xml); // parse
         String newXml = qos.toXml();                  // dump
         qos = factory.readObject(newXml);             // parse again

         if (log.isLoggable(Level.FINE)) log.fine("ORIG=\n" + xml + "\n NEW=\n" + newXml);
        
         ClientQueueProperty prop = qos.getClientQueueProperty();
         assertEquals("", "RAM", prop.getType());
         assertEquals("", "1.0", prop.getVersion());
         System.out.println(qos.toXml());
      }
      catch (XmlBlasterException e) {
         fail("testParse2 failed: " + e.toString());
      }
View Full Code Here

         "      </callback>\n" +
         "   </queue>\n" +
         "</qos>\n";

         I_ConnectQosFactory factory = this.glob.getConnectQosFactory();
         ConnectQosData qos = factory.readObject(xml); // parse
         String newXml = qos.toXml();                  // dump
         qos = factory.readObject(newXml);             // parse again

         if (log.isLoggable(Level.FINE)) log.fine("ORIG=\n" + xml + "\n NEW=\n" + newXml);

         {
            CbQueueProperty prop = qos.getSessionCbQueueProperty();
            assertEquals("", 1600L, prop.getMaxEntries());
            assertEquals("", 2000L, prop.getMaxBytes());
            AddressBase[] addrArr = prop.getAddresses();
            assertEquals("Address array", 1, addrArr.length);
            AddressBase addr = addrArr[0];
View Full Code Here

               + "   <address type='SOCKET'>\n"
               + "      socket://:7501\n"
               + "      <attribute name='useRemoteLoginAsTunnel'>true</attribute>\n"
               + "   </address>\n" + "</qos>\n";

         ConnectQosData qos = factory.readObject(xml);

         String xml2 = qos.toXml();
         qos = factory.readObject(xml2);
         log.info(xml2);

         assertTrue(qos.isPersistent());
         Address address = qos.getAddress();
         assertEquals(true, address.getEnv("useRemoteLoginAsTunnel", false)
               .getValue());
         // assertEquals(3412, address.getBootstrapPort());
         assertEquals("socket://:7501", address.getRawAddress());
      } catch (XmlBlasterException e) {
View Full Code Here

         qos.addClientProperty("twoKey", "twoValue");
         qos.addClientProperty("threeKey", new Integer(55));
         String literal = qos.toXml();
        
         ConnectQosSaxFactory factory = new ConnectQosSaxFactory(this.glob);
         ConnectQosData data = factory.readObject(literal);
         checkValues(data.getClientProperties());
      }
      catch (XmlBlasterException ex) {
         assertTrue("Exeption occured : " + ex.getMessage(), false);
      }
   }
View Full Code Here

      qos.addClientProperty("threeKey", new Integer(55));
      String literal = qos.toXml();
     
      ConnectQosSaxFactory factory = new ConnectQosSaxFactory(this.glob);
      try {
         ConnectQosData data = factory.readObject(literal);
         checkValues(data.getClientProperties());
      }
      catch (XmlBlasterException ex) {
         assertTrue("Exeption occured : " + ex.getMessage(), false);
      }
   }
View Full Code Here

    * To use another security authentication plugin use setSecurity()
    * @exception XmlBlasterException on problems loading the client security plugin
    */
   public ConnectQos(Global glob) throws XmlBlasterException {
      this.glob = (glob==null) ? Global.instance() : glob;
      this.connectQosData = new ConnectQosData(this.glob);
      init();
   }
View Full Code Here

    * @param passwd The password if you use a password based authentication
    * @exception XmlBlasterException if the default security plugin couldn't be loaded
    */
   public ConnectQos(Global glob, String userId, String passwd) throws XmlBlasterException {
      this.glob = (glob==null) ? Global.instance() : glob;
      this.connectQosData = new ConnectQosData(this.glob, this.glob.getConnectQosFactory(), null, null);
      this.connectQosData.loadClientPlugin(null, null, userId, passwd);
      init();
   }
View Full Code Here

      SessionInfo sessionInfo = clientEvent.getSessionInfo();
      SessionName sessionName = sessionInfo.getSessionName();

      try {
         ConnectQosData cd = sessionInfo.getConnectQos().getData();
         // A client can on connect send a event/connect=false clientProperty to suppress the event fired
         if (cd.getClientProperty(ContextNode.EVENT_MARKER_TAG + ContextNode.SEP + "connect", true) == false) {
            if (log.isLoggable(Level.FINE)) log.fine("Found " + ContextNode.EVENT_MARKER_TAG + ContextNode.SEP + "connect=true for "+sessionName.toString());
          return;
         }
      }
      catch (Throwable e) {
View Full Code Here

TOP

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

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.