CVS update: JGroups/tests/junit-functional/org/jgroups/tests ProgrammaticApiTest.java

"Bela Ban" <[email protected]> Wed, 6 Oct 2010 09:46:33 +0000
Newsgroups gmane.comp.java.javagroups.cvs
Message-ID <[email protected]>
  User: belaban 
  Date: 10/10/06 09:46:33

  Added:       tests/junit-functional/org/jgroups/tests
                        ProgrammaticApiTest.java
  Log:
  first impl of programmatic API (https://jira.jboss.org/browse/JGRP-1245)
  
  Revision  Changes    Path
  1.1                  JGroups/tests/junit-functional/org/jgroups/tests/ProgrammaticApiTest.java
  
  Index: ProgrammaticApiTest.java
  ===================================================================
  package org.jgroups.tests;
  
  import org.jgroups.*;
  import org.jgroups.protocols.SHARED_LOOPBACK;
  import org.jgroups.stack.Protocol;
  import org.jgroups.stack.ProtocolStack;
  import org.jgroups.util.Util;
  import org.testng.annotations.Test;
  
  /**
   * @author Bela Ban
   * @version $Id: ProgrammaticApiTest.java,v 1.1 2010/10/06 09:46:32 belaban Exp $
   */
  @Test(groups=Global.FUNCTIONAL,sequential=false)
  public class ProgrammaticApiTest {
  
      public void testChannelCreation() throws Exception {
          JChannel ch=new JChannel(false);
          ch.setReceiver(new ReceiverAdapter() {
              public void receive(Message msg) {
                  System.out.println("<< " + msg);
              }
          });
          ProtocolStack stack=ch.createProtocolStack();
          stack.addProtocol(new SHARED_LOOPBACK()).addProtocol(new MockProtocol1()).addProtocol(new MockProtocol2());
          stack.init();
          ch.connect("demo");
  
          Protocol transport=stack.getTransport();
          transport.up(new Event(Event.MSG, new Message(null, Util.createRandomAddress(), "hello world")));
  
      }
  
  
  
      protected static class MockProtocol1 extends Protocol {
  
      }
  
      protected static class MockProtocol2 extends Protocol {
          
      }
  }
  
  
  

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb