[jboss-cvs] JBossAS SVN: r68928 - branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Jan 13 17:22:03 EST 2008
Author: galder.zamarreno at jboss.com
Date: 2008-01-13 17:22:02 -0500 (Sun, 13 Jan 2008)
New Revision: 68928
Added:
branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/AbstractInvokerHaTransactionSticky.java
branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/InvokerHaFailureType.java
branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaTransactionStickyUnitTestCase.java
branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaTransactionStickyUnitTestCase.java
Modified:
branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/AbstractInvokerHa.java
branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/InvokerHaInfrastructure.java
branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaMockUtils.java
branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaUnitTestCase.java
branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaMockUtils.java
branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaUnitTestCase.java
Log:
[JBAS-4455] New test classes added to test the new transaction sticky lbps and the behaivour of the invoker ha proxies. These tests include both successfull and failure scenarios.
Modified: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/AbstractInvokerHa.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/AbstractInvokerHa.java 2008-01-13 22:20:00 UTC (rev 68927)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/AbstractInvokerHa.java 2008-01-13 22:22:02 UTC (rev 68928)
@@ -22,7 +22,6 @@
package org.jboss.test.cluster.invokerha;
import java.rmi.server.UID;
-import java.util.WeakHashMap;
import javax.transaction.Transaction;
@@ -48,19 +47,19 @@
{
private static final Logger log = Logger.getLogger(AbstractInvokerHa.class);
- private InvokerHaInfrastructure infrastructure;
+ InvokerHaInfrastructure infrastructure;
- private InvokerHaTransactionalMockUtils transactionalMockUtils;
+ InvokerHaTransactionalMockUtils transactionalMockUtils;
- private InvokerHaFactory invokerHaFactory;
+ InvokerHaFactory invokerHaFactory;
- private Invoker timeTellerProxy;
+ Invoker timeTellerProxy;
- private Invoker systemTimeProxy;
+ Invoker systemTimeProxy;
- private Object prevChosenTargetDateTimeTeller;
+ Object prevChosenTargetDateTimeTeller;
- private Object prevChosenTargetSystemTimeTeller;
+ Object prevChosenTargetSystemTimeTeller;
protected void setUp(int serverCount, InvokerHaFactory factory) throws Exception
{
@@ -96,41 +95,41 @@
infrastructure.undeployServers();
}
- public void testSuccessfulCallsRoundRobin() throws Exception
+ public void testTransactionalSuccessfulCallsRoundRobin() throws Exception
{
/* same proxies used in simulated transactions */
- successfulCalls(TraceRoundRobin.class, false);
+ transactionalSuccessfulCalls(TraceRoundRobin.class, false);
/* different proxies in simulated transactions */
- successfulCalls(TraceRoundRobin.class, true);
+ transactionalSuccessfulCalls(TraceRoundRobin.class, true);
}
- public void testSuccessfulCallsFirstAvailable() throws Exception
+ public void testTransactionalSuccessfulCallsFirstAvailable() throws Exception
{
/* same proxies used in simulated transactions */
- successfulCalls(TraceFirstAvailable.class, false);
+ transactionalSuccessfulCalls(TraceFirstAvailable.class, false);
/* same proxies used in simulated transactions */
- successfulCalls(TraceFirstAvailable.class, true);
+ transactionalSuccessfulCalls(TraceFirstAvailable.class, true);
}
- public void testSuccessfulCallsFirstAvailableIndenticalAllProxies() throws Exception
+ public void testTransactionalSuccessfulCallsFirstAvailableIndenticalAllProxies() throws Exception
{
/* same proxies used in simulated transactions */
- successfulCalls(TraceFirstAvailableIdenticalAllProxies.class, false);
+ transactionalSuccessfulCalls(TraceFirstAvailableIdenticalAllProxies.class, false);
/* same proxies used in simulated transactions */
- successfulCalls(TraceFirstAvailableIdenticalAllProxies.class, true);
+ transactionalSuccessfulCalls(TraceFirstAvailableIdenticalAllProxies.class, true);
}
- public void testSuccessfulCallsRandomRobin() throws Exception
+ public void testTransactionalSuccessfulCallsRandomRobin() throws Exception
{
/* same proxies used in simulated transactions */
- successfulCalls(TraceRandomRobin.class, false);
+ transactionalSuccessfulCalls(TraceRandomRobin.class, false);
/* same proxies used in simulated transactions */
- successfulCalls(TraceRandomRobin.class, true);
+ transactionalSuccessfulCalls(TraceRandomRobin.class, true);
}
- protected void successfulCalls(Class<? extends LoadBalancePolicy> policyClass, boolean newProxiesInBetweenTransactions)
+ protected void transactionalSuccessfulCalls(Class<? extends LoadBalancePolicy> policyClass, boolean newProxiesInBetweenTransactions)
{
- log.debug("successfull calls [policy=" + policyClass + ",newProxiesInBetweenTransactions=" + newProxiesInBetweenTransactions + "]");
+ log.debug("transactional successfull calls [policy=" + policyClass + ",newProxiesInBetweenTransactions=" + newProxiesInBetweenTransactions + "]");
try
{
@@ -141,7 +140,7 @@
/* Simulate client user transaction */
uid = new UID();
transactionalMockUtils.getTpcf().setUid(uid);
- callsWithinTransaction(3, null, policyClass, newProxiesInBetweenTransactions);
+ performCalls(3, null, policyClass);
if (newProxiesInBetweenTransactions)
{
@@ -153,7 +152,7 @@
Transaction tx = new MockTransaction();
transactionalMockUtils.getTpcf().setUid(uid);
transactionalMockUtils.getTpci().setTransaction(tx);
- callsWithinTransaction(3, tx, policyClass, newProxiesInBetweenTransactions);
+ performCalls(3, tx, policyClass);
}
catch(Exception e)
{
@@ -164,47 +163,43 @@
}
}
- protected void callsWithinTransaction(int numberPairCalls,
- Transaction tx, Class<? extends LoadBalancePolicy> policyClass,
- boolean newProxiesInBetweenTransactions) throws Exception
+ protected void performCalls(int numberPairCalls,
+ Transaction tx, Class<? extends LoadBalancePolicy> policyClass) throws Exception
{
Invocation inv;
- Object chosenTarget;
- WeakHashMap txFailoverAuthorizations = invokerHaFactory.getTxFailoverAuthorizationsMap();
-
for (int i = 0; i < numberPairCalls; i++)
{
/* create invocation to date time teller */
- inv = infrastructure.createDateTimeTellerInvocation(tx);
+ inv = infrastructure.createDateTimeTellerInvocation(tx, null);
/* invoke on proxy passing the invocation */
log.debug(timeTellerProxy.invoke(inv));
-
- assertEquals(0, inv.getAsIsValue("FAILOVER_COUNTER"));
- chosenTarget = inv.getTransientValue("TEST_CHOSEN_TARGET");
- assertNotNull(chosenTarget);
- /* if tx was null, invocation's tx should be null after invocation. */
- assertEquals(tx, inv.getTransaction());
- /* check tx failover authorisations */
- assertTrue("transaction should have reached the server", txFailoverAuthorizations.containsKey(transactionalMockUtils.getTpcf().getUid()));
- /* check chosen target with previously chosen target, if there's any */
- prevChosenTargetDateTimeTeller = assertChosenTarget(policyClass, chosenTarget, prevChosenTargetDateTimeTeller);
+ /* assert post conditions after invocation */
+ prevChosenTargetDateTimeTeller = assertSuccessfulPostConditions(inv, prevChosenTargetDateTimeTeller, tx, policyClass);
/* create invocation to system time teller */
- inv = infrastructure.createSystemTimeTellerInvocation(tx);
+ inv = infrastructure.createSystemTimeTellerInvocation(tx, null);
/* invoke on proxy passing the invocation */
log.debug(systemTimeProxy.invoke(inv));
-
- assertEquals(0, inv.getAsIsValue("FAILOVER_COUNTER"));
- chosenTarget = inv.getTransientValue("TEST_CHOSEN_TARGET");
- assertNotNull(chosenTarget);
- /* if tx was null, invocation's tx should be null after invocation. */
- assertEquals(tx, inv.getTransaction());
+ /* assert post conditions after invocation */
+ prevChosenTargetSystemTimeTeller = assertSuccessfulPostConditions(inv, prevChosenTargetSystemTimeTeller, tx, policyClass);
+ }
+ }
+
+ protected Object assertSuccessfulPostConditions(Invocation inv, Object prevChosenTarget, Transaction tx, Class<? extends LoadBalancePolicy> policyClass)
+ {
+ assertEquals(0, inv.getAsIsValue("FAILOVER_COUNTER"));
+ Object chosenTarget = inv.getTransientValue(invokerHaFactory.getChosenTargetKey());
+ assertNotNull(chosenTarget);
+ /* if tx was null, invocation's tx should be null after invocation. */
+ assertEquals(tx, inv.getTransaction());
+ if (transactionalMockUtils.getTpcf().getUid() != null)
+ {
/* check tx failover authorisations */
- assertTrue("transaction should have reached the server", txFailoverAuthorizations.containsKey(transactionalMockUtils.getTpcf().getUid()));
- /* check chosen target with previously chosen target, if there's any */
- prevChosenTargetSystemTimeTeller = assertChosenTarget(policyClass, chosenTarget, prevChosenTargetSystemTimeTeller);
+ assertTrue("transaction should have reached the server", invokerHaFactory.getTxFailoverAuthorizationsMap().containsKey(transactionalMockUtils.getTpcf().getUid()));
}
+ /* check chosen target with previously chosen target, if there's any */
+ return assertChosenTarget(policyClass, chosenTarget, prevChosenTarget);
}
protected void createNewProxies(int serverIndex, Class<? extends LoadBalancePolicy> policyClass, boolean isVery1st) throws Exception
Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/AbstractInvokerHaTransactionSticky.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/AbstractInvokerHaTransactionSticky.java (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/AbstractInvokerHaTransactionSticky.java 2008-01-13 22:22:02 UTC (rev 68928)
@@ -0,0 +1,368 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.cluster.invokerha;
+
+import java.rmi.server.UID;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.transaction.Transaction;
+
+import org.jboss.ha.framework.interfaces.LoadBalancePolicy;
+import org.jboss.ha.framework.interfaces.TransactionStickyFirstAvailable;
+import org.jboss.ha.framework.interfaces.TransactionStickyFirstAvailableIdenticalAllProxies;
+import org.jboss.ha.framework.interfaces.TransactionStickyRandomRobin;
+import org.jboss.ha.framework.interfaces.TransactionStickyRoundRobin;
+import org.jboss.invocation.Invocation;
+import org.jboss.logging.Logger;
+import org.jboss.test.cluster.invokerha.InvokerHaTransactionalMockUtils.MockTransaction;
+
+/**
+ * AbstractInvokerHaTransactionSticky.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class AbstractInvokerHaTransactionSticky extends AbstractInvokerHa
+{
+ private static final Logger log = Logger.getLogger(AbstractInvokerHaTransactionSticky.class);
+
+ private Set<Object> chosenTargets;
+
+ @Override
+ public void testTransactionalSuccessfulCallsRoundRobin() throws Exception
+ {
+ /* same proxies used in simulated transactions */
+ transactionalSuccessfulCalls(TransactionStickyRoundRobin.class, false);
+ /* different proxies in simulated transactions */
+ transactionalSuccessfulCalls(TransactionStickyRoundRobin.class, true);
+ }
+
+ @Override
+ public void testTransactionalSuccessfulCallsFirstAvailable() throws Exception
+ {
+ /* same proxies used in simulated transactions */
+ transactionalSuccessfulCalls(TransactionStickyFirstAvailable.class, false);
+ /* different proxies in simulated transactions */
+ transactionalSuccessfulCalls(TransactionStickyFirstAvailable.class, true);
+ }
+
+ @Override
+ public void testTransactionalSuccessfulCallsFirstAvailableIndenticalAllProxies() throws Exception
+ {
+ /* same proxies used in simulated transactions */
+ transactionalSuccessfulCalls(TransactionStickyFirstAvailableIdenticalAllProxies.class, false);
+ /* different proxies in simulated transactions */
+ transactionalSuccessfulCalls(TransactionStickyFirstAvailableIdenticalAllProxies.class, true);
+ }
+
+ @Override
+ public void testTransactionalSuccessfulCallsRandomRobin() throws Exception
+ {
+ /* same proxies used in simulated transactions */
+ transactionalSuccessfulCalls(TransactionStickyRandomRobin.class, false);
+ /* different proxies in simulated transactions */
+ transactionalSuccessfulCalls(TransactionStickyRandomRobin.class, true);
+ }
+
+ public void testSuccessfulCallsRoundRobin() throws Exception
+ {
+ /* test transaction sticky round robin lbp without transactions, should
+ * behave like standard round robin */
+ successfulCalls(TransactionStickyRoundRobin.class);
+ }
+
+ public void testSuccessfulCallsFirstAvailable() throws Exception
+ {
+ /* test transaction sticky first available lbp without transactions, should
+ * behave like standard first available */
+ successfulCalls(TransactionStickyFirstAvailable.class);
+ }
+
+ public void testSuccessfulCallsFirstAvailableIndenticalAllProxies() throws Exception
+ {
+ /* test transaction sticky first available identical all proxies lbp
+ * without transactions, should behave like standard identical all
+ * proxies */
+ successfulCalls(TransactionStickyFirstAvailableIdenticalAllProxies.class);
+ }
+
+ public void testSuccessfulCallsRandomRobin() throws Exception
+ {
+ /* test transaction sticky random robin lbp without transactions, should
+ * behave like standard random robin */
+ successfulCalls(TransactionStickyRandomRobin.class);
+ }
+
+ public void testFailBeforeServer() throws Exception
+ {
+ /* if failure happens before reaching the server, regardless of whether
+ * the failure happened in the 1st or the Nth invocation, it's not
+ * recoverable */
+ transactionalFailureCalls(InvokerHaFailureType.BEFORE_SERVER, TransactionStickyRandomRobin.class, false);
+ }
+
+ public void testFailAfterServerNotCompletedButSuccessAfter() throws Exception
+ {
+ /* we use new proxies in between tests for 1st and Nth
+ * call so that results from Nth call don't get polluted with what
+ * happened in the 1st call test. */
+ transactionalFailureCalls(InvokerHaFailureType.AFTER_SERVER_NOT_COMPLETED_BUT_SUCCESS_AFTER, TransactionStickyRandomRobin.class, true);
+ }
+
+ public void testFailAfterServerNotCompletedBothServers() throws Exception
+ {
+ /* we use new proxies in between tests for 1st and Nth call
+ * so that results from Nth call don't get polluted with what happened in
+ * the 1st call test. */
+ transactionalFailureCalls(InvokerHaFailureType.AFTER_SERVER_NOT_COMPLETED_BOTH_SERVERS, TransactionStickyRandomRobin.class, true);
+ }
+
+ public void testFailAfterServerCompleted() throws Exception
+ {
+ /* We use new proxies in between tests for 1st and Nth call
+ * so that results from Nth call don't get polluted with what happened in
+ * the 1st call test. */
+ transactionalFailureCalls(InvokerHaFailureType.AFTER_SERVER_COMPLETED, TransactionStickyRandomRobin.class, true);
+ }
+
+ @Override
+ protected void transactionalSuccessfulCalls(Class<? extends LoadBalancePolicy> policyClass,
+ boolean newProxiesInBetweenTransactions)
+ {
+ log.debug("transactional successfull calls [policy=" + policyClass + ",newProxiesInBetweenTransactions=" + newProxiesInBetweenTransactions + "]");
+
+ try
+ {
+ UID uid;
+
+ createNewProxies(0, policyClass, true);
+
+ /* Simulate client user transaction */
+ uid = new UID();
+ transactionalMockUtils.getTpcf().setUid(uid);
+ performTransactionalStickyCalls(3, null, policyClass, newProxiesInBetweenTransactions);
+ /* either set would do because they should be the same */
+ Set<Object> chosenTargetsTx1 = chosenTargets;
+
+ if (newProxiesInBetweenTransactions)
+ {
+ createNewProxies(0, policyClass, false);
+ }
+
+ /* Simulate transaction interceptor */
+ uid = new UID();
+ Transaction tx = new MockTransaction();
+ transactionalMockUtils.getTpcf().setUid(uid);
+ transactionalMockUtils.getTpci().setTransaction(tx);
+ performTransactionalStickyCalls(3, tx, policyClass, newProxiesInBetweenTransactions);
+ /* either set would do because they should be the same */
+ Set<Object> chosenTargetsTx2 = chosenTargets;
+
+ assertChosenTargetsInBetweenTx(policyClass, chosenTargetsTx1, chosenTargetsTx2, newProxiesInBetweenTransactions);
+ }
+ catch(Exception e)
+ {
+ /* catching to log the error properly (JUnit in eclipse does not show
+ * correctly exceptions from invokers) and fail */
+ log.error("error", e);
+ fail();
+ }
+
+ }
+
+ protected void successfulCalls(Class<? extends LoadBalancePolicy> policyClass)
+ {
+ log.debug("successfull calls [policy=" + policyClass);
+
+ try
+ {
+ createNewProxies(0, policyClass, true);
+ performCalls(3, null, policyClass);
+ }
+ catch(Exception e)
+ {
+ /* catching to log the error properly (JUnit in eclipse does not show
+ * correctly exceptions from invokers) and fail */
+ log.error("error", e);
+ fail();
+ }
+ }
+
+ protected void performTransactionalStickyCalls(int numberPairCalls, Transaction tx,
+ Class<? extends LoadBalancePolicy> policyClass, boolean newProxiesInBetweenTransactions) throws Exception
+ {
+ Invocation inv;
+
+ Set<Object> chosenTargetsDateTimeTeller = new HashSet<Object>(1);
+ Set<Object> chosenTargetsSystemTimeTeller = new HashSet<Object>(1);
+
+ for (int i = 0; i < numberPairCalls; i++)
+ {
+ /* create invocation to date time teller */
+ inv = infrastructure.createDateTimeTellerInvocation(tx, null);
+ /* invoke on proxy passing the invocation */
+ log.debug(timeTellerProxy.invoke(inv));
+ /* assert post conditions after invocation */
+ chosenTargetsDateTimeTeller = assertSuccessfulPostConditions(inv, chosenTargetsDateTimeTeller);
+
+ /* create invocation to system time teller */
+ inv = infrastructure.createSystemTimeTellerInvocation(tx, null);
+ /* invoke on proxy passing the invocation */
+ log.debug(systemTimeProxy.invoke(inv));
+ /* assert post conditions after invocation */
+ chosenTargetsSystemTimeTeller = assertSuccessfulPostConditions(inv, chosenTargetsSystemTimeTeller);
+ }
+
+ /* for the duration of a transaction, all chosen targets should be the same */
+ assertEquals(chosenTargetsDateTimeTeller, chosenTargetsSystemTimeTeller);
+
+ chosenTargets = chosenTargetsDateTimeTeller;
+ }
+
+ protected Set<Object> assertSuccessfulPostConditions(Invocation inv, Set<Object> chosenTargets)
+ {
+ assertEquals(0, inv.getAsIsValue("FAILOVER_COUNTER"));
+ Object chosenTarget = inv.getTransientValue(invokerHaFactory.getChosenTargetKey());
+ assertNotNull(chosenTarget);
+ /* check tx failover authorisations */
+ assertTrue("transaction should have reached the server", invokerHaFactory.getTxFailoverAuthorizationsMap().containsKey(transactionalMockUtils.getTpcf().getUid()));
+ /* add target to singleton set, there must only be one different target within a transaction */
+ chosenTargets.add(chosenTarget);
+ assertEquals(1, chosenTargets.size());
+
+ return chosenTargets;
+ }
+
+ protected void assertChosenTargetsInBetweenTx(Class<? extends LoadBalancePolicy> policyClass, Set<?> chosenTargetsTx1, Set<?> chosenTargetsTx2, boolean newProxiesInBetweenTransactions)
+ {
+ if (policyClass.equals(TransactionStickyRoundRobin.class))
+ {
+ if (!newProxiesInBetweenTransactions)
+ {
+ /* If we're using sticky round robin and we didn't change proxies
+ * in between transactions, we can guarantee that the chosen targets
+ * were different between transactions.*/
+ assertNotSame(chosenTargetsTx1, chosenTargetsTx2);
+ }
+ }
+ else if (policyClass.equals(TransactionStickyFirstAvailable.class))
+ {
+ if (!newProxiesInBetweenTransactions)
+ {
+ /* If we're using sticky first available and we didn't change proxies
+ * in between transactions, we can guarantee that the chosen targets
+ * are equals between transactions.*/
+ assertEquals(chosenTargetsTx1, chosenTargetsTx2);
+ }
+ }
+ else if (policyClass.equals(TransactionStickyFirstAvailableIdenticalAllProxies.class))
+ {
+ /* If we're using sticky first available identical all proxies,
+ * regardless of whether we're using same proxies or not, we can
+ * guarantee that the chosen targets are the same between
+ * transactions.*/
+ assertEquals(chosenTargetsTx1, chosenTargetsTx2);
+ }
+ }
+
+ protected void transactionalFailureCalls(InvokerHaFailureType failureType, Class<? extends LoadBalancePolicy> policyClass, boolean newProxiesInBetweenFailures) throws Exception
+ {
+ createNewProxies(0, policyClass, true);
+
+ try
+ {
+ /* fail in 1st call */
+ failureCall(failureType, true, policyClass, newProxiesInBetweenFailures);
+
+ if (newProxiesInBetweenFailures)
+ {
+ createNewProxies(0, policyClass, false);
+ }
+
+ /* fail in Nth call */
+ failureCall(failureType, false, policyClass, newProxiesInBetweenFailures);
+ }
+ catch(Exception e)
+ {
+ /* catching to log the error properly (JUnit in eclipse does not show
+ * correctly exceptions from invokers) and fail */
+ log.error("error", e);
+ fail();
+ }
+ }
+
+ protected void failureCall(InvokerHaFailureType failureType, boolean injectFailureIn1stCall, Class<? extends LoadBalancePolicy> policyClass, boolean newProxiesInBetweenFailures) throws Exception
+ {
+ UID uid;
+ Invocation inv;
+
+ if (injectFailureIn1stCall)
+ {
+ uid = new UID();
+ transactionalMockUtils.getTpcf().setUid(uid);
+ /* When failure must happen in the very 1st call, we create a 1st
+ * invocation with the failure injected */
+ inv = infrastructure.createDateTimeTellerInvocation(null, failureType);
+ }
+ else
+ {
+ uid = new UID();
+ Transaction tx = new MockTransaction();
+ transactionalMockUtils.getTpcf().setUid(uid);
+ transactionalMockUtils.getTpci().setTransaction(tx);
+ /* When failure is not in first call, we do a call to each bean before
+ * injecting the faliure */
+ performTransactionalStickyCalls(1, tx, policyClass, newProxiesInBetweenFailures);
+ /* Now we create the invocation with the failure injected */
+ inv = infrastructure.createDateTimeTellerInvocation(null, failureType);
+ }
+
+ try
+ {
+ log.debug(timeTellerProxy.invoke(inv));
+ if (failureType.isRecoverable(injectFailureIn1stCall))
+ {
+ failureType.assertFailoverCounter(injectFailureIn1stCall, inv.getAsIsValue("FAILOVER_COUNTER"));
+ inv = infrastructure.createDateTimeTellerInvocation(null, null);
+ log.debug(timeTellerProxy.invoke(inv));
+ }
+ else
+ {
+ fail("should have failed, failover is not allowed for " + failureType);
+ }
+ }
+ catch (Exception e)
+ {
+ if (failureType.isRecoverable(injectFailureIn1stCall))
+ {
+ fail("should have failed, failover is not allowed for " + failureType);
+ }
+ else
+ {
+ assertNull("transaction on the client side should be null", inv.getTransaction());
+ failureType.assertFailoverCounter(injectFailureIn1stCall, inv.getAsIsValue("FAILOVER_COUNTER"));
+ failureType.assertException(e);
+ }
+ }
+ }
+
+}
Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/InvokerHaFailureType.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/InvokerHaFailureType.java (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/InvokerHaFailureType.java 2008-01-13 22:22:02 UTC (rev 68928)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.cluster.invokerha;
+
+import java.rmi.ServerException;
+
+import org.jboss.ha.framework.interfaces.GenericClusteringException;
+import org.jboss.invocation.ServiceUnavailableException;
+import org.jboss.logging.Logger;
+
+import junit.framework.TestCase;
+
+/**
+ * InvokerHaFailureType.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public enum InvokerHaFailureType
+{
+ BEFORE_SERVER,
+ AFTER_SERVER_NOT_COMPLETED_BUT_SUCCESS_AFTER,
+ AFTER_SERVER_NOT_COMPLETED_BOTH_SERVERS,
+ AFTER_SERVER_COMPLETED;
+
+ private static final Logger log = Logger.getLogger(InvokerHaFailureType.class);
+
+ public boolean isRecoverable(boolean injectFailureIn1stCall)
+ {
+ switch(this)
+ {
+ case BEFORE_SERVER:
+ /* a failure before even getting to the invocation call itself is
+ * never recoverable */
+ return false;
+
+ case AFTER_SERVER_NOT_COMPLETED_BUT_SUCCESS_AFTER:
+ /* - if failure happens after reaching the server but didn't complete, and
+ * it happens in the 1st transactional invocation, it's recoverable as
+ * long as the failover call succeeds, otherwise (Nth invocation) it's
+ * not recoverable. */
+ if (injectFailureIn1stCall)
+ {
+ return true;
+ }
+ return false;
+
+ case AFTER_SERVER_NOT_COMPLETED_BOTH_SERVERS:
+ /* if failure happens after reaching the server but didn't complete when
+ * trying to call either server, neither in the 1st or Nth call is
+ * recoverable.*/
+ return false;
+
+ case AFTER_SERVER_COMPLETED:
+ /* if failure happens after reaching the server and completed, neither
+ * 1st or Nth call are recoverable. */
+ return false;
+
+ default:
+ return false;
+ }
+ }
+
+ public void injectFailureIfExistsBeforeServer() throws IllegalStateException
+ {
+ switch(this)
+ {
+ case BEFORE_SERVER:
+ log.debug("failing because of " + this);
+ throw new IllegalStateException("see how you handle this!!");
+ }
+ }
+
+ public void injectFailureIfExistsAfterServer(Integer failoverCounter) throws GenericClusteringException
+ {
+ switch(this)
+ {
+ case AFTER_SERVER_NOT_COMPLETED_BUT_SUCCESS_AFTER:
+ if (failoverCounter.equals(new Integer(0)))
+ {
+ log.debug("failing because of " + this);
+ throw new GenericClusteringException(GenericClusteringException.COMPLETED_NO, this.toString());
+ }
+ break;
+
+ case AFTER_SERVER_NOT_COMPLETED_BOTH_SERVERS:
+ log.debug("failing because of " + this);
+ throw new GenericClusteringException(GenericClusteringException.COMPLETED_NO, this.toString());
+
+ case AFTER_SERVER_COMPLETED:
+ log.debug("failing because of " + this);
+ throw new GenericClusteringException(GenericClusteringException.COMPLETED_YES, this.toString());
+ }
+ }
+
+ public void assertFailoverCounter(boolean injectFailureIn1stCall, Object failoverCounter)
+ {
+ switch(this)
+ {
+ case BEFORE_SERVER:
+ TestCase.assertEquals(0, failoverCounter);
+ break;
+
+ case AFTER_SERVER_NOT_COMPLETED_BUT_SUCCESS_AFTER:
+ TestCase.assertEquals(1, failoverCounter);
+ break;
+
+ case AFTER_SERVER_NOT_COMPLETED_BOTH_SERVERS:
+ if (injectFailureIn1stCall)
+ {
+ /* Two failovers were attempted before finally giving up */
+ TestCase.assertEquals(2, failoverCounter);
+ }
+ else
+ {
+ /* It's 1 because after several calls, the transaction has
+ * already reached the server, so that's good enough not to
+ * succeed */
+ TestCase.assertEquals(1, failoverCounter);
+ }
+ break;
+
+ case AFTER_SERVER_COMPLETED:
+ /* failover counters are always 0 because there's no chance of
+ * calculating failover at all */
+ TestCase.assertEquals(0, failoverCounter);
+ break;
+ }
+ }
+
+ public void assertException(Exception e)
+ {
+ switch(this)
+ {
+ case BEFORE_SERVER:
+ TestCase.assertTrue(e instanceof IllegalStateException);
+ break;
+
+ case AFTER_SERVER_NOT_COMPLETED_BUT_SUCCESS_AFTER:
+ case AFTER_SERVER_NOT_COMPLETED_BOTH_SERVERS:
+ TestCase.assertTrue(e instanceof ServiceUnavailableException);
+ TestCase.assertTrue(e.getCause() instanceof GenericClusteringException);
+ break;
+
+ case AFTER_SERVER_COMPLETED:
+ TestCase.assertTrue(e instanceof ServerException);
+ TestCase.assertTrue(e.getCause() instanceof GenericClusteringException);
+ break;
+ }
+ }
+}
Modified: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/InvokerHaInfrastructure.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/InvokerHaInfrastructure.java 2008-01-13 22:20:00 UTC (rev 68927)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/InvokerHaInfrastructure.java 2008-01-13 22:22:02 UTC (rev 68928)
@@ -223,11 +223,13 @@
* @param tx instance of Transaction. If tx is null, transaction is not
* added to invocation, which is useful to replicate transactions starting
* in non managed environments.
+ * @param failureType type of failure to inject. If null, no failure is
+ * injected.
* @return
*/
- public Invocation createDateTimeTellerInvocation(Transaction tx)
+ public Invocation createDateTimeTellerInvocation(Transaction tx, InvokerHaFailureType failureType)
{
- return createInvocation(tx, dateTimeTellerONHashCode);
+ return createInvocation(tx, dateTimeTellerONHashCode, failureType);
}
/**
@@ -236,11 +238,13 @@
* @param tx instance of Transaction. If tx is null, transaction is not
* added to invocation, which is useful to replicate transactions starting
* in non managed environments.
+ * @param failureType type of failure to inject. If null, no failure is
+ * injected.
* @return
*/
- public Invocation createSystemTimeTellerInvocation(Transaction tx)
+ public Invocation createSystemTimeTellerInvocation(Transaction tx, InvokerHaFailureType failureType)
{
- return createInvocation(tx, systemTimeTellerONHashCode);
+ return createInvocation(tx, systemTimeTellerONHashCode, failureType);
}
/**
@@ -327,7 +331,7 @@
* @param hashCode hashcode of object name of the mbean
* @return
*/
- private Invocation createInvocation(Transaction tx, Integer hashCode)
+ private Invocation createInvocation(Transaction tx, Integer hashCode, InvokerHaFailureType failureType)
{
Invocation inv = new Invocation();
inv.setObjectName(hashCode);
@@ -335,6 +339,10 @@
{
inv.setTransaction(tx);
}
+ if (failureType != null)
+ {
+ inv.setValue("FAILURE_TYPE", failureType);
+ }
return inv;
}
@@ -376,6 +384,13 @@
* @return
*/
InvokerHA createInvokerHaServer(String serverName, int serverNumber);
+
+ /**
+ * Returns transient payload key to retrieve chosen target.
+ *
+ * @return String representation of the key
+ */
+ String getChosenTargetKey();
}
/**
Modified: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaMockUtils.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaMockUtils.java 2008-01-13 22:20:00 UTC (rev 68927)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaMockUtils.java 2008-01-13 22:22:02 UTC (rev 68928)
@@ -92,27 +92,11 @@
@Override
public Object invoke(Invocation invocation) throws Exception
{
-// Object[] arguments = invocation.getArguments();
-// if (arguments != null && arguments.length != 0)
-// {
-// if (arguments[0].equals(FailureType.AFTER_SERVER_NOT_COMPLETED_BUT_SUCCESS_AFTER)
-// && invocation.getPayloadValue("MOCK_FAILOVER_COUNTER").equals(new Integer(0)))
-// {
-// log.debug("failing because of " + FailureType.AFTER_SERVER_NOT_COMPLETED_BUT_SUCCESS_AFTER);
-// throw new GenericClusteringException(GenericClusteringException.COMPLETED_NO, FailureType.AFTER_SERVER_NOT_COMPLETED_BUT_SUCCESS_AFTER.toString());
-// }
-//
-// if (arguments[0].equals(FailureType.AFTER_SERVER_NOT_COMPLETED_BOTH_SERVERS))
-// {
-// log.debug("failing because of " + FailureType.AFTER_SERVER_NOT_COMPLETED_BOTH_SERVERS);
-// throw new GenericClusteringException(GenericClusteringException.COMPLETED_NO, FailureType.AFTER_SERVER_NOT_COMPLETED_BOTH_SERVERS.toString());
-// }
-// if (arguments[0].equals(FailureType.AFTER_SERVER_COMPLETED))
-// {
-// log.debug("failing because of " + FailureType.AFTER_SERVER_COMPLETED);
-// throw new GenericClusteringException(GenericClusteringException.COMPLETED_YES, FailureType.AFTER_SERVER_COMPLETED.toString());
-// }
-// }
+ InvokerHaFailureType failureType = (InvokerHaFailureType)invocation.getValue("FAILURE_TYPE");
+ if (failureType != null)
+ {
+ failureType.injectFailureIfExistsAfterServer((Integer)invocation.getAsIsValue("FAILOVER_COUNTER"));
+ }
return super.invoke(invocation);
}
@@ -127,35 +111,28 @@
super(targets, policy, proxyFamilyName, viewId);
}
-// @Override
-// protected void putIfExistsTransactionTarget(Invocation invocation, Object tpc)
-// {
-// Object[] arguments = invocation.getArguments();
-// if (arguments != null && arguments.length != 0 && arguments[0].equals(FailureType.BEFORE_SERVER))
-// {
-// log.info("failing because of " + FailureType.BEFORE_SERVER);
-// throw new IllegalStateException("see how you handle this!!");
-// }
-//
-// super.putIfExistsTransactionTarget(invocation, tpc);
-// }
-
@Override
public boolean txContextAllowsFailover(Invocation invocation)
{
-// int failoverCount = ((Integer)invocation.getPayloadValue("MOCK_FAILOVER_COUNTER")).intValue();
-// failoverCount++;
-// invocation.setValue ("MOCK_FAILOVER_COUNTER", new Integer(failoverCount), PayloadKey.PAYLOAD);
-
return super.txContextAllowsFailover(invocation);
}
@Override
public Object invoke(Invocation invocation) throws Exception
{
-// invocation.setValue ("MOCK_FAILOVER_COUNTER", new Integer(0), PayloadKey.PAYLOAD);
-
return super.invoke(invocation);
+ }
+
+ @Override
+ protected void putIfExistsTransactionTarget(Invocation invocation, Object tpc)
+ {
+ InvokerHaFailureType failureType = (InvokerHaFailureType)invocation.getValue("FAILURE_TYPE");
+ if (failureType != null)
+ {
+ failureType.injectFailureIfExistsBeforeServer();
+ }
+
+ super.putIfExistsTransactionTarget(invocation, tpc);
}
}
Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaTransactionStickyUnitTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaTransactionStickyUnitTestCase.java (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaTransactionStickyUnitTestCase.java 2008-01-13 22:22:02 UTC (rev 68928)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.cluster.invokerha;
+
+import org.jboss.test.cluster.invokerha.JRMPInvokerHaUnitTestCase.JRMPInvokerHaFactory;
+import org.jboss.test.cluster.invokerha.AbstractInvokerHaTransactionSticky;
+
+/**
+ * JRMPInvokerHaTransactionStickyUnitTestCase.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class JRMPInvokerHaTransactionStickyUnitTestCase extends AbstractInvokerHaTransactionSticky
+{
+ @Override
+ protected void setUp() throws Exception
+ {
+ setUp(2, new JRMPInvokerHaTransactionStickyFactory());
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public static class JRMPInvokerHaTransactionStickyFactory extends JRMPInvokerHaFactory
+ {
+ @Override
+ public String getChosenTargetKey()
+ {
+ return "TX_STICKY_TARGET";
+ }
+ }
+}
Modified: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaUnitTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaUnitTestCase.java 2008-01-13 22:20:00 UTC (rev 68927)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/JRMPInvokerHaUnitTestCase.java 2008-01-13 22:22:02 UTC (rev 68928)
@@ -51,7 +51,7 @@
/** Classes **/
- public class JRMPInvokerHaFactory implements InvokerHaFactory
+ public static class JRMPInvokerHaFactory implements InvokerHaFactory
{
public String getInvokerTypeName()
{
@@ -72,5 +72,10 @@
{
return new MockJRMPInvokerHA(getInvokerTypeName() + "-" + serverName + "-" + serverNumber);
}
+
+ public String getChosenTargetKey()
+ {
+ return "TEST_CHOSEN_TARGET";
+ }
}
}
Modified: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaMockUtils.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaMockUtils.java 2008-01-13 22:20:00 UTC (rev 68927)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaMockUtils.java 2008-01-13 22:22:02 UTC (rev 68928)
@@ -72,7 +72,7 @@
@Override
public String toString()
{
- return name;
+ return name + "," + super.toString();
}
public void setLocator(InvokerLocator locator)
@@ -101,6 +101,21 @@
}
@Override
+ public Object invoke(InvocationRequest invocationReq) throws Throwable
+ {
+ Invocation invocation = (Invocation) invocationReq.getParameter();
+ InvokerHaFailureType failureType = (InvokerHaFailureType)invocation.getValue("FAILURE_TYPE");
+ if (failureType != null)
+ {
+ failureType.injectFailureIfExistsAfterServer((Integer)invocation.getAsIsValue("FAILOVER_COUNTER"));
+ }
+
+ log.debug("invoking on " + invocation.getObjectName());
+
+ return super.invoke(invocationReq);
+ }
+
+ @Override
protected SerializationManager getSerializationManager() throws IOException
{
return new JavaSerializationManager();
@@ -127,6 +142,17 @@
return ((MockInvokerLocator)locator).getClient();
}
+ @Override
+ protected void putIfExistsTransactionTarget(Invocation invocation, Object tpc)
+ {
+ InvokerHaFailureType failureType = (InvokerHaFailureType)invocation.getValue("FAILURE_TYPE");
+ if (failureType != null)
+ {
+ failureType.injectFailureIfExistsBeforeServer();
+ }
+
+ super.putIfExistsTransactionTarget(invocation, tpc);
+ }
}
public static class MockInvokerLocator extends InvokerLocator
@@ -147,6 +173,20 @@
{
return client;
}
+
+ @Override
+ public String toString()
+ {
+ return super.toString() + ",[client=" + client + "]";
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ /* reimplemented equals to avoid lingering static family cluster info
+ * references being valid in latter tests */
+ return super.equals(obj) && client.equals(((MockInvokerLocator)obj).getClient());
+ }
}
public static class MockClient extends Client
@@ -197,6 +237,12 @@
TransactionPropagationContextFactory tpcFactory = TransactionPropagationContextUtil.getTPCFactoryClientSide();
return (tpcFactory == null) ? null : tpcFactory.getTransactionPropagationContext();
}
+
+ @Override
+ public String toString()
+ {
+ return invoker.toString();
+ }
}
public static class MockClientInvoker implements ClientInvoker
Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaTransactionStickyUnitTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaTransactionStickyUnitTestCase.java (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaTransactionStickyUnitTestCase.java 2008-01-13 22:22:02 UTC (rev 68928)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.cluster.invokerha;
+
+import org.jboss.test.cluster.invokerha.UnifiedInvokerHaUnitTestCase.UnifiedInvokerHaFactory;
+import org.jboss.test.cluster.invokerha.AbstractInvokerHaTransactionSticky;
+
+/**
+ * UnifiedInvokerHaTransactionStickyUnitTestCase.
+ *
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
+ */
+public class UnifiedInvokerHaTransactionStickyUnitTestCase extends AbstractInvokerHaTransactionSticky
+{
+ @Override
+ protected void setUp() throws Exception
+ {
+ setUp(2, new UnifiedInvokerHaTransactionStickyFactory());
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public static class UnifiedInvokerHaTransactionStickyFactory extends UnifiedInvokerHaFactory
+ {
+ @Override
+ public String getChosenTargetKey()
+ {
+ return "TX_STICKY_TARGET";
+ }
+ }
+}
Modified: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaUnitTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaUnitTestCase.java 2008-01-13 22:20:00 UTC (rev 68927)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaUnitTestCase.java 2008-01-13 22:22:02 UTC (rev 68928)
@@ -32,7 +32,6 @@
import org.jboss.invocation.unified.interfaces.UnifiedInvokerHAProxy;
import org.jboss.remoting.InvokerLocator;
import org.jboss.test.cluster.invokerha.InvokerHaInfrastructure.InvokerHaFactory;
-import org.jboss.test.cluster.invokerha.InvokerHaInfrastructure.TraceRoundRobin;
import org.jboss.test.cluster.invokerha.UnifiedInvokerHaMockUtils.MockClient;
import org.jboss.test.cluster.invokerha.UnifiedInvokerHaMockUtils.MockInvokerLocator;
import org.jboss.test.cluster.invokerha.UnifiedInvokerHaMockUtils.MockUnifiedInvokerHA;
@@ -64,7 +63,7 @@
/**
* Unified invoker ha factory.
*/
- public class UnifiedInvokerHaFactory implements InvokerHaFactory
+ public static class UnifiedInvokerHaFactory implements InvokerHaFactory
{
public String getInvokerTypeName()
{
@@ -90,12 +89,17 @@
return invoker;
}
+
+ public String getChosenTargetKey()
+ {
+ return "TEST_CHOSEN_TARGET";
+ }
}
/**
* Unified invoker specific infrastructure class.
*/
- public class UnifiedInvokerHaInfrastructure extends InvokerHaInfrastructure
+ public static class UnifiedInvokerHaInfrastructure extends InvokerHaInfrastructure
{
public UnifiedInvokerHaInfrastructure(int serverCount, InvokerHaFactory invokerHaFactory)
{
More information about the jboss-cvs-commits
mailing list