From be0fe6abf4e1b1e92a86adba5da04344f61d0b3b Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Mon, 26 Aug 2024 13:11:48 +0200 Subject: [PATCH 1/5] Remove unused methods This is an internal public API, so can be removed now --- config-model-api/abi-spec.json | 5 ---- .../application/api/ApplicationMetaData.java | 29 ------------------- 2 files changed, 34 deletions(-) diff --git a/config-model-api/abi-spec.json b/config-model-api/abi-spec.json index d238a6db66f4..c771d78516a5 100644 --- a/config-model-api/abi-spec.json +++ b/config-model-api/abi-spec.json @@ -74,10 +74,6 @@ ], "methods" : [ "public void (java.lang.String, java.lang.Long, boolean, com.yahoo.config.provision.ApplicationId, java.lang.String, java.lang.Long, long)", - "public void (java.lang.String, java.lang.Long, boolean, com.yahoo.config.provision.ApplicationId, com.yahoo.config.provision.Tags, java.lang.String, java.lang.Long, long)", - "public void (java.lang.String, java.lang.String, java.lang.Long, boolean, com.yahoo.config.provision.ApplicationId, java.lang.String, java.lang.Long, long)", - "public java.lang.String getDeployedByUser()", - "public com.yahoo.config.provision.Tags getTags()", "public java.lang.String getDeployPath()", "public com.yahoo.config.provision.ApplicationId getApplicationId()", "public java.lang.Long getDeployTimestamp()", @@ -88,7 +84,6 @@ "public java.lang.String toString()", "public static com.yahoo.config.application.api.ApplicationMetaData fromJsonString(java.lang.String)", "public com.yahoo.slime.Slime getSlime()", - "public java.lang.String asJsonString()", "public byte[] asJsonBytes()" ], "fields" : [ ] diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationMetaData.java b/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationMetaData.java index 6b3314d0c06c..6fd98fd2e0da 100644 --- a/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationMetaData.java +++ b/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationMetaData.java @@ -2,12 +2,10 @@ package com.yahoo.config.application.api; import com.yahoo.config.provision.ApplicationId; -import com.yahoo.config.provision.Tags; import com.yahoo.slime.Cursor; import com.yahoo.slime.Inspector; import com.yahoo.slime.Slime; import com.yahoo.slime.SlimeUtils; -import com.yahoo.text.Utf8; import java.io.IOException; @@ -37,29 +35,6 @@ public ApplicationMetaData(String deployedFromDir, Long deployTimestamp, boolean this.previousActiveGeneration = previousActiveGeneration; } - @Deprecated // TODO: Remove on Vespa 9 - public ApplicationMetaData(String deployedFromDir, Long deployTimestamp, boolean internalRedeploy, ApplicationId applicationId, - Tags ignored, String checksum, Long generation, long previousActiveGeneration) { - this(deployedFromDir, deployTimestamp, internalRedeploy, applicationId, checksum, generation, previousActiveGeneration); - } - - @Deprecated // TODO: Remove on Vespa 9 - public ApplicationMetaData(String ignored, String deployedFromDir, Long deployTimestamp, boolean internalRedeploy, - ApplicationId applicationId, String checksum, Long generation, long previousActiveGeneration) { - this(deployedFromDir, deployTimestamp, internalRedeploy, applicationId, Tags.empty(), checksum, generation, previousActiveGeneration); - } - - /** - * Gets the user who deployed the application. - * - * @return username of the user who ran "deploy-application" - */ - @Deprecated // TODO: Remove in Vespa 9 - public String getDeployedByUser() { return "unknown"; } - - @Deprecated // TODO: Remove in Vespa 9 - public Tags getTags() { return Tags.empty(); } - /** * Gets the directory where the application was deployed from. * Will return null if a problem occurred while getting metadata @@ -141,10 +116,6 @@ private static boolean booleanField(String fieldName, boolean defaultValue, Insp return value.asBool(); } - public String asJsonString() { - return Utf8.toString(asJsonBytes()); - } - public byte[] asJsonBytes() { try { return SlimeUtils.toJsonBytes(getSlime()); From 08cf2776993f9d6610a497aa46178e72a667b21d Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Mon, 26 Aug 2024 14:55:02 +0200 Subject: [PATCH 2/5] Prepare for removing deployPath from ApplicationMetaData --- config-model-api/abi-spec.json | 1 + .../application/api/ApplicationMetaData.java | 22 +++++++++++-------- .../server/deploy/ZooKeeperDeployerTest.java | 1 - 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/config-model-api/abi-spec.json b/config-model-api/abi-spec.json index c771d78516a5..ef8336be57bc 100644 --- a/config-model-api/abi-spec.json +++ b/config-model-api/abi-spec.json @@ -73,6 +73,7 @@ "public" ], "methods" : [ + "public void (java.lang.Long, boolean, com.yahoo.config.provision.ApplicationId, java.lang.String, java.lang.Long, long)", "public void (java.lang.String, java.lang.Long, boolean, com.yahoo.config.provision.ApplicationId, java.lang.String, java.lang.Long, long)", "public java.lang.String getDeployPath()", "public com.yahoo.config.provision.ApplicationId getApplicationId()", diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationMetaData.java b/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationMetaData.java index 6fd98fd2e0da..f76ad9e0db0f 100644 --- a/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationMetaData.java +++ b/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationMetaData.java @@ -16,7 +16,6 @@ */ public class ApplicationMetaData { - private final String deployedFromDir; private final long deployTimestamp; private final boolean internalRedeploy; private final ApplicationId applicationId; @@ -24,9 +23,8 @@ public class ApplicationMetaData { private final long generation; private final long previousActiveGeneration; - public ApplicationMetaData(String deployedFromDir, Long deployTimestamp, boolean internalRedeploy, - ApplicationId applicationId, String checksum, Long generation, long previousActiveGeneration) { - this.deployedFromDir = deployedFromDir; + public ApplicationMetaData(Long deployTimestamp, boolean internalRedeploy, ApplicationId applicationId, + String checksum, Long generation, long previousActiveGeneration) { this.deployTimestamp = deployTimestamp; this.internalRedeploy = internalRedeploy; this.applicationId = applicationId; @@ -35,13 +33,20 @@ public ApplicationMetaData(String deployedFromDir, Long deployTimestamp, boolean this.previousActiveGeneration = previousActiveGeneration; } + //TODO: Remove when Vespa 8.401 is oldest supported version + public ApplicationMetaData(String ignored, Long deployTimestamp, boolean internalRedeploy, + ApplicationId applicationId, String checksum, Long generation, long previousActiveGeneration) { + this(deployTimestamp, internalRedeploy, applicationId, checksum, generation, previousActiveGeneration); + } + /** * Gets the directory where the application was deployed from. * Will return null if a problem occurred while getting metadata * * @return path to raw deploy directory (for the original application) */ - public String getDeployPath() { return deployedFromDir; } + @Deprecated //TODO: Remove when Vespa 8.401 is oldest supported version + public String getDeployPath() { return "unknown"; } public ApplicationId getApplicationId() { return applicationId; } @@ -73,7 +78,7 @@ public ApplicationMetaData(String deployedFromDir, Long deployTimestamp, boolean @Override public String toString() { - return deployedFromDir + ", " + deployTimestamp + ", " + generation + ", " + checksum + ", " + previousActiveGeneration; + return deployTimestamp + ", " + generation + ", " + checksum + ", " + previousActiveGeneration; } public static ApplicationMetaData fromJsonString(String jsonString) { @@ -83,8 +88,7 @@ public static ApplicationMetaData fromJsonString(String jsonString) { Inspector deploy = root.field("deploy"); Inspector app = root.field("application"); - return new ApplicationMetaData(deploy.field("from").asString(), - deploy.field("timestamp").asLong(), + return new ApplicationMetaData(deploy.field("timestamp").asLong(), booleanField("internalRedeploy", false, deploy), ApplicationId.fromSerializedForm(app.field("id").asString()), app.field("checksum").asString(), @@ -99,7 +103,7 @@ public Slime getSlime() { Slime slime = new Slime(); Cursor meta = slime.setObject(); Cursor deploy = meta.setObject("deploy"); - deploy.setString("from", deployedFromDir); + deploy.setString("from", ""); deploy.setLong("timestamp", deployTimestamp); deploy.setBool("internalRedeploy", internalRedeploy); Cursor app = meta.setObject("application"); diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/ZooKeeperDeployerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/ZooKeeperDeployerTest.java index 11d4704150fb..a11314555967 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/ZooKeeperDeployerTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/ZooKeeperDeployerTest.java @@ -140,7 +140,6 @@ public void testFeedAppMetaDataToZooKeeper() { Utf8.toString(zk.getData(appPath.append(META_ZK_PATH)).get())); assertTrue(metaData.getChecksum().length() > 0); assertTrue(metaData.isInternalRedeploy()); - assertEquals("/bar/baz", metaData.getDeployPath()); assertEquals(1345, metaData.getDeployTimestamp().longValue()); assertEquals(3, metaData.getGeneration().longValue()); assertEquals(2, metaData.getPreviousActiveGeneration()); From b96e69618f05d402bd48d20cf7fb0885e0f53754 Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Mon, 26 Aug 2024 15:48:08 +0200 Subject: [PATCH 3/5] Stop using and testing deploy path in ApplicationMetaData --- .../java/com/yahoo/vespa/model/container/ContainerCluster.java | 1 - .../test/java/com/yahoo/config/model/ApplicationDeployTest.java | 1 - .../handler/observability/ApplicationStatusHandler.java | 2 +- .../handler/observability/ApplicationStatusHandlerTest.java | 2 -- 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java index 00ab47e8ddb9..2e007d1c89ea 100755 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java @@ -492,7 +492,6 @@ public void getConfig(HealthMonitorConfig.Builder builder) { public void getConfig(ApplicationMetadataConfig.Builder builder) { if (applicationMetaData != null) builder.name(applicationMetaData.getApplicationId().application().value()). - path(applicationMetaData.getDeployPath()). timestamp(applicationMetaData.getDeployTimestamp()). checksum(applicationMetaData.getChecksum()). generation(applicationMetaData.getGeneration()); diff --git a/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java b/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java index 908d32c4d238..a1530bc66fce 100644 --- a/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java +++ b/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java @@ -240,7 +240,6 @@ void testMetaData() throws IOException { app.writeMetaData(); FilesApplicationPackage newApp = FilesApplicationPackage.fromFileWithDeployData(tmp, deployData); ApplicationMetaData meta = newApp.getMetaData(); - assertEquals("bar", meta.getDeployPath()); assertEquals(applicationId, meta.getApplicationId()); assertEquals(13L, (long) meta.getDeployTimestamp()); assertEquals(1337L, (long) meta.getGeneration()); diff --git a/container-disc/src/main/java/com/yahoo/container/handler/observability/ApplicationStatusHandler.java b/container-disc/src/main/java/com/yahoo/container/handler/observability/ApplicationStatusHandler.java index 19fb8e06a832..c99e9ee09adf 100644 --- a/container-disc/src/main/java/com/yahoo/container/handler/observability/ApplicationStatusHandler.java +++ b/container-disc/src/main/java/com/yahoo/container/handler/observability/ApplicationStatusHandler.java @@ -112,7 +112,7 @@ public ContentChannel handleRequest(Request request, ResponseHandler handler) { private static Container container() { return Container.get(); } static JsonNode renderApplicationConfigs(ApplicationMetadataConfig metaConfig, - ApplicationUserdataConfig userConfig) { + ApplicationUserdataConfig userConfig) { ObjectNode vespa = jsonMapper.createObjectNode(); vespa.put("version", Vtag.currentVersion.toString()); diff --git a/container-disc/src/test/java/com/yahoo/container/handler/observability/ApplicationStatusHandlerTest.java b/container-disc/src/test/java/com/yahoo/container/handler/observability/ApplicationStatusHandlerTest.java index f128bd29a789..e418b6b9fc76 100644 --- a/container-disc/src/test/java/com/yahoo/container/handler/observability/ApplicationStatusHandlerTest.java +++ b/container-disc/src/test/java/com/yahoo/container/handler/observability/ApplicationStatusHandlerTest.java @@ -31,7 +31,6 @@ void application_configs_are_rendered() { new ApplicationMetadataConfig.Builder() .checksum("abc") .name("app") - .path("/a/b/c") .timestamp(3000) .user("donald")); @@ -44,7 +43,6 @@ void application_configs_are_rendered() { assertTrue(json.contains("meta")); assertTrue(json.contains("abc")); assertTrue(json.contains("app")); - assertTrue(json.contains("/a/b/c")); assertTrue(json.contains("3000")); assertTrue(json.contains("donald")); From 678e0dee83636b1dc6b81ac6ea415e5501a28a1c Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Mon, 26 Aug 2024 19:09:55 +0200 Subject: [PATCH 4/5] Use new constructor --- .../model/application/provider/FilesApplicationPackage.java | 6 ++---- .../com/yahoo/config/model/test/MockApplicationPackage.java | 3 +-- .../container.core.application-metadata.def | 1 + 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/config-application-package/src/main/java/com/yahoo/config/model/application/provider/FilesApplicationPackage.java b/config-application-package/src/main/java/com/yahoo/config/model/application/provider/FilesApplicationPackage.java index b56bf6180888..cb58d4a09300 100644 --- a/config-application-package/src/main/java/com/yahoo/config/model/application/provider/FilesApplicationPackage.java +++ b/config-application-package/src/main/java/com/yahoo/config/model/application/provider/FilesApplicationPackage.java @@ -143,8 +143,7 @@ public static FilesApplicationPackage fromFileWithDeployData(File appDir, Deploy } private static ApplicationMetaData metaDataFromDeployData(File appDir, DeployData deployData) { - return new ApplicationMetaData(deployData.getDeployedFromDir(), - deployData.getDeployTimestamp(), + return new ApplicationMetaData(deployData.getDeployTimestamp(), deployData.isInternalRedeploy(), deployData.getApplicationId(), computeCheckSum(appDir), @@ -487,8 +486,7 @@ public File getAppDir() throws IOException { private static ApplicationMetaData readMetaData(File appDir) { String originalAppDir = preprocessed.equals(appDir.getName()) ? appDir.getParentFile().getName() : appDir.getName(); - ApplicationMetaData defaultMetaData = new ApplicationMetaData("n/a", - 0L, + ApplicationMetaData defaultMetaData = new ApplicationMetaData(0L, false, ApplicationId.from(TenantName.defaultName(), ApplicationName.from(originalAppDir), diff --git a/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java b/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java index 18bb15a37f23..16990aebfa67 100644 --- a/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java +++ b/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java @@ -84,8 +84,7 @@ protected MockApplicationPackage(File root, String hosts, String services, List< this.failOnValidateXml = failOnValidateXml; queryProfileRegistry = new QueryProfileXMLReader().read(asNamedReaderList(queryProfileType), asNamedReaderList(queryProfile)); - applicationMetaData = new ApplicationMetaData("dir", - 0L, + applicationMetaData = new ApplicationMetaData(0L, false, ApplicationId.from(tenantName, ApplicationName.from(APPLICATION_NAME), diff --git a/container-core/src/main/resources/configdefinitions/container.core.application-metadata.def b/container-core/src/main/resources/configdefinitions/container.core.application-metadata.def index 46259c554a8a..7d2e81a93b13 100644 --- a/container-core/src/main/resources/configdefinitions/container.core.application-metadata.def +++ b/container-core/src/main/resources/configdefinitions/container.core.application-metadata.def @@ -11,6 +11,7 @@ name string default="" user string default="unknown" # The directory the application was deployed from +# TODO: Remove in Vespa 9 path string default="" # The application timestamp in ms From 5798aab4944aee108b950fd798a0b107a23c5434 Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Mon, 26 Aug 2024 19:31:19 +0200 Subject: [PATCH 5/5] Remove deploy path from DeployData as well --- .../application/provider/DeployData.java | 19 ++++++++++--------- .../provider/FilesApplicationPackage.java | 6 ++---- .../application/api/ApplicationMetaData.java | 2 +- .../config/model/ApplicationDeployTest.java | 3 +-- .../server/session/SessionRepository.java | 8 +++----- .../server/deploy/ZooKeeperDeployerTest.java | 17 +++++++++-------- 6 files changed, 26 insertions(+), 29 deletions(-) diff --git a/config-application-package/src/main/java/com/yahoo/config/model/application/provider/DeployData.java b/config-application-package/src/main/java/com/yahoo/config/model/application/provider/DeployData.java index eae578732d8d..469ad587524c 100644 --- a/config-application-package/src/main/java/com/yahoo/config/model/application/provider/DeployData.java +++ b/config-application-package/src/main/java/com/yahoo/config/model/application/provider/DeployData.java @@ -3,8 +3,6 @@ import com.yahoo.config.provision.ApplicationId; -import java.util.Set; - /** * Data generated or computed during deployment * @@ -14,9 +12,6 @@ public class DeployData { private final ApplicationId applicationId; - /** The absolute path to the directory holding the application */ - private final String deployedFromDir; - /** Timestamp when a deployment was made */ private final long deployTimestamp; @@ -27,13 +22,11 @@ public class DeployData { private final long generation; private final long currentlyActiveGeneration; - public DeployData(String deployedFromDir, - ApplicationId applicationId, + public DeployData(ApplicationId applicationId, Long deployTimestamp, boolean internalRedeploy, Long generation, long currentlyActiveGeneration) { - this.deployedFromDir = deployedFromDir; this.applicationId = applicationId; this.deployTimestamp = deployTimestamp; this.internalRedeploy = internalRedeploy; @@ -41,7 +34,15 @@ public DeployData(String deployedFromDir, this.currentlyActiveGeneration = currentlyActiveGeneration; } - public String getDeployedFromDir() { return deployedFromDir; } + //TODO: Remove when Vespa 8.401 is oldest supported version + public DeployData(String ignored, + ApplicationId applicationId, + Long deployTimestamp, + boolean internalRedeploy, + Long generation, + long currentlyActiveGeneration) { + this(applicationId, deployTimestamp, internalRedeploy, generation, currentlyActiveGeneration); + } public long getDeployTimestamp() { return deployTimestamp; } diff --git a/config-application-package/src/main/java/com/yahoo/config/model/application/provider/FilesApplicationPackage.java b/config-application-package/src/main/java/com/yahoo/config/model/application/provider/FilesApplicationPackage.java index cb58d4a09300..73ddd85201ce 100644 --- a/config-application-package/src/main/java/com/yahoo/config/model/application/provider/FilesApplicationPackage.java +++ b/config-application-package/src/main/java/com/yahoo/config/model/application/provider/FilesApplicationPackage.java @@ -11,7 +11,6 @@ import com.yahoo.config.application.api.ApplicationPackage; import com.yahoo.config.application.api.ComponentInfo; import com.yahoo.config.application.api.DeployLogger; -import com.yahoo.config.application.api.DeploymentInstanceSpec; import com.yahoo.config.application.api.DeploymentSpec; import com.yahoo.config.application.api.UnparsedConfigDefinition; import com.yahoo.config.codegen.DefParser; @@ -19,7 +18,6 @@ import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ApplicationName; import com.yahoo.config.provision.InstanceName; -import com.yahoo.config.provision.Tags; import com.yahoo.config.provision.TenantName; import com.yahoo.config.provision.Zone; import com.yahoo.io.HexDump; @@ -72,7 +70,6 @@ import java.util.logging.Logger; import static com.yahoo.text.Lowercase.toLowerCase; -import static java.util.logging.Level.INFO; /** @@ -137,7 +134,8 @@ public static FilesApplicationPackage fromFileWithDeployData(File appDir, Deploy } /** Creates package from a local directory, typically deploy app */ - public static FilesApplicationPackage fromFileWithDeployData(File appDir, DeployData deployData, + public static FilesApplicationPackage fromFileWithDeployData(File appDir, + DeployData deployData, boolean includeSourceFiles) { return new Builder(appDir).includeSourceFiles(includeSourceFiles).deployData(deployData).build(); } diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationMetaData.java b/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationMetaData.java index f76ad9e0db0f..f0b6dac8b10b 100644 --- a/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationMetaData.java +++ b/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationMetaData.java @@ -103,7 +103,7 @@ public Slime getSlime() { Slime slime = new Slime(); Cursor meta = slime.setObject(); Cursor deploy = meta.setObject("deploy"); - deploy.setString("from", ""); + deploy.setString("from", "unknown"); deploy.setLong("timestamp", deployTimestamp); deploy.setBool("internalRedeploy", internalRedeploy); Cursor app = meta.setObject("application"); diff --git a/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java b/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java index a1530bc66fce..b186b9821c1e 100644 --- a/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java +++ b/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java @@ -230,8 +230,7 @@ void testMetaData() throws IOException { String appPkg = TESTDIR + "app1"; IOUtils.copyDirectory(new File(appPkg), tmp); ApplicationId applicationId = ApplicationId.from("tenant1", "application1", "instance1"); - DeployData deployData = new DeployData("bar", - applicationId, + DeployData deployData = new DeployData(applicationId, 13L, false, 1337L, diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java index 726b8a086421..94c471852ff0 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java @@ -843,15 +843,14 @@ private void ensureSessionPathDoesNotExist(long sessionId) { } } - private ApplicationPackage createApplication(File userDir, - File configApplicationDir, + private ApplicationPackage createApplication(File configApplicationDir, ApplicationId applicationId, long sessionId, Optional currentlyActiveSessionId, boolean internalRedeploy, Optional deployLogger) { long deployTimestamp = System.currentTimeMillis(); - DeployData deployData = new DeployData(userDir.getAbsolutePath(), applicationId, deployTimestamp, internalRedeploy, + DeployData deployData = new DeployData(applicationId, deployTimestamp, internalRedeploy, sessionId, currentlyActiveSessionId.orElse(nonExistingActiveSessionId)); FilesApplicationPackage app = FilesApplicationPackage.fromFileWithDeployData(configApplicationDir, deployData); validateFileExtensions(applicationId, deployLogger, app); @@ -911,8 +910,7 @@ private ApplicationPackage createApplicationPackage(File applicationDirectory, Optional activeSessionId = getActiveSessionId(applicationId); File userApplicationDir = getSessionAppDir(sessionId); copyApp(applicationDirectory, userApplicationDir); - ApplicationPackage applicationPackage = createApplication(applicationDirectory, - userApplicationDir, + ApplicationPackage applicationPackage = createApplication(userApplicationDir, applicationId, sessionId, activeSessionId, diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/ZooKeeperDeployerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/ZooKeeperDeployerTest.java index a11314555967..7d8628f13f2d 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/ZooKeeperDeployerTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/ZooKeeperDeployerTest.java @@ -35,6 +35,7 @@ import java.util.Set; import java.util.logging.Level; +import static com.yahoo.config.model.application.provider.FilesApplicationPackage.fromFileWithDeployData; import static com.yahoo.config.provision.serialization.AllocatedHostsSerializer.fromJson; import static com.yahoo.vespa.config.server.session.SessionZooKeeperClient.getSessionPath; import static com.yahoo.vespa.config.server.zookeeper.ZKApplication.DEFCONFIGS_ZK_SUBPATH; @@ -42,6 +43,7 @@ import static com.yahoo.vespa.config.server.zookeeper.ZKApplication.USERAPP_ZK_SUBPATH; import static com.yahoo.vespa.config.server.zookeeper.ZKApplication.USER_DEFCONFIGS_ZK_SUBPATH; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -61,13 +63,12 @@ public class ZooKeeperDeployerTest { public void setupZK() throws IOException { zk = new MockCurator(); ZooKeeperDeployer.Client zkc = new ZooKeeperDeployer.Client(zk, new BaseDeployLogger(), appPath); - ApplicationPackage app = FilesApplicationPackage.fromFileWithDeployData(new File("src/test/apps/zkfeed"), - new DeployData("/bar/baz", - ApplicationId.from("default", "appName", "default"), - 1345L, - true, - 3L, - 2L)); + ApplicationPackage app = fromFileWithDeployData(new File("src/test/apps/zkfeed"), + new DeployData(ApplicationId.from("default", "appName", "default"), + 1345L, + true, + 3L, + 2L)); Map fileRegistries = createFileRegistries(); app.writeMetaData(); zkc.initialize(); @@ -138,7 +139,7 @@ public void testFeedAppMetaDataToZooKeeper() { assertTrue(zk.exists(appPath.append(META_ZK_PATH))); ApplicationMetaData metaData = ApplicationMetaData.fromJsonString( Utf8.toString(zk.getData(appPath.append(META_ZK_PATH)).get())); - assertTrue(metaData.getChecksum().length() > 0); + assertFalse(metaData.getChecksum().isEmpty()); assertTrue(metaData.isInternalRedeploy()); assertEquals(1345, metaData.getDeployTimestamp().longValue()); assertEquals(3, metaData.getGeneration().longValue());