You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jg...@apache.org on 2006/10/19 18:13:22 UTC
svn commit: r465671 -
/geronimo/sandbox/gcache/server/src/test/java/org/apache/geronimo/gcache/transports/tcp/TCPSocketServerTest.java
Author: jgenender
Date: Thu Oct 19 09:13:21 2006
New Revision: 465671
URL: http://svn.apache.org/viewvc?view=rev&rev=465671
Log:
Add Mina server
Added:
geronimo/sandbox/gcache/server/src/test/java/org/apache/geronimo/gcache/transports/tcp/TCPSocketServerTest.java (with props)
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=465671
==============================================================================
--- 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 Thu Oct 19 09:13:21 2006
@@ -0,0 +1,59 @@
+/*
+ *
+ * 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));
+ commandBuffer.flip();
+ sendCommand(command);
+
+ //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();
+
+ }
+
+}
Propchange: geronimo/sandbox/gcache/server/src/test/java/org/apache/geronimo/gcache/transports/tcp/TCPSocketServerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/gcache/server/src/test/java/org/apache/geronimo/gcache/transports/tcp/TCPSocketServerTest.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/gcache/server/src/test/java/org/apache/geronimo/gcache/transports/tcp/TCPSocketServerTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain