Package com.sun.sgs.app

Examples of com.sun.sgs.app.ClientSession


        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);
      }
      String name = session.getName();
      if (! users.contains(name)) {
          fail("unexpected channel member: " + name);
      } else {
          System.err.println("getSessions includes: " + name);
          users.remove(name);
View Full Code Here


  try {
      txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
        Channel channel = getChannel(channelName);
        ClientSession session =
      (ClientSession) dataService.getBinding(user);
        channel.join(session);
        dataService.removeObject(channel);
        try {
      channel.leave(session);
View Full Code Here

  try {
      txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
        Channel channel = getChannel(channelName);
 
        ClientSession moe =
      (ClientSession) dataService.getBinding(MOE);
        channel.join(moe);

        try {
      ClientSession larry =
          (ClientSession) dataService.getBinding(LARRY);
      channel.leave(larry);
      System.err.println("leave of non-member session returned");
     
        } catch (Exception e) {
      System.err.println(e);
      fail("test failed with exception: " + e);
        }
       
    }
       }, taskOwner);

      Thread.sleep(100);
     
      txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
        Channel channel = getChannel(channelName);
 
        ClientSession moe =
      (ClientSession) dataService.getBinding(MOE);

        ClientSession larry =
      (ClientSession) dataService.getBinding(LARRY);
       
        Set<ClientSession> sessions = getSessions(channel);
        System.err.println(
      "sessions set (should only have moe): " + sessions);
View Full Code Here

      for (final String user : someUsers) {
   
    txnScheduler.runTask(new TestAbstractKernelRunnable() {
        public void run() {
      Channel channel = getChannel(channelName);
      ClientSession session = getSession(user);
      channel.leave(session);
        }}, taskOwner);

    Thread.sleep(100);
   
    txnScheduler.runTask(new TestAbstractKernelRunnable() {
        public void run() {
      Channel channel = getChannel(channelName);
      ClientSession session = getSession(user);
      if (getSessions(channel).contains(session)) {
          fail("Failed to remove session: " + session);
      }}}, taskOwner);
      }
     
View Full Code Here

  txnScheduler.runTask(new TestAbstractKernelRunnable() {
      public void run() {
    ChannelListener listener =
        new ValidatingChannelListener();
    dataService.setBinding(listenerName, listener);
    ClientSession session =
        (ClientSession) dataService.getBinding(user);
    Channel channel =
        channelService.createChannel(
      channelName, listener, Delivery.RELIABLE);
    channel.join(session);
      }
  }, taskOwner);

  // Wait for the client to join, and then send a channel message.
  client.assertJoinedChannel(channelName);
  client.sendChannelMessage(channelName, 0);

  // Validate that the session passed to the handleChannelMessage
  // method was a wrapped ClientSession.
  txnScheduler.runTask(new TestAbstractKernelRunnable() {
      public void run() {
    ValidatingChannelListener listener = (ValidatingChannelListener)
        dataService.getBinding(listenerName);
    ClientSession session =
        (ClientSession) dataService.getBinding(user);
    listener.validateSession(session);
    System.err.println("sessions are equal");
      }
  }, taskOwner);
View Full Code Here

  for (int i = 0; i < numIterations; i++) {
      txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
        Channel channel = channelService.getChannel(channelName);
        DataManager dataManager = AppContext.getDataManager();
        ClientSession session = (ClientSession)
      dataManager.getBinding(sessionKey);
        channel.join(session);
        channel.leave(session);
    }}, taskOwner);
  }
View Full Code Here

TOP

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

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.