accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] milleruntime commented on a change in pull request #361: ACCUMULO-4784 - Create builder for Connector
Date Thu, 01 Jan 1970 00:00:00 GMT
milleruntime commented on a change in pull request #361: ACCUMULO-4784 - Create builder for
Connector
URL: https://github.com/apache/accumulo/pull/361#discussion_r165192489
 
 

 ##########
 File path: test/src/main/java/org/apache/accumulo/test/functional/ConnectorIT.java
 ##########
 @@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.functional;
+
+import java.util.Properties;
+
+import org.apache.accumulo.core.client.ConnectionInfo;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.impl.ConnectionInfoImpl;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.conf.ClientProperty;
+import org.apache.accumulo.harness.AccumuloClusterHarness;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ConnectorIT extends AccumuloClusterHarness {
+
+  @Test
+  public void testConnectorBuilder() throws Exception {
+    Connector c = getConnector();
+    String instanceName = c.getInstance().getInstanceName();
+    String zookeepers = c.getInstance().getZooKeepers();
+    final String user = "testuser";
+    final String password = "testpassword";
+    c.securityOperations().createLocalUser(user, new PasswordToken(password));
+
+    Connector conn = Connector.builder().forInstance(instanceName, zookeepers).usingBasicCredentials(user,
password).build();
+
+    Assert.assertEquals(instanceName, conn.getInstance().getInstanceName());
+    Assert.assertEquals(zookeepers, conn.getInstance().getZooKeepers());
+    Assert.assertEquals(user, conn.whoami());
+
+    ConnectionInfo info = Connector.builder().forInstance(instanceName, zookeepers).usingBasicCredentials(user,
password).info();
+    ConnectionInfoImpl impl = (ConnectionInfoImpl) info;
 
 Review comment:
   Same with my comments above, should only see the interface at this level. But the builder
method above looks awesome!!

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message