Package com.sun.sgs.app

Examples of com.sun.sgs.app.Channel


    // -- Test Channel.getSessions --

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


  }
    }

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

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

  try {
      joinUsers("foo", someUsers);
      checkUsersJoined("foo", someUsers);
      txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
        Channel channel = channelService.getChannel(channelName);
        List<String> users =
      new ArrayList<String>(Arrays.asList(someUsers));
        Iterator<ClientSession> iter = channel.getSessions();
        while (iter.hasNext()) {
      ClientSession session = iter.next();
      if (!(session instanceof ClientSessionWrapper)) {
          fail("session not ClientSessionWrapper instance: " +
         session);
View Full Code Here

    @Test
    public void testChannelGetSessionsClosedChannel() 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.getSessions();
        fail("Expected IllegalStateException");
    } catch (IllegalStateException e) {
        System.err.println(e);
    }
      }
View Full Code Here

    // -- Test Channel.join --

    @Test
    public void testChannelJoinNoTxn() throws Exception {
  Channel channel = createChannel();
  DummyClient client = newClient();
  try {
      channel.join(client.getSession());
      fail("Expected TransactionNotActiveException");
  } catch (TransactionNotActiveException e) {
      System.err.println(e);
  } finally {
      if (client != null) {
View Full Code Here

    public void testChannelJoinClosedChannel() throws Exception {
  final DummyClient client = newClient();
  try {
      txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        Channel channel =
      channelService.createChannel(
          "x", null, Delivery.RELIABLE);
        dataService.removeObject(channel);
        try {
      channel.join(client.getSession());
      fail("Expected IllegalStateException");
        } catch (IllegalStateException e) {
      System.err.println(e);
        }
    }
View Full Code Here

    @Test
    public void testChannelJoinNullClientSession() throws Exception {
  txnScheduler.runTask(new TestAbstractKernelRunnable() {
      public void run() {
    Channel channel =
        channelService.createChannel("x", null, Delivery.RELIABLE);
    try {
        channel.join((ClientSession) null);
        fail("Expected NullPointerException");
    } catch (NullPointerException e) {
        System.err.println(e);
    }
      }
View Full Code Here

    // -- Test Channel.leave --

    @Test
    public void testChannelLeaveNoTxn() throws Exception {
  Channel channel = createChannel();
  DummyClient client = newClient();
  try {
      channel.leave(client.getSession());
      fail("Expected TransactionNotActiveException");
  } catch (TransactionNotActiveException e) {
      System.err.println(e);
  } finally {
      if (client != null) {
View Full Code Here

    @Test
    public void testChannelLeaveMismatchedTxn() throws Exception {
  // TBD: should the implementation work this way?
  final String channelName = "test";
  final Channel channel = createChannel(channelName);
  final DummyClient client = newClient();
  try {
      txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        try {
      channel.leave(client.getSession());
      fail("Expected TransactionNotActiveException");
        } catch (TransactionNotActiveException 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.