Updated Branches: refs/heads/master 98b2a0bc5 -> 5e0d7e7ba
http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java b/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java index 802d942..5eed38f 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java @@ -140,7 +140,7 @@ public class SplitRecoveryTest extends FunctionalTest { KeyExtent extent = extents[i]; String tdir = ServerConstants.getTablesDirs()[0] + "/" + extent.getTableId().toString() + "/dir_" + i; - MetadataTableUtil.addTablet(extent, tdir, SystemCredentials.get().getAsThrift(), TabletTime.LOGICAL_TIME_ID, zl); + MetadataTableUtil.addTablet(extent, tdir, SystemCredentials.get(), TabletTime.LOGICAL_TIME_ID, zl); SortedMap<FileRef,DataFileValue> mapFiles = new TreeMap<FileRef,DataFileValue>(); mapFiles.put(new FileRef(tdir + "/" + RFile.EXTENSION + "_000_000"), new DataFileValue(1000017 + i, 10000 + i)); @@ -149,7 +149,7 @@ public class SplitRecoveryTest extends FunctionalTest { } int tid = 0; TransactionWatcher.ZooArbitrator.start(Constants.BULK_ARBITRATOR_TYPE, tid); - MetadataTableUtil.updateTabletDataFile(tid, extent, mapFiles, "L0", SystemCredentials.get().getAsThrift(), zl); + MetadataTableUtil.updateTabletDataFile(tid, extent, mapFiles, "L0", SystemCredentials.get(), zl); } KeyExtent extent = extents[extentToSplit]; @@ -170,21 +170,21 @@ public class SplitRecoveryTest extends FunctionalTest { MetadataTableUtil.splitDatafiles(extent.getTableId(), midRow, splitRatio, new HashMap<FileRef,FileUtil.FileInfo>(), mapFiles, lowDatafileSizes, highDatafileSizes, highDatafilesToRemove); - MetadataTableUtil.splitTablet(high, extent.getPrevEndRow(), splitRatio, SystemCredentials.get().getAsThrift(), zl); + MetadataTableUtil.splitTablet(high, extent.getPrevEndRow(), splitRatio, SystemCredentials.get(), zl); TServerInstance instance = new TServerInstance(location, zl.getSessionId()); - Writer writer = new Writer(HdfsZooInstance.getInstance(), SystemCredentials.get().getAsThrift(), MetadataTable.ID); + Writer writer = new Writer(HdfsZooInstance.getInstance(), SystemCredentials.get(), MetadataTable.ID); Assignment assignment = new Assignment(high, instance); Mutation m = new Mutation(assignment.tablet.getMetadataEntry()); m.put(TabletsSection.FutureLocationColumnFamily.NAME, assignment.server.asColumnQualifier(), assignment.server.asMutationValue()); writer.update(m); if (steps >= 1) { - Map<FileRef,Long> bulkFiles = MetadataTableUtil.getBulkFilesLoaded(SystemCredentials.get().getAsThrift(), extent); - MetadataTableUtil.addNewTablet(low, "/lowDir", instance, lowDatafileSizes, bulkFiles, SystemCredentials.get().getAsThrift(), TabletTime.LOGICAL_TIME_ID - + "0", -1l, -1l, zl); + Map<FileRef,Long> bulkFiles = MetadataTableUtil.getBulkFilesLoaded(SystemCredentials.get(), extent); + MetadataTableUtil.addNewTablet(low, "/lowDir", instance, lowDatafileSizes, bulkFiles, SystemCredentials.get(), TabletTime.LOGICAL_TIME_ID + "0", -1l, + -1l, zl); } if (steps >= 2) - MetadataTableUtil.finishSplit(high, highDatafileSizes, highDatafilesToRemove, SystemCredentials.get().getAsThrift(), zl); + MetadataTableUtil.finishSplit(high, highDatafileSizes, highDatafilesToRemove, SystemCredentials.get(), zl); TabletServer.verifyTabletInformation(high, instance, null, "127.0.0.1:0", zl); @@ -192,8 +192,8 @@ public class SplitRecoveryTest extends FunctionalTest { ensureTabletHasNoUnexpectedMetadataEntries(low, lowDatafileSizes); ensureTabletHasNoUnexpectedMetadataEntries(high, highDatafileSizes); - Map<FileRef,Long> lowBulkFiles = MetadataTableUtil.getBulkFilesLoaded(SystemCredentials.get().getAsThrift(), low); - Map<FileRef,Long> highBulkFiles = MetadataTableUtil.getBulkFilesLoaded(SystemCredentials.get().getAsThrift(), high); + Map<FileRef,Long> lowBulkFiles = MetadataTableUtil.getBulkFilesLoaded(SystemCredentials.get(), low); + Map<FileRef,Long> highBulkFiles = MetadataTableUtil.getBulkFilesLoaded(SystemCredentials.get(), high); if (!lowBulkFiles.equals(highBulkFiles)) { throw new Exception(" " + lowBulkFiles + " != " + highBulkFiles + " " + low + " " + high); @@ -208,7 +208,7 @@ public class SplitRecoveryTest extends FunctionalTest { } private void ensureTabletHasNoUnexpectedMetadataEntries(KeyExtent extent, SortedMap<FileRef,DataFileValue> expectedMapFiles) throws Exception { - Scanner scanner = new ScannerImpl(HdfsZooInstance.getInstance(), SystemCredentials.get().getAsThrift(), MetadataTable.ID, Authorizations.EMPTY); + Scanner scanner = new ScannerImpl(HdfsZooInstance.getInstance(), SystemCredentials.get(), MetadataTable.ID, Authorizations.EMPTY); scanner.setRange(extent.toMetadataRange()); HashSet<ColumnFQ> expectedColumns = new HashSet<ColumnFQ>(); @@ -247,7 +247,7 @@ public class SplitRecoveryTest extends FunctionalTest { throw new Exception("Not all expected columns seen " + extent + " " + expectedColumns); } - SortedMap<FileRef,DataFileValue> fixedMapFiles = MetadataTableUtil.getDataFileSizes(extent, SystemCredentials.get().getAsThrift()); + SortedMap<FileRef,DataFileValue> fixedMapFiles = MetadataTableUtil.getDataFileSizes(extent, SystemCredentials.get()); verifySame(expectedMapFiles, fixedMapFiles); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java index 08430e5..6c558bb 100644 --- a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java +++ b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java @@ -60,8 +60,7 @@ import org.apache.accumulo.core.iterators.system.MultiIterator; import org.apache.accumulo.core.iterators.system.VisibilityFilter; import org.apache.accumulo.core.metadata.MetadataServicer; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.CredentialHelper; -import org.apache.accumulo.core.security.thrift.TCredentials; +import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.util.AddressUtil; import org.apache.accumulo.core.util.Stat; import org.apache.accumulo.server.cli.ClientOnRequiredTable; @@ -117,8 +116,8 @@ public class CollectTabletStats { } TreeMap<KeyExtent,String> tabletLocations = new TreeMap<KeyExtent,String>(); - List<KeyExtent> candidates = findTablets(!opts.selectFarTablets, CredentialHelper.create(opts.principal, opts.getToken(), opts.instance), opts.tableName, - instance, tabletLocations); + List<KeyExtent> candidates = findTablets(!opts.selectFarTablets, new Credentials(opts.principal, opts.getToken()), opts.tableName, instance, + tabletLocations); if (candidates.size() < opts.numThreads) { System.err.println("ERROR : Unable to find " + opts.numThreads + " " + (opts.selectFarTablets ? "far" : "local") + " tablets"); @@ -130,7 +129,7 @@ public class CollectTabletStats { Map<KeyExtent,List<FileRef>> tabletFiles = new HashMap<KeyExtent,List<FileRef>>(); for (KeyExtent ke : tabletsToTest) { - List<FileRef> files = getTabletFiles(CredentialHelper.create(opts.principal, opts.getToken(), opts.instance), opts.getInstance(), tableId, ke); + List<FileRef> files = getTabletFiles(new Credentials(opts.principal, opts.getToken()), opts.getInstance(), tableId, ke); tabletFiles.put(ke, files); } @@ -344,7 +343,7 @@ public class CollectTabletStats { } - private static List<KeyExtent> findTablets(boolean selectLocalTablets, TCredentials credentials, String tableName, Instance zki, + private static List<KeyExtent> findTablets(boolean selectLocalTablets, Credentials credentials, String tableName, Instance zki, SortedMap<KeyExtent,String> tabletLocations) throws Exception { String tableId = Tables.getNameToIdMap(zki).get(tableName); @@ -382,8 +381,8 @@ public class CollectTabletStats { return tabletsToTest; } - private static List<FileRef> getTabletFiles(TCredentials token, Instance zki, String tableId, KeyExtent ke) throws IOException { - return new ArrayList<FileRef>(MetadataTableUtil.getDataFileSizes(ke, token).keySet()); + private static List<FileRef> getTabletFiles(Credentials credentials, Instance zki, String tableId, KeyExtent ke) throws IOException { + return new ArrayList<FileRef>(MetadataTableUtil.getDataFileSizes(ke, credentials).keySet()); } private static void reportHdfsBlockLocations(List<FileRef> files) throws Exception { http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java b/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java index c84fd7f..cd1b1a3 100644 --- a/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java +++ b/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java @@ -204,20 +204,19 @@ public class NullTserver { public List<ActiveCompaction> getActiveCompactions(TInfo tinfo, TCredentials credentials) throws ThriftSecurityException, TException { return new ArrayList<ActiveCompaction>(); } - + @Override public TConditionalSession startConditionalUpdate(TInfo tinfo, TCredentials credentials, List<ByteBuffer> authorizations, String tableID) - throws ThriftSecurityException, - TException { + throws ThriftSecurityException, TException { return null; } - + @Override public List<TCMResult> conditionalUpdate(TInfo tinfo, long sessID, Map<TKeyExtent,List<TConditionalMutation>> mutations, List<String> symbols) throws NoSuchScanIDException, TException { return null; } - + @Override public void invalidateConditionalUpdate(TInfo tinfo, long sessID) throws TException {} @@ -253,7 +252,7 @@ public class NullTserver { // read the locations for the table Range tableRange = new KeyExtent(new Text(tableId), null, null).toMetadataRange(); - MetaDataTableScanner s = new MetaDataTableScanner(zki, SystemCredentials.get().getAsThrift(), tableRange); + MetaDataTableScanner s = new MetaDataTableScanner(zki, SystemCredentials.get(), tableRange); long randomSessionID = opts.port; TServerInstance instance = new TServerInstance(addr, randomSessionID); List<Assignment> assignments = new ArrayList<Assignment>(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java index d31d88b..ea6d8ed 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java @@ -31,8 +31,7 @@ import org.apache.accumulo.core.client.MultiTableBatchWriter; import org.apache.accumulo.core.client.ZooKeeperInstance; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.core.security.CredentialHelper; -import org.apache.accumulo.core.security.thrift.TCredentials; +import org.apache.accumulo.core.security.Credentials; import org.apache.log4j.Logger; public class State { @@ -109,10 +108,8 @@ public class State { return connector; } - public TCredentials getCredentials() { - String username = getUserName(); - AuthenticationToken password = getToken(); - return CredentialHelper.createSquelchError(username, password, getInstance().getInstanceID()); + public Credentials getCredentials() { + return new Credentials(getUserName(), getToken()); } public String getUserName() { @@ -169,7 +166,7 @@ public class State { File libdir = new File(acuHome + "/lib"); for (String jar : "accumulo-core accumulo-server accumulo-fate accumulo-trace libthrift".split(" ")) { - retval += String.format(",%s/%s.jar", libdir.getAbsolutePath(), jar); + retval += String.format(",%s/%s.jar", libdir.getAbsolutePath(), jar); } return retval; http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Shutdown.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Shutdown.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Shutdown.java index aa4c619..62d298f 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Shutdown.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Shutdown.java @@ -18,6 +18,7 @@ package org.apache.accumulo.test.randomwalk.concurrent; import java.util.Properties; +import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.impl.MasterClient; import org.apache.accumulo.core.master.thrift.MasterClientService.Client; import org.apache.accumulo.core.master.thrift.MasterGoalState; @@ -42,8 +43,9 @@ public class Shutdown extends Test { while (true) { try { - Client client = MasterClient.getConnection(HdfsZooInstance.getInstance()); - client.getMasterStats(Tracer.traceInfo(), SystemCredentials.get().getAsThrift()); + Instance instance = HdfsZooInstance.getInstance(); + Client client = MasterClient.getConnection(instance); + client.getMasterStats(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance)); } catch (Exception e) { // assume this is due to server shutdown break; http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/StartAll.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/StartAll.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/StartAll.java index 45844b0..7d0da11 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/StartAll.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/StartAll.java @@ -18,6 +18,7 @@ package org.apache.accumulo.test.randomwalk.concurrent; import java.util.Properties; +import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.impl.MasterClient; import org.apache.accumulo.core.master.thrift.MasterClientService.Client; import org.apache.accumulo.core.master.thrift.MasterGoalState; @@ -40,8 +41,9 @@ public class StartAll extends Test { exec.waitFor(); while (true) { try { - Client client = MasterClient.getConnection(HdfsZooInstance.getInstance()); - MasterMonitorInfo masterStats = client.getMasterStats(Tracer.traceInfo(), SystemCredentials.get().getAsThrift()); + Instance instance = HdfsZooInstance.getInstance(); + Client client = MasterClient.getConnection(instance); + MasterMonitorInfo masterStats = client.getMasterStats(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance)); if (!masterStats.tServerInfo.isEmpty()) break; } catch (Exception ex) { http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java index ecca3fd..bad7b28 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java @@ -23,7 +23,7 @@ import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; -import org.apache.accumulo.core.security.CredentialHelper; +import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; @@ -35,7 +35,7 @@ public class AlterTablePerm extends Test { alter(state, props); } - public static void alter(State state, Properties props) throws Exception { + public static void alter(State state, Properties props) throws Exception { String action = props.getProperty("task", "toggle"); String perm = props.getProperty("perm", "random"); String sourceUserProp = props.getProperty("source", "system"); @@ -75,8 +75,9 @@ public class AlterTablePerm extends Test { } Connector conn = state.getInstance().getConnector(sourceUser, sourceToken); - canGive = WalkingSecurity.get(state).canGrantTable(CredentialHelper.create(sourceUser, sourceToken, state.getInstance().getInstanceID()), target, WalkingSecurity.get(state).getTableName()); - + canGive = WalkingSecurity.get(state).canGrantTable(new Credentials(sourceUser, sourceToken).toThrift(state.getInstance()), target, + WalkingSecurity.get(state).getTableName()); + // toggle if (!"take".equals(action) && !"give".equals(action)) { try { http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Authenticate.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Authenticate.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Authenticate.java index 331d0d0..14f5028 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Authenticate.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Authenticate.java @@ -24,7 +24,7 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.core.security.CredentialHelper; +import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; @@ -51,7 +51,7 @@ public class Authenticate extends Test { boolean exists = WalkingSecurity.get(state).userExists(target); // Copy so if failed it doesn't mess with the password stored in state byte[] password = Arrays.copyOf(WalkingSecurity.get(state).getUserPassword(target), WalkingSecurity.get(state).getUserPassword(target).length); - boolean hasPermission = WalkingSecurity.get(state).canAskAboutUser(CredentialHelper.create(principal, token, state.getInstance().getInstanceID()), target); + boolean hasPermission = WalkingSecurity.get(state).canAskAboutUser(new Credentials(principal, token).toThrift(state.getInstance()), target); if (!success) for (int i = 0; i < password.length; i++) http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java index c23f9a3..439e724 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java @@ -24,7 +24,7 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.core.security.CredentialHelper; +import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; @@ -55,7 +55,7 @@ public class ChangePass extends Test { targetExists = WalkingSecurity.get(state).userExists(target); - hasPerm = WalkingSecurity.get(state).canChangePassword(CredentialHelper.create(principal, token, state.getInstance().getInstanceID()), target); + hasPerm = WalkingSecurity.get(state).canChangePassword(new Credentials(principal, token).toThrift(state.getInstance()), target); Random r = new Random(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java index 6d48f89..52b6e25 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java @@ -25,7 +25,7 @@ import org.apache.accumulo.core.client.TableExistsException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.security.SecurityErrorCode; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; -import org.apache.accumulo.core.security.CredentialHelper; +import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; @@ -52,7 +52,7 @@ public class DropTable extends Test { String tableName = WalkingSecurity.get(state).getTableName(); boolean exists = WalkingSecurity.get(state).getTableExists(); - boolean hasPermission = WalkingSecurity.get(state).canDeleteTable(CredentialHelper.create(principal, token, state.getInstance().getInstanceID()), tableName); + boolean hasPermission = WalkingSecurity.get(state).canDeleteTable(new Credentials(principal, token).toThrift(state.getInstance()), tableName); try { conn.tableOperations().delete(tableName); http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java index a6661ea..4016c12 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java @@ -22,7 +22,6 @@ import java.util.Set; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.CredentialHelper; import org.apache.accumulo.core.security.SystemPermission; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.test.randomwalk.Fixture; @@ -53,7 +52,7 @@ public class SecurityFixture extends Fixture { conn.securityOperations().createLocalUser(systemUserName, sysUserPass); WalkingSecurity.get(state).setTableName(secTableName); - state.set("rootUserPass", CredentialHelper.extractToken(state.getCredentials())); + state.set("rootUserPass", state.getCredentials().getToken()); WalkingSecurity.get(state).setSysUserName(systemUserName); WalkingSecurity.get(state).createUser(systemUserName, sysUserPass); http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java index cc08c0e..ff0253d 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java @@ -30,7 +30,7 @@ import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.CredentialHelper; +import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.SystemPermission; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.core.security.thrift.TCredentials; @@ -282,11 +282,19 @@ public class WalkingSecurity extends SecurityOperation implements Authorizor, Au } public TCredentials getSysCredentials() { - return CredentialHelper.createSquelchError(getSysUserName(), getSysToken(), state.getInstance().getInstanceID()); + try { + return new Credentials(getSysUserName(), getSysToken()).toThrift(this.state.getInstance()); + } catch (ThriftSecurityException e) { + throw new RuntimeException(e); + } } public TCredentials getTabCredentials() { - return CredentialHelper.createSquelchError(getTabUserName(), getTabToken(), state.getInstance().getInstanceID()); + try { + return new Credentials(getTabUserName(), getTabToken()).toThrift(this.state.getInstance()); + } catch (ThriftSecurityException e) { + throw new RuntimeException(e); + } } public AuthenticationToken getSysToken() { http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/test/src/test/java/org/apache/accumulo/test/ConditionalWriterTest.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/ConditionalWriterTest.java b/test/src/test/java/org/apache/accumulo/test/ConditionalWriterTest.java index f5340cc..936e0ac 100644 --- a/test/src/test/java/org/apache/accumulo/test/ConditionalWriterTest.java +++ b/test/src/test/java/org/apache/accumulo/test/ConditionalWriterTest.java @@ -67,7 +67,7 @@ import org.apache.accumulo.core.iterators.user.SummingCombiner; import org.apache.accumulo.core.iterators.user.VersioningIterator; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.security.ColumnVisibility; -import org.apache.accumulo.core.security.CredentialHelper; +import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.core.util.FastFormat; import org.apache.accumulo.core.util.UtilWaitThread; @@ -83,7 +83,6 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.rules.TemporaryFolder; - /** * */ @@ -100,15 +99,15 @@ public class ConditionalWriterTest { cluster = new MiniAccumuloCluster(cfg); cluster.start(); } - + @Test public void testBasic() throws Exception { - + ZooKeeperInstance zki = new ZooKeeperInstance(cluster.getInstanceName(), cluster.getZooKeepers()); Connector conn = zki.getConnector("root", new PasswordToken(secret)); conn.tableOperations().create("foo"); - + ConditionalWriter cw = conn.createConditionalWriter("foo", new ConditionalWriterConfig()); // mutation conditional on column tx:seq not exiting @@ -118,13 +117,13 @@ public class ConditionalWriterTest { cm0.put("tx", "seq", "1"); Assert.assertEquals(Status.ACCEPTED, cw.write(cm0).getStatus()); Assert.assertEquals(Status.REJECTED, cw.write(cm0).getStatus()); - + // mutation conditional on column tx:seq being 1 ConditionalMutation cm1 = new ConditionalMutation("99006", new Condition("tx", "seq").setValue("1")); cm1.put("name", "last", "Doe"); cm1.put("tx", "seq", "2"); Assert.assertEquals(Status.ACCEPTED, cw.write(cm1).getStatus()); - + // test condition where value differs ConditionalMutation cm2 = new ConditionalMutation("99006", new Condition("tx", "seq").setValue("1")); cm2.put("name", "last", "DOE"); @@ -142,19 +141,19 @@ public class ConditionalWriterTest { cm4.put("name", "last", "deo"); cm4.put("tx", "seq", "3"); Assert.assertEquals(Status.REJECTED, cw.write(cm4).getStatus()); - + // test two conditions, where one should fail ConditionalMutation cm5 = new ConditionalMutation("99006", new Condition("tx", "seq").setValue("1"), new Condition("name", "last").setValue("Doe")); cm5.put("name", "last", "deo"); cm5.put("tx", "seq", "3"); Assert.assertEquals(Status.REJECTED, cw.write(cm5).getStatus()); - + // ensure rejected mutations did not write Scanner scanner = conn.createScanner("foo", Authorizations.EMPTY); scanner.fetchColumn(new Text("name"), new Text("last")); scanner.setRange(new Range("99006")); Assert.assertEquals("Doe", scanner.iterator().next().getValue().toString()); - + // test w/ two conditions that are met ConditionalMutation cm6 = new ConditionalMutation("99006", new Condition("tx", "seq").setValue("2"), new Condition("name", "last").setValue("Doe")); cm6.put("name", "last", "DOE"); @@ -171,7 +170,7 @@ public class ConditionalWriterTest { Assert.assertEquals(Status.ACCEPTED, cw.write(cm7).getStatus()); Assert.assertFalse(scanner.iterator().hasNext()); - + // add the row back Assert.assertEquals(Status.ACCEPTED, cw.write(cm0).getStatus()); Assert.assertEquals(Status.REJECTED, cw.write(cm0).getStatus()); @@ -231,7 +230,7 @@ public class ConditionalWriterTest { cm3.put("name", "first", cva, "John"); cm3.put("tx", "seq", cva, "2"); Assert.assertEquals(Status.REJECTED, cw.write(cm3).getStatus()); - + // test wrong timestamp ConditionalMutation cm4 = new ConditionalMutation("99006", new Condition("tx", "seq").setVisibility(cva).setTimestamp(ts + 1).setValue("1")); cm4.put("name", "last", cva, "Doe"); @@ -245,25 +244,25 @@ public class ConditionalWriterTest { cm5.put("name", "first", cva, "John"); cm5.put("tx", "seq", cva, "2"); Assert.assertEquals(Status.REJECTED, cw.write(cm5).getStatus()); - + // ensure no updates were made entry = scanner.iterator().next(); Assert.assertEquals("1", entry.getValue().toString()); - + // set all columns correctly ConditionalMutation cm6 = new ConditionalMutation("99006", new Condition("tx", "seq").setVisibility(cva).setTimestamp(ts).setValue("1")); cm6.put("name", "last", cva, "Doe"); cm6.put("name", "first", cva, "John"); cm6.put("tx", "seq", cva, "2"); Assert.assertEquals(Status.ACCEPTED, cw.write(cm6).getStatus()); - + entry = scanner.iterator().next(); Assert.assertEquals("2", entry.getValue().toString()); // TODO test each field w/ absence - + } - + @Test public void testBadColVis() throws Exception { // test when a user sets a col vis in a condition that can never be seen @@ -277,7 +276,7 @@ public class ConditionalWriterTest { Authorizations auths = new Authorizations("A", "B"); conn.securityOperations().changeUserAuthorizations("root", auths); - + Authorizations filteredAuths = new Authorizations("A"); ConditionalWriter cw = conn.createConditionalWriter(table, new ConditionalWriterConfig().setAuthorizations(filteredAuths)); @@ -298,7 +297,7 @@ public class ConditionalWriterTest { cm1.put("name", "first", cva, "john"); cm1.put("tx", "seq", cva, "1"); Assert.assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm1).getStatus()); - + // User does not have the authorization ConditionalMutation cm2 = new ConditionalMutation("99006", new Condition("tx", "seq").setVisibility(cvc)); cm2.put("name", "last", cva, "doe"); @@ -311,10 +310,10 @@ public class ConditionalWriterTest { cm3.put("name", "first", cva, "john"); cm3.put("tx", "seq", cva, "1"); Assert.assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm3).getStatus()); - + // if any visibility is bad, good visibilities don't override ConditionalMutation cm4 = new ConditionalMutation("99006", new Condition("tx", "seq").setVisibility(cvb), new Condition("tx", "seq").setVisibility(cva)); - + cm4.put("name", "last", cva, "doe"); cm4.put("name", "first", cva, "john"); cm4.put("tx", "seq", cva, "1"); @@ -326,14 +325,14 @@ public class ConditionalWriterTest { cm5.put("name", "first", cva, "john"); cm5.put("tx", "seq", cva, "1"); Assert.assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm5).getStatus()); - + ConditionalMutation cm6 = new ConditionalMutation("99006", new Condition("tx", "seq").setVisibility(cvb).setValue("1"), new Condition("tx", "seq").setVisibility(cva)); cm6.put("name", "last", cva, "doe"); cm6.put("name", "first", cva, "john"); cm6.put("tx", "seq", cva, "1"); Assert.assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm6).getStatus()); - + ConditionalMutation cm7 = new ConditionalMutation("99006", new Condition("tx", "seq").setVisibility(cvb), new Condition("tx", "seq").setVisibility(cva) .setValue("1")); cm7.put("name", "last", cva, "doe"); @@ -342,7 +341,7 @@ public class ConditionalWriterTest { Assert.assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm7).getStatus()); cw.close(); - + // test passing auths that exceed users configured auths Authorizations exceedingAuths = new Authorizations("A", "B", "D"); @@ -353,13 +352,12 @@ public class ConditionalWriterTest { cm8.put("name", "last", cva, "doe"); cm8.put("name", "first", cva, "john"); cm8.put("tx", "seq", cva, "1"); - + try { cw2.write(cm8).getStatus(); Assert.fail(); } catch (AccumuloSecurityException ase) {} - cw2.close(); } @@ -376,9 +374,9 @@ public class ConditionalWriterTest { conn.tableOperations().clone(table, table + "_clone", true, new HashMap<String,String>(), new HashSet<String>()); Scanner scanner = conn.createScanner(table + "_clone", new Authorizations()); - + ConditionalWriter cw = conn.createConditionalWriter(table + "_clone", new ConditionalWriterConfig()); - + ConditionalMutation cm0 = new ConditionalMutation("99006+", new Condition("tx", "seq")); cm0.put("tx", "seq", "1"); @@ -392,9 +390,9 @@ public class ConditionalWriterTest { Assert.assertTrue(scanner.iterator().hasNext()); cw.close(); - + } - + @Test public void testIterators() throws Exception { String table = "foo4"; @@ -416,12 +414,12 @@ public class ConditionalWriterTest { m.put("count2", "comments", "1"); bw.addMutation(m); bw.addMutation(m); - + m = new Mutation("ACCUMULO-1002"); m.put("count2", "comments", "1"); bw.addMutation(m); bw.addMutation(m); - + bw.close(); IteratorSetting iterConfig = new IteratorSetting(10, SummingCombiner.class); @@ -434,14 +432,14 @@ public class ConditionalWriterTest { IteratorSetting iterConfig3 = new IteratorSetting(5, VersioningIterator.class); VersioningIterator.setMaxVersions(iterConfig3, 1); - + Scanner scanner = conn.createScanner(table, new Authorizations()); scanner.addScanIterator(iterConfig); scanner.setRange(new Range("ACCUMULO-1000")); scanner.fetchColumn(new Text("count"), new Text("comments")); Assert.assertEquals("3", scanner.iterator().next().getValue().toString()); - + ConditionalWriter cw = conn.createConditionalWriter(table, new ConditionalWriterConfig()); ConditionalMutation cm0 = new ConditionalMutation("ACCUMULO-1000", new Condition("count", "comments").setValue("3")); @@ -460,7 +458,7 @@ public class ConditionalWriterTest { Assert.assertEquals("4", scanner.iterator().next().getValue().toString()); // run test with multiple iterators passed in same batch and condition with two iterators - + ConditionalMutation cm3 = new ConditionalMutation("ACCUMULO-1000", new Condition("count", "comments").setIterators(iterConfig).setValue("4")); cm3.put("count", "comments", "1"); @@ -479,19 +477,19 @@ public class ConditionalWriterTest { Assert.assertFalse(actual.containsKey(k)); actual.put(k, result.getStatus()); } - + Map<String,Status> expected = new HashMap<String,Status>(); expected.put("ACCUMULO-1000", Status.ACCEPTED); expected.put("ACCUMULO-1001", Status.ACCEPTED); expected.put("ACCUMULO-1002", Status.REJECTED); Assert.assertEquals(expected, actual); - + // TODO test w/ table that has iterators configured cw.close(); } - + @Test public void testBatch() throws Exception { String table = "foo6"; @@ -535,7 +533,7 @@ public class ConditionalWriterTest { } Assert.assertEquals(3, count); - + Scanner scanner = conn.createScanner(table, new Authorizations("A")); scanner.fetchColumn(new Text("tx"), new Text("seq")); @@ -543,14 +541,14 @@ public class ConditionalWriterTest { scanner.setRange(new Range(row)); Assert.assertEquals("1", scanner.iterator().next().getValue().toString()); } - + TreeSet<Text> splits = new TreeSet<Text>(); splits.add(new Text("7")); splits.add(new Text("3")); conn.tableOperations().addSplits(table, splits); - + mutations.clear(); - + ConditionalMutation cm3 = new ConditionalMutation("99006", new Condition("tx", "seq").setVisibility(cvab).setValue("1")); cm3.put("name", "last", cvab, "Doe"); cm3.put("tx", "seq", cvab, "2"); @@ -565,7 +563,7 @@ public class ConditionalWriterTest { cm5.put("name", "last", cvab, "Doe"); cm5.put("tx", "seq", cvab, "3"); mutations.add(cm5); - + results = cw.write(mutations.iterator()); int accepted = 0; int rejected = 0; @@ -582,7 +580,7 @@ public class ConditionalWriterTest { Assert.assertEquals(1, accepted); Assert.assertEquals(2, rejected); - + for (String row : new String[] {"59056", "19059"}) { scanner.setRange(new Range(row)); Assert.assertEquals("1", scanner.iterator().next().getValue().toString()); @@ -590,7 +588,7 @@ public class ConditionalWriterTest { scanner.setRange(new Range("99006")); Assert.assertEquals("2", scanner.iterator().next().getValue().toString()); - + scanner.clearColumns(); scanner.fetchColumn(new Text("name"), new Text("last")); Assert.assertEquals("Doe", scanner.iterator().next().getValue().toString()); @@ -610,7 +608,7 @@ public class ConditionalWriterTest { conn.tableOperations().addSplits(table, nss("2", "4", "6")); UtilWaitThread.sleep(2000); - + int num = 100; ArrayList<byte[]> rows = new ArrayList<byte[]>(num); @@ -631,11 +629,11 @@ public class ConditionalWriterTest { cml.add(cm); } - + ConditionalWriter cw = conn.createConditionalWriter(table, new ConditionalWriterConfig()); - + Iterator<Result> results = cw.write(cml.iterator()); - + int count = 0; // TODO check got each row back @@ -646,7 +644,7 @@ public class ConditionalWriterTest { } Assert.assertEquals(num, count); - + ArrayList<ConditionalMutation> cml2 = new ArrayList<ConditionalMutation>(num); for (int i = 0; i < num; i++) { @@ -659,7 +657,7 @@ public class ConditionalWriterTest { } count = 0; - + results = cw.write(cml2.iterator()); while (results.hasNext()) { @@ -684,7 +682,7 @@ public class ConditionalWriterTest { conn.tableOperations().create(table); conn.tableOperations().addConstraint(table, AlphaNumKeyConstraint.class.getName()); conn.tableOperations().clone(table, table + "_clone", true, new HashMap<String,String>(), new HashSet<String>()); - + conn.securityOperations().changeUserAuthorizations("root", new Authorizations("A", "B")); ColumnVisibility cvaob = new ColumnVisibility("A|B"); @@ -724,7 +722,7 @@ public class ConditionalWriterTest { cm3.put("name", "first", cvaob, "john"); cm3.put("tx", "seq", cvaob, "2"); mutations.add(cm3); - + ConditionalWriter cw = conn.createConditionalWriter(table, new ConditionalWriterConfig().setAuthorizations(new Authorizations("A"))); Iterator<Result> results = cw.write(mutations.iterator()); HashSet<String> rows = new HashSet<String>(); @@ -744,14 +742,14 @@ public class ConditionalWriterTest { } Assert.assertEquals(4, rows.size()); - + Scanner scanner = conn.createScanner(table, new Authorizations("A")); scanner.fetchColumn(new Text("tx"), new Text("seq")); Iterator<Entry<Key,Value>> iter = scanner.iterator(); Assert.assertEquals("1", iter.next().getValue().toString()); Assert.assertFalse(iter.hasNext()); - + cw.close(); } @@ -807,7 +805,7 @@ public class ConditionalWriterTest { cw.close(); } - + private static class Stats { ByteSequence row = null; @@ -821,7 +819,7 @@ public class ConditionalWriterTest { if (row == null) row = entry.getKey().getRowData(); - + String cf = entry.getKey().getColumnFamilyData().toString(); String cq = entry.getKey().getColumnQualifierData().toString(); @@ -853,7 +851,7 @@ public class ConditionalWriterTest { this.seq = -1; this.sum = 0; } - + void set(int index, int value) { sum -= data[index]; sum += value; @@ -876,12 +874,13 @@ public class ConditionalWriterTest { return cm; } - + + @Override public String toString() { return row + " " + seq + " " + sum; } } - + private static class MutatorTask implements Runnable { String table; ArrayList<ByteSequence> rows; @@ -896,7 +895,7 @@ public class ConditionalWriterTest { this.cw = cw; this.failed = failed; } - + @Override public void run() { try { @@ -931,16 +930,16 @@ public class ConditionalWriterTest { Collections.sort(changed); Assert.assertEquals(changes, changed); - + } - + } catch (Exception e) { e.printStackTrace(); failed.set(true); } } } - + @Test public void testThreads() throws Exception { // test multiple threads using a single conditional writer @@ -966,7 +965,6 @@ public class ConditionalWriterTest { ConditionalWriter cw = conn.createConditionalWriter(table, new ConditionalWriterConfig()); ArrayList<ByteSequence> rows = new ArrayList<ByteSequence>(); - for (int i = 0; i < 1000; i++) { rows.add(new ArrayByteSequence(FastFormat.toZeroPaddedString(Math.abs(rand.nextLong()), 16, 16, new byte[0]))); @@ -991,30 +989,30 @@ public class ConditionalWriterTest { Assert.assertEquals(rows, rows2); AtomicBoolean failed = new AtomicBoolean(false); - + ExecutorService tp = Executors.newFixedThreadPool(5); for (int i = 0; i < 5; i++) { tp.submit(new MutatorTask(table, conn, rows, cw, failed)); } - + tp.shutdown(); - + while (!tp.isTerminated()) { tp.awaitTermination(1, TimeUnit.MINUTES); } - + Assert.assertFalse(failed.get()); - + Scanner scanner = conn.createScanner(table, Authorizations.EMPTY); RowIterator rowIter = new RowIterator(scanner); - + while (rowIter.hasNext()) { Iterator<Entry<Key,Value>> row = rowIter.next(); new Stats(row); } } - + private SortedSet<Text> nss(String... splits) { TreeSet<Text> ret = new TreeSet<Text>(); for (String split : splits) @@ -1022,7 +1020,7 @@ public class ConditionalWriterTest { return ret; } - + @Test public void testSecurity() throws Exception { // test against table user does not have read and/or write permissions for @@ -1066,10 +1064,9 @@ public class ConditionalWriterTest { } catch (AccumuloSecurityException ase) { } - + } - - + @Test public void testTimeout() throws Exception { ZooKeeperInstance zki = new ZooKeeperInstance(cluster.getInstanceName(), cluster.getZooKeepers()); @@ -1078,9 +1075,9 @@ public class ConditionalWriterTest { String table = "fooT"; conn.tableOperations().create(table); - + ConditionalWriter cw = conn.createConditionalWriter(table, new ConditionalWriterConfig().setTimeout(1, TimeUnit.SECONDS)); - + ConditionalMutation cm1 = new ConditionalMutation("r1", new Condition("tx", "seq")); cm1.put("tx", "seq", "1"); cm1.put("data", "x", "a"); @@ -1118,9 +1115,9 @@ public class ConditionalWriterTest { Assert.assertEquals(cw.write(cm3).getStatus(), Status.ACCEPTED); cw.close(); - + } - + @Test public void testDeleteTable() throws Exception { String table = "foo12"; @@ -1166,7 +1163,7 @@ public class ConditionalWriterTest { ConditionalWriter cw = conn.createConditionalWriter(table, new ConditionalWriterConfig()); conn.tableOperations().offline(table); - + waitForSingleTabletTableToGoOffline(table, zki); ConditionalMutation cm1 = new ConditionalMutation("r1", new Condition("tx", "seq")); @@ -1189,15 +1186,15 @@ public class ConditionalWriterTest { Assert.assertFalse(true); } catch (TableOfflineException e) {} } - + void waitForSingleTabletTableToGoOffline(String table, ZooKeeperInstance zki) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { TabletLocator locator = TabletLocator.getLocator(zki, new Text(Tables.getNameToIdMap(zki).get(table))); - while (locator.locateTablet(new Text("a"), false, false, CredentialHelper.create("root", new PasswordToken(secret), zki.getInstanceID())) != null) { + while (locator.locateTablet(new Credentials("root", new PasswordToken(secret)), new Text("a"), false, false) != null) { UtilWaitThread.sleep(50); locator.invalidateCache(); } } - + @Test public void testError() throws Exception { String table = "foo10"; @@ -1225,9 +1222,9 @@ public class ConditionalWriterTest { } cw.close(); - + } - + @AfterClass public static void tearDownAfterClass() throws Exception { cluster.stop(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java b/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java index 539122b..6b3595c 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java @@ -16,7 +16,7 @@ */ package org.apache.accumulo.test.functional; -import static org.junit.Assert.*; +import static org.junit.Assert.fail; import java.util.Collections; @@ -28,8 +28,7 @@ import org.apache.accumulo.core.master.thrift.MasterClientService; import org.apache.accumulo.core.master.thrift.MasterMonitorInfo; import org.apache.accumulo.core.master.thrift.TableInfo; import org.apache.accumulo.core.master.thrift.TabletServerStatus; -import org.apache.accumulo.core.security.CredentialHelper; -import org.apache.accumulo.core.security.thrift.TCredentials; +import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.minicluster.MiniAccumuloConfig; import org.apache.accumulo.test.TestIngest; @@ -50,14 +49,14 @@ public class DynamicThreadPoolsIT extends ConfigurableMacIT { Connector c = getConnector(); c.instanceOperations().setProperty(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), "5"); TestIngest.Opts opts = new TestIngest.Opts(); - opts.rows = 100*1000; + opts.rows = 100 * 1000; opts.createTable = true; TestIngest.ingest(c, opts, BWOPTS); c.tableOperations().flush("test_ingest", null, null, true); for (int i = 1; i < TABLES; i++) c.tableOperations().clone("test_ingest", "test_ingest" + i, true, null, null); - UtilWaitThread.sleep(11*1000); // time between checks of the thread pool sizes - TCredentials creds = CredentialHelper.create("root", new PasswordToken(ROOT_PASSWORD), c.getInstance().getInstanceName()); + UtilWaitThread.sleep(11 * 1000); // time between checks of the thread pool sizes + Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD)); for (int i = 1; i < TABLES; i++) c.tableOperations().compact("test_ingest" + i, null, null, true, false); for (int i = 0; i < 30; i++) { @@ -66,7 +65,7 @@ public class DynamicThreadPoolsIT extends ConfigurableMacIT { MasterMonitorInfo stats = null; try { client = MasterClient.getConnectionWithRetry(c.getInstance()); - stats = client.getMasterStats(Tracer.traceInfo(), creds); + stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance())); } finally { if (client != null) MasterClient.close(client); http://git-wip-us.apache.org/repos/asf/accumulo/blob/99da5641/test/src/test/java/org/apache/accumulo/test/functional/MetadataMaxFiles.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/MetadataMaxFiles.java b/test/src/test/java/org/apache/accumulo/test/functional/MetadataMaxFiles.java index fd0a2a8..d08d3c1 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/MetadataMaxFiles.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/MetadataMaxFiles.java @@ -34,8 +34,7 @@ import org.apache.accumulo.core.master.thrift.TableInfo; import org.apache.accumulo.core.master.thrift.TabletServerStatus; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; -import org.apache.accumulo.core.security.CredentialHelper; -import org.apache.accumulo.core.security.thrift.TCredentials; +import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.minicluster.MiniAccumuloConfig; import org.apache.accumulo.server.util.Admin; @@ -82,11 +81,11 @@ public class MetadataMaxFiles extends ConfigurableMacIT { while (true) { MasterMonitorInfo stats = null; - TCredentials creds = CredentialHelper.create("root", new PasswordToken(ROOT_PASSWORD), c.getInstance().getInstanceName()); + Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD)); Client client = null; try { client = MasterClient.getConnectionWithRetry(c.getInstance()); - stats = client.getMasterStats(Tracer.traceInfo(), creds); + stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance())); } finally { if (client != null) MasterClient.close(client); @@ -104,5 +103,4 @@ public class MetadataMaxFiles extends ConfigurableMacIT { UtilWaitThread.sleep(1000); } } - }
