Package org.jboss.internal.soa.esb.message.urigen

Examples of org.jboss.internal.soa.esb.message.urigen.DefaultMessageURIGenerator


 
    /**
     * Test that we're using the right prefix.
     */
    public void testPrefix() {
    DefaultMessageURIGenerator dmurig = new DefaultMessageURIGenerator();
    Message msg1 = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
     
    msg1.getBody().add("bar");
    try {
      msg1.getHeader().getCall().setTo(new HTTPEpr("http://foo.bar"));
      msg1.getHeader().getCall().setMessageID(new URI("urn:1234"));
    } catch (URISyntaxException e1) {
      fail(e1.getMessage());
    }
   
    try {
      URI uuid = dmurig.generateMessageURI(msg1);
      assertTrue("Make sure that URI starts with " + URI_PREFIX,
          uuid.toString().startsWith(URI_PREFIX));
    } catch (URIGenerationException e) {
      fail(e.getMessage());
    }
View Full Code Here


   * A simple test to make sure that the UUIDs created are somewhat unique -
   * test to make sure we don't have duplicates in the first ten created.
   */
  public void testUniqueness() {
    Hashtable<URI, String> hash = new Hashtable<URI, String>();
    DefaultMessageURIGenerator dmurig = new DefaultMessageURIGenerator();
    Message msg1 = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
     
    msg1.getBody().add("bar");
    try {
      msg1.getHeader().getCall().setTo(new HTTPEpr("http://foo.bar"));
      msg1.getHeader().getCall().setMessageID(new URI("urn:1234"));
    } catch (URISyntaxException e1) {
      fail(e1.getMessage());
    }
     
    for (int i = 0 ; i < MAX_COUNT; i++) {
        URI uuid = null;
        try {
          uuid = dmurig.generateMessageURI(msg1);
        } catch (URIGenerationException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
        if (!hash.contains(uuid)) {
View Full Code Here

TOP

Related Classes of org.jboss.internal.soa.esb.message.urigen.DefaultMessageURIGenerator

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.