[jboss-cvs] JBossAS SVN: r104415 - projects/cluster/ha-server-api/trunk/src/test/java/org/jboss/test/ha/framework/server/lock.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue May 4 01:12:37 EDT 2010
Author: bstansberry at jboss.com
Date: 2010-05-04 01:12:37 -0400 (Tue, 04 May 2010)
New Revision: 104415
Added:
projects/cluster/ha-server-api/trunk/src/test/java/org/jboss/test/ha/framework/server/lock/LockParamsMatcher.java
Modified:
projects/cluster/ha-server-api/trunk/src/test/java/org/jboss/test/ha/framework/server/lock/ClusteredLockManagerTestBase.java
projects/cluster/ha-server-api/trunk/src/test/java/org/jboss/test/ha/framework/server/lock/ReadWriteClusteredLockManagerUnitTestCase.java
Log:
[JBCLUSTER-223] Move tests from AS testsuite to ha-server-api
Modified: projects/cluster/ha-server-api/trunk/src/test/java/org/jboss/test/ha/framework/server/lock/ClusteredLockManagerTestBase.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/test/java/org/jboss/test/ha/framework/server/lock/ClusteredLockManagerTestBase.java 2010-05-04 05:10:55 UTC (rev 104414)
+++ projects/cluster/ha-server-api/trunk/src/test/java/org/jboss/test/ha/framework/server/lock/ClusteredLockManagerTestBase.java 2010-05-04 05:12:37 UTC (rev 104415)
@@ -17,6 +17,7 @@
import static org.easymock.EasyMock.resetToStrict;
import static org.easymock.EasyMock.same;
import static org.easymock.EasyMock.verify;
+import static org.jboss.test.ha.framework.server.lock.LockParamsMatcher.eqLockParams;
import java.util.ArrayList;
import java.util.Arrays;
@@ -28,9 +29,7 @@
import junit.framework.TestCase;
import org.easymock.Capture;
-import org.easymock.EasyMock;
import org.easymock.IAnswer;
-import org.easymock.IArgumentMatcher;
import org.jboss.ha.framework.interfaces.ClusterNode;
import org.jboss.ha.framework.interfaces.HAPartition;
import org.jboss.ha.framework.interfaces.ResponseFilter;
@@ -48,52 +47,6 @@
protected ClusterNode node2;
protected ClusterNode node3;
- public static Object[] eqLockParams(ClusterNode node, long timeout)
- {
- EasyMock.reportMatcher(new LockParamsMatcher(node, timeout));
- return null;
- }
-
- protected static class LockParamsMatcher implements IArgumentMatcher
- {
- private final ClusterNode node;
- private final long timeout;
-
- LockParamsMatcher(ClusterNode node, long timeout)
- {
- this.node = node;
- this.timeout = timeout;
- }
-
- public void appendTo(StringBuffer buffer)
- {
- buffer.append("eqRemoteLockParams({\"test\",");
- buffer.append(node);
- buffer.append(',');
- buffer.append(timeout);
- buffer.append("})");
- }
-
- public boolean matches(Object arg)
- {
- if (arg instanceof Object[])
- {
- Object[] args = (Object[]) arg;
- if (args.length == 3)
- {
- if ("test".equals(args[0]) && node.equals(args[1])
- && args[2] instanceof Long)
- {
- long l = ((Long) args[2]).longValue();
- return l >= 0 && l <= timeout;
- }
- }
- }
- return false;
- }
-
- }
-
public ClusteredLockManagerTestBase()
{
super();
Added: projects/cluster/ha-server-api/trunk/src/test/java/org/jboss/test/ha/framework/server/lock/LockParamsMatcher.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/test/java/org/jboss/test/ha/framework/server/lock/LockParamsMatcher.java (rev 0)
+++ projects/cluster/ha-server-api/trunk/src/test/java/org/jboss/test/ha/framework/server/lock/LockParamsMatcher.java 2010-05-04 05:12:37 UTC (rev 104415)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc. 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.ha.framework.server.lock;
+
+import org.easymock.EasyMock;
+import org.easymock.IArgumentMatcher;
+import org.jboss.ha.framework.interfaces.ClusterNode;
+
+class LockParamsMatcher implements IArgumentMatcher
+{
+ public static Object[] eqLockParams(ClusterNode node, long timeout)
+ {
+ EasyMock.reportMatcher(new LockParamsMatcher(node, timeout));
+ return null;
+ }
+
+ private final ClusterNode node;
+ private final long timeout;
+
+ LockParamsMatcher(ClusterNode node, long timeout)
+ {
+ this.node = node;
+ this.timeout = timeout;
+ }
+
+ public void appendTo(StringBuffer buffer)
+ {
+ buffer.append("eqRemoteLockParams({\"test\",");
+ buffer.append(node);
+ buffer.append(',');
+ buffer.append(timeout);
+ buffer.append("})");
+ }
+
+ public boolean matches(Object arg)
+ {
+ if (arg instanceof Object[])
+ {
+ Object[] args = (Object[]) arg;
+ if (args.length == 3)
+ {
+ if ("test".equals(args[0]) && node.equals(args[1])
+ && args[2] instanceof Long)
+ {
+ long l = ((Long) args[2]).longValue();
+ return l >= 0 && l <= timeout;
+ }
+ }
+ }
+ return false;
+ }
+
+}
\ No newline at end of file
Modified: projects/cluster/ha-server-api/trunk/src/test/java/org/jboss/test/ha/framework/server/lock/ReadWriteClusteredLockManagerUnitTestCase.java
===================================================================
--- projects/cluster/ha-server-api/trunk/src/test/java/org/jboss/test/ha/framework/server/lock/ReadWriteClusteredLockManagerUnitTestCase.java 2010-05-04 05:10:55 UTC (rev 104414)
+++ projects/cluster/ha-server-api/trunk/src/test/java/org/jboss/test/ha/framework/server/lock/ReadWriteClusteredLockManagerUnitTestCase.java 2010-05-04 05:12:37 UTC (rev 104415)
@@ -33,6 +33,7 @@
import static org.easymock.EasyMock.resetToNice;
import static org.easymock.EasyMock.resetToStrict;
import static org.easymock.EasyMock.verify;
+import static org.jboss.test.ha.framework.server.lock.LockParamsMatcher.eqLockParams;
import java.util.ArrayList;
import java.util.List;
More information about the jboss-cvs-commits
mailing list