summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2019-05-02 10:27:04 +0200
committerGitHub <noreply@github.com>2019-05-02 10:27:04 +0200
commit05fb9663a0e78ee98f50e8ec57229654b5a4bb3c (patch)
tree5558ebabd4cb51195d1038b6b6f1eaf3de0e4e45 /controller-server
parent47d5629be01d830d12e900cb23a613c62a8207ec (diff)
parent60972e6c2f5ef01bbc933ee069df56262d84a411 (diff)
Merge pull request #9230 from vespa-engine/jvenstad/submit
Jvenstad/submit
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/pom.xml6
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java19
2 files changed, 16 insertions, 9 deletions
diff --git a/controller-server/pom.xml b/controller-server/pom.xml
index f22142db727..3e7247bd44b 100644
--- a/controller-server/pom.xml
+++ b/controller-server/pom.xml
@@ -131,6 +131,12 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>hosted-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
<!-- test -->
<dependency>
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
index a7a28591d62..7032112a860 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
@@ -1,6 +1,7 @@
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.restapi.application;
+import ai.vespa.hosted.api.MultiPartStreamer;
import com.yahoo.application.container.handler.Request;
import com.yahoo.component.Version;
import com.yahoo.config.provision.ApplicationId;
@@ -58,6 +59,7 @@ import com.yahoo.vespa.hosted.controller.restapi.ContainerControllerTester;
import com.yahoo.vespa.hosted.controller.restapi.ContainerTester;
import com.yahoo.vespa.hosted.controller.restapi.ControllerContainerTest;
import com.yahoo.vespa.hosted.controller.tenant.AthenzTenant;
+import com.yahoo.yolean.Exceptions;
import org.apache.http.HttpEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
@@ -1417,16 +1419,12 @@ public class ApplicationApiTest extends ControllerContainerTest {
return builder.build();
}
- private HttpEntity createApplicationSubmissionData(ApplicationPackage applicationPackage) {
- MultipartEntityBuilder builder = MultipartEntityBuilder.create();
- builder.addTextBody(EnvironmentResource.SUBMIT_OPTIONS,
- "{\"repository\":\"repo\",\"branch\":\"master\",\"commit\":\"d00d\",\"authorEmail\":\"a@b\"}",
- ContentType.APPLICATION_JSON);
- builder.addBinaryBody(EnvironmentResource.APPLICATION_ZIP, applicationPackage.zippedContent());
- builder.addBinaryBody(EnvironmentResource.APPLICATION_TEST_ZIP, "content".getBytes());
- return builder.build();
+ private MultiPartStreamer createApplicationSubmissionData(ApplicationPackage applicationPackage) {
+ return new MultiPartStreamer().addJson(EnvironmentResource.SUBMIT_OPTIONS, "{\"repository\":\"repo\",\"branch\":\"master\",\"commit\":\"d00d\",\"authorEmail\":\"a@b\"}")
+ .addBytes(EnvironmentResource.APPLICATION_ZIP, applicationPackage.zippedContent())
+ .addBytes(EnvironmentResource.APPLICATION_TEST_ZIP, "content".getBytes());
}
-
+
private String deployOptions(boolean deployDirectly, Optional<ApplicationVersion> applicationVersion) {
return "{\"vespaVersion\":null," +
"\"ignoreValidationErrors\":false," +
@@ -1629,6 +1627,9 @@ public class ApplicationApiTest extends ControllerContainerTest {
private RequestBuilder data(byte[] data) { this.data = data; return this; }
private RequestBuilder data(String data) { return data(data.getBytes(StandardCharsets.UTF_8)); }
+ private RequestBuilder data(MultiPartStreamer streamer) {
+ return Exceptions.uncheck(() -> data(streamer.data().readAllBytes()).contentType(streamer.contentType()));
+ }
private RequestBuilder data(HttpEntity data) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {