From notifications-return-41866-archive-asf-public=cust-asf.ponee.io@accumulo.apache.org Wed Jan 31 22:33:50 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id C7C1D18066D for ; Wed, 31 Jan 2018 22:33:49 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id B5C77160C2C; Wed, 31 Jan 2018 21:33:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DA836160C59 for ; Wed, 31 Jan 2018 22:33:48 +0100 (CET) Received: (qmail 70524 invoked by uid 500); 31 Jan 2018 21:33:47 -0000 Mailing-List: contact notifications-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jira@apache.org Delivered-To: mailing list notifications@accumulo.apache.org Received: (qmail 70034 invoked by uid 99); 31 Jan 2018 21:33:47 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Jan 2018 21:33:47 +0000 From: GitBox To: notifications@accumulo.apache.org Subject: [GitHub] milleruntime commented on a change in pull request #361: ACCUMULO-4784 - Create builder for Connector Message-ID: <151743442722.9559.2031997223979445199.gitbox@gitbox.apache.org> 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