Author: julien(a)jboss.com
Date: 2007-01-31 20:31:21 -0500 (Wed, 31 Jan 2007)
New Revision: 6136
Modified:
trunk/test/src/main/org/jboss/portal/test/framework/JBossServiceLookup.java
trunk/test/src/main/org/jboss/portal/test/framework/JNDIServiceLookup.java
trunk/test/src/main/org/jboss/portal/test/framework/server/Node.java
trunk/test/src/main/org/jboss/portal/test/framework/server/NodeId.java
trunk/test/src/main/org/jboss/portal/test/framework/server/NodeManager.java
trunk/test/src/resources/portal-test-jar/org/jboss/portal/test/framework/container/jboss-beans.xml
Log:
improves slightly NodeManager/Node bean wiring (which was working but not correct, had to
find a workaround before I discovered that kind of wiring was possible to be done)
Modified: trunk/test/src/main/org/jboss/portal/test/framework/JBossServiceLookup.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/JBossServiceLookup.java 2007-02-01
00:06:56 UTC (rev 6135)
+++ trunk/test/src/main/org/jboss/portal/test/framework/JBossServiceLookup.java 2007-02-01
01:31:21 UTC (rev 6136)
@@ -54,7 +54,7 @@
{
Class proxyClass =
Thread.currentThread().getContextClassLoader().loadClass(proxyClassName);
ObjectName name = new ObjectName(this.name);
- MBeanServer server = node.getServer();
+ MBeanServer server = node.getMBeanServer();
return MBeanProxy.get(proxyClass, name, server);
}
catch (Exception e)
Modified: trunk/test/src/main/org/jboss/portal/test/framework/JNDIServiceLookup.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/JNDIServiceLookup.java 2007-02-01
00:06:56 UTC (rev 6135)
+++ trunk/test/src/main/org/jboss/portal/test/framework/JNDIServiceLookup.java 2007-02-01
01:31:21 UTC (rev 6136)
@@ -25,8 +25,8 @@
import org.jboss.portal.test.framework.server.Node;
-import javax.naming.InitialContext;
import javax.naming.NamingException;
+import javax.naming.Context;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -56,10 +56,10 @@
public Object getService(Node node)
{
- InitialContext ctx = null;
+ Context ctx = null;
try
{
- ctx = node.getInitialContext();
+ ctx = node.getNamingContext();
return ctx.lookup(jndiName);
}
catch (NamingException e)
Modified: trunk/test/src/main/org/jboss/portal/test/framework/server/Node.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/server/Node.java 2007-02-01
00:06:56 UTC (rev 6135)
+++ trunk/test/src/main/org/jboss/portal/test/framework/server/Node.java 2007-02-01
01:31:21 UTC (rev 6136)
@@ -26,6 +26,7 @@
import javax.management.MBeanServer;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import javax.naming.Context;
import java.util.Properties;
/**
@@ -35,36 +36,49 @@
public class Node
{
+ /** . */
private final NodeId id;
- private MBeanServer server;
+ /** . */
+ private final MBeanServer mbeanServer;
- private NodeManager nodeManager;
+ /** . */
+ private final Properties jndiEnv;
- private Properties jndiEnv;
-
- public Node(String id, MBeanServer server, NodeManager nodeManager, Properties
jndiEnv)
+ public Node(String id, MBeanServer mBeanServer, Properties jndiEnv)
{
this.id = new NodeId(id);
- this.server = server;
- this.nodeManager = nodeManager;
+ this.mbeanServer = mBeanServer;
this.jndiEnv = jndiEnv;
-
- //
- nodeManager.nodeMap.put(this.id, this);
}
+ /**
+ * Returns the node id.
+ *
+ * @return the node id
+ */
public NodeId getId()
{
return id;
}
- public MBeanServer getServer()
+ /**
+ * Returns the MBeanServer of the node.
+ *
+ * @return the mbean server
+ */
+ public MBeanServer getMBeanServer()
{
- return server;
+ return mbeanServer;
}
- public InitialContext getInitialContext() throws NamingException
+ /**
+ * Returns the naming context that resolves to the node.
+ *
+ * @return the naming context
+ * @throws NamingException
+ */
+ public Context getNamingContext() throws NamingException
{
return new InitialContext(jndiEnv);
}
Modified: trunk/test/src/main/org/jboss/portal/test/framework/server/NodeId.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/server/NodeId.java 2007-02-01
00:06:56 UTC (rev 6135)
+++ trunk/test/src/main/org/jboss/portal/test/framework/server/NodeId.java 2007-02-01
01:31:21 UTC (rev 6136)
@@ -41,6 +41,7 @@
/** . */
public static final NodeId PORTS_02 = new NodeId("ports-02");
+ /** . */
private final String value;
public NodeId(String value)
@@ -63,19 +64,12 @@
{
return true;
}
- if (o == null || getClass() != o.getClass())
+ if (o instanceof NodeId)
{
- return false;
+ NodeId that = (NodeId)o;
+ return value.equals(that.value);
}
-
- final NodeId nodeId = (NodeId)o;
-
- if (!value.equals(nodeId.value))
- {
- return false;
- }
-
- return true;
+ return false;
}
public int hashCode()
Modified: trunk/test/src/main/org/jboss/portal/test/framework/server/NodeManager.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/server/NodeManager.java 2007-02-01
00:06:56 UTC (rev 6135)
+++ trunk/test/src/main/org/jboss/portal/test/framework/server/NodeManager.java 2007-02-01
01:31:21 UTC (rev 6136)
@@ -26,6 +26,8 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
+import java.util.List;
+import java.util.Iterator;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -34,16 +36,17 @@
public class NodeManager
{
- Map nodeMap;
+ /** The nodes. */
+ private final Map nodeMap;
- public NodeManager()
+ public NodeManager(List nodes)
{
- nodeMap = new HashMap();
-// for (Iterator i = nodes.iterator(); i.hasNext();)
-// {
-// Node node = (Node)i.next();
-// nodeMap.put(node.getId(), node);
-// }
+ this.nodeMap = new HashMap();
+ for (Iterator i = nodes.iterator();i.hasNext();)
+ {
+ Node node = (Node)i.next();
+ nodeMap.put(node.getId(), node);
+ }
}
public Collection getNodes()
Modified:
trunk/test/src/resources/portal-test-jar/org/jboss/portal/test/framework/container/jboss-beans.xml
===================================================================
---
trunk/test/src/resources/portal-test-jar/org/jboss/portal/test/framework/container/jboss-beans.xml 2007-02-01
00:06:56 UTC (rev 6135)
+++
trunk/test/src/resources/portal-test-jar/org/jboss/portal/test/framework/container/jboss-beans.xml 2007-02-01
01:31:21 UTC (rev 6136)
@@ -88,7 +88,6 @@
<constructor>
<parameter><value>default</value></parameter>
<parameter><inject bean="MBeanServerFactory0"
property="server"/></parameter>
- <parameter><inject bean="NodeManager"/></parameter>
<parameter name="jndiEnv">
<map class="java.util.Properties"
keyClass="java.lang.String" valueClass="java.lang.String">
<entry>
@@ -112,7 +111,6 @@
<constructor>
<parameter><value>ports-01</value></parameter>
<parameter><inject bean="MBeanServerFactory1"
property="server"/></parameter>
- <parameter><inject bean="NodeManager"/></parameter>
<parameter name="jndiEnv">
<map class="java.util.Properties"
keyClass="java.lang.String" valueClass="java.lang.String">
<entry>
@@ -136,7 +134,6 @@
<constructor>
<parameter><value>ports-02</value></parameter>
<parameter><inject bean="MBeanServerFactory2"
property="server"/></parameter>
- <parameter><inject bean="NodeManager"/></parameter>
<parameter name="jndiEnv">
<map class="java.util.Properties"
keyClass="java.lang.String" valueClass="java.lang.String">
<entry>
@@ -169,6 +166,15 @@
</bean>
<bean name="NodeManager"
class="org.jboss.portal.test.framework.server.NodeManager">
+ <constructor>
+ <parameter>
+ <list>
+ <inject bean="Node0"/>
+ <inject bean="Node1"/>
+ <inject bean="Node2"/>
+ </list>
+ </parameter>
+ </constructor>
</bean>
<bean name="Deployer"
class="org.jboss.portal.test.framework.deployment.Deployer">
Show replies by date