ctubbsii closed pull request #522: #408 - Fix deprecation warnings URL: https://github.com/apache/accumulo/pull/522
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java b/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java index 516cb8912e..4ee198426b 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java +++ b/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java @@ -47,6 +47,7 @@ * @since 1.6.0 * @deprecated since 2.0.0, replaced {@link Connector#builder()} */ +@Deprecated public class ClientConfiguration { private static final Logger log = LoggerFactory.getLogger(ClientConfiguration.class); diff --git a/core/src/test/java/org/apache/accumulo/core/client/ClientConfigurationTest.java b/core/src/test/java/org/apache/accumulo/core/client/ClientConfigurationTest.java index 82c1760e1c..8212a2f8fa 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/ClientConfigurationTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/ClientConfigurationTest.java @@ -23,12 +23,16 @@ import java.io.File; import java.io.IOException; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.junit.Test; -@Deprecated +@SuppressWarnings("deprecation") public class ClientConfigurationTest { + private static org.apache.accumulo.core.client.ClientConfiguration.ClientProperty INSTANCE_NAME = org.apache.accumulo.core.client.ClientConfiguration.ClientProperty.INSTANCE_NAME; + private static org.apache.accumulo.core.client.ClientConfiguration.ClientProperty INSTANCE_ZK_HOST = org.apache.accumulo.core.client.ClientConfiguration.ClientProperty.INSTANCE_ZK_HOST; + private static org.apache.accumulo.core.client.ClientConfiguration.ClientProperty INSTANCE_ZK_TIMEOUT = org.apache.accumulo.core.client.ClientConfiguration.ClientProperty.INSTANCE_ZK_TIMEOUT; + private static org.apache.accumulo.core.client.ClientConfiguration.ClientProperty RPC_SSL_TRUSTSTORE_TYPE = ClientConfiguration.ClientProperty.RPC_SSL_TRUSTSTORE_TYPE; + @Test public void testOverrides() { ClientConfiguration clientConfig = createConfig(); @@ -47,17 +51,16 @@ public void testSerialization() { } private void assertExpectedConfig(ClientConfiguration clientConfig) { - assertEquals("firstZkHosts", clientConfig.get(ClientProperty.INSTANCE_ZK_HOST)); - assertEquals("secondInstanceName", clientConfig.get(ClientProperty.INSTANCE_NAME)); - assertEquals("123s", clientConfig.get(ClientProperty.INSTANCE_ZK_TIMEOUT)); - assertEquals(ClientProperty.RPC_SSL_TRUSTSTORE_TYPE.getDefaultValue(), - clientConfig.get(ClientProperty.RPC_SSL_TRUSTSTORE_TYPE)); + assertEquals("firstZkHosts", clientConfig.get(INSTANCE_ZK_HOST)); + assertEquals("secondInstanceName", clientConfig.get(INSTANCE_NAME)); + assertEquals("123s", clientConfig.get(INSTANCE_ZK_TIMEOUT)); + assertEquals(RPC_SSL_TRUSTSTORE_TYPE.getDefaultValue(), + clientConfig.get(RPC_SSL_TRUSTSTORE_TYPE)); } private ClientConfiguration createConfig() { - return ClientConfiguration.create().with(ClientProperty.INSTANCE_ZK_HOST, "firstZkHosts") - .with(ClientProperty.INSTANCE_NAME, "secondInstanceName") - .with(ClientProperty.INSTANCE_ZK_TIMEOUT, "123s"); + return ClientConfiguration.create().with(INSTANCE_ZK_HOST, "firstZkHosts") + .with(INSTANCE_NAME, "secondInstanceName").with(INSTANCE_ZK_TIMEOUT, "123s"); } @Test diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java b/shell/src/main/java/org/apache/accumulo/shell/Shell.java index 4b544fffe3..1f21ad8124 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java +++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java @@ -317,8 +317,8 @@ public boolean config(String... args) throws IOException { Properties props = options.getClientProperties(); String password = options.getPassword(); - if (password == null && props.containsKey(ClientProperty.AUTH_TOKEN.getKey()) && - user.equals(ClientProperty.AUTH_PRINCIPAL.getValue(props))) { + if (password == null && props.containsKey(ClientProperty.AUTH_TOKEN.getKey()) + && user.equals(ClientProperty.AUTH_PRINCIPAL.getValue(props))) { token = ClientProperty.getAuthenticationToken(props); } if (token == null) { diff --git a/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java b/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java index 6ac99a1141..86032f0995 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java +++ b/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java @@ -31,8 +31,6 @@ import org.apache.accumulo.core.conf.ClientProperty; import org.apache.hadoop.security.UserGroupInformation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.beust.jcommander.DynamicParameter; import com.beust.jcommander.IStringConverter; @@ -41,7 +39,6 @@ import com.beust.jcommander.converters.FileConverter; public class ShellOptionsJC { - private static final Logger log = LoggerFactory.getLogger(ShellOptionsJC.class); @Parameter(names = {"-u", "--user"}, description = "username") private String username = null; ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services