This is an automated email from the ASF dual-hosted git repository.

domgarguilo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git

commit 003cdf333d3273208c6a0b744ec621391b38cfc8
Merge: 1ad72a5f2a eb681a9da7
Author: Dom Garguilo <domgargu...@apache.org>
AuthorDate: Fri Aug 16 13:53:23 2024 -0400

    Merge remote-tracking branch 'upstream/2.1'

 .../core/client/lexicoder/BytesLexicoderTest.java  |   4 +-
 .../core/client/lexicoder/LexicoderTest.java       |   5 +-
 .../core/clientImpl/TabletLocatorImplTest.java     |   5 +-
 .../core/clientImpl/lexicoder/ByteUtilsTest.java   |  15 +--
 .../accumulo/core/conf/ClientPropertyTest.java     |   7 +-
 .../apache/accumulo/core/crypto/CryptoTest.java    |   5 +-
 .../org/apache/accumulo/core/data/ColumnTest.java  |   7 +-
 .../org/apache/accumulo/core/data/KeyTest.java     |  38 ++++----
 .../apache/accumulo/core/data/MutationTest.java    | 101 +++++++++++----------
 .../org/apache/accumulo/core/data/RangeTest.java   |  12 +--
 .../zookeeper/DistributedReadWriteLockTest.java    |   3 +-
 .../core/file/rfile/CreateCompatTestFile.java      |   5 +-
 .../core/file/rfile/GenerateSplitsTest.java        |   3 +-
 .../accumulo/core/file/rfile/KeyShortenerTest.java |  11 ++-
 .../core/file/rfile/MultiThreadedRFileTest.java    |   4 +-
 .../apache/accumulo/core/file/rfile/RFileTest.java |   6 +-
 .../core/iterators/system/ColumnFilterTest.java    |   5 +-
 .../iterators/system/VisibilityFilterTest.java     |   4 +-
 .../accumulo/core/iterators/user/FilterTest.java   |  23 ++---
 .../iterators/user/IndexedDocIteratorTest.java     |  17 ++--
 .../core/iterators/user/RegExFilterTest.java       |   5 +-
 .../iterators/user/RowDeletingIteratorTest.java    |   5 +-
 .../iterators/user/VersioningIteratorTest.java     |   3 +-
 .../accumulo/core/security/AuthorizationsTest.java |   3 +-
 .../core/security/ColumnVisibilityTest.java        |   8 +-
 .../balancer/HostRegexTableLoadBalancerTest.java   |   8 +-
 .../hadoop/its/mapred/AccumuloInputFormatIT.java   |   5 +-
 .../hadoop/its/mapred/AccumuloOutputFormatIT.java  |   9 +-
 .../its/mapred/AccumuloRowInputFormatIT.java       |  11 ++-
 .../hadoop/its/mapred/MultiTableInputFormatIT.java |   5 +-
 .../accumulo/hadoop/its/mapred/TokenFileIT.java    |   9 +-
 .../its/mapreduce/AccumuloInputFormatIT.java       |   5 +-
 .../its/mapreduce/AccumuloOutputFormatIT.java      |   9 +-
 .../its/mapreduce/AccumuloRowInputFormatIT.java    |  11 ++-
 .../its/mapreduce/MultiTableInputFormatIT.java     |   5 +-
 .../accumulo/hadoop/its/mapreduce/RowHashIT.java   |   5 +-
 .../accumulo/hadoop/its/mapreduce/TokenFileIT.java |   9 +-
 .../miniclusterImpl/MiniAccumuloClusterImpl.java   |   2 +-
 .../accumulo/server/data/ServerMutationTest.java   |  21 +++--
 .../security/handler/ZKAuthenticatorTest.java      |   2 +-
 .../tableOps/compact/CompactionDriverTest.java     |   5 +-
 .../org/apache/accumulo/monitor/it/WebViewsIT.java |   3 +-
 .../accumulo/tserver/CheckTabletMetadataTest.java  |   5 +-
 .../accumulo/tserver/TservConstraintEnvTest.java   |   3 +-
 .../shell/commands/HistoryCommandTest.java         |   4 +-
 .../apache/accumulo/test/ConditionalWriterIT.java  |   8 +-
 .../org/apache/accumulo/test/InMemoryMapIT.java    |   3 +-
 .../apache/accumulo/test/MultiTableRecoveryIT.java |   3 +-
 .../org/apache/accumulo/test/VerifyIngest.java     |   6 +-
 .../accumulo/test/functional/AuthsIterator.java    |   4 +-
 .../accumulo/test/functional/CombinerIT.java       |   3 +-
 .../accumulo/test/functional/KerberosIT.java       |   3 +-
 .../test/functional/WatchTheWatchCountIT.java      |   5 +-
 .../accumulo/test/metrics/TestStatsDSink.java      |   4 +-
 54 files changed, 269 insertions(+), 210 deletions(-)

diff --cc 
core/src/test/java/org/apache/accumulo/core/file/rfile/MultiThreadedRFileTest.java
index daf615b197,1651b8031d..efac32abff
--- 
a/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiThreadedRFileTest.java
+++ 
b/core/src/test/java/org/apache/accumulo/core/file/rfile/MultiThreadedRFileTest.java
@@@ -18,9 -18,9 +18,10 @@@
   */
  package org.apache.accumulo.core.file.rfile;
  
+ import static java.nio.charset.StandardCharsets.UTF_8;
  import static java.util.concurrent.TimeUnit.MILLISECONDS;
  import static java.util.concurrent.TimeUnit.MINUTES;
 +import static org.apache.accumulo.core.util.LazySingletons.RANDOM;
  import static org.junit.jupiter.api.Assertions.assertEquals;
  import static org.junit.jupiter.api.Assertions.assertFalse;
  import static org.junit.jupiter.api.Assertions.assertTrue;
diff --cc core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
index b81b0196d9,082e0d6ea7..36533596dc
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
@@@ -18,7 -18,7 +18,8 @@@
   */
  package org.apache.accumulo.core.file.rfile;
  
+ import static java.nio.charset.StandardCharsets.UTF_8;
 +import static org.apache.accumulo.core.util.LazySingletons.RANDOM;
  import static org.junit.jupiter.api.Assertions.assertEquals;
  import static org.junit.jupiter.api.Assertions.assertFalse;
  import static org.junit.jupiter.api.Assertions.assertNotNull;
@@@ -189,8 -199,157 +190,9 @@@ public class RFileTest extends Abstract
  
    }
  
 -  private static void checkIndex(Reader reader) throws IOException {
 -    FileSKVIterator indexIter = reader.getIndex();
 -
 -    if (indexIter.hasTop()) {
 -      Key lastKey = new Key(indexIter.getTopKey());
 -
 -      if (reader.getFirstKey().compareTo(lastKey) > 0) {
 -        throw new RuntimeException(
 -            "First key out of order " + reader.getFirstKey() + " " + lastKey);
 -      }
 -
 -      indexIter.next();
 -
 -      while (indexIter.hasTop()) {
 -        if (lastKey.compareTo(indexIter.getTopKey()) > 0) {
 -          throw new RuntimeException(
 -              "Indext out of order " + lastKey + " " + indexIter.getTopKey());
 -        }
 -
 -        lastKey = new Key(indexIter.getTopKey());
 -        indexIter.next();
 -
 -      }
 -
 -      if (!reader.getLastKey().equals(lastKey)) {
 -        throw new RuntimeException("Last key out of order " + 
reader.getLastKey() + " " + lastKey);
 -      }
 -    }
 -  }
 -
 -  public static class TestRFile {
 -
 -    protected Configuration conf = new Configuration();
 -    public RFile.Writer writer;
 -    protected ByteArrayOutputStream baos;
 -    protected FSDataOutputStream dos;
 -    protected SeekableByteArrayInputStream bais;
 -    protected FSDataInputStream in;
 -    protected AccumuloConfiguration accumuloConfiguration;
 -    public Reader reader;
 -    public SortedKeyValueIterator<Key,Value> iter;
 -    private BlockCacheManager manager;
 -
 -    public TestRFile(AccumuloConfiguration accumuloConfiguration) {
 -      this.accumuloConfiguration = accumuloConfiguration;
 -      if (this.accumuloConfiguration == null) {
 -        this.accumuloConfiguration = DefaultConfiguration.getInstance();
 -      }
 -    }
 -
 -    public void openWriter(boolean startDLG) throws IOException {
 -      openWriter(startDLG, 1000);
 -    }
 -
 -    public void openWriter(boolean startDLG, int blockSize) throws 
IOException {
 -      baos = new ByteArrayOutputStream();
 -      dos = new FSDataOutputStream(baos, new FileSystem.Statistics("a"));
 -      CryptoService cs = 
CryptoFactoryLoader.getServiceForClient(CryptoEnvironment.Scope.TABLE,
 -          accumuloConfiguration.getAllCryptoProperties());
 -
 -      BCFile.Writer _cbw = new BCFile.Writer(dos, null, "gz", conf, cs);
 -
 -      SamplerConfigurationImpl samplerConfig =
 -          SamplerConfigurationImpl.newSamplerConfig(accumuloConfiguration);
 -      Sampler sampler = null;
 -
 -      if (samplerConfig != null) {
 -        sampler = SamplerFactory.newSampler(samplerConfig, 
accumuloConfiguration);
 -      }
 -
 -      writer = new RFile.Writer(_cbw, blockSize, 1000, samplerConfig, 
sampler);
 -
 -      if (startDLG) {
 -        writer.startDefaultLocalityGroup();
 -      }
 -    }
 -
 -    public void openWriter() throws IOException {
 -      openWriter(1000);
 -    }
 -
 -    public void openWriter(int blockSize) throws IOException {
 -      openWriter(true, blockSize);
 -    }
 -
 -    public void closeWriter() throws IOException {
 -      dos.flush();
 -      writer.close();
 -      dos.close();
 -      if (baos != null) {
 -        baos.close();
 -      }
 -    }
 -
 -    public void openReader() throws IOException {
 -      openReader(true);
 -    }
 -
 -    public void openReader(boolean cfsi) throws IOException {
 -      int fileLength = 0;
 -      byte[] data = null;
 -      data = baos.toByteArray();
 -
 -      bais = new SeekableByteArrayInputStream(data);
 -      in = new FSDataInputStream(bais);
 -      fileLength = data.length;
 -
 -      DefaultConfiguration dc = DefaultConfiguration.getInstance();
 -      ConfigurationCopy cc = new ConfigurationCopy(dc);
 -      cc.set(Property.TSERV_CACHE_MANAGER_IMPL, 
LruBlockCacheManager.class.getName());
 -      try {
 -        manager = BlockCacheManagerFactory.getInstance(cc);
 -      } catch (Exception e) {
 -        throw new RuntimeException("Error creating BlockCacheManager", e);
 -      }
 -      cc.set(Property.TSERV_DEFAULT_BLOCKSIZE, Long.toString(100000));
 -      cc.set(Property.TSERV_DATACACHE_SIZE, Long.toString(100000000));
 -      cc.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(100000000));
 -      manager.start(BlockCacheConfiguration.forTabletServer(cc));
 -      LruBlockCache indexCache = (LruBlockCache) 
manager.getBlockCache(CacheType.INDEX);
 -      LruBlockCache dataCache = (LruBlockCache) 
manager.getBlockCache(CacheType.DATA);
 -
 -      CryptoService cs = 
CryptoFactoryLoader.getServiceForClient(CryptoEnvironment.Scope.TABLE,
 -          accumuloConfiguration.getAllCryptoProperties());
 -
 -      CachableBuilder cb = new CachableBuilder().input(in, 
"source-1").length(fileLength).conf(conf)
 -          .cacheProvider(new BasicCacheProvider(indexCache, 
dataCache)).cryptoService(cs);
 -      reader = new RFile.Reader(cb);
 -      if (cfsi) {
 -        iter = new ColumnFamilySkippingIterator(reader);
 -      }
 -
 -      checkIndex(reader);
 -    }
 -
 -    public void closeReader() throws IOException {
 -      reader.close();
 -      in.close();
 -      if (null != manager) {
 -        manager.stop();
 -      }
 -    }
 -
 -    public void seek(Key nk) throws IOException {
 -      iter.seek(new Range(nk, null), EMPTY_COL_FAMS, false);
 -    }
 -  }
 -
    static Key newKey(String row, String cf, String cq, String cv, long ts) {
-     return new Key(row.getBytes(), cf.getBytes(), cq.getBytes(), 
cv.getBytes(), ts);
+     return new Key(row.getBytes(UTF_8), cf.getBytes(UTF_8), 
cq.getBytes(UTF_8), cv.getBytes(UTF_8),
+         ts);
    }
  
    static Value newValue(String val) {
diff --cc 
core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
index 97ce48b9fa,fdb34e1fa3..57f19f6de7
--- 
a/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
+++ 
b/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
@@@ -18,7 -18,7 +18,8 @@@
   */
  package org.apache.accumulo.core.iterators.user;
  
+ import static java.nio.charset.StandardCharsets.UTF_8;
 +import static org.apache.accumulo.core.util.LazySingletons.RANDOM;
  import static org.junit.jupiter.api.Assertions.assertEquals;
  import static org.junit.jupiter.api.Assertions.assertTrue;
  
@@@ -90,9 -92,9 +91,9 @@@ public class IndexedDocIteratorTest 
          boolean docHits = true;
          Text doc = new Text("type");
          doc.append(nullByte, 0, 1);
-         doc.append(String.format("%010d", docid).getBytes(), 0, 10);
+         doc.append(String.format("%010d", docid).getBytes(UTF_8), 0, 10);
          for (int j = 0; j < columnFamilies.length; j++) {
 -          if (random.nextFloat() < hitRatio) {
 +          if (RANDOM.get().nextFloat() < hitRatio) {
              Text colq = new Text(columnFamilies[j]);
              colq.append(nullByte, 0, 1);
              colq.append(doc.getBytes(), 0, doc.getLength());
diff --cc 
core/src/test/java/org/apache/accumulo/core/security/ColumnVisibilityTest.java
index b68ac37682,1ed0afc36f..229e97ab16
--- 
a/core/src/test/java/org/apache/accumulo/core/security/ColumnVisibilityTest.java
+++ 
b/core/src/test/java/org/apache/accumulo/core/security/ColumnVisibilityTest.java
@@@ -29,19 -35,9 +29,19 @@@ import org.junit.jupiter.api.Test
  
  public class ColumnVisibilityTest {
  
 +  @SuppressWarnings("deprecation")
 +  private static org.apache.accumulo.core.security.ColumnVisibility.NodeType 
AND =
 +      org.apache.accumulo.core.security.ColumnVisibility.NodeType.AND;
 +  @SuppressWarnings("deprecation")
 +  private static org.apache.accumulo.core.security.ColumnVisibility.NodeType 
OR =
 +      org.apache.accumulo.core.security.ColumnVisibility.NodeType.OR;
 +  @SuppressWarnings("deprecation")
 +  private static org.apache.accumulo.core.security.ColumnVisibility.NodeType 
TERM =
 +      org.apache.accumulo.core.security.ColumnVisibility.NodeType.TERM;
 +
    private void shouldThrow(String... strings) {
      for (String s : strings) {
-       final byte[] sBytes = s.getBytes();
+       final byte[] sBytes = s.getBytes(UTF_8);
        assertThrows(IllegalArgumentException.class, () -> new 
ColumnVisibility(sBytes),
            "Should throw: " + s);
      }
@@@ -92,11 -87,10 +92,11 @@@
      shouldThrow("a*b");
    }
  
 +  @SuppressWarnings("deprecation")
    public void normalized(String... values) {
      for (int i = 0; i < values.length; i += 2) {
-       ColumnVisibility cv = new ColumnVisibility(values[i].getBytes());
-       assertArrayEquals(cv.flatten(), values[i + 1].getBytes());
+       ColumnVisibility cv = new ColumnVisibility(values[i].getBytes(UTF_8));
+       assertArrayEquals(cv.flatten(), values[i + 1].getBytes(UTF_8));
      }
    }
  
diff --cc 
hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloInputFormatIT.java
index b79db6caea,b535f12858..c6b6918c71
--- 
a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloInputFormatIT.java
+++ 
b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/its/mapreduce/AccumuloInputFormatIT.java
@@@ -19,6 -19,8 +19,7 @@@
  package org.apache.accumulo.hadoop.its.mapreduce;
  
  import static java.lang.System.currentTimeMillis;
+ import static java.nio.charset.StandardCharsets.UTF_8;
 -import static 
org.apache.accumulo.core.util.UtilWaitThread.sleepUninterruptibly;
  import static org.junit.jupiter.api.Assertions.assertEquals;
  import static org.junit.jupiter.api.Assertions.assertNotNull;
  import static org.junit.jupiter.api.Assertions.assertThrows;
diff --cc test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java
index a263883eb1,255676bd3e..45f993fba7
--- a/test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java
@@@ -18,8 -18,8 +18,9 @@@
   */
  package org.apache.accumulo.test;
  
+ import static java.nio.charset.StandardCharsets.UTF_8;
 -import static 
org.apache.accumulo.core.util.UtilWaitThread.sleepUninterruptibly;
 +import static java.util.concurrent.TimeUnit.SECONDS;
 +import static org.apache.accumulo.core.util.LazySingletons.RANDOM;
  import static org.junit.jupiter.api.Assertions.assertEquals;
  import static org.junit.jupiter.api.Assertions.assertTrue;
  

Reply via email to