From 513c631985568d4b60aa9fffef1809d5f7a6f07d Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Mon, 15 Mar 2021 09:14:11 +0100 Subject: GC unused env variables --- .../yahoo/vespa/config/LZ4PayloadCompressor.java | 1 - .../config/protocol/JRTConfigRequestFactory.java | 9 ++--- .../protocol/JRTConfigRequestFactoryTest.java | 43 ++++++---------------- 3 files changed, 16 insertions(+), 37 deletions(-) (limited to 'config/src') diff --git a/config/src/main/java/com/yahoo/vespa/config/LZ4PayloadCompressor.java b/config/src/main/java/com/yahoo/vespa/config/LZ4PayloadCompressor.java index ba2caaf3e91..688d6d54888 100644 --- a/config/src/main/java/com/yahoo/vespa/config/LZ4PayloadCompressor.java +++ b/config/src/main/java/com/yahoo/vespa/config/LZ4PayloadCompressor.java @@ -18,7 +18,6 @@ public class LZ4PayloadCompressor { private static int getCompressionLevel() { return Integer.parseInt(ConfigUtils.getEnvValue("0", System.getenv(VESPA_CONFIG_PROTOCOL_COMPRESSION_LEVEL), - System.getenv("services__config_protocol_compression_level"), System.getProperty(VESPA_CONFIG_PROTOCOL_COMPRESSION_LEVEL))); } diff --git a/config/src/main/java/com/yahoo/vespa/config/protocol/JRTConfigRequestFactory.java b/config/src/main/java/com/yahoo/vespa/config/protocol/JRTConfigRequestFactory.java index b6277f750dc..953be93b67b 100644 --- a/config/src/main/java/com/yahoo/vespa/config/protocol/JRTConfigRequestFactory.java +++ b/config/src/main/java/com/yahoo/vespa/config/protocol/JRTConfigRequestFactory.java @@ -1,4 +1,4 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.protocol; import com.yahoo.config.ConfigInstance; @@ -30,12 +30,11 @@ public class JRTConfigRequestFactory { public static CompressionType getCompressionType() { return getCompressionType(System.getenv(VESPA_CONFIG_PROTOCOL_COMPRESSION), - System.getenv("services__config_protocol_compression"), - System.getProperty(VESPA_CONFIG_PROTOCOL_COMPRESSION)); + System.getProperty(VESPA_CONFIG_PROTOCOL_COMPRESSION)); } - static CompressionType getCompressionType(String env, String alternateEnv, String property) { - return CompressionType.valueOf(ConfigUtils.getEnvValue("LZ4", env, alternateEnv, property)); + static CompressionType getCompressionType(String env, String property) { + return CompressionType.valueOf(ConfigUtils.getEnvValue("LZ4", env, property)); } static Optional getVespaVersion() { diff --git a/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestFactoryTest.java b/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestFactoryTest.java index 04f3a7abe29..c1d381725e4 100644 --- a/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestFactoryTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestFactoryTest.java @@ -1,4 +1,4 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.protocol; import com.yahoo.foo.FunctionTestConfig; @@ -17,41 +17,22 @@ import static org.hamcrest.MatcherAssert.assertThat; * @author hmusum */ public class JRTConfigRequestFactoryTest { - private static VespaVersion defaultVespaVersion = JRTConfigRequestFactory.getCompiledVespaVersion(); + private static final VespaVersion defaultVespaVersion = JRTConfigRequestFactory.getCompiledVespaVersion(); @Test public void testCompressionType() { - assertThat(JRTConfigRequestFactory.getCompressionType("", "", ""), is(CompressionType.LZ4)); + assertThat(JRTConfigRequestFactory.getCompressionType("", ""), is(CompressionType.LZ4)); + assertThat(JRTConfigRequestFactory.getCompressionType("UNCOMPRESSED", ""), is(CompressionType.UNCOMPRESSED)); + assertThat(JRTConfigRequestFactory.getCompressionType("", "UNCOMPRESSED"), is(CompressionType.UNCOMPRESSED)); + assertThat(JRTConfigRequestFactory.getCompressionType("UNCOMPRESSED", "UNCOMPRESSED"), is(CompressionType.UNCOMPRESSED)); - assertThat(JRTConfigRequestFactory.getCompressionType("UNCOMPRESSED", "", ""), is(CompressionType.UNCOMPRESSED)); - assertThat(JRTConfigRequestFactory.getCompressionType("", "UNCOMPRESSED", ""), is(CompressionType.UNCOMPRESSED)); - assertThat(JRTConfigRequestFactory.getCompressionType("", "", "UNCOMPRESSED"), is(CompressionType.UNCOMPRESSED)); - assertThat(JRTConfigRequestFactory.getCompressionType("UNCOMPRESSED", "UNCOMPRESSED", ""), is(CompressionType.UNCOMPRESSED)); - assertThat(JRTConfigRequestFactory.getCompressionType("UNCOMPRESSED", "", "UNCOMPRESSED"), is(CompressionType.UNCOMPRESSED)); - assertThat(JRTConfigRequestFactory.getCompressionType("", "UNCOMPRESSED", "UNCOMPRESSED"), is(CompressionType.UNCOMPRESSED)); - assertThat(JRTConfigRequestFactory.getCompressionType("UNCOMPRESSED", "UNCOMPRESSED", "UNCOMPRESSED"), is(CompressionType.UNCOMPRESSED)); + assertThat(JRTConfigRequestFactory.getCompressionType("", ""), is(CompressionType.LZ4)); + assertThat(JRTConfigRequestFactory.getCompressionType("LZ4", ""), is(CompressionType.LZ4)); + assertThat(JRTConfigRequestFactory.getCompressionType("", "LZ4"), is(CompressionType.LZ4)); + assertThat(JRTConfigRequestFactory.getCompressionType("LZ4", "LZ4"), is(CompressionType.LZ4)); - assertThat(JRTConfigRequestFactory.getCompressionType("LZ4", "", ""), is(CompressionType.LZ4)); - assertThat(JRTConfigRequestFactory.getCompressionType("", "LZ4", ""), is(CompressionType.LZ4)); - assertThat(JRTConfigRequestFactory.getCompressionType("", "", "LZ4"), is(CompressionType.LZ4)); - assertThat(JRTConfigRequestFactory.getCompressionType("LZ4", "LZ4", ""), is(CompressionType.LZ4)); - assertThat(JRTConfigRequestFactory.getCompressionType("LZ4", "", "LZ4"), is(CompressionType.LZ4)); - assertThat(JRTConfigRequestFactory.getCompressionType("", "LZ4", "LZ4"), is(CompressionType.LZ4)); - assertThat(JRTConfigRequestFactory.getCompressionType("LZ4", "LZ4", "LZ4"), is(CompressionType.LZ4)); - - assertThat(JRTConfigRequestFactory.getCompressionType("UNCOMPRESSED", "LZ4", ""), is(CompressionType.UNCOMPRESSED)); - assertThat(JRTConfigRequestFactory.getCompressionType("UNCOMPRESSED", "", "LZ4"), is(CompressionType.UNCOMPRESSED)); - assertThat(JRTConfigRequestFactory.getCompressionType("", "UNCOMPRESSED", "LZ4"), is(CompressionType.UNCOMPRESSED)); - assertThat(JRTConfigRequestFactory.getCompressionType("LZ4", "UNCOMPRESSED", ""), is(CompressionType.LZ4)); - assertThat(JRTConfigRequestFactory.getCompressionType("LZ4", "", "UNCOMPRESSED"), is(CompressionType.LZ4)); - assertThat(JRTConfigRequestFactory.getCompressionType("", "LZ4", "UNCOMPRESSED"), is(CompressionType.LZ4)); - - assertThat(JRTConfigRequestFactory.getCompressionType("UNCOMPRESSED", "LZ4", "LZ4"), is(CompressionType.UNCOMPRESSED)); - assertThat(JRTConfigRequestFactory.getCompressionType("UNCOMPRESSED", "UNCOMPRESSED", "LZ4"), is(CompressionType.UNCOMPRESSED)); - assertThat(JRTConfigRequestFactory.getCompressionType("UNCOMPRESSED", "LZ4", "UNCOMPRESSED"), is(CompressionType.UNCOMPRESSED)); - assertThat(JRTConfigRequestFactory.getCompressionType("LZ4", "UNCOMPRESSED", "UNCOMPRESSED"), is(CompressionType.LZ4)); - assertThat(JRTConfigRequestFactory.getCompressionType("LZ4", "UNCOMPRESSED", "LZ4"), is(CompressionType.LZ4)); - assertThat(JRTConfigRequestFactory.getCompressionType("LZ4", "LZ4", "UNCOMPRESSED"), is(CompressionType.LZ4)); + assertThat(JRTConfigRequestFactory.getCompressionType("UNCOMPRESSED", "LZ4"), is(CompressionType.UNCOMPRESSED)); + assertThat(JRTConfigRequestFactory.getCompressionType("LZ4", "UNCOMPRESSED"), is(CompressionType.LZ4)); } @Test -- cgit v1.2.3