diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-11-08 13:29:54 +0100 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-11-08 13:29:54 +0100 |
commit | a4b7eafd975b778f22de0ba1b5403d2fa2d5f5e7 (patch) | |
tree | 4432f7fdd9e08df8fe3819c5c7c181931f518df3 | |
parent | 22f119ef6f01b6be2700d36cb8ed3e61129012f9 (diff) |
Use ApplicationVersion instead of String keys in ApplicationStore
2 files changed, 13 insertions, 10 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java index acf59b2a850..9c111f277cb 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java @@ -10,14 +10,15 @@ import com.yahoo.config.provision.ApplicationId; public interface ApplicationStore { /** Returns the tenant application package of the given version. */ - byte[] getApplicationPackage(ApplicationId application, String applicationVersion); + byte[] getApplicationPackage(ApplicationId application, ApplicationVersion applicationVersion); /** Stores the given tenant application package of the given version. */ - void putApplicationPackage(ApplicationId application, String applicationVersion, byte[] applicationPackage); + void putApplicationPackage(ApplicationId application, ApplicationVersion applicationVersion, byte[] applicationPackage); /** Stores the given tester application package of the given version. Does NOT contain the services.xml. */ - void putTesterPackage(ApplicationId tester, String applicationVersion, byte[] testerPackage); + void putTesterPackage(ApplicationId tester, ApplicationVersion applicationVersion, byte[] testerPackage); /** Returns the tester application package of the given version. Does NOT contain the services.xml. */ - byte[] getTesterPackage(ApplicationId tester, String applicationVersion); + byte[] getTesterPackage(ApplicationId tester, ApplicationVersion applicationVersion); + } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ApplicationStoreMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ApplicationStoreMock.java index dc6042e669b..e21f356dbf7 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ApplicationStoreMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ApplicationStoreMock.java @@ -3,6 +3,7 @@ package com.yahoo.vespa.hosted.controller.integration; import com.yahoo.config.provision.ApplicationId; import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationStore; +import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationVersion; import java.util.HashMap; import java.util.Map; @@ -12,26 +13,27 @@ public class ApplicationStoreMock implements ApplicationStore { Map<String, byte[]> store = new HashMap<>(); @Override - public byte[] getApplicationPackage(ApplicationId application, String applicationVersion) { + public byte[] getApplicationPackage(ApplicationId application, ApplicationVersion applicationVersion) { return store.get(path(application, applicationVersion)); } @Override - public void putApplicationPackage(ApplicationId application, String applicationVersion, byte[] applicationPackage) { + public void putApplicationPackage(ApplicationId application, ApplicationVersion applicationVersion, byte[] applicationPackage) { store.put(path(application, applicationVersion), applicationPackage); } @Override - public void putTesterPackage(ApplicationId tester, String applicationVersion, byte[] testerPackage) { + public void putTesterPackage(ApplicationId tester, ApplicationVersion applicationVersion, byte[] testerPackage) { store.put(path(tester, applicationVersion), testerPackage); } @Override - public byte[] getTesterPackage(ApplicationId tester, String applicationVersion) { + public byte[] getTesterPackage(ApplicationId tester, ApplicationVersion applicationVersion) { return store.get(path(tester, applicationVersion)); } - String path(ApplicationId tester, String applicationVersion) { - return tester.toString() + applicationVersion; + String path(ApplicationId tester, ApplicationVersion applicationVersion) { + return tester.toString() + applicationVersion.id(); } + } |