geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r454564 - in /geronimo/sandbox/gcache/server/src/test/java/org/apache/geronimo/gcache/transports/tcp: TCPSocketServerTest.java TcpSocketServerTest.java
Date Tue, 10 Oct 2006 00:02:37 GMT
Author: jgenender
Date: Mon Oct  9 17:02:37 2006
New Revision: 454564

URL: http://svn.apache.org/viewvc?view=rev&rev=454564
Log:
Rename to make consistent

Added:
    geronimo/sandbox/gcache/server/src/test/java/org/apache/geronimo/gcache/transports/tcp/TCPSocketServerTest.java
Removed:
    geronimo/sandbox/gcache/server/src/test/java/org/apache/geronimo/gcache/transports/tcp/TcpSocketServerTest.java

Added: geronimo/sandbox/gcache/server/src/test/java/org/apache/geronimo/gcache/transports/tcp/TCPSocketServerTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/server/src/test/java/org/apache/geronimo/gcache/transports/tcp/TCPSocketServerTest.java?view=auto&rev=454564
==============================================================================
--- geronimo/sandbox/gcache/server/src/test/java/org/apache/geronimo/gcache/transports/tcp/TCPSocketServerTest.java
(added)
+++ geronimo/sandbox/gcache/server/src/test/java/org/apache/geronimo/gcache/transports/tcp/TCPSocketServerTest.java
Mon Oct  9 17:02:37 2006
@@ -0,0 +1,58 @@
+/*
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.gcache.transports.tcp;
+
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.geronimo.gcache.command.Command;
+import org.apache.geronimo.gcache.command.MessageAckCommand;
+import org.apache.geronimo.gcache.command.PutSessionCommand;
+import org.testng.annotations.Test;
+
+public class TCPSocketServerTest extends AbstractServer {
+
+    @Test()
+    public void sendSession()  throws Exception {
+
+        //Create a session
+        Map<String,String> session = new HashMap<String, String>();
+        session.put("key1","data1");
+        session.put("key2","data2");
+        session.put("key3","data3");
+        PutSessionCommand command = new PutSessionCommand();
+        command.setCacheName("Cache1");
+        command.setSessionId("Session1");
+        command.setPayloadFromSession(session);
+
+        //Send the packet
+        ByteBuffer commandBuffer = ByteBuffer.wrap(command.createPacket(true));
+        clientChannel.write(commandBuffer);
+
+        //Now receive any data (it Should be a MessageAck)
+        Command ackCommand = this.readCommand(); 
+
+        //Is the message the type we think it is?
+        assert ackCommand instanceof MessageAckCommand;
+
+        //Is the ack for the original message?
+        assert command.getCommandId() == ((MessageAckCommand)ackCommand).getMessageId();
+
+    }
+
+}



Mime
View raw message