Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 93BE111EA3 for ; Tue, 16 Sep 2014 20:15:51 +0000 (UTC) Received: (qmail 78737 invoked by uid 500); 16 Sep 2014 20:15:51 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 78699 invoked by uid 500); 16 Sep 2014 20:15:51 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 78598 invoked by uid 99); 16 Sep 2014 20:15:51 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Sep 2014 20:15:51 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 0A1CBA16DC5; Tue, 16 Sep 2014 20:15:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: elserj@apache.org To: commits@accumulo.apache.org Date: Tue, 16 Sep 2014 20:15:51 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/4] git commit: ACCUMULO-3130 Fix UnorderedWorkAssignerReplicationIT for SSL Repository: accumulo Updated Branches: refs/heads/master e3b8ec5df -> b5e97f59a ACCUMULO-3130 Fix UnorderedWorkAssignerReplicationIT for SSL Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/b5e97f59 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/b5e97f59 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/b5e97f59 Branch: refs/heads/master Commit: b5e97f59ac7b49e5558efaeb59ded6a15007d281 Parents: d1cd740 Author: Josh Elser Authored: Tue Sep 16 15:39:00 2014 -0400 Committer: Josh Elser Committed: Tue Sep 16 16:15:34 2014 -0400 ---------------------------------------------------------------------- .../UnorderedWorkAssignerReplicationIT.java | 59 +++++++++++++++----- 1 file changed, 45 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/b5e97f59/test/src/test/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java b/test/src/test/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java index 5ad63a1..2014cd6 100644 --- a/test/src/test/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java +++ b/test/src/test/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java @@ -16,7 +16,9 @@ */ package org.apache.accumulo.test.replication; +import java.util.HashMap; import java.util.Iterator; +import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.Callable; @@ -96,17 +98,53 @@ public class UnorderedWorkAssignerReplicationIT extends ConfigurableMacIT { hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName()); } + /** + * Use the same SSL and credential provider configuration that is set up by AbstractMacIT for the other MAC used for replication + */ + private void updatePeerConfigFromPrimary(MiniAccumuloConfigImpl primaryCfg, MiniAccumuloConfigImpl peerCfg) { + // Set the same SSL information from the primary when present + Map primarySiteConfig = primaryCfg.getSiteConfig(); + if ("true".equals(primarySiteConfig.get(Property.INSTANCE_RPC_SSL_ENABLED.getKey()))) { + Map peerSiteConfig = new HashMap(); + peerSiteConfig.put(Property.INSTANCE_RPC_SSL_ENABLED.getKey(), "true"); + String keystorePath = primarySiteConfig.get(Property.RPC_SSL_KEYSTORE_PATH.getKey()); + Assert.assertNotNull("Keystore Path was null", keystorePath); + peerSiteConfig.put(Property.RPC_SSL_KEYSTORE_PATH.getKey(), keystorePath); + String truststorePath = primarySiteConfig.get(Property.RPC_SSL_TRUSTSTORE_PATH.getKey()); + Assert.assertNotNull("Truststore Path was null", truststorePath); + peerSiteConfig.put(Property.RPC_SSL_TRUSTSTORE_PATH.getKey(), truststorePath); + + // Passwords might be stored in CredentialProvider + String keystorePassword = primarySiteConfig.get(Property.RPC_SSL_KEYSTORE_PASSWORD.getKey()); + if (null != keystorePassword) { + peerSiteConfig.put(Property.RPC_SSL_KEYSTORE_PASSWORD.getKey(), keystorePassword); + } + String truststorePassword = primarySiteConfig.get(Property.RPC_SSL_TRUSTSTORE_PASSWORD.getKey()); + if (null != truststorePassword) { + peerSiteConfig.put(Property.RPC_SSL_TRUSTSTORE_PASSWORD.getKey(), truststorePassword); + } + + System.out.println("Setting site configuration for peer " + peerSiteConfig); + peerCfg.setSiteConfig(peerSiteConfig); + } + + // Use the CredentialProvider if the primary also uses one + String credProvider = primarySiteConfig.get(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey()); + if (null != credProvider) { + Map peerSiteConfig = peerCfg.getSiteConfig(); + peerSiteConfig.put(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey(), credProvider); + peerCfg.setSiteConfig(peerSiteConfig); + } + } + @Test(timeout = 60 * 5000) public void dataWasReplicatedToThePeer() throws Exception { MiniAccumuloConfigImpl peerCfg = new MiniAccumuloConfigImpl(createTestDir(this.getClass().getName() + "_" + this.testName.getMethodName() + "_peer"), ROOT_PASSWORD); peerCfg.setNumTservers(1); peerCfg.setInstanceName("peer"); - peerCfg.setProperty(Property.TSERV_WALOG_MAX_SIZE, "5M"); - peerCfg.setProperty(Property.REPLICATION_WORK_ASSIGNMENT_SLEEP, "1s"); - peerCfg.setProperty(Property.MASTER_REPLICATION_SCAN_INTERVAL, "1s"); + updatePeerConfigFromPrimary(getCluster().getConfig(), peerCfg); peerCfg.setProperty(Property.REPLICATION_NAME, "peer"); - peerCfg.setProperty(Property.REPLICATION_WORK_ASSIGNER, UnorderedWorkAssigner.class.getName()); MiniAccumuloClusterImpl peerCluster = peerCfg.build(); peerCluster.start(); @@ -257,11 +295,8 @@ public class UnorderedWorkAssignerReplicationIT extends ConfigurableMacIT { ROOT_PASSWORD); peerCfg.setNumTservers(1); peerCfg.setInstanceName("peer"); - peerCfg.setProperty(Property.TSERV_WALOG_MAX_SIZE, "5M"); - peerCfg.setProperty(Property.REPLICATION_WORK_ASSIGNMENT_SLEEP, "1s"); - peerCfg.setProperty(Property.MASTER_REPLICATION_SCAN_INTERVAL, "1s"); + updatePeerConfigFromPrimary(getCluster().getConfig(), peerCfg); peerCfg.setProperty(Property.REPLICATION_NAME, "peer"); - peerCfg.setProperty(Property.REPLICATION_WORK_ASSIGNER, UnorderedWorkAssigner.class.getName()); MiniAccumuloClusterImpl peer1Cluster = peerCfg.build(); peer1Cluster.start(); @@ -422,9 +457,7 @@ public class UnorderedWorkAssignerReplicationIT extends ConfigurableMacIT { ROOT_PASSWORD); peerCfg.setNumTservers(1); peerCfg.setInstanceName("peer"); - peerCfg.setProperty(Property.TSERV_WALOG_MAX_SIZE, "5M"); - peerCfg.setProperty(Property.REPLICATION_WORK_ASSIGNMENT_SLEEP, "1s"); - peerCfg.setProperty(Property.MASTER_REPLICATION_SCAN_INTERVAL, "1s"); + updatePeerConfigFromPrimary(getCluster().getConfig(), peerCfg); peerCfg.setProperty(Property.REPLICATION_NAME, "peer"); MiniAccumuloClusterImpl peerCluster = peerCfg.build(); @@ -521,9 +554,7 @@ public class UnorderedWorkAssignerReplicationIT extends ConfigurableMacIT { ROOT_PASSWORD); peerCfg.setNumTservers(1); peerCfg.setInstanceName("peer"); - peerCfg.setProperty(Property.TSERV_WALOG_MAX_SIZE, "5M"); - peerCfg.setProperty(Property.REPLICATION_WORK_ASSIGNMENT_SLEEP, "1s"); - peerCfg.setProperty(Property.MASTER_REPLICATION_SCAN_INTERVAL, "1s"); + updatePeerConfigFromPrimary(getCluster().getConfig(), peerCfg); peerCfg.setProperty(Property.REPLICATION_NAME, "peer"); MiniAccumuloClusterImpl peer1Cluster = peerCfg.build();