From 03bc9bf046d17fa102874fe76935c633ab84a4b5 Mon Sep 17 00:00:00 2001 From: Martin Polden Date: Thu, 25 Oct 2018 08:59:28 +0200 Subject: Remove unused API path --- .../restapi/screwdriver/ScrewdriverApiHandler.java | 22 +++------------------- .../restapi/screwdriver/ScrewdriverApiTest.java | 14 -------------- 2 files changed, 3 insertions(+), 33 deletions(-) (limited to 'controller-server') diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiHandler.java index 74caa4dcb47..6633eafc509 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiHandler.java @@ -6,15 +6,14 @@ import com.yahoo.container.jdisc.HttpRequest; import com.yahoo.container.jdisc.HttpResponse; import com.yahoo.container.jdisc.LoggingRequestHandler; import com.yahoo.jdisc.http.HttpRequest.Method; +import com.yahoo.restapi.Path; import com.yahoo.slime.Cursor; import com.yahoo.slime.Slime; import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.api.integration.BuildService; import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; import com.yahoo.vespa.hosted.controller.restapi.ErrorResponse; -import com.yahoo.restapi.Path; import com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse; -import com.yahoo.vespa.hosted.controller.versions.VespaVersion; import com.yahoo.yolean.Exceptions; import java.io.InputStream; @@ -64,11 +63,9 @@ public class ScrewdriverApiHandler extends LoggingRequestHandler { private HttpResponse get(HttpRequest request) { Path path = new Path(request.getUri().getPath()); - if (path.matches("/screwdriver/v1/release/vespa")) { - return vespaVersion(); - } - if (path.matches("/screwdriver/v1/jobsToRun")) + if (path.matches("/screwdriver/v1/jobsToRun")) { return buildJobs(controller.applications().deploymentTrigger().jobsToRun()); + } return notFound(request); } @@ -97,19 +94,6 @@ public class ScrewdriverApiHandler extends LoggingRequestHandler { return new SlimeJsonResponse(slime); } - private HttpResponse vespaVersion() { - VespaVersion version = controller.versionStatus().version(controller.systemVersion()); - if (version == null) - return ErrorResponse.notFoundError("Information about the current system version is not available at this time"); - - Slime slime = new Slime(); - Cursor cursor = slime.setObject(); - cursor.setString("version", version.versionNumber().toString()); - cursor.setString("sha", version.releaseCommit()); - cursor.setLong("date", version.committedAt().toEpochMilli()); - return new SlimeJsonResponse(slime); - } - private HttpResponse buildJobs(Map> jobLists) { Slime slime = new Slime(); Cursor jobTypesObject = slime.setObject(); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java index 6cd4464dce4..6391e49d041 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java @@ -8,10 +8,8 @@ import com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobReport; import com.yahoo.vespa.hosted.controller.application.SourceRevision; import com.yahoo.vespa.hosted.controller.restapi.ContainerControllerTester; import com.yahoo.vespa.hosted.controller.restapi.ControllerContainerTest; -import com.yahoo.vespa.hosted.controller.versions.VersionStatus; import org.junit.Test; -import java.io.File; import java.nio.charset.StandardCharsets; import java.util.Optional; import java.util.OptionalLong; @@ -24,18 +22,6 @@ public class ScrewdriverApiTest extends ControllerContainerTest { private static final String responseFiles = "src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/responses/"; - @Test - public void testGetReleaseStatus() throws Exception { - ContainerControllerTester tester = new ContainerControllerTester(container, responseFiles); - tester.containerTester().assertResponse(authenticatedRequest("http://localhost:8080/screwdriver/v1/release/vespa"), - "{\"error-code\":\"NOT_FOUND\",\"message\":\"Information about the current system version is not available at this time\"}", - 404); - - tester.controller().updateVersionStatus(VersionStatus.compute(tester.controller())); - tester.containerTester().assertResponse(authenticatedRequest("http://localhost:8080/screwdriver/v1/release/vespa"), - new File("release-response.json"), 200); - } - @Test public void testTriggerJobForApplication() { ContainerControllerTester tester = new ContainerControllerTester(container, responseFiles); -- cgit v1.2.3