Package com.sun.sgs.app

Examples of com.sun.sgs.app.Channel


         ChannelListener listener,
         Delivery delivery)
    {
        serviceStats.createChannelOp.report();
  try {
      Channel channel = ChannelImpl.newInstance(
    name, listener, delivery, writeBufferSize);
      return channel;
     
  } catch (RuntimeException e) {
      logger.logThrow(Level.FINEST, e, "createChannel:{0} throws");
View Full Code Here


    // -- Test Channel.getDelivery --

    @Test
    public void testChannelGetDeliveryNoTxn() throws Exception {
  Channel channel = createChannel();
  try {
      channel.getDelivery();
      fail("Expected TransactionNotActiveException");
  } catch (TransactionNotActiveException e) {
      System.err.println(e);
  }
    }
View Full Code Here

    }

    @Test
    public void testChannelGetDeliveryMismatchedTxn() throws Exception {
  // TBD: should the implementation work this way?
  final Channel channel = createChannel();
  txnScheduler.runTask(new TestAbstractKernelRunnable() {
      public void run() {
    try {
        channel.getDelivery();
        fail("Expected TransactionNotActiveException");
    } catch (TransactionNotActiveException e) {
        System.err.println(e);
    }
      }
View Full Code Here

    @Test
    public void testChannelGetDelivery() throws Exception {
  txnScheduler.runTask(new TestAbstractKernelRunnable() {
      public void run() {
    for (Delivery delivery : Delivery.values()) {
        Channel channel = channelService.createChannel(
      delivery.toString(), null, delivery);
        if (!delivery.equals(channel.getDelivery())) {
      fail("Expected: " + delivery + ", got: " +
           channel.getDelivery());
        }
    }
    System.err.println("Delivery requirements are equal");
      }
  }, taskOwner);
View Full Code Here

    @Test
    public void testChannelGetDeliveryClosedChannel() throws Exception {
  txnScheduler.runTask(new TestAbstractKernelRunnable() {
      public void run() {
    for (Delivery delivery : Delivery.values()) {
        Channel channel = channelService.createChannel(
      delivery.toString(), null, delivery);
        dataService.removeObject(channel);
        try {
      channel.getDelivery();
      fail("Expected IllegalStateException");
        } catch (IllegalStateException e) {
      System.err.println(e);
        }
    }
View Full Code Here

    // -- Test Channel.hasSessions --

    @Test
    public void testChannelHasSessionsNoTxn() throws Exception {
  Channel channel = createChannel();
  try {
      channel.hasSessions();
      fail("Expected TransactionNotActiveException");
  } catch (TransactionNotActiveException e) {
      System.err.println(e);
  }
    }
View Full Code Here

  }
    }

    @Test
    public void testChannelHasSessionsMismatchedTxn() throws Exception {
  final Channel channel = createChannel();
  txnScheduler.runTask(new TestAbstractKernelRunnable() {
      public void run() {
    try {
        channel.hasSessions();
        fail("Expected TransactionNotActiveException");
    } catch (TransactionNotActiveException e) {
        System.err.println(e);
    }
      }
View Full Code Here

    @Test
    public void testChannelHasSessionsNoSessionsJoined() throws Exception {
  txnScheduler.runTask(new TestAbstractKernelRunnable() {
      public void run() {
    String name = "foo";
    Channel channel = channelService.createChannel(
        name, null, Delivery.RELIABLE);
    if (channel.hasSessions()) {
        fail("Expected no sessions joined");
    }
    System.err.println("no sessions joined");
      }
  }, taskOwner);
View Full Code Here

  ClientGroup group = new ClientGroup(someUsers);
  try {
      joinUsers("foo", someUsers);
      txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
        Channel channel = channelService.getChannel(channelName);
        if (! channel.hasSessions()) {
      fail("Expected sessions joined");
        }
    }
    }, taskOwner);
  } finally {
View Full Code Here

    @Test
    public void testChannelHasSessionsClosedChannel() throws Exception {
  txnScheduler.runTask(new TestAbstractKernelRunnable() {
      public void run() {
    String name = "foo";
    Channel channel = channelService.createChannel(
        name, null, Delivery.RELIABLE);
    dataService.removeObject(channel);
    try {
        channel.hasSessions();
        fail("Expected IllegalStateException");
    } catch (IllegalStateException e) {
        System.err.println(e);
    }
      }
View Full Code Here

TOP

Related Classes of com.sun.sgs.app.Channel

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.