[jboss-cvs] JBossAS SVN: r74023 - in projects/cluster/ha-client/tags: 1.1.0.GA and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jun 3 16:53:24 EDT 2008
Author: bstansberry at jboss.com
Date: 2008-06-03 16:53:24 -0400 (Tue, 03 Jun 2008)
New Revision: 74023
Added:
projects/cluster/ha-client/tags/1.1.0.GA/
projects/cluster/ha-client/tags/1.1.0.GA/pom.xml
projects/cluster/ha-client/tags/1.1.0.GA/src/main/java/org/jboss/aspects/remoting/ClusterConstants.java
projects/cluster/ha-client/tags/1.1.0.GA/src/main/java/org/jboss/aspects/remoting/ClusteredPojiProxy.java
projects/cluster/ha-client/tags/1.1.0.GA/src/test/java/org/jboss/test/aspects/remoting/ClusteredPojiProxyUnitTestCase.java
Removed:
projects/cluster/ha-client/tags/1.1.0.GA/pom.xml
projects/cluster/ha-client/tags/1.1.0.GA/src/main/java/org/jboss/aspects/remoting/ClusterConstants.java
Log:
[maven-release-plugin] copy for tag 1.1.0.GA
Copied: projects/cluster/ha-client/tags/1.1.0.GA (from rev 73569, projects/cluster/ha-client/trunk)
Deleted: projects/cluster/ha-client/tags/1.1.0.GA/pom.xml
===================================================================
--- projects/cluster/ha-client/trunk/pom.xml 2008-05-21 23:22:01 UTC (rev 73569)
+++ projects/cluster/ha-client/tags/1.1.0.GA/pom.xml 2008-06-03 20:53:24 UTC (rev 74023)
@@ -1,139 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.jboss.cluster</groupId>
- <artifactId>jboss-cluster</artifactId>
- <version>1.1.0.Beta1</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.cluster</groupId>
- <artifactId>jboss-ha-client</artifactId>
- <packaging>jar</packaging>
- <version>1.1.0.Beta2</version>
- <name>JBoss Cluster HA Client Classes</name>
- <url>http://www.jboss.org</url>
- <description>A set of client-side classes commonly used by applications that want HA</description>
- <licenses>
- <license>
- <name>lgpl</name>
- <url>http://repository.jboss.com/licenses/lgpl.txt</url>
- </license>
- </licenses>
- <organization>
- <name>JBoss, a division of Red Hat, Inc.</name>
- <url>http://www.jboss.org</url>
- </organization>
-
- <scm>
- <connection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/cluster/ha-client/trunk/</connection>
- </scm>
-
- <properties>
- <version.jboss.common.core>[2.2.5.GA,)</version.jboss.common.core>
- <version.jboss.remoting.aspects>1.0.0.Beta1</version.jboss.remoting.aspects>
- <version.jboss.remoting>[2.4.0.CR1,)</version.jboss.remoting>
- <version.jboss.aop>[2.0.0.CR8,)</version.jboss.aop>
- <version.junit>3.8.1</version.junit>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <!-- The tagBase property is needed during the release process so that the maven release plugin
- will create the release tag in the appropriate location. -->
- <tagBase>https://svn.jboss.org/repos/jbossas/projects/cluster/ha-client/tags</tagBase>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <!-- Global dependencies -->
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- <version>${version.jboss.common.core}</version>
- </dependency>
-
- <!-- Only needed if you are using the remoting based interceptors -->
- <dependency>
- <groupId>org.jboss.aspects</groupId>
- <artifactId>jboss-remoting-aspects</artifactId>
- <version>${version.jboss.remoting.aspects}</version>
- <!-- <optional>true</optional>-->
- <exclusions>
- <!-- Get logging via jboss-common-core -->
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </exclusion>
- <!-- Don't pull in the other aspects libraries -->
- <exclusion>
- <groupId>org.jboss.aspects</groupId>
- <artifactId>jboss-transaction-aspects</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.aspects</groupId>
- <artifactId>jboss-security-aspects</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>jboss.remoting</groupId>
- <artifactId>jboss-remoting</artifactId>
- <version>${version.jboss.remoting}</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.jboss.aop</groupId>
- <artifactId>jboss-aop</artifactId>
- <version>${version.jboss.aop}</version>
- <optional>true</optional>
- <exclusions>
- <!-- Don't pull in all the stuff from aop -->
- <exclusion>
- <groupId>ant</groupId>
- <artifactId>ant</artifactId>
- </exclusion>
- <exclusion>
- <groupId>apache-xerces</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>javassist</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-container</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-common-logging-spi</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-common-logging-log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>qdox</groupId>
- <artifactId>qdox</artifactId>
- </exclusion>
- <exclusion>
- <groupId>trove</groupId>
- <artifactId>trove</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- Test dependencies -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${version.junit}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
-
Copied: projects/cluster/ha-client/tags/1.1.0.GA/pom.xml (from rev 74022, projects/cluster/ha-client/trunk/pom.xml)
===================================================================
--- projects/cluster/ha-client/tags/1.1.0.GA/pom.xml (rev 0)
+++ projects/cluster/ha-client/tags/1.1.0.GA/pom.xml 2008-06-03 20:53:24 UTC (rev 74023)
@@ -0,0 +1,139 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>jboss-cluster</artifactId>
+ <version>1.1.0.GA</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.cluster</groupId>
+ <artifactId>jboss-ha-client</artifactId>
+ <packaging>jar</packaging>
+ <version>1.1.0.GA</version>
+ <name>JBoss Cluster HA Client Classes</name>
+ <url>http://www.jboss.org</url>
+ <description>A set of client-side classes commonly used by applications that want HA</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss, a division of Red Hat, Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+
+ <scm>
+ <connection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/cluster/ha-client/tags/1.1.0.GA</connection>
+ </scm>
+
+ <properties>
+ <version.jboss.common.core>2.2.5.GA</version.jboss.common.core>
+ <version.jboss.remoting.aspects>1.0.1.CR2</version.jboss.remoting.aspects>
+ <version.jboss.remoting>2.4.0.GA</version.jboss.remoting>
+ <version.jboss.aop>2.0.0.CR11</version.jboss.aop>
+ <version.junit>3.8.1</version.junit>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <!-- The tagBase property is needed during the release process so that the maven release plugin
+ will create the release tag in the appropriate location. -->
+ <tagBase>https://svn.jboss.org/repos/jbossas/projects/cluster/ha-client/tags</tagBase>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <!-- Global dependencies -->
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ <version>${version.jboss.common.core}</version>
+ </dependency>
+
+ <!-- Only needed if you are using the remoting based interceptors -->
+ <dependency>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-remoting-aspects</artifactId>
+ <version>${version.jboss.remoting.aspects}</version>
+ <!-- <optional>true</optional>-->
+ <exclusions>
+ <!-- Get logging via jboss-common-core -->
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ <!-- Don't pull in the other aspects libraries -->
+ <exclusion>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-transaction-aspects</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.aspects</groupId>
+ <artifactId>jboss-security-aspects</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.remoting</groupId>
+ <artifactId>jboss-remoting</artifactId>
+ <version>${version.jboss.remoting}</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop</artifactId>
+ <version>${version.jboss.aop}</version>
+ <optional>true</optional>
+ <exclusions>
+ <!-- Don't pull in all the stuff from aop -->
+ <exclusion>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>apache-xerces</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-container</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common-logging-spi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common-logging-log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>qdox</groupId>
+ <artifactId>qdox</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>trove</groupId>
+ <artifactId>trove</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
+
Deleted: projects/cluster/ha-client/tags/1.1.0.GA/src/main/java/org/jboss/aspects/remoting/ClusterConstants.java
===================================================================
--- projects/cluster/ha-client/trunk/src/main/java/org/jboss/aspects/remoting/ClusterConstants.java 2008-05-21 23:22:01 UTC (rev 73569)
+++ projects/cluster/ha-client/tags/1.1.0.GA/src/main/java/org/jboss/aspects/remoting/ClusterConstants.java 2008-06-03 20:53:24 UTC (rev 74023)
@@ -1,39 +0,0 @@
-/*
- * 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.aspects.remoting;
-
-/**
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision: 37406 $
- */
-
-public interface ClusterConstants
-{
- public static final String CLUSTERED_REMOTING = "CLUSTERED_REMOTING";
- public static final String LOADBALANCE_POLICY = "LOADBALANCE_POLICY";
- public static final String FAILOVER_COUNTER = "FAILOVER_COUNTER";
- public static final String CLUSTER_FAMILY_WRAPPER = "CLUSTER_FAMILY_WRAPPER";
- public static final String CLUSTER_FAMILY = "CLUSTER_FAMILY";
- public static final String CLUSTER_FAMILIES = "CLUSTER_FAMILIES";
- public static final String HA_TARGET = "HA_TARGET";
- public static final String CLUSTER_VIEW_ID = "CLUSTER_VIEW_ID";
-}
Copied: projects/cluster/ha-client/tags/1.1.0.GA/src/main/java/org/jboss/aspects/remoting/ClusterConstants.java (from rev 73593, projects/cluster/ha-client/trunk/src/main/java/org/jboss/aspects/remoting/ClusterConstants.java)
===================================================================
--- projects/cluster/ha-client/tags/1.1.0.GA/src/main/java/org/jboss/aspects/remoting/ClusterConstants.java (rev 0)
+++ projects/cluster/ha-client/tags/1.1.0.GA/src/main/java/org/jboss/aspects/remoting/ClusterConstants.java 2008-06-03 20:53:24 UTC (rev 74023)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.aspects.remoting;
+
+/**
+ * Set of constants used in remoting clustered objects (mostly
+ * as metadata keys in an Invocation).
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 37406 $
+ */
+public interface ClusterConstants
+{
+ public static final String CLUSTERED_REMOTING = "CLUSTERED_REMOTING";
+ public static final String LOADBALANCE_POLICY = "LOADBALANCE_POLICY";
+ public static final String FAILOVER_COUNTER = "FAILOVER_COUNTER";
+ public static final String CLUSTER_FAMILY_WRAPPER = "CLUSTER_FAMILY_WRAPPER";
+ public static final String CLUSTER_FAMILY = "CLUSTER_FAMILY";
+ public static final String CLUSTER_FAMILIES = "CLUSTER_FAMILIES";
+ public static final String PARTITION_NAME = "PARTITION_NAME";
+ public static final String HA_TARGET = "HA_TARGET";
+ public static final String CLUSTER_VIEW_ID = "CLUSTER_VIEW_ID";
+}
Copied: projects/cluster/ha-client/tags/1.1.0.GA/src/main/java/org/jboss/aspects/remoting/ClusteredPojiProxy.java (from rev 73593, projects/cluster/ha-client/trunk/src/main/java/org/jboss/aspects/remoting/ClusteredPojiProxy.java)
===================================================================
--- projects/cluster/ha-client/tags/1.1.0.GA/src/main/java/org/jboss/aspects/remoting/ClusteredPojiProxy.java (rev 0)
+++ projects/cluster/ha-client/tags/1.1.0.GA/src/main/java/org/jboss/aspects/remoting/ClusteredPojiProxy.java 2008-06-03 20:53:24 UTC (rev 74023)
@@ -0,0 +1,81 @@
+/*
+ * 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.aspects.remoting;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.MethodInvocation;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.aop.util.PayloadKey;
+import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
+import org.jboss.remoting.InvokerLocator;
+
+/**
+ * InvocationHandler that generates an aop {@link MethodInvocation} and
+ * populates its metadata with a target URI as well as various pieces of
+ * clustering metadata.
+ *
+ * @author Brian Stansberry, based on work by Bill Burke
+ */
+public class ClusteredPojiProxy implements java.io.Serializable, InvocationHandler
+{
+ private static final long serialVersionUID = 8054816523858555978L;
+
+ private Object oid;
+ private InvokerLocator uri;
+ private Interceptor[] interceptors;
+ private FamilyWrapper family;
+ private LoadBalancePolicy lbPolicy;
+ private String partitionName;
+ private Object originTarget;
+
+ public ClusteredPojiProxy(Object oid, InvokerLocator uri, Interceptor[] interceptors,
+ FamilyWrapper family, LoadBalancePolicy lb,
+ String partitionName, Object originTarget)
+ {
+ this.oid = oid;
+ this.uri = uri;
+ this.interceptors = interceptors;
+ this.family = family;
+ this.lbPolicy = lb;
+ this.partitionName = partitionName;
+ this.originTarget = originTarget;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ long hash = MethodHashing.calculateHash(method);
+ MethodInvocation sri = new MethodInvocation(interceptors, hash, method, method, null);
+ sri.setArguments(args);
+ sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.CLUSTER_FAMILY_WRAPPER, family, PayloadKey.TRANSIENT);
+ sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.LOADBALANCE_POLICY, lbPolicy, PayloadKey.TRANSIENT);
+ sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.PARTITION_NAME, partitionName, PayloadKey.TRANSIENT);
+ if (originTarget != null)
+ sri.getMetaData().addMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.HA_TARGET, originTarget, PayloadKey.TRANSIENT);
+ sri.getMetaData().addMetaData(Dispatcher.DISPATCHER, Dispatcher.OID, oid, PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR, uri, PayloadKey.AS_IS);
+ sri.getMetaData().addMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM, "AOP", PayloadKey.AS_IS);
+ return sri.invokeNext();
+ }
+}
Copied: projects/cluster/ha-client/tags/1.1.0.GA/src/test/java/org/jboss/test/aspects/remoting/ClusteredPojiProxyUnitTestCase.java (from rev 73593, projects/cluster/ha-client/trunk/src/test/java/org/jboss/test/aspects/remoting/ClusteredPojiProxyUnitTestCase.java)
===================================================================
--- projects/cluster/ha-client/tags/1.1.0.GA/src/test/java/org/jboss/test/aspects/remoting/ClusteredPojiProxyUnitTestCase.java (rev 0)
+++ projects/cluster/ha-client/tags/1.1.0.GA/src/test/java/org/jboss/test/aspects/remoting/ClusteredPojiProxyUnitTestCase.java 2008-06-03 20:53:24 UTC (rev 74023)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.test.aspects.remoting;
+
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.metadata.SimpleMetaData;
+import org.jboss.aop.util.PayloadKey;
+import org.jboss.aspects.remoting.ClusterConstants;
+import org.jboss.aspects.remoting.ClusteredPojiProxy;
+import org.jboss.aspects.remoting.FamilyWrapper;
+import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
+import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
+import org.jboss.ha.client.loadbalance.RoundRobin;
+import org.jboss.remoting.InvokerLocator;
+
+/**
+ * Unit tests for {@link ClusteredPojiProxy}.
+ *
+ * @author Brian Stansberry
+ *
+ */
+public class ClusteredPojiProxyUnitTestCase extends TestCase
+{
+ protected static final String[] TARGETS = { "A", "B", "C" };
+ protected static final String FAMILY_BASE = "ClusteredPojiProxy";
+ protected static final String MOCK_URI = "http://localhost";
+ protected static final String OK = "OK";
+ protected static int testCount = 0;
+
+ /**
+ * Create a new ClusteredPojiProxyUnitTestCase.
+ *
+ * @param name
+ */
+ public ClusteredPojiProxyUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Tests that the proxy sets the expected metadata
+ */
+ public void testInvocationMetaData() throws Throwable
+ {
+ invocationMetaDataTest(TARGETS[0]);
+ }
+
+ /**
+ * Tests that the proxy sets the expected metadata when no originTarget
+ * is provided.
+ */
+ public void testNullOriginTarget() throws Throwable
+ {
+ invocationMetaDataTest(null);
+ }
+
+ private void invocationMetaDataTest(Object originTarget) throws Throwable
+ {
+ testCount++;
+ List<String> targets = Arrays.asList(TARGETS);
+ FamilyWrapper wrapper = new FamilyWrapper(FAMILY_BASE + testCount, targets);
+
+ MockNextInterceptor interceptor = new MockNextInterceptor();
+ interceptor.setReturnValue(OK);
+
+ Object oid = new Object();
+ LoadBalancePolicy lbp = new RoundRobin();
+ InvokerLocator uri = new InvokerLocator(MOCK_URI);
+ ClusteredPojiProxy proxy = new ClusteredPojiProxy(oid, uri, new Interceptor[]{interceptor}, wrapper, lbp, FAMILY_BASE, originTarget);
+
+ assertEquals(OK, proxy.invoke(this, Object.class.getDeclaredMethod("toString", new Class[]{}), new Object[]{}));
+
+ List<SimpleMetaData> history = interceptor.getInvocationHistory();
+ SimpleMetaData metadata = history.get(0);
+ assertSame(wrapper, metadata.getMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.CLUSTER_FAMILY_WRAPPER));
+ assertSame(lbp, metadata.getMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.LOADBALANCE_POLICY));
+ assertSame(FAMILY_BASE, metadata.getMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.PARTITION_NAME));
+ assertSame(originTarget, metadata.getMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.HA_TARGET));
+ assertSame(oid, metadata.getMetaData(Dispatcher.DISPATCHER, Dispatcher.OID));
+ assertSame(uri, metadata.getMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR));
+ assertEquals("AOP", metadata.getMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.SUBSYSTEM));
+
+ }
+
+}
More information about the jboss-cvs-commits
mailing list