summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2020-06-16 11:54:42 +0200
committerHarald Musum <musum@verizonmedia.com>2020-06-16 11:54:42 +0200
commit35f21ae1bb7e3428f54739b21d91658520b4010c (patch)
tree5e9a9a5a3d609d3ffea7186639a9bfff7b585ef2 /configserver
parenteec40a01d1c084505491250b1aa89994b17ad2c5 (diff)
Remove useless test
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/SessionExampleHandlerTest.java101
1 files changed, 0 insertions, 101 deletions
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/SessionExampleHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/SessionExampleHandlerTest.java
deleted file mode 100644
index b6d9ab5d618..00000000000
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/SessionExampleHandlerTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.config.server.http;
-
-import com.yahoo.container.jdisc.HttpRequest;
-import com.yahoo.container.jdisc.HttpResponse;
-import com.yahoo.container.jdisc.ThreadedHttpRequestHandler;
-import com.yahoo.slime.Cursor;
-import com.yahoo.slime.JsonFormat;
-import com.yahoo.slime.Slime;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-
-import static com.yahoo.jdisc.http.HttpResponse.Status.*;
-import static com.yahoo.jdisc.http.HttpRequest.Method.*;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author hmusum
- * @since 5.1.14
- */
-public class SessionExampleHandlerTest {
- private static final String URI = "http://localhost:19071/session/example";
-
- @Test
- public void basicPut() throws IOException {
- final SessionExampleHandler handler = new SessionExampleHandler(Executors.newCachedThreadPool());
- final HttpRequest request = HttpRequest.createTestRequest(URI, PUT);
- HttpResponse response = handler.handle(request);
- assertThat(response.getStatus(), is(OK));
- assertThat(SessionHandlerTest.getRenderedString(response), is("{\"test\":\"PUT received\"}"));
- }
-
- @Test
- public void invalidMethod() {
- final SessionExampleHandler handler = new SessionExampleHandler(Executors.newCachedThreadPool());
- final HttpRequest request = HttpRequest.createTestRequest(URI, GET);
- HttpResponse response = handler.handle(request);
- assertThat(response.getStatus(), is(METHOD_NOT_ALLOWED));
- }
-
-
- /**
- * A handler that prepares a session given by an id in the request.
- *
- * @author hmusum
- * @since 5.1.14
- */
- public static class SessionExampleHandler extends ThreadedHttpRequestHandler {
-
- public SessionExampleHandler(Executor executor) {
- super(executor, null);
- }
-
- @Override
- public HttpResponse handle(HttpRequest request) {
- final com.yahoo.jdisc.http.HttpRequest.Method method = request.getMethod();
- switch (method) {
- case PUT:
- return handlePUT(request);
- case GET:
- return new SessionExampleResponse(METHOD_NOT_ALLOWED, "Method '" + method + "' is not supported");
- default:
- return new SessionExampleResponse(INTERNAL_SERVER_ERROR);
- }
- }
-
- @SuppressWarnings({"UnusedDeclaration"})
- HttpResponse handlePUT(HttpRequest request) {
- return new SessionExampleResponse(OK, "PUT received");
- }
-
- private static class SessionExampleResponse extends HttpResponse {
- private final Slime slime = new Slime();
- private final Cursor root = slime.setObject();
- private final String message;
-
-
- private SessionExampleResponse(int status) {
- this(status, "");
- headers().put("Cache-Control","max-age=120");
- }
-
- private SessionExampleResponse(int status, String message) {
- super(status);
- this.message = message;
- }
-
- @Override
- public void render(OutputStream outputStream) throws IOException {
- root.setString("test", message);
- new JsonFormat(true).encode(outputStream, slime);
- }
- }
- }
-}