[infinispan-commits] Infinispan SVN: r1643 - in trunk/client/hotrod-client/src: main/java/org/infinispan/client/hotrod/impl and 1 other directories.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Wed Mar 31 07:16:35 EDT 2010
Author: mircea.markus
Date: 2010-03-31 07:16:34 -0400 (Wed, 31 Mar 2010)
New Revision: 1643
Added:
trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/ServerStatistics.java
trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/ServerStatisticsImpl.java
trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/VersionedOperationResponse.java
trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/NettyHotRodIntegrationTest.java
trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/TestHotrodStatistics.java
Modified:
trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/RemoteCache.java
trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/HotrodConstants.java
trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/HotrodOperations.java
trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/HotrodOperationsImpl.java
trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/RemoteCacheImpl.java
trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodIntegrationTest.java
Log:
ongoing work on hotrod client
Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/RemoteCache.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/RemoteCache.java 2010-03-31 07:34:14 UTC (rev 1642)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/RemoteCache.java 2010-03-31 11:16:34 UTC (rev 1643)
@@ -339,6 +339,13 @@
void putAll(Map<? extends K, ? extends V> m);
/**
+ * Returns true if the remote cluster can be reached, false otherwise.
+ */
+ boolean ping();
+
+ public ServerStatistics stats();
+
+ /**
* Besides the key and value, also contains an version. To be used in versioned operations, e.g. {@link RemoteCache#remove(Object, long)}.
*/
public static interface VersionedValue<V> {
Added: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/ServerStatistics.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/ServerStatistics.java (rev 0)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/ServerStatistics.java 2010-03-31 11:16:34 UTC (rev 1643)
@@ -0,0 +1,63 @@
+package org.infinispan.client.hotrod;
+
+import java.util.Map;
+
+/**
+ * // TODO: Document this
+ *
+ * @author Mircea.Markus at jboss.com
+ * @since 4.1
+ */
+public interface ServerStatistics {
+
+ /**
+ * Number of seconds since Hot Rod started.
+ */
+ public static final String TIME_SINCE_START = "timeSinceStart";
+
+ /**
+ * Number of entries currently in the Hot Rod server
+ */
+ public static final String CURRENT_NR_OF_ENTRIES = "currentNumberOfEntries";
+
+ /**
+ * Number of entries stored in Hot Rod server.
+ */
+ public static final String TOTAL_NR_OF_ENTRIES = "totalNumberOfEntries";
+
+ /**
+ * Number of put operations.
+ */
+ public static final String STORES = "stores";
+
+
+ /**
+ * Number of get operations.
+ */
+ public static final String RETRIEVALS = "retrievals";
+
+ /**
+ * Number of get hits.
+ */
+ public static final String HITS = "hits";
+
+ /**
+ * Number of get misses.
+ */
+ public static final String MISSES = "misses";
+
+
+ /**
+ * Number of removal hits.
+ */
+ public static final String REMOVE_HITS = "removeHits";
+
+ /**
+ * Number of removal misses.
+ */
+ public static final String REMOVE_MISSES = "removeMisses";
+
+ public Map<String, Number> getStatsMap();
+
+ public Number getStats(String statsName);
+}
Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/HotrodConstants.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/HotrodConstants.java 2010-03-31 07:34:14 UTC (rev 1642)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/HotrodConstants.java 2010-03-31 11:16:34 UTC (rev 1643)
@@ -29,7 +29,9 @@
public static final byte STATS_REQUEST = 0x19;
public static final byte QUIT_REQUEST = 0x1B;
public static final byte EVENT_REGISTRATION_REQUEST = 0x1D;
+ public static final byte PING_REQUEST = 0x17;
+
//responses
public static final byte PUT_RESPONSE = 0x02;
public static final byte GET_RESPONSE = 0x04;
@@ -47,6 +49,7 @@
public static final byte QUIT_RESPONSE = 0x1C;
public static final byte EVENT_REGISTRATION_RESPONSE = 0x1E;
public static final byte ERROR_RESPONSE = 0x50;
+ public static final byte PING_RESPONSE = 0x18;
//response status
public static final byte NO_ERROR_STATUS = 0x00;
Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/HotrodOperations.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/HotrodOperations.java 2010-03-31 07:34:14 UTC (rev 1642)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/HotrodOperations.java 2010-03-31 11:16:34 UTC (rev 1643)
@@ -16,19 +16,6 @@
*/
public interface HotrodOperations {
- public enum VersionedOperationResponse {
- SUCCESS(true), NO_SUCH_KEY(false), MODIFIED_KEY(false);
- private boolean isModified;
-
- VersionedOperationResponse(boolean modified) {
- isModified = modified;
- }
-
- public boolean isUpdated() {
- return isModified;
- }
- }
-
public byte[] get(byte[] key, Flag... flags);
public byte[] remove(byte[] key, Flag... flags);
@@ -74,9 +61,7 @@
public void clear(Flag... flags);
- public Map<String, String> stats();
+ public Map<String, Number> stats();
- public String stats(String paramName);
-
public boolean ping();
}
Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/HotrodOperationsImpl.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/HotrodOperationsImpl.java 2010-03-31 07:34:14 UTC (rev 1642)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/HotrodOperationsImpl.java 2010-03-31 11:16:34 UTC (rev 1643)
@@ -4,7 +4,11 @@
import org.infinispan.client.hotrod.exceptions.HotRodClientException;
import org.infinispan.client.hotrod.exceptions.InvalidResponseException;
import org.infinispan.client.hotrod.exceptions.TimeoutException;
+import org.infinispan.client.hotrod.impl.transport.TransportException;
+import org.infinispan.util.logging.Log;
+import org.infinispan.util.logging.LogFactory;
+import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
@@ -16,6 +20,8 @@
*/
public class HotrodOperationsImpl implements HotrodOperations, HotrodConstants {
+ private static Log log = LogFactory.getLog(HotrodOperationsImpl.class);
+
private final byte[] cacheNameBytes;
private static final AtomicLong MSG_ID = new AtomicLong();
private TransportFactory transportFactory;
@@ -37,7 +43,7 @@
return transport.readByteArray();
}
} finally {
- transport.release();
+ releaseTransport(transport);
}
throw new IllegalStateException("We should not reach here!");
}
@@ -52,7 +58,7 @@
return returnPossiblePrevValue(transport, flags);
}
} finally {
- transport.release();
+ releaseTransport(transport);
}
throw new IllegalStateException("We should not reach here!");
}
@@ -67,7 +73,7 @@
return true;
}
} finally {
- transport.release();
+ releaseTransport(transport);
}
throw new IllegalStateException("We should not reach here!");
}
@@ -85,7 +91,7 @@
return new BinaryVersionedValue(version, value);
}
} finally {
- transport.release();
+ releaseTransport(transport);
}
throw new IllegalStateException("We should not reach here!");
}
@@ -100,7 +106,7 @@
}
return returnPossiblePrevValue(transport, flags);
} finally {
- transport.release();
+ releaseTransport(transport);
}
}
@@ -114,57 +120,124 @@
return null;
}
} finally {
- transport.release();
+ releaseTransport(transport);
}
throw new IllegalStateException("We should not reach here!");
}
public byte[] replace(byte[] key, byte[] value, int lifespan, int maxIdle, Flag... flags) {
- return null;
+ Transport transport = getTransport();
+ try {
+ short status = sendPutOperation(key, value, transport, REPLACE_REQUEST, REPLACE_RESPONSE, lifespan, maxIdle, flags);
+ if (status == NO_ERROR_STATUS) {
+ return returnPossiblePrevValue(transport, flags);
+ } else if (status == NOT_PUT_REMOVED_REPLACED_STATUS) {
+ return null;
+ }
+ } finally {
+ releaseTransport(transport);
+ }
+ throw new IllegalStateException("We should not reach here!");
}
+ /**
+ * request : [header][key length][key][lifespan][max idle][entry_version][value length][value] response: If
+ * ForceReturnPreviousValue has been passed, this responses will contain previous [value length][value] for that key.
+ * If the key does not exist or previous was null, value length would be 0. Otherwise, if no ForceReturnPreviousValue
+ * was sent, the response would be empty.
+ */
public VersionedOperationResponse replaceIfUnmodified(byte[] key, byte[] value, int lifespan, int maxIdle, long version, Flag... flags) {
- return null; // TODO: Customise this generated block
+ Transport transport = getTransport();
+ try {
+ // 1) write header
+ long messageId = writeHeader(transport, REPLACE_IF_UNMODIFIED_REQUEST, flags);
+
+ //2) write message body
+ transport.writeByteArray(key);
+ transport.writeVInt(lifespan);
+ transport.writeVInt(maxIdle);
+ transport.writeVLong(version);
+ transport.writeByteArray(value);
+ return returnVersionedOperationResponse(transport, messageId, flags);
+ } finally {
+ releaseTransport(transport);
+ }
}
+ /**
+ * Request: [header][key length][key][entry_version]
+ */
public VersionedOperationResponse removeIfUnmodified(byte[] key, long version, Flag... flags) {
- return null; // TODO: Customise this generated block
+ Transport transport = getTransport();
+ try {
+ // 1) write header
+ long messageId = writeHeader(transport, REMOVE_IF_UNMODIFIED_REQUEST, flags);
+
+ //2) write message body
+ transport.writeByteArray(key);
+ transport.writeVLong(version);
+
+ //process response and return
+ return returnVersionedOperationResponse(transport, messageId, flags);
+
+ } finally {
+ releaseTransport(transport);
+ }
}
public void clear(Flag... flags) {
- // TODO: Customise this generated block
+ Transport transport = getTransport();
+ try {
+ // 1) write header
+ long messageId = writeHeader(transport, CLEAR_REQUEST, flags);
+ readHeaderAndValidate(transport, messageId, CLEAR_RESPONSE);
+ } finally {
+ releaseTransport(transport);
+ }
}
- public Map<String, String> stats() {
- return null; // TODO: Customise this generated block
+ public Map<String, Number> stats() {
+ Transport transport = getTransport();
+ try {
+ // 1) write header
+ long messageId = writeHeader(transport, STATS_REQUEST);
+ readHeaderAndValidate(transport, messageId, CLEAR_RESPONSE);
+ int nrOfStats = transport.readVInt();
+ Map<String, Number> result = new HashMap<String, Number>();
+ for (int i = 0; i < nrOfStats; i++) {
+ String statName = transport.readString();
+ Long statValue = transport.readVLong();
+ result.put(statName, statValue);
+ }
+ return result;
+ } finally {
+ releaseTransport(transport);
+ }
}
- public String stats(String paramName) {
- return null; // TODO: Customise this generated block
- }
-
public Transport getTransport() {
return transportFactory.getTransport();
}
- private short sendKeyOperation(byte[] key, Transport transport, byte opCode, Flag[] flags, byte opRespCode) {
- // 1) write [header][key length][key]
- long messageId = writeHeader(transport, opCode, flags);
- transport.writeByteArray(key);
- transport.flush();
-
- // 2) now read the header
- short status = readHeaderAndValidate(transport, messageId, opCode, opRespCode);
-
- // 3) process possible error messages
- checkForErrorsInResponseStatus(status, messageId, transport);
-
- return status;
- }
-
@Override
public boolean ping() {
- return false; // TODO: Customise this generated block
+ Transport transport = null;
+ try {
+ transport = getTransport();
+ // 1) write header
+ long messageId = writeHeader(transport, PING_REQUEST);
+ short respStatus = readHeaderAndValidate(transport, messageId, HotrodConstants.PING_RESPONSE);
+ if (respStatus == NO_ERROR_STATUS) {
+ return true;
+ }
+ throw new IllegalStateException("Unknown response status: " + Integer.toHexString(respStatus));
+ } catch (TransportException te) {
+ log.trace("Exception while ping", te);
+ return false;
+ }
+ finally {
+ releaseTransport(transport);
+ }
}
//[header][key length][key][lifespan][max idle][value length][value]
@@ -181,11 +254,9 @@
transport.flush();
// 3) now read header
- short status = readHeaderAndValidate(transport, messageId, opCode, opRespCode);
- checkForErrorsInResponseStatus(status, messageId, transport);
//return status (not error status for sure)
- return status;
+ return readHeaderAndValidate(transport, messageId, opRespCode);
}
/*
@@ -214,7 +285,7 @@
/**
* Magic | Message Id | Op code | Status | Topology Change Marker
*/
- private short readHeaderAndValidate(Transport transport, long messageId, short opCode, short opRespCode) {
+ private short readHeaderAndValidate(Transport transport, long messageId, short opRespCode) {
short magic = transport.readByte();
if (magic != RESPONSE_MAGIC) {
throw new InvalidResponseException("Invalid magic number. Expected " + Integer.toHexString(RESPONSE_MAGIC) + " and received " + Integer.toHexString(magic));
@@ -229,11 +300,12 @@
checkForErrorsInResponseStatus(transport.readByte(), messageId, transport);
throw new IllegalStateException("Error expected! (i.e. exception in the prev statement)");
}
- throw new InvalidResponseException("Invalid response operation. Expected " + Integer.toHexString(opCode) + " and received " + Integer.toHexString(receivedOpCode));
+ throw new InvalidResponseException("Invalid response operation. Expected " + Integer.toHexString(opRespCode) + " and received " + Integer.toHexString(receivedOpCode));
}
short status = transport.readByte();
transport.readByte(); //todo - this will be changed once we support smarter than basic clients
- return status;
+ checkForErrorsInResponseStatus(status, messageId, transport);
+ return status;
}
private void checkForErrorsInResponseStatus(short status, long messageId, Transport transport) {
@@ -267,7 +339,41 @@
return false;
}
+ private short sendKeyOperation(byte[] key, Transport transport, byte opCode, Flag[] flags, byte opRespCode) {
+ // 1) write [header][key length][key]
+ long messageId = writeHeader(transport, opCode, flags);
+ transport.writeByteArray(key);
+ transport.flush();
+
+ // 2) now read the header
+ return readHeaderAndValidate(transport, messageId, opRespCode);
+ }
+
private byte[] returnPossiblePrevValue(Transport transport, Flag[] flags) {
return hasForceReturn(flags) ? transport.readByteArray() : null;
}
+
+ private void releaseTransport(Transport transport) {
+ if (transport != null)
+ transport.release();
+ }
+
+ private VersionedOperationResponse returnVersionedOperationResponse(Transport transport, long messageId, Flag[] flags) {
+ //3) ...
+ short respStatus = readHeaderAndValidate(transport, messageId, REPLACE_IF_UNMODIFIED_RESPONSE);
+
+ //4 ...
+ VersionedOperationResponse.RspCode code;
+ if (respStatus == NO_ERROR_STATUS) {
+ code = VersionedOperationResponse.RspCode.SUCCESS;
+ } else if (respStatus == NOT_PUT_REMOVED_REPLACED_STATUS) {
+ code = VersionedOperationResponse.RspCode.MODIFIED_KEY;
+ } else if (respStatus == KEY_DOES_NOT_EXIST_STATUS) {
+ code = VersionedOperationResponse.RspCode.NO_SUCH_KEY;
+ } else {
+ throw new IllegalStateException("Unknown response status: " + Integer.toHexString(respStatus));
+ }
+ byte[] prevValue = returnPossiblePrevValue(transport, flags);
+ return new VersionedOperationResponse(prevValue, code);
+ }
}
Modified: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/RemoteCacheImpl.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/RemoteCacheImpl.java 2010-03-31 07:34:14 UTC (rev 1642)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/RemoteCacheImpl.java 2010-03-31 11:16:34 UTC (rev 1643)
@@ -2,6 +2,7 @@
import org.infinispan.client.hotrod.Flag;
import org.infinispan.client.hotrod.RemoteCache;
+import org.infinispan.client.hotrod.ServerStatistics;
import org.infinispan.client.hotrod.Version;
import org.infinispan.util.concurrent.NotifyingFuture;
@@ -30,8 +31,8 @@
@Override
public boolean remove(K key, long version) {
- HotrodOperations.VersionedOperationResponse response = operations.removeIfUnmodified(obj2bytes(key), version, flags());
- return response.isUpdated();
+ VersionedOperationResponse response = operations.removeIfUnmodified(obj2bytes(key), version, flags());
+ return response.getCode().isUpdated();
}
@Override
@@ -41,8 +42,8 @@
@Override
public boolean replace(K key, V newValue, long version, int lifespanSeconds, int maxIdleTimeSeconds) {
- HotrodOperations.VersionedOperationResponse response = operations.replaceIfUnmodified(obj2bytes(key), obj2bytes(newValue), lifespanSeconds, maxIdleTimeSeconds, version, flags());
- return response.isUpdated();
+ VersionedOperationResponse response = operations.replaceIfUnmodified(obj2bytes(key), obj2bytes(newValue), lifespanSeconds, maxIdleTimeSeconds, version, flags());
+ return response.getCode().isUpdated();
}
@Override
@@ -69,6 +70,16 @@
}
@Override
+ public ServerStatistics stats() {
+ Map<String, Number> statsMap = operations.stats();
+ ServerStatisticsImpl stats = new ServerStatisticsImpl();
+ for (Map.Entry<String, Number> entry : statsMap.entrySet()) {
+ stats.addStats(entry.getKey(), entry.getValue());
+ }
+ return stats;
+ }
+
+ @Override
public String getName() {
return name;
}
@@ -151,6 +162,11 @@
}
@Override
+ public boolean ping() {
+ return operations.ping();
+ }
+
+ @Override
public void start() {
// TODO: Customise this generated block
}
Added: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/ServerStatisticsImpl.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/ServerStatisticsImpl.java (rev 0)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/ServerStatisticsImpl.java 2010-03-31 11:16:34 UTC (rev 1643)
@@ -0,0 +1,52 @@
+package org.infinispan.client.hotrod.impl;
+
+import org.infinispan.client.hotrod.ServerStatistics;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * // TODO: Document this
+ *
+ * @author Mircea.Markus at jboss.com
+ * @since 4.1
+ */
+public class ServerStatisticsImpl implements ServerStatistics {
+
+ public static final Set<String> supportedStatNames;
+
+ private Map<String, Number> stats = new HashMap<String, Number>();
+
+ static {
+ Set<String> keys = new HashSet<String>();
+ keys.add(CURRENT_NR_OF_ENTRIES);
+ keys.add(HITS);
+ keys.add(MISSES);
+ keys.add(REMOVE_HITS);
+ keys.add(REMOVE_MISSES);
+ keys.add(RETRIEVALS);
+ keys.add(TOTAL_NR_OF_ENTRIES);
+ keys.add(TIME_SINCE_START);
+ supportedStatNames = Collections.unmodifiableSet(keys);
+ }
+
+ @Override
+ public Map<String, Number> getStatsMap() {
+ return Collections.unmodifiableMap(stats);
+ }
+
+ @Override
+ public Number getStats(String statsName) {
+ return stats.get(statsName);
+ }
+
+ public void addStats(String name, Number value) {
+ if (!supportedStatNames.contains(name)) {
+ throw new IllegalArgumentException("Unknown stat: '" + name);
+ }
+ stats.put(name, value);
+ }
+}
Added: trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/VersionedOperationResponse.java
===================================================================
--- trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/VersionedOperationResponse.java (rev 0)
+++ trunk/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/VersionedOperationResponse.java 2010-03-31 11:16:34 UTC (rev 1643)
@@ -0,0 +1,41 @@
+package org.infinispan.client.hotrod.impl;
+
+/**
+* // TODO: Document this
+*
+* @author Mircea.Markus at jboss.com
+* @since 4.1
+*/
+public class VersionedOperationResponse {
+
+ public enum RspCode {
+ SUCCESS(true), NO_SUCH_KEY(false), MODIFIED_KEY(false);
+ private boolean isModified;
+
+ RspCode(boolean modified) {
+ isModified = modified;
+ }
+
+ public boolean isUpdated() {
+ return isModified;
+ }
+ }
+
+ private byte[] value;
+
+ private RspCode code;
+
+
+ public VersionedOperationResponse(byte[] value, RspCode code) {
+ this.value = value;
+ this.code = code;
+ }
+
+ public byte[] getValue() {
+ return value;
+ }
+
+ public RspCode getCode() {
+ return code;
+ }
+}
Modified: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodIntegrationTest.java
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodIntegrationTest.java 2010-03-31 07:34:14 UTC (rev 1642)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/HotRodIntegrationTest.java 2010-03-31 11:16:34 UTC (rev 1643)
@@ -24,7 +24,7 @@
* @author mmarkus
* @since 4.1
*/
- at Test (testName = "client.hotrod.HotRodClientIntegrationTest", groups = "functional", enabled = true)
+ at Test (testName = "client.hotrod.HotRodClientIntegrationTest", groups = "functional")
public class HotRodIntegrationTest extends SingleCacheManagerTest {
private static final String CACHE_NAME = "replSync";
@@ -49,17 +49,22 @@
//pass the config file to the cache
hotrodServer = HotRodTestingUtil.startHotRodServer(cacheManager);
- remoteCacheManager = new RemoteCacheManager();
+ remoteCacheManager = getRemoteCacheManager();
defaultRemote = remoteCacheManager.getCache();
remoteCache = remoteCacheManager.getCache(CACHE_NAME);
return cacheManager;
}
+ protected RemoteCacheManager getRemoteCacheManager() {
+ return new RemoteCacheManager();
+ }
- @AfterClass (enabled = false)
+ @AfterClass (enabled = true)
public void testDestroyRemoteCacheFactory() {
+ assert remoteCache.ping();
hotrodServer.stop();
+ assert !remoteCache.ping();
// try {
// remoteCache.get("aKey");
// assert false;
@@ -199,9 +204,9 @@
remoteCache.put("aKey", "aValue");
remoteCache.put("aKey2", "aValue");
remoteCache.clear();
- assert cache.isEmpty();
assert !remoteCache.containsKey("aKey");
assert !remoteCache.containsKey("aKey2");
+ assert cache.isEmpty();
}
public void testStats() {
Added: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/NettyHotRodIntegrationTest.java
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/NettyHotRodIntegrationTest.java (rev 0)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/NettyHotRodIntegrationTest.java 2010-03-31 11:16:34 UTC (rev 1643)
@@ -0,0 +1,28 @@
+package org.infinispan.client.hotrod;
+
+import org.infinispan.client.hotrod.impl.transport.netty.NettyTransportFactory;
+import org.testng.annotations.Test;
+
+import java.util.Properties;
+
+/**
+ * // TODO: Document this
+ *
+ * @author Mircea.Marku127.0.0.1:11311;127.0.0.2:11411s at jboss.com
+ * @since 4.1
+ */
+ at Test(testName = "hotrod.NettyHotRodIntegrationTest", groups = "functional")
+public class NettyHotRodIntegrationTest extends HotRodIntegrationTest {
+ @Override
+ protected RemoteCacheManager getRemoteCacheManager() {
+ Properties props = new Properties();
+ props.put("transport-factory", NettyTransportFactory.class.getName());
+ props.put("hotrod-servers", "127.0.0.1:11311;127.0.0.2:11411");
+ return new RemoteCacheManager(props, true);
+ }
+
+ @Override
+ public void testPut() {
+ super.testPut(); // TODO: Customise this generated block
+ }
+}
Added: trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/TestHotrodStatistics.java
===================================================================
--- trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/TestHotrodStatistics.java (rev 0)
+++ trunk/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/TestHotrodStatistics.java 2010-03-31 11:16:34 UTC (rev 1643)
@@ -0,0 +1,11 @@
+package org.infinispan.client.hotrod;
+
+/**
+ * // TODO: Document this
+ *
+ * @author Mircea.Markus at jboss.com
+ * @since 4.1
+ * todo - add test
+ */
+public class TestHotrodStatistics {
+}
More information about the infinispan-commits
mailing list