Package edu.indiana.extreme.www.xgws.msgbox.client

Examples of edu.indiana.extreme.www.xgws.msgbox.client.MsgBoxClient


      fill = fill + fill;
    }

    System.out.println("fill size : " + fill.length());

    MsgBoxClient user = new MsgBoxClient();

    EndpointReference msgBoxEpr = user.createMessageBox(
        "http://localhost:8080/axis2/services/MsgBoxService", 5000L);
    /*
     * user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils .reader2OMElement(new
     * StringReader( "<test>simple test message 1</test>")));
     * user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils .reader2OMElement(new
     * StringReader( "<test>simple test message 2</test>")));
     * user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils .reader2OMElement(new
     * StringReader( "<test>simple test message 3</test>")));
     * user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils .reader2OMElement(new
     * StringReader( "<test>simple test message 4</test>")));
     */

    EndpointReference msgBoxEprTcpMon = new EndpointReference(msgBoxEpr
        .getAddress().replace("8080", "5050"));

    for (int i = 0; i < 10; i++) {
      String msg = String.format(
          "<msg><seq>%d</seq><fill>%s</fill></msg>", i, fill);

      user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils
          .reader2OMElement(new StringReader(msg)));

      Thread.sleep(200L);
    }

    Iterator<OMElement> iterator = null;

    try {
      iterator = user.takeMessagesFromMsgBox(msgBoxEprTcpMon, 5000L);
    } catch (Exception e) {
      e.printStackTrace();
    }

    if (iterator != null)
      while (iterator.hasNext()) {

        System.out.println(iterator.next().toStringWithConsume());
      }

    System.out.println("Delete message box response :  "
        + user.deleteMsgBox(msgBoxEpr, 5000L));
  }
View Full Code Here


  @Test
  public void testMessageBox() throws Exception {

    String msgBoxId = UUID.randomUUID().toString();
    MsgBoxClient  user = new MsgBoxClient();

    //test publish with Epr
    EndpointReference msgBoxEpr = user.createMessageBox("http://localhost:"+port+"/axis2/services/MsgBoxService", 500L);
   
    System.out.println(msgBoxEpr.toString());
    user.storeMessage(msgBoxEpr, 500L, MsgBoxUtils
        .reader2OMElement(new StringReader(
            "<test>A simple test message</test>")));
   
   
   
    Iterator<OMElement> iterator = user.takeMessagesFromMsgBox(msgBoxEpr,
        500L);
    int i = 0;
    if (iterator != null)
      while (iterator.hasNext()) {
        i++;
        System.out.println("Retrieved message :" + i);
        System.out.println(iterator.next().toStringWithConsume());
      }

    System.out.println("Delete message box response :  "
        + user.deleteMsgBox(msgBoxEpr, 500L));
   
    //test invocations with id encoded in the Url
    msgBoxId = UUID.randomUUID().toString();
    user = new MsgBoxClient();

    //test publish with Epr
    msgBoxEpr = user.createMessageBox("http://localhost:"+port+"/axis2/services/MsgBoxService", 500L);
   
    String mesgboxUrl = "http://localhost:"+port+"/axis2/services/MsgBoxService/clientid/"+msgBoxId;
   
    ServiceClient client = new ServiceClient();
    client.getOptions().setTo(new EndpointReference(mesgboxUrl));
   
    OMElement request = OMAbstractFactory.getOMFactory().createOMElement(new QName("foo"));
    request.setText("bar");
    client.sendReceive(request);
   
    iterator = user.takeMessagesFromMsgBox(new EndpointReference(mesgboxUrl),500L);
    assertTrue(iterator.hasNext());
    iterator.next();
    assertFalse(iterator.hasNext());
   
    System.out.println("All tests Done");
View Full Code Here

      System.out
          .println("unable to load configurations defaults will be used");
    }

    String msgBoxId = UUID.randomUUID().toString();
    MsgBoxClient client = new MsgBoxClient();

    EndpointReference msgBoxEpr = client.createMessageBox(configurations
        .getProperty(ConfigKeys.MSGBOX_SERVICE_URL), 500L);

    try {
      client.storeMessage(msgBoxEpr, 500L, MsgBoxUtils
          .reader2OMElement(new StringReader(
              "<test>A simple test message</test>")));
    } catch (XMLStreamException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    Iterator<OMElement> iterator = client.takeMessagesFromMsgBox(msgBoxEpr,
        500L);
    int i = 0;
    if (iterator != null)
      while (iterator.hasNext()) {
        i++;
        System.out.println("Retrieved message :" + i);
        try {
          System.out.println(iterator.next().toStringWithConsume());
        } catch (XMLStreamException e) {
          e.printStackTrace();
        }
      }

    System.out.println("Delete message box response :  "
        + client.deleteMsgBox(msgBoxEpr, 500L));
  }
View Full Code Here

TOP

Related Classes of edu.indiana.extreme.www.xgws.msgbox.client.MsgBoxClient

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.