[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jboss-cvs-commits
Subject:    [jboss-cvs]
From:       Julien Viet <julien () jboss ! com>
Date:       2006-06-30 23:51:02
Message-ID: E1FwSlK-0003Bd-Mp () committer01 ! frg ! pub ! inap ! atl ! jboss ! com
[Download RAW message or body]

  User: julien  
  Date: 06/06/30 19:51:02

  Added:       test/src/main/org/jboss/portal/test/framework/server   
                        Node.java NodeId.java NodeManager.java
  Log:
  add notion of Node and NodeManager in test framework to allow deploy/invoke a set \
of Node in order to implement clustering unit testing for portlet session replication \
  Revision  Changes    Path
  1.1      date: 2006/06/30 23:51:02;  author: julien;  state: \
Exp;jboss-portal/test/src/main/org/jboss/portal/test/framework/server/Node.java  
  Index: Node.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
  package org.jboss.portal.test.framework.server;
  
  import javax.management.MBeanServer;
  
  /**
   * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
   * @version $Revision: 1.1 $
   */
  public class Node
  {
  
     private final NodeId id;
  
     private MBeanServer server;
  
     private NodeManager nodeManager;
  
     public Node(String id, MBeanServer server, NodeManager nodeManager)
     {
        this.id = new NodeId(id);
        this.server = server;
        this.nodeManager = nodeManager;
  
        //
        nodeManager.nodeMap.put(this.id, this);
     }
  
     public NodeId getId()
     {
        return id;
     }
  
     public MBeanServer getServer()
     {
        return server;
     }
  
     public String toString()
     {
        return "Node[" + id + "]";
     }
  }
  
  
  
  1.1      date: 2006/06/30 23:51:02;  author: julien;  state: \
Exp;jboss-portal/test/src/main/org/jboss/portal/test/framework/server/NodeId.java  
  Index: NodeId.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
  package org.jboss.portal.test.framework.server;
  
  import java.io.Serializable;
  
  /**
   * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
   * @version $Revision: 1.1 $
   */
  public class NodeId implements Serializable
  {
  
     /** . */
     public static final NodeId DEFAULT = new NodeId("default");
  
     /** . */
     public static final NodeId PORTS_01 = new NodeId("ports-01");
  
     /** . */
     public static final NodeId PORTS_02 = new NodeId("ports-02");
  
     private final String value;
  
     public NodeId(String value)
     {
        if (value == null)
        {
           throw new IllegalArgumentException("No null value accepted");
        }
        this.value = value;
     }
  
     public String toString()
     {
        return value;
     }
  
     public boolean equals(Object o)
     {
        if (this == o)
        {
           return true;
        }
        if (o == null || getClass() != o.getClass())
        {
           return false;
        }
  
        final NodeId nodeId = (NodeId)o;
  
        if (!value.equals(nodeId.value))
        {
           return false;
        }
  
        return true;
     }
  
     public int hashCode()
     {
        return value.hashCode();
     }
  
     /**
      * Return the current node id.
      *
      * @return the current node id
      * @throws IllegalStateException if not in a node context 
      */
     public static NodeId locate() throws IllegalStateException
     {
        String serverName = System.getProperty("jboss.server.name");
        if (serverName == null)
        {
           throw new IllegalStateException("Not in a node context");
        }
        return new NodeId(serverName);
     }
  }
  
  
  
  1.1      date: 2006/06/30 23:51:02;  author: julien;  state: \
Exp;jboss-portal/test/src/main/org/jboss/portal/test/framework/server/NodeManager.java
  
  Index: NodeManager.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
  package org.jboss.portal.test.framework.server;
  
  import org.jboss.portal.test.framework.server.Node;
  import org.jboss.portal.test.framework.server.NodeId;
  
  import java.util.Map;
  import java.util.HashMap;
  import java.util.Collection;
  
  /**
   * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
   * @version $Revision: 1.1 $
   */
  public class NodeManager
  {
  
     Map nodeMap;
  
     public NodeManager()
     {
        nodeMap = new HashMap();
  //      for (Iterator i = nodes.iterator(); i.hasNext();)
  //      {
  //         Node node = (Node)i.next();
  //         nodeMap.put(node.getId(), node);
  //      }
     }
  
     public Collection getNodes()
     {
        return nodeMap.values();
     }
  
     public Node getNode(NodeId nodeId)
     {
        return (Node)nodeMap.get(nodeId);
     }
  }
  
  
  

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic