You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wink.apache.org by ro...@apache.org on 2010/07/27 15:48:26 UTC

svn commit: r979699 - /incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/handlers/ServerMessageContextTest.java

Author: rott
Date: Tue Jul 27 13:48:26 2010
New Revision: 979699

URL: http://svn.apache.org/viewvc?rev=979699&view=rev
Log:
add test to ensure legacy code lives on

Added:
    incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/handlers/ServerMessageContextTest.java

Added: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/handlers/ServerMessageContextTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/handlers/ServerMessageContextTest.java?rev=979699&view=auto
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/handlers/ServerMessageContextTest.java (added)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/handlers/ServerMessageContextTest.java Tue Jul 27 13:48:26 2010
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.wink.server.internal.handlers;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.HttpMethod;
+
+import junit.framework.TestCase;
+
+import org.apache.wink.common.internal.WinkConfiguration;
+import org.apache.wink.server.internal.DeploymentConfiguration;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.junit.Test;
+
+/**
+ * Initial version of this test class is only intended to check for one little
+ * bit of legacy code, to ensure its existence is eternal, or until the apocalypse.
+ */
+public class ServerMessageContextTest extends TestCase {
+
+    @Test
+    public void testServerMessageContext() {
+        Mockery mockery = new Mockery();
+        final HttpServletRequest request = mockery.mock(HttpServletRequest.class);
+        final HttpServletResponse response = mockery.mock(HttpServletResponse.class);
+        DeploymentConfiguration config = new DeploymentConfiguration();
+        mockery.checking(new Expectations() {
+            {
+                allowing(request).getMethod(); will(returnValue(HttpMethod.GET));
+            }
+        });
+        ServerMessageContext smc = new ServerMessageContext(request, response, config);
+        // object compare to make sure the same object is stored under both
+        // WinkConfiguration and DeploymentConfiguration (legacy)
+        assertTrue(smc.getAttribute(WinkConfiguration.class) == smc.getAttribute(DeploymentConfiguration.class));
+    }
+
+}