Package com.sun.sgs.test.util

Examples of com.sun.sgs.test.util.SgsTestNode


    {
  String channelName = "foo";
  // channel coordinator is on server node
  createChannel(channelName);

  SgsTestNode oldNode = addNode();
  SgsTestNode newNode = addNode();
  String[] users = new String[]{ "relocatingClient", "otherClient"};
  DummyClient relocatingClient = createDummyClient(users[0], oldNode);
  DummyClient otherClient = createDummyClient(users[1], newNode);

  try {
View Full Code Here


  String channelName = "foo";
  createChannel(channelName);

  // All clients will log into server node.
  ClientGroup group = new ClientGroup(someUsers);
  SgsTestNode newNode = addNode();
  MySessionStatusListener mySessionStatusListener =
      new MySessionStatusListener();
  serverNode.getClientSessionService().
      addSessionStatusListener(mySessionStatusListener);
 
View Full Code Here

    {
  String channelName = "foo";
  // channel coordinator is on server node
  createChannel(channelName);

  SgsTestNode oldNode = addNode();
  SgsTestNode newNode = addNode();
  String[] users = new String[]{ "relocatingClient"};
  DummyClient relocatingClient = createDummyClient(users[0], oldNode);

  try {
      joinUsers(channelName, users);
View Full Code Here

    {
  String channelName = "foo";
  // channel coordinator is on server node
  createChannel(channelName);

  SgsTestNode oldNode = addNode();
  SgsTestNode newNode = addNode();
  String[] users = new String[]{ "relocatingClient", "otherClient"};
  DummyClient relocatingClient = createDummyClient(users[0], oldNode);
  DummyClient otherClient = createDummyClient(users[1], newNode);

  try {
View Full Code Here

    {
  String channelName = "foo";
  // channel coordinator is on server node
  createChannel(channelName);

  SgsTestNode oldNode = addNode();
  SgsTestNode newNode = addNode();
  MySessionStatusListener oldNodeListener =
      new MySessionStatusListener(true);
  oldNode.getClientSessionService().
      addSessionStatusListener(oldNodeListener);
  MySessionStatusListener newNodeListener =
      new MySessionStatusListener(false);
  newNode.getClientSessionService().
      addSessionStatusListener(newNodeListener);
  String[] users = new String[]{ "relocatingClient" };
  DummyClient relocatingClient = createDummyClient(users[0], oldNode);

  try {
View Full Code Here

    {
  String channelName = "foo";
  // channel coordinator is on server node
  createChannel(channelName);

  SgsTestNode oldNode = addNode();
  SgsTestNode newNode = addNode();
  MySessionStatusListener newNodeListener =
      new MySessionStatusListener(false);
  newNode.getClientSessionService().
      addSessionStatusListener(newNodeListener);
  String[] users = new String[]{ "relocatingClient" };
  DummyClient relocatingClient = createDummyClient(users[0], oldNode);

  try {
View Full Code Here

    }

    protected void setUp(Properties props) throws Exception {
        nodeListenerMap = new HashMap<Long, TestListener>();
       
        serverNode = new SgsTestNode("TestNodeMappingServiceImpl", null, props);
        txnProxy = serverNode.getProxy();
        systemRegistry = serverNode.getSystemRegistry();
        serviceProps = serverNode.getServiceProperties();
        removeTime = Integer.valueOf(
            serviceProps.getProperty(
View Full Code Here

    private void addNodes(Properties props) throws Exception {
        // Create the other nodes
        additionalNodes = new SgsTestNode[NUM_NODES];
       
        for (int i = 0; i < NUM_NODES; i++) {
            SgsTestNode node =  new SgsTestNode(serverNode, null, props);
            additionalNodes[i] = node;
       
            NodeMappingService nmap = node.getNodeMappingService();

            // Add to our test data structures, so we can find these nodes
            // and listeners.
            TestListener listener = new TestListener();       
            nmap.addNodeMappingListener(listener);
            nodeListenerMap.put(node.getNodeId(), listener);
        }
    }
View Full Code Here

    @Test
    @IntegrationTest
    public void testChannelLeaveAllWithCoordinatorCrash() throws Exception {
  final String channelName = "leaveAllTest";
  // Create channel on coordinator node
  SgsTestNode coordinatorNode = addNode();
  createChannel(channelName, null, coordinatorNode);
  // Clients will log into server node.
  ClientGroup group = new ClientGroup(serverNode.getAppPort(), someUsers);
 
  try {
      joinUsers(channelName, someUsers);
      checkUsersJoined(channelName, someUsers);
      holdChannelServerMethodToNode(serverNode, "close");
      leaveAll(channelName);
      waitForHeldChannelServerMethodToNode(serverNode);
      coordinatorNode.shutdown(false);
      Thread.sleep(2000);
      checkUsersJoined(channelName, noUsers);
      for (DummyClient client : group.getClients()) {
    client.assertLeftChannel(channelName);
      }
View Full Code Here

    @Test
    @IntegrationTest
    public void testChannelSendToExistingMembersAfterNodeFailure()
  throws Exception
    {
  SgsTestNode coordinatorNode = addNode();
  SgsTestNode otherNode = addNode();
  ConfigurableNodePolicy.setRoundRobinPolicy();
 
  // create channels on specific node which will be the coordinator node
  String[] channelNames = new String[] {"channel1", "channel2"};
  for (String channelName : channelNames) {
      createChannel(channelName, null, coordinatorNode);
  }
 
  ClientGroup group = new ClientGroup(sevenDwarfs);
  try {
      for (String channelName : channelNames) {
    joinUsers(channelName, sevenDwarfs);
    sendMessagesToChannel(channelName, 2);
    checkChannelMessagesReceived(group, channelName, 2);
      }
      printServiceBindings("after users joined");
      // nuke non-coordinator node
      System.err.println("shutting down other node: " + otherNode);
      int otherNodePort = otherNode.getAppPort();
      shutdownNode(otherNode);
            Thread.sleep(1000);
      // remove disconnected sessions from client group
      System.err.println("remove disconnected sessions");
      ClientGroup disconnectedSessionsGroup =
View Full Code Here

TOP

Related Classes of com.sun.sgs.test.util.SgsTestNode

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.