summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-03-25 12:26:48 +0100
committerJon Marius Venstad <venstad@gmail.com>2021-03-25 12:26:48 +0100
commit7dc2393d9e203c14a8e679968841cb68aa753595 (patch)
tree137271a5dd25ba079cb107b7212c03c0d26b745e
parent9de276bb472166383c40d82666dc0dbd044603bd (diff)
Rename, remove unused, non-functional
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpErrorResponse.java28
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/HandlerTest.java4
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpErrorResponseTest.java2
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpGetConfigHandlerTest.java6
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpHandlerTest.java2
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpListConfigsHandlerTest.java6
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java10
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/HostHandlerTest.java6
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/HttpGetConfigHandlerTest.java6
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/HttpListConfigsHandlerTest.java6
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionActiveHandlerTest.java2
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionCreateHandlerTest.java14
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java18
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/TenantController.java6
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/security/AthenzCredentials.java2
-rw-r--r--http-utils/src/main/java/ai/vespa/util/http/hc5/VespaHttpClientBuilder.java1
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/handler/AbstractRequestHandlerTestCase.java7
17 files changed, 59 insertions, 67 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpErrorResponse.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpErrorResponse.java
index 7dc6b5185a6..3961fe12357 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpErrorResponse.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpErrorResponse.java
@@ -37,7 +37,7 @@ public class HttpErrorResponse extends HttpResponse {
}
}
- public enum errorCodes {
+ public enum ErrorCode {
APPLICATION_LOCK_FAILURE,
BAD_REQUEST,
ACTIVATION_CONFLICT,
@@ -54,55 +54,55 @@ public class HttpErrorResponse extends HttpResponse {
}
public static HttpErrorResponse notFoundError(String msg) {
- return new HttpErrorResponse(NOT_FOUND, errorCodes.NOT_FOUND.name(), msg);
+ return new HttpErrorResponse(NOT_FOUND, ErrorCode.NOT_FOUND.name(), msg);
}
public static HttpErrorResponse internalServerError(String msg) {
- return new HttpErrorResponse(INTERNAL_SERVER_ERROR, errorCodes.INTERNAL_SERVER_ERROR.name(), msg);
+ return new HttpErrorResponse(INTERNAL_SERVER_ERROR, ErrorCode.INTERNAL_SERVER_ERROR.name(), msg);
}
public static HttpErrorResponse invalidApplicationPackage(String msg) {
- return new HttpErrorResponse(BAD_REQUEST, errorCodes.INVALID_APPLICATION_PACKAGE.name(), msg);
+ return new HttpErrorResponse(BAD_REQUEST, ErrorCode.INVALID_APPLICATION_PACKAGE.name(), msg);
}
public static HttpErrorResponse outOfCapacity(String msg) {
- return new HttpErrorResponse(BAD_REQUEST, errorCodes.OUT_OF_CAPACITY.name(), msg);
+ return new HttpErrorResponse(BAD_REQUEST, ErrorCode.OUT_OF_CAPACITY.name(), msg);
}
public static HttpErrorResponse badRequest(String msg) {
- return new HttpErrorResponse(BAD_REQUEST, errorCodes.BAD_REQUEST.name(), msg);
+ return new HttpErrorResponse(BAD_REQUEST, ErrorCode.BAD_REQUEST.name(), msg);
}
public static HttpErrorResponse conflictWhenActivating(String msg) {
- return new HttpErrorResponse(CONFLICT, errorCodes.ACTIVATION_CONFLICT.name(), msg);
+ return new HttpErrorResponse(CONFLICT, ErrorCode.ACTIVATION_CONFLICT.name(), msg);
}
public static HttpErrorResponse methodNotAllowed(String msg) {
- return new HttpErrorResponse(METHOD_NOT_ALLOWED, errorCodes.METHOD_NOT_ALLOWED.name(), msg);
+ return new HttpErrorResponse(METHOD_NOT_ALLOWED, ErrorCode.METHOD_NOT_ALLOWED.name(), msg);
}
public static HttpResponse unknownVespaVersion(String message) {
- return new HttpErrorResponse(BAD_REQUEST, errorCodes.UNKNOWN_VESPA_VERSION.name(), message);
+ return new HttpErrorResponse(BAD_REQUEST, ErrorCode.UNKNOWN_VESPA_VERSION.name(), message);
}
public static HttpResponse requestTimeout(String message) {
- return new HttpErrorResponse(REQUEST_TIMEOUT, errorCodes.REQUEST_TIMEOUT.name(), message);
+ return new HttpErrorResponse(REQUEST_TIMEOUT, ErrorCode.REQUEST_TIMEOUT.name(), message);
}
public static HttpErrorResponse applicationLockFailure(String msg) {
- return new HttpErrorResponse(INTERNAL_SERVER_ERROR, errorCodes.APPLICATION_LOCK_FAILURE.name(), msg);
+ return new HttpErrorResponse(INTERNAL_SERVER_ERROR, ErrorCode.APPLICATION_LOCK_FAILURE.name(), msg);
}
public static HttpErrorResponse parentHostNotReady(String msg) {
- return new HttpErrorResponse(CONFLICT, errorCodes.PARENT_HOST_NOT_READY.name(), msg);
+ return new HttpErrorResponse(CONFLICT, ErrorCode.PARENT_HOST_NOT_READY.name(), msg);
}
public static HttpErrorResponse certificateNotReady(String msg) {
- return new HttpErrorResponse(CONFLICT, errorCodes.CERTIFICATE_NOT_READY.name(), msg);
+ return new HttpErrorResponse(CONFLICT, ErrorCode.CERTIFICATE_NOT_READY.name(), msg);
}
public static HttpErrorResponse loadBalancerNotReady(String msg) {
- return new HttpErrorResponse(CONFLICT, errorCodes.LOAD_BALANCER_NOT_READY.name(), msg);
+ return new HttpErrorResponse(CONFLICT, ErrorCode.LOAD_BALANCER_NOT_READY.name(), msg);
}
@Override
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/HandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/HandlerTest.java
index 0e2cee24b60..6047aa1dbc5 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/HandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/HandlerTest.java
@@ -19,7 +19,7 @@ public class HandlerTest {
public static void assertHttpStatusCodeErrorCodeAndMessage(
HttpResponse response,
int statusCode,
- HttpErrorResponse.errorCodes errorCode,
+ HttpErrorResponse.ErrorCode errorCode,
String contentType,
String message) throws IOException {
assertNotNull(response);
@@ -37,7 +37,7 @@ public class HandlerTest {
assertThat(renderedString, containsString(message));
}
- public static void assertHttpStatusCodeErrorCodeAndMessage(HttpResponse response, int statusCode, HttpErrorResponse.errorCodes errorCode, String message) throws IOException {
+ public static void assertHttpStatusCodeErrorCodeAndMessage(HttpResponse response, int statusCode, HttpErrorResponse.ErrorCode errorCode, String message) throws IOException {
assertHttpStatusCodeErrorCodeAndMessage(response, statusCode, errorCode, null, message);
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpErrorResponseTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpErrorResponseTest.java
index 56391127b62..3fe52fe9691 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpErrorResponseTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpErrorResponseTest.java
@@ -24,7 +24,7 @@ public class HttpErrorResponseTest {
@Test
public void testThatHttpErrorResponseProvidesCorrectErrorMessage() throws IOException {
HttpErrorResponse response = HttpErrorResponse.badRequest("Error doing something");
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, BAD_REQUEST, HttpErrorResponse.errorCodes.BAD_REQUEST, "Error doing something");
+ HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, BAD_REQUEST, HttpErrorResponse.ErrorCode.BAD_REQUEST, "Error doing something");
}
@Test
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpGetConfigHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpGetConfigHandlerTest.java
index 176686e5843..67992d817d0 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpGetConfigHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpGetConfigHandlerTest.java
@@ -81,14 +81,14 @@ public class HttpGetConfigHandlerTest {
final String illegalConfigNameUri = baseUri + "/foobar/myid";
HttpResponse response = handler.handle(HttpRequest.createTestRequest(nonExistingConfigNameUri, GET));
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "No such config: nonexisting.config");
+ HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.ErrorCode.NOT_FOUND, "No such config: nonexisting.config");
assertTrue(SessionHandlerTest.getRenderedString(response).contains("No such config:"));
response = handler.handle(HttpRequest.createTestRequest(nonExistingConfigUri, GET));
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "No such config id: myid/nonexisting/id");
+ HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.ErrorCode.NOT_FOUND, "No such config id: myid/nonexisting/id");
assertEquals(response.getContentType(), "application/json");
assertTrue(SessionHandlerTest.getRenderedString(response).contains("No such config id:"));
response = handler.handle(HttpRequest.createTestRequest(illegalConfigNameUri, GET));
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, BAD_REQUEST, HttpErrorResponse.errorCodes.BAD_REQUEST, "Illegal config, must be of form namespace.name.");
+ HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, BAD_REQUEST, HttpErrorResponse.ErrorCode.BAD_REQUEST, "Illegal config, must be of form namespace.name.");
}
@Test
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpHandlerTest.java
index ab161feb519..7b1dad40e13 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpHandlerTest.java
@@ -31,7 +31,7 @@ public class HttpHandlerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
response.render(baos);
Slime data = SlimeUtils.jsonToSlime(baos.toByteArray());
- assertThat(data.get().field("error-code").asString(), is(HttpErrorResponse.errorCodes.INVALID_APPLICATION_PACKAGE.name()));
+ assertThat(data.get().field("error-code").asString(), is(HttpErrorResponse.ErrorCode.INVALID_APPLICATION_PACKAGE.name()));
assertThat(data.get().field("message").asString(), is(message));
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpListConfigsHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpListConfigsHandlerTest.java
index ff33eb70bca..bfd4b1aff37 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpListConfigsHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/HttpListConfigsHandlerTest.java
@@ -121,13 +121,13 @@ public class HttpListConfigsHandlerTest {
public void require_error_on_bad_request() throws IOException {
HttpRequest req = createTestRequest(baseUri + "foobar/hosts/localhost/sentinel/", GET);
HttpResponse resp = namedHandler.handle(req);
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(resp, BAD_REQUEST, HttpErrorResponse.errorCodes.BAD_REQUEST, "Illegal config, must be of form namespace.name.");
+ HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(resp, BAD_REQUEST, HttpErrorResponse.ErrorCode.BAD_REQUEST, "Illegal config, must be of form namespace.name.");
req = createTestRequest(baseUri + "foo.barNOPE/conf/id/", GET);
resp = namedHandler.handle(req);
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(resp, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "No such config: foo.barNOPE");
+ HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(resp, NOT_FOUND, HttpErrorResponse.ErrorCode.NOT_FOUND, "No such config: foo.barNOPE");
req = createTestRequest(baseUri + "cloud.config.sentinel/conf/id/NOPE/", GET);
resp = namedHandler.handle(req);
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(resp, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "No such config id: conf/id/NOPE");
+ HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(resp, NOT_FOUND, HttpErrorResponse.ErrorCode.NOT_FOUND, "No such config id: conf/id/NOPE");
}
private PrepareParams prepareParams() {
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
index d364785f415..22a5b3795d9 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
@@ -186,7 +186,7 @@ public class ApplicationHandlerTest {
deleteAndAssertResponse(myTenantApplicationId,
Zone.defaultZone(),
Response.Status.NOT_FOUND,
- HttpErrorResponse.errorCodes.NOT_FOUND,
+ HttpErrorResponse.ErrorCode.NOT_FOUND,
"Unable to delete mytenant.default.default: Not found");
}
@@ -543,7 +543,7 @@ public class ApplicationHandlerTest {
private void assertNotAllowed(Method method) throws IOException {
String url = "http://myhost:14000/application/v2/tenant/" + mytenantName + "/application/default";
- deleteAndAssertResponse(url, Response.Status.METHOD_NOT_ALLOWED, HttpErrorResponse.errorCodes.METHOD_NOT_ALLOWED, "{\"error-code\":\"METHOD_NOT_ALLOWED\",\"message\":\"Method '" + method + "' is not supported\"}",
+ deleteAndAssertResponse(url, Response.Status.METHOD_NOT_ALLOWED, HttpErrorResponse.ErrorCode.METHOD_NOT_ALLOWED, "{\"error-code\":\"METHOD_NOT_ALLOWED\",\"message\":\"Method '" + method + "' is not supported\"}",
method);
}
@@ -558,16 +558,16 @@ public class ApplicationHandlerTest {
deleteAndAssertResponse(applicationId, Zone.defaultZone(), Response.Status.OK, null, true);
}
- private void deleteAndAssertResponse(ApplicationId applicationId, Zone zone, int expectedStatus, HttpErrorResponse.errorCodes errorCode, boolean fullAppIdInUrl) throws IOException {
+ private void deleteAndAssertResponse(ApplicationId applicationId, Zone zone, int expectedStatus, HttpErrorResponse.ErrorCode errorCode, boolean fullAppIdInUrl) throws IOException {
String expectedResponse = "{\"message\":\"Application '" + applicationId + "' deleted\"}";
deleteAndAssertResponse(toUrlPath(applicationId, zone, fullAppIdInUrl), expectedStatus, errorCode, expectedResponse, Method.DELETE);
}
- private void deleteAndAssertResponse(ApplicationId applicationId, Zone zone, int expectedStatus, HttpErrorResponse.errorCodes errorCode, String expectedResponse) throws IOException {
+ private void deleteAndAssertResponse(ApplicationId applicationId, Zone zone, int expectedStatus, HttpErrorResponse.ErrorCode errorCode, String expectedResponse) throws IOException {
deleteAndAssertResponse(toUrlPath(applicationId, zone, true), expectedStatus, errorCode, expectedResponse, Method.DELETE);
}
- private void deleteAndAssertResponse(String url, int expectedStatus, HttpErrorResponse.errorCodes errorCode, String expectedResponse, Method method) throws IOException {
+ private void deleteAndAssertResponse(String url, int expectedStatus, HttpErrorResponse.ErrorCode errorCode, String expectedResponse, Method method) throws IOException {
ApplicationHandler handler = createApplicationHandler();
HttpResponse response = handler.handle(createTestRequest(url, method));
if (expectedStatus == 200) {
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/HostHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/HostHandlerTest.java
index 2514a911c06..eaf98a89d35 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/HostHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/HostHandlerTest.java
@@ -91,7 +91,7 @@ public class HostHandlerTest {
private void assertNotAllowed(Method method) throws IOException {
String url = urlPrefix + "somehostname";
executeAndAssertResponse(url, Response.Status.METHOD_NOT_ALLOWED,
- HttpErrorResponse.errorCodes.METHOD_NOT_ALLOWED,
+ HttpErrorResponse.ErrorCode.METHOD_NOT_ALLOWED,
"{\"error-code\":\"METHOD_NOT_ALLOWED\",\"message\":\"Method '" + method + "' is not supported\"}",
method);
}
@@ -111,10 +111,10 @@ public class HostHandlerTest {
private void assertErrorForUnknownHost(String hostname, int expectedStatus, String expectedResponse) throws IOException {
String url = urlPrefix + hostname;
HttpResponse response = handler.handle(HttpRequest.createTestRequest(url, com.yahoo.jdisc.http.HttpRequest.Method.GET));
- assertHttpStatusCodeErrorCodeAndMessage(response, expectedStatus, HttpErrorResponse.errorCodes.NOT_FOUND, expectedResponse);
+ assertHttpStatusCodeErrorCodeAndMessage(response, expectedStatus, HttpErrorResponse.ErrorCode.NOT_FOUND, expectedResponse);
}
- private void executeAndAssertResponse(String url, int expectedStatus, HttpErrorResponse.errorCodes errorCode,
+ private void executeAndAssertResponse(String url, int expectedStatus, HttpErrorResponse.ErrorCode errorCode,
String expectedResponse, Method method) throws IOException {
HttpResponse response = handler.handle(HttpRequest.createTestRequest(url, method));
assertHttpStatusCodeErrorCodeAndMessage(response, expectedStatus, errorCode, expectedResponse);
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/HttpGetConfigHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/HttpGetConfigHandlerTest.java
index 983a02d2496..58de09088da 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/HttpGetConfigHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/HttpGetConfigHandlerTest.java
@@ -119,14 +119,14 @@ public class HttpGetConfigHandlerTest {
String illegalConfigNameUri = baseUri + "/foobar/myid";
HttpResponse response = handler.handle(HttpRequest.createTestRequest(nonExistingConfigNameUri, GET));
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "No such config: nonexisting.config");
+ HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.ErrorCode.NOT_FOUND, "No such config: nonexisting.config");
assertTrue(SessionHandlerTest.getRenderedString(response).contains("No such config:"));
response = handler.handle(HttpRequest.createTestRequest(nonExistingConfigUri, GET));
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "No such config id: myid/nonexisting/id");
+ HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.ErrorCode.NOT_FOUND, "No such config id: myid/nonexisting/id");
assertEquals(response.getContentType(), "application/json");
assertTrue(SessionHandlerTest.getRenderedString(response).contains("No such config id:"));
response = handler.handle(HttpRequest.createTestRequest(illegalConfigNameUri, GET));
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, BAD_REQUEST, HttpErrorResponse.errorCodes.BAD_REQUEST, "Illegal config, must be of form namespace.name.");
+ HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, BAD_REQUEST, HttpErrorResponse.ErrorCode.BAD_REQUEST, "Illegal config, must be of form namespace.name.");
}
@Test
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/HttpListConfigsHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/HttpListConfigsHandlerTest.java
index 4453e78f64e..943ff9b0fd1 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/HttpListConfigsHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/HttpListConfigsHandlerTest.java
@@ -153,13 +153,13 @@ public class HttpListConfigsHandlerTest {
public void require_error_on_bad_request() throws IOException {
HttpRequest req = createTestRequest(baseUri + "foobar/hosts/localhost/sentinel/", GET);
HttpResponse resp = namedHandler.handle(req);
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(resp, BAD_REQUEST, HttpErrorResponse.errorCodes.BAD_REQUEST, "Illegal config, must be of form namespace.name.");
+ HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(resp, BAD_REQUEST, HttpErrorResponse.ErrorCode.BAD_REQUEST, "Illegal config, must be of form namespace.name.");
req = createTestRequest(baseUri + "foo.barNOPE/conf/id/", GET);
resp = namedHandler.handle(req);
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(resp, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "No such config: foo.barNOPE");
+ HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(resp, NOT_FOUND, HttpErrorResponse.ErrorCode.NOT_FOUND, "No such config: foo.barNOPE");
req = createTestRequest(baseUri + "cloud.config.sentinel/conf/id/NOPE/", GET);
resp = namedHandler.handle(req);
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(resp, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "No such config id: conf/id/NOPE");
+ HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(resp, NOT_FOUND, HttpErrorResponse.ErrorCode.NOT_FOUND, "No such config id: conf/id/NOPE");
}
@Test
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionActiveHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionActiveHandlerTest.java
index 635f6d58abc..a51346148d2 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionActiveHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionActiveHandlerTest.java
@@ -111,7 +111,7 @@ public class SessionActiveHandlerTest {
HttpResponse response = handler.handle(request);
HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response,
METHOD_NOT_ALLOWED,
- HttpErrorResponse.errorCodes.METHOD_NOT_ALLOWED,
+ HttpErrorResponse.ErrorCode.METHOD_NOT_ALLOWED,
"Method '" + request.getMethod().name() + "' is not supported");
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionCreateHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionCreateHandlerTest.java
index dd1a4996884..83d6ac5b288 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionCreateHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionCreateHandlerTest.java
@@ -90,13 +90,13 @@ public class SessionCreateHandlerTest extends SessionHandlerTest {
public void require_that_from_parameter_cannot_be_set_if_data_in_request() throws IOException {
HttpRequest request = post(Collections.singletonMap("from", "active"));
HttpResponse response = createHandler().handle(request);
- assertHttpStatusCodeErrorCodeAndMessage(response, BAD_REQUEST, HttpErrorResponse.errorCodes.BAD_REQUEST, "Parameter 'from' is illegal for POST");
+ assertHttpStatusCodeErrorCodeAndMessage(response, BAD_REQUEST, HttpErrorResponse.ErrorCode.BAD_REQUEST, "Parameter 'from' is illegal for POST");
}
@Test
public void require_that_post_request_must_contain_data() throws IOException {
HttpResponse response = createHandler().handle(post());
- assertHttpStatusCodeErrorCodeAndMessage(response, BAD_REQUEST, HttpErrorResponse.errorCodes.BAD_REQUEST, "Request contains no data");
+ assertHttpStatusCodeErrorCodeAndMessage(response, BAD_REQUEST, HttpErrorResponse.ErrorCode.BAD_REQUEST, "Request contains no data");
}
@Test
@@ -104,13 +104,13 @@ public class SessionCreateHandlerTest extends SessionHandlerTest {
HashMap<String, String> headers = new HashMap<>(); // no Content-Type header
File outFile = CompressedApplicationInputStreamTest.createTarFile();
HttpResponse response = createHandler().handle(post(outFile, headers, null));
- assertHttpStatusCodeErrorCodeAndMessage(response, BAD_REQUEST, HttpErrorResponse.errorCodes.BAD_REQUEST, "Request contains no Content-Type header");
+ assertHttpStatusCodeErrorCodeAndMessage(response, BAD_REQUEST, HttpErrorResponse.ErrorCode.BAD_REQUEST, "Request contains no Content-Type header");
}
private void assertIllegalFromParameter(String fromValue) throws IOException {
File outFile = CompressedApplicationInputStreamTest.createTarFile();
HttpRequest request = post(outFile, postHeaders, Collections.singletonMap("from", fromValue));
- assertHttpStatusCodeErrorCodeAndMessage(createHandler().handle(request), BAD_REQUEST, HttpErrorResponse.errorCodes.BAD_REQUEST, "Parameter 'from' has illegal value '" + fromValue + "'");
+ assertHttpStatusCodeErrorCodeAndMessage(createHandler().handle(request), BAD_REQUEST, HttpErrorResponse.ErrorCode.BAD_REQUEST, "Parameter 'from' has illegal value '" + fromValue + "'");
}
@Test
@@ -130,8 +130,8 @@ public class SessionCreateHandlerTest extends SessionHandlerTest {
public void require_that_handler_does_not_support_get() throws IOException {
HttpResponse response = createHandler().handle(HttpRequest.createTestRequest(pathPrefix, GET));
assertHttpStatusCodeErrorCodeAndMessage(response, METHOD_NOT_ALLOWED,
- HttpErrorResponse.errorCodes.METHOD_NOT_ALLOWED,
- "Method 'GET' is not supported");
+ HttpErrorResponse.ErrorCode.METHOD_NOT_ALLOWED,
+ "Method 'GET' is not supported");
}
@Test
@@ -140,7 +140,7 @@ public class SessionCreateHandlerTest extends SessionHandlerTest {
new FileWriter(outFile).write("rubbish");
HttpResponse response = createHandler().handle(post(outFile));
assertHttpStatusCodeErrorCodeAndMessage(response, INTERNAL_SERVER_ERROR,
- HttpErrorResponse.errorCodes.INTERNAL_SERVER_ERROR,
+ HttpErrorResponse.ErrorCode.INTERNAL_SERVER_ERROR,
"Unable to create compressed application stream");
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java
index a69cbe74eae..584caad4ded 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java
@@ -98,7 +98,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
public void require_error_when_session_id_does_not_exist() throws Exception {
// No session with this id exists
HttpResponse response = request(HttpRequest.Method.PUT, 9999L);
- assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "Session 9999 was not found");
+ assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.ErrorCode.NOT_FOUND, "Session 9999 was not found");
}
@Test
@@ -106,7 +106,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
final String session = "notanumber/prepared";
HttpResponse response = createHandler().handle(SessionHandlerTest.createTestRequest(pathPrefix + session));
assertHttpStatusCodeErrorCodeAndMessage(response, BAD_REQUEST,
- HttpErrorResponse.errorCodes.BAD_REQUEST,
+ HttpErrorResponse.ErrorCode.BAD_REQUEST,
"Session id in request is not a number, request was 'http://" + hostname + ":" + port + pathPrefix + session + "'");
}
@@ -119,7 +119,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
private void testUnsupportedMethod(com.yahoo.container.jdisc.HttpRequest request) throws Exception {
HttpResponse response = createHandler().handle(request);
assertHttpStatusCodeErrorCodeAndMessage(response, METHOD_NOT_ALLOWED,
- HttpErrorResponse.errorCodes.METHOD_NOT_ALLOWED,
+ HttpErrorResponse.ErrorCode.METHOD_NOT_ALLOWED,
"Method '" + request.getMethod().name() + "' is not supported");
}
@@ -166,7 +166,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
HttpResponse getResponse = request(HttpRequest.Method.GET, sessionId);
assertHttpStatusCodeErrorCodeAndMessage(getResponse, BAD_REQUEST,
- HttpErrorResponse.errorCodes.BAD_REQUEST,
+ HttpErrorResponse.ErrorCode.BAD_REQUEST,
"Session not prepared: " + sessionId);
request(HttpRequest.Method.PUT, sessionId);
@@ -174,7 +174,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
getResponse = request(HttpRequest.Method.GET, sessionId);
assertHttpStatusCodeErrorCodeAndMessage(getResponse, BAD_REQUEST,
- HttpErrorResponse.errorCodes.BAD_REQUEST,
+ HttpErrorResponse.ErrorCode.BAD_REQUEST,
"Session is active: " + sessionId);
}
@@ -182,7 +182,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
public void require_get_response_error_when_session_id_does_not_exist() throws Exception {
HttpResponse getResponse = request(HttpRequest.Method.GET, 9999L);
assertHttpStatusCodeErrorCodeAndMessage(getResponse, NOT_FOUND,
- HttpErrorResponse.errorCodes.NOT_FOUND,
+ HttpErrorResponse.ErrorCode.NOT_FOUND,
"Session 9999 was not found");
}
@@ -256,7 +256,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
HttpResponse response = handler.handle(createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, sessionId));
assertEquals(400, response.getStatus());
Slime data = getData(response);
- assertThat(data.get().field("error-code").asString(), is(HttpErrorResponse.errorCodes.OUT_OF_CAPACITY.name()));
+ assertThat(data.get().field("error-code").asString(), is(HttpErrorResponse.ErrorCode.OUT_OF_CAPACITY.name()));
assertThat(data.get().field("message").asString(), is(exceptionMessage));
}
@@ -271,7 +271,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
HttpResponse response = handler.handle(createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, sessionId));
assertEquals(500, response.getStatus());
Slime data = getData(response);
- assertThat(data.get().field("error-code").asString(), is(HttpErrorResponse.errorCodes.INTERNAL_SERVER_ERROR.name()));
+ assertThat(data.get().field("error-code").asString(), is(HttpErrorResponse.ErrorCode.INTERNAL_SERVER_ERROR.name()));
assertThat(data.get().field("message").asString(), is(exceptionMessage));
}
@@ -286,7 +286,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
HttpResponse response = handler.handle(createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, sessionId));
assertEquals(500, response.getStatus());
Slime data = getData(response);
- assertThat(data.get().field("error-code").asString(), is(HttpErrorResponse.errorCodes.APPLICATION_LOCK_FAILURE.name()));
+ assertThat(data.get().field("error-code").asString(), is(HttpErrorResponse.ErrorCode.APPLICATION_LOCK_FAILURE.name()));
assertThat(data.get().field("message").asString(), is(exceptionMessage));
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/TenantController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/TenantController.java
index d3992290f20..fdd0e02e2ec 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/TenantController.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/TenantController.java
@@ -71,12 +71,6 @@ public class TenantController {
.collect(Collectors.toList());
}
- // TODO jonmv: Remove.
- /** Returns the list of tenants accessible to the given user. */
- public List<Tenant> asList(Credentials credentials) {
- return ((AthenzFacade) accessControl).accessibleTenants(asList(), credentials);
- }
-
/** Locks a tenant for modification and applies the given action. */
public <T extends LockedTenant> void lockIfPresent(TenantName name, Class<T> token, Consumer<T> action) {
try (Lock lock = lock(name)) {
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/security/AthenzCredentials.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/security/AthenzCredentials.java
index ebdb70e2c6c..ae7358e74f8 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/security/AthenzCredentials.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/security/AthenzCredentials.java
@@ -38,7 +38,7 @@ public class AthenzCredentials extends Credentials {
/** Returns the Okta access token required for Athenz tenancy operation */
public OktaAccessToken accessToken() { return accessToken; }
- /** /** Returns the Okta identity token required for Athenz tenancy operation */
+ /** Returns the Okta identity token required for Athenz tenancy operation */
public OktaIdentityToken identityToken() { return identityToken; }
diff --git a/http-utils/src/main/java/ai/vespa/util/http/hc5/VespaHttpClientBuilder.java b/http-utils/src/main/java/ai/vespa/util/http/hc5/VespaHttpClientBuilder.java
index 2824a1b801d..40cb0796cbf 100644
--- a/http-utils/src/main/java/ai/vespa/util/http/hc5/VespaHttpClientBuilder.java
+++ b/http-utils/src/main/java/ai/vespa/util/http/hc5/VespaHttpClientBuilder.java
@@ -1,7 +1,6 @@
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.util.http.hc5;
-import com.yahoo.security.tls.TransportSecurityUtils;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
import org.apache.hc.client5.http.io.HttpClientConnectionManager;
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/handler/AbstractRequestHandlerTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/handler/AbstractRequestHandlerTestCase.java
index a80f3725b51..e530510b6da 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/handler/AbstractRequestHandlerTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/handler/AbstractRequestHandlerTestCase.java
@@ -10,9 +10,9 @@ import org.junit.Test;
import java.net.URI;
import java.nio.ByteBuffer;
-import java.nio.charset.Charset;
import java.util.concurrent.TimeUnit;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -25,8 +25,7 @@ import static org.junit.Assert.assertTrue;
*/
public class AbstractRequestHandlerTestCase {
- private static final Charset UTF8 = Charset.forName("utf-8");
- private static int NUM_REQUESTS = 666;
+ private static final int NUM_REQUESTS = 666;
@Test
public void requireThatHandleTimeoutIsImplemented() throws Exception {
@@ -56,7 +55,7 @@ public class AbstractRequestHandlerTestCase {
ByteBuffer buf = responseHandler.content.read();
assertNotNull(buf);
- assertEquals("Hello World!", new String(buf.array(), buf.arrayOffset() + buf.position(), buf.remaining(), UTF8));
+ assertEquals("Hello World!", new String(buf.array(), buf.arrayOffset() + buf.position(), buf.remaining(), UTF_8));
assertNull(responseHandler.content.read());
}
assertTrue(driver.close());