From cbca8af22a7a98cc6764a155532fa3e0331131ec Mon Sep 17 00:00:00 2001 From: Amanda Villarreal Date: Wed, 24 Jun 2026 10:34:54 -0500 Subject: [PATCH 1/4] Refactoring resource files to remove 1 TODO --- .../ContextClassLoaderFactoryTest.java | 5 ++-- .../tokens/CredentialProviderTokenTest.java | 3 ++- .../core/clientImpl/ClientContextTest.java | 2 +- .../conf/HadoopCredentialProviderTest.java | 6 ++--- .../core/conf/SiteConfigurationTest.java | 6 +++-- .../apache/accumulo/core}/accumulo.jceks | Bin .../accumulo/core}/accumulo2.properties | 0 .../apache/accumulo/core}/empty.jceks | Bin .../apache/accumulo/core}/passwords.jceks | Bin .../apache/accumulo/core}/site-cfg.jceks | Bin .../MiniAccumuloClusterClasspathTest.java | 5 ++-- .../accumulo/minicluster}/FooFilter.jar | Bin .../tserver/log/TestUpgradePathForWALogs.java | 6 ++--- .../550e8400-e29b-41d4-a716-446655440000 | Bin .../accumulo/tserver}/walog-from-15.walog | Bin .../accumulo/tserver}/walog-from-16.walog | Bin .../accumulo/tserver}/walog-from-20.walog | Bin .../ci/check-module-package-conventions.sh | 19 -------------- .../accumulo/test}/v2_import_test/README.md | 0 .../test}/v2_import_test/data/A0000008.rf | Bin .../test}/v2_import_test/data/A0000009.rf | Bin .../test}/v2_import_test/data/A000000a.rf | Bin .../test}/v2_import_test/data/A000000b.rf | Bin .../test/v2_import_test/data/distcp.txt | 24 ++++++++++++++++++ .../v2_import_test/data/exportMetadata.zip | Bin .../resources/v2_import_test/data/distcp.txt | 5 ---- 26 files changed, 42 insertions(+), 39 deletions(-) rename core/src/test/resources/{ => org/apache/accumulo/core}/accumulo.jceks (100%) rename core/src/test/resources/{ => org/apache/accumulo/core}/accumulo2.properties (100%) rename core/src/test/resources/{ => org/apache/accumulo/core}/empty.jceks (100%) rename core/src/test/resources/{ => org/apache/accumulo/core}/passwords.jceks (100%) rename core/src/test/resources/{ => org/apache/accumulo/core}/site-cfg.jceks (100%) rename minicluster/src/test/resources/{ => org/apache/accumulo/minicluster}/FooFilter.jar (100%) rename server/tserver/src/test/resources/{ => org/apache/accumulo/tserver}/walog-from-14/550e8400-e29b-41d4-a716-446655440000 (100%) rename server/tserver/src/test/resources/{ => org/apache/accumulo/tserver}/walog-from-15.walog (100%) rename server/tserver/src/test/resources/{ => org/apache/accumulo/tserver}/walog-from-16.walog (100%) rename server/tserver/src/test/resources/{ => org/apache/accumulo/tserver}/walog-from-20.walog (100%) rename test/src/main/resources/{ => org/apache/accumulo/test}/v2_import_test/README.md (100%) rename test/src/main/resources/{ => org/apache/accumulo/test}/v2_import_test/data/A0000008.rf (100%) rename test/src/main/resources/{ => org/apache/accumulo/test}/v2_import_test/data/A0000009.rf (100%) rename test/src/main/resources/{ => org/apache/accumulo/test}/v2_import_test/data/A000000a.rf (100%) rename test/src/main/resources/{ => org/apache/accumulo/test}/v2_import_test/data/A000000b.rf (100%) create mode 100644 test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/distcp.txt rename test/src/main/resources/{ => org/apache/accumulo/test}/v2_import_test/data/exportMetadata.zip (100%) delete mode 100644 test/src/main/resources/v2_import_test/data/distcp.txt diff --git a/core/src/test/java/org/apache/accumulo/core/classloader/ContextClassLoaderFactoryTest.java b/core/src/test/java/org/apache/accumulo/core/classloader/ContextClassLoaderFactoryTest.java index 352e7ce5d4a..440d6ca72b4 100644 --- a/core/src/test/java/org/apache/accumulo/core/classloader/ContextClassLoaderFactoryTest.java +++ b/core/src/test/java/org/apache/accumulo/core/classloader/ContextClassLoaderFactoryTest.java @@ -63,9 +63,10 @@ public void setup() throws Exception { if (!Files.isDirectory(folder2)) { Files.createDirectories(folder2); } - Path propsFile2 = folder2.resolve("accumulo2.properties"); + Path propsFile2 = folder2.resolve("org/apache/accumulo/core/accumulo2.properties"); FileUtils.copyURLToFile( - Objects.requireNonNull(this.getClass().getResource("/accumulo2.properties")), + Objects.requireNonNull( + this.getClass().getResource("/org/apache/accumulo/core/accumulo2.properties")), propsFile2.toFile()); uri2 = propsFile2.toUri().toURL(); diff --git a/core/src/test/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderTokenTest.java b/core/src/test/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderTokenTest.java index d00f3dbe7fc..dfd59c67f62 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderTokenTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderTokenTest.java @@ -51,7 +51,8 @@ public class CredentialProviderTokenTest { justification = "keystoreUrl location isn't provided by user input") @BeforeAll public static void setup() throws Exception { - URL keystoreUrl = CredentialProviderTokenTest.class.getResource("/passwords.jceks"); + URL keystoreUrl = + CredentialProviderTokenTest.class.getResource("/org/apache/accumulo/core/passwords.jceks"); assertNotNull(keystoreUrl); keystorePath = "jceks://file/" + Path.of(keystoreUrl.toURI()).toAbsolutePath(); } diff --git a/core/src/test/java/org/apache/accumulo/core/clientImpl/ClientContextTest.java b/core/src/test/java/org/apache/accumulo/core/clientImpl/ClientContextTest.java index 5452da6c7ca..b9000b43d67 100644 --- a/core/src/test/java/org/apache/accumulo/core/clientImpl/ClientContextTest.java +++ b/core/src/test/java/org/apache/accumulo/core/clientImpl/ClientContextTest.java @@ -44,7 +44,7 @@ public class ClientContextTest { - private static final String keystoreName = "/site-cfg.jceks"; + private static final String keystoreName = "/org/apache/accumulo/core/site-cfg.jceks"; // site-cfg.jceks={'ignored.property'=>'ignored', 'instance.secret'=>'mysecret', // 'general.rpc.timeout'=>'timeout'} diff --git a/core/src/test/java/org/apache/accumulo/core/conf/HadoopCredentialProviderTest.java b/core/src/test/java/org/apache/accumulo/core/conf/HadoopCredentialProviderTest.java index 85b3f3738ac..22263b2bd38 100644 --- a/core/src/test/java/org/apache/accumulo/core/conf/HadoopCredentialProviderTest.java +++ b/core/src/test/java/org/apache/accumulo/core/conf/HadoopCredentialProviderTest.java @@ -51,8 +51,8 @@ public class HadoopCredentialProviderTest { private static final Configuration hadoopConf = new Configuration(); - private static final String populatedKeyStoreName = "/accumulo.jceks"; - private static final String emptyKeyStoreName = "/empty.jceks"; + private static final String populatedKeyStoreName = "/org/apache/accumulo/core/accumulo.jceks"; + private static final String emptyKeyStoreName = "/org/apache/accumulo/core/empty.jceks"; private static File emptyKeyStore; private static File populatedKeyStore; @@ -180,7 +180,7 @@ public void extractFromHdfs() throws Exception { // One namenode, One configuration Configuration dfsConfiguration = dfsCluster.getConfiguration(0); - Path destPath = new Path("/accumulo.jceks"); + Path destPath = new Path("/org/apache/accumulo/core/accumulo.jceks"); FileSystem dfs = dfsCluster.getFileSystem(); // Put the populated keystore in hdfs dfs.copyFromLocalFile(new Path(populatedKeyStore.toURI()), destPath); diff --git a/core/src/test/java/org/apache/accumulo/core/conf/SiteConfigurationTest.java b/core/src/test/java/org/apache/accumulo/core/conf/SiteConfigurationTest.java index 6afafc87120..e97c8a1615a 100644 --- a/core/src/test/java/org/apache/accumulo/core/conf/SiteConfigurationTest.java +++ b/core/src/test/java/org/apache/accumulo/core/conf/SiteConfigurationTest.java @@ -39,7 +39,8 @@ public class SiteConfigurationTest { @Test public void testOnlySensitivePropertiesExtractedFromCredentialProvider() throws SecurityException { - URL keystore = SiteConfigurationTest.class.getResource("/site-cfg.jceks"); + URL keystore = + SiteConfigurationTest.class.getResource("/org/apache/accumulo/core/site-cfg.jceks"); assertNotNull(keystore); String credProvPath = "jceks://file" + Path.of(keystore.getFile()).toAbsolutePath(); @@ -68,7 +69,8 @@ public void testDefault() { @Test public void testFile() { System.setProperty("DIR", "/tmp/test/dir"); - URL propsUrl = getClass().getClassLoader().getResource("accumulo2.properties"); + URL propsUrl = + getClass().getClassLoader().getResource("org/apache/accumulo/core/accumulo2.properties"); var conf = new SiteConfiguration.Builder().fromUrl(propsUrl).build(); assertEquals("myhost123:2181", conf.get(Property.INSTANCE_ZK_HOST)); assertEquals("mysecret", conf.get(Property.INSTANCE_SECRET)); diff --git a/core/src/test/resources/accumulo.jceks b/core/src/test/resources/org/apache/accumulo/core/accumulo.jceks similarity index 100% rename from core/src/test/resources/accumulo.jceks rename to core/src/test/resources/org/apache/accumulo/core/accumulo.jceks diff --git a/core/src/test/resources/accumulo2.properties b/core/src/test/resources/org/apache/accumulo/core/accumulo2.properties similarity index 100% rename from core/src/test/resources/accumulo2.properties rename to core/src/test/resources/org/apache/accumulo/core/accumulo2.properties diff --git a/core/src/test/resources/empty.jceks b/core/src/test/resources/org/apache/accumulo/core/empty.jceks similarity index 100% rename from core/src/test/resources/empty.jceks rename to core/src/test/resources/org/apache/accumulo/core/empty.jceks diff --git a/core/src/test/resources/passwords.jceks b/core/src/test/resources/org/apache/accumulo/core/passwords.jceks similarity index 100% rename from core/src/test/resources/passwords.jceks rename to core/src/test/resources/org/apache/accumulo/core/passwords.jceks diff --git a/core/src/test/resources/site-cfg.jceks b/core/src/test/resources/org/apache/accumulo/core/site-cfg.jceks similarity index 100% rename from core/src/test/resources/site-cfg.jceks rename to core/src/test/resources/org/apache/accumulo/core/site-cfg.jceks diff --git a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterClasspathTest.java b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterClasspathTest.java index 0e190fc5f39..88881dee9a0 100644 --- a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterClasspathTest.java +++ b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterClasspathTest.java @@ -68,9 +68,8 @@ public static void setupMiniCluster() throws Exception { Files.createDirectories(testDir); jarFile = tempDir.resolve("iterator.jar").toFile(); - FileUtils.copyURLToFile( - requireNonNull(MiniAccumuloClusterClasspathTest.class.getResource("/FooFilter.jar")), - jarFile); + FileUtils.copyURLToFile(requireNonNull(MiniAccumuloClusterClasspathTest.class + .getResource("/org/apache/accumulo/minicluster/FooFilter.jar")), jarFile); MiniAccumuloConfig config = new MiniAccumuloConfig(testDir.toFile(), ROOT_PASSWORD).setJDWPEnabled(true); diff --git a/minicluster/src/test/resources/FooFilter.jar b/minicluster/src/test/resources/org/apache/accumulo/minicluster/FooFilter.jar similarity index 100% rename from minicluster/src/test/resources/FooFilter.jar rename to minicluster/src/test/resources/org/apache/accumulo/minicluster/FooFilter.jar diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/TestUpgradePathForWALogs.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/TestUpgradePathForWALogs.java index e6d6faa3010..252500d852e 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/TestUpgradePathForWALogs.java +++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/TestUpgradePathForWALogs.java @@ -54,11 +54,11 @@ public class TestUpgradePathForWALogs extends WithTestNames { // older logs no longer compatible - private static final String WALOG_FROM_15 = "walog-from-15.walog"; + private static final String WALOG_FROM_15 = "org/apache/accumulo/tserver/walog-from-15.walog"; // logs from versions 1.6 through 1.10 should be the same - private static final String WALOG_FROM_16 = "walog-from-16.walog"; + private static final String WALOG_FROM_16 = "org/apache/accumulo/tserver/walog-from-16.walog"; // logs from 2.0 were changed for improved crypto - private static final String WALOG_FROM_20 = "walog-from-20.walog"; + private static final String WALOG_FROM_20 = "org/apache/accumulo/tserver/walog-from-20.walog"; private static final ScheduledThreadPoolExecutor EXECUTOR = new ScheduledThreadPoolExecutor(1); diff --git a/server/tserver/src/test/resources/walog-from-14/550e8400-e29b-41d4-a716-446655440000 b/server/tserver/src/test/resources/org/apache/accumulo/tserver/walog-from-14/550e8400-e29b-41d4-a716-446655440000 similarity index 100% rename from server/tserver/src/test/resources/walog-from-14/550e8400-e29b-41d4-a716-446655440000 rename to server/tserver/src/test/resources/org/apache/accumulo/tserver/walog-from-14/550e8400-e29b-41d4-a716-446655440000 diff --git a/server/tserver/src/test/resources/walog-from-15.walog b/server/tserver/src/test/resources/org/apache/accumulo/tserver/walog-from-15.walog similarity index 100% rename from server/tserver/src/test/resources/walog-from-15.walog rename to server/tserver/src/test/resources/org/apache/accumulo/tserver/walog-from-15.walog diff --git a/server/tserver/src/test/resources/walog-from-16.walog b/server/tserver/src/test/resources/org/apache/accumulo/tserver/walog-from-16.walog similarity index 100% rename from server/tserver/src/test/resources/walog-from-16.walog rename to server/tserver/src/test/resources/org/apache/accumulo/tserver/walog-from-16.walog diff --git a/server/tserver/src/test/resources/walog-from-20.walog b/server/tserver/src/test/resources/org/apache/accumulo/tserver/walog-from-20.walog similarity index 100% rename from server/tserver/src/test/resources/walog-from-20.walog rename to server/tserver/src/test/resources/org/apache/accumulo/tserver/walog-from-20.walog diff --git a/src/build/ci/check-module-package-conventions.sh b/src/build/ci/check-module-package-conventions.sh index 397adba7331..e483206d090 100755 --- a/src/build/ci/check-module-package-conventions.sh +++ b/src/build/ci/check-module-package-conventions.sh @@ -56,25 +56,6 @@ ALLOWED=( test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java test/src/main/java/org/apache/accumulo/harness/TestingKdc.java - # TODO: these test resources should be moved into the correct package for the module - core/src/test/resources/accumulo.jceks - core/src/test/resources/empty.jceks - core/src/test/resources/site-cfg.jceks - core/src/test/resources/accumulo2.properties - core/src/test/resources/passwords.jceks - minicluster/src/test/resources/FooFilter.jar - server/tserver/src/test/resources/walog-from-15.walog - server/tserver/src/test/resources/walog-from-16.walog - server/tserver/src/test/resources/walog-from-14/550e8400-e29b-41d4-a716-446655440000 - server/tserver/src/test/resources/walog-from-20.walog - test/src/main/resources/v2_import_test/README.md - test/src/main/resources/v2_import_test/data/A0000008.rf - test/src/main/resources/v2_import_test/data/A0000009.rf - test/src/main/resources/v2_import_test/data/A000000a.rf - test/src/main/resources/v2_import_test/data/A000000b.rf - test/src/main/resources/v2_import_test/data/distcp.txt - test/src/main/resources/v2_import_test/data/exportMetadata.zip - # TODO: these minicluster classes should be moved into the correct package for the module minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneAccumuloCluster.java minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java diff --git a/test/src/main/resources/v2_import_test/README.md b/test/src/main/resources/org/apache/accumulo/test/v2_import_test/README.md similarity index 100% rename from test/src/main/resources/v2_import_test/README.md rename to test/src/main/resources/org/apache/accumulo/test/v2_import_test/README.md diff --git a/test/src/main/resources/v2_import_test/data/A0000008.rf b/test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/A0000008.rf similarity index 100% rename from test/src/main/resources/v2_import_test/data/A0000008.rf rename to test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/A0000008.rf diff --git a/test/src/main/resources/v2_import_test/data/A0000009.rf b/test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/A0000009.rf similarity index 100% rename from test/src/main/resources/v2_import_test/data/A0000009.rf rename to test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/A0000009.rf diff --git a/test/src/main/resources/v2_import_test/data/A000000a.rf b/test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/A000000a.rf similarity index 100% rename from test/src/main/resources/v2_import_test/data/A000000a.rf rename to test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/A000000a.rf diff --git a/test/src/main/resources/v2_import_test/data/A000000b.rf b/test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/A000000b.rf similarity index 100% rename from test/src/main/resources/v2_import_test/data/A000000b.rf rename to test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/A000000b.rf diff --git a/test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/distcp.txt b/test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/distcp.txt new file mode 100644 index 00000000000..c07955431fb --- /dev/null +++ b/test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/distcp.txt @@ -0,0 +1,24 @@ +==== + 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 + + https://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. +==== + +hdfs://localhost:8020/accumulo/tables/1/default_tablet/A000000b.rf +hdfs://localhost:8020/accumulo/tables/1/t-0000002/A000000a.rf +hdfs://localhost:8020/accumulo/tables/1/t-0000001/A0000009.rf +hdfs://localhost:8020/accumulo/tables/1/t-0000003/A0000008.rf +hdfs://localhost:8020/accumulo/export_test/exportMetadata.zip diff --git a/test/src/main/resources/v2_import_test/data/exportMetadata.zip b/test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/exportMetadata.zip similarity index 100% rename from test/src/main/resources/v2_import_test/data/exportMetadata.zip rename to test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/exportMetadata.zip diff --git a/test/src/main/resources/v2_import_test/data/distcp.txt b/test/src/main/resources/v2_import_test/data/distcp.txt deleted file mode 100644 index 672c11fba8f..00000000000 --- a/test/src/main/resources/v2_import_test/data/distcp.txt +++ /dev/null @@ -1,5 +0,0 @@ -hdfs://localhost:8020/accumulo/tables/1/default_tablet/A000000b.rf -hdfs://localhost:8020/accumulo/tables/1/t-0000002/A000000a.rf -hdfs://localhost:8020/accumulo/tables/1/t-0000001/A0000009.rf -hdfs://localhost:8020/accumulo/tables/1/t-0000003/A0000008.rf -hdfs://localhost:8020/accumulo/export_test/exportMetadata.zip From a5d31aa4f2b4ccd8ae24bdf402c18cf4b7e9a65c Mon Sep 17 00:00:00 2001 From: Amanda Villarreal Date: Mon, 29 Jun 2026 13:17:54 -0500 Subject: [PATCH 2/4] fixing a failing unit test, removes 1 TODO from apache#2699 --- .../apache/accumulo/core/conf/HadoopCredentialProviderTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/java/org/apache/accumulo/core/conf/HadoopCredentialProviderTest.java b/core/src/test/java/org/apache/accumulo/core/conf/HadoopCredentialProviderTest.java index 22263b2bd38..2644c1d0597 100644 --- a/core/src/test/java/org/apache/accumulo/core/conf/HadoopCredentialProviderTest.java +++ b/core/src/test/java/org/apache/accumulo/core/conf/HadoopCredentialProviderTest.java @@ -186,7 +186,7 @@ public void extractFromHdfs() throws Exception { dfs.copyFromLocalFile(new Path(populatedKeyStore.toURI()), destPath); Configuration cpConf = dfsConfiguration; - HadoopCredentialProvider.setPath(cpConf, "jceks://hdfs/accumulo.jceks"); + HadoopCredentialProvider.setPath(cpConf, "jceks://hdfs/" + destPath); // The values in the keystore Map expectations = new HashMap<>(); From d74edfb5667a84ebc07d3ad146dd9466204848b3 Mon Sep 17 00:00:00 2001 From: Dom Garguilo Date: Wed, 1 Jul 2026 11:49:32 -0400 Subject: [PATCH 3/4] Move test resources into module package paths * Relocate misplaced test resources under their module package namespaces. * Update resource lookups and license/RAT excludes. * Fix WAL test temp-file handling for nested resource paths. --- server/tserver/pom.xml | 8 +- .../tserver/log/TestUpgradePathForWALogs.java | 82 ++++++++----------- test/pom.xml | 4 +- .../apache/accumulo/test/ImportExportIT.java | 2 +- 4 files changed, 43 insertions(+), 53 deletions(-) diff --git a/server/tserver/pom.xml b/server/tserver/pom.xml index e29cb5f601c..224787bac0f 100644 --- a/server/tserver/pom.xml +++ b/server/tserver/pom.xml @@ -141,8 +141,8 @@ ${accumulo.build.license.header} - src/test/resources/*.walog - src/test/resources/walog-from-14/* + src/test/resources/org/apache/accumulo/tserver/*.walog + src/test/resources/org/apache/accumulo/tserver/walog-from-14/* @@ -153,8 +153,8 @@ apache-rat-plugin - src/test/resources/*.walog - src/test/resources/walog-from-14/* + src/test/resources/org/apache/accumulo/tserver/*.walog + src/test/resources/org/apache/accumulo/tserver/walog-from-14/* diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/TestUpgradePathForWALogs.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/TestUpgradePathForWALogs.java index 252500d852e..0e5c74032a5 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/TestUpgradePathForWALogs.java +++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/TestUpgradePathForWALogs.java @@ -31,6 +31,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.nio.file.Files; +import java.util.Objects; import java.util.concurrent.ScheduledThreadPoolExecutor; import org.apache.accumulo.core.conf.DefaultConfiguration; @@ -108,72 +109,61 @@ public static void shutdown() { */ @Test public void testUpgradeOf15WALog() throws IOException { - String walogToTest = WALOG_FROM_15; - String testPath = perTestTempSubDir.toAbsolutePath().toString(); + java.nio.file.Path testPath = perTestTempSubDir.toAbsolutePath(); + copyWalogToTestDir(WALOG_FROM_15); - try (InputStream walogStream = getClass().getResourceAsStream("/" + walogToTest); - OutputStream walogInHDFStream = - Files.newOutputStream(perTestTempSubDir.resolve(walogToTest))) { - walogStream.transferTo(walogInHDFStream); - walogInHDFStream.flush(); - walogInHDFStream.close(); - - LogSorter logSorter = new LogSorter(server); - LogSorter.LogProcessor logProcessor = logSorter.new LogProcessor(); + LogSorter logSorter = new LogSorter(server); + LogSorter.LogProcessor logProcessor = logSorter.new LogProcessor(); - assertThrows(IllegalArgumentException.class, - () -> logProcessor.sort(context.getVolumeManager(), "/" + WALOG_FROM_15, - new Path("file://" + testPath + "/" + WALOG_FROM_15), - "file://" + testPath + "/manyMaps")); - } + assertThrows(IllegalArgumentException.class, + () -> logProcessor.sort(context.getVolumeManager(), "/" + WALOG_FROM_15, + new Path(testPath.toUri() + WALOG_FROM_15), testPath.toUri() + "manyMaps")); } @Test public void testBasic16WALogRead() throws IOException { String walogToTest = WALOG_FROM_16; - String testPath = perTestTempSubDir.toAbsolutePath().toString(); - String destPath = "file://" + testPath + "/manyMaps"; - - try (InputStream walogStream = getClass().getResourceAsStream("/" + walogToTest); - OutputStream walogInHDFStream = - Files.newOutputStream(java.nio.file.Path.of(testPath).resolve(walogToTest))) { - walogStream.transferTo(walogInHDFStream); - walogInHDFStream.flush(); - walogInHDFStream.close(); + java.nio.file.Path testPath = perTestTempSubDir.toAbsolutePath(); + String destPath = testPath.toUri() + "manyMaps"; + copyWalogToTestDir(walogToTest); - assertFalse(context.getVolumeManager().exists(getFinishedMarkerPath(destPath))); + assertFalse(context.getVolumeManager().exists(getFinishedMarkerPath(destPath))); - LogSorter logSorter = new LogSorter(server); - LogSorter.LogProcessor logProcessor = logSorter.new LogProcessor(); + LogSorter logSorter = new LogSorter(server); + LogSorter.LogProcessor logProcessor = logSorter.new LogProcessor(); - logProcessor.sort(context.getVolumeManager(), "/" + walogToTest, - new Path("file://" + testPath + "/" + walogToTest), destPath); + logProcessor.sort(context.getVolumeManager(), "/" + walogToTest, + new Path(testPath.toUri() + walogToTest), destPath); - assertTrue(context.getVolumeManager().exists(getFinishedMarkerPath(destPath))); - } + assertTrue(context.getVolumeManager().exists(getFinishedMarkerPath(destPath))); } @Test public void testBasic20WALogRead() throws IOException { String walogToTest = WALOG_FROM_20; - String testPath = perTestTempSubDir.toAbsolutePath().toString(); - String destPath = "file://" + testPath + "/manyMaps"; + java.nio.file.Path testPath = perTestTempSubDir.toAbsolutePath(); + String destPath = testPath.toUri() + "manyMaps"; + copyWalogToTestDir(walogToTest); - try (InputStream walogStream = getClass().getResourceAsStream("/" + walogToTest); - OutputStream walogInHDFStream = - Files.newOutputStream(java.nio.file.Path.of(testPath).resolve(walogToTest))) { - walogStream.transferTo(walogInHDFStream); - walogInHDFStream.flush(); - walogInHDFStream.close(); + assertFalse(context.getVolumeManager().exists(getFinishedMarkerPath(destPath))); - assertFalse(context.getVolumeManager().exists(getFinishedMarkerPath(destPath))); + LogSorter logSorter = new LogSorter(server); + LogSorter.LogProcessor logProcessor = logSorter.new LogProcessor(); + logProcessor.sort(context.getVolumeManager(), "/" + walogToTest, + new Path(testPath.toUri() + walogToTest), destPath); - LogSorter logSorter = new LogSorter(server); - LogSorter.LogProcessor logProcessor = logSorter.new LogProcessor(); - logProcessor.sort(context.getVolumeManager(), "/" + walogToTest, - new Path("file://" + testPath + "/" + walogToTest), destPath); + assertTrue(context.getVolumeManager().exists(getFinishedMarkerPath(destPath))); + } - assertTrue(context.getVolumeManager().exists(getFinishedMarkerPath(destPath))); + private void copyWalogToTestDir(String walogToTest) throws IOException { + var walogPath = perTestTempSubDir.resolve(walogToTest); + Files.createDirectories(Objects.requireNonNull(walogPath.getParent())); + + try ( + InputStream walogStream = + Objects.requireNonNull(getClass().getResourceAsStream("/" + walogToTest)); + OutputStream walogInHDFStream = Files.newOutputStream(walogPath)) { + walogStream.transferTo(walogInHDFStream); } } diff --git a/test/pom.xml b/test/pom.xml index a3c2a44bdc0..4cccdffa97b 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -277,7 +277,7 @@ ${accumulo.build.license.header} - src/main/resources/v2_import_test/data/distcp.txt + src/main/resources/org/apache/accumulo/test/v2_import_test/data/distcp.txt @@ -288,7 +288,7 @@ apache-rat-plugin - src/main/resources/v2_import_test/data/distcp.txt + src/main/resources/org/apache/accumulo/test/v2_import_test/data/distcp.txt diff --git a/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java b/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java index a8c7cc6e86a..e153c85267d 100644 --- a/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java +++ b/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java @@ -481,7 +481,7 @@ private boolean verifyMappingsFile(String destTableId) throws IOException { */ @Test public void importV2data() throws Exception { - final String dataRoot = "./target/classes/v2_import_test"; + final String dataRoot = "./target/classes/org/apache/accumulo/test/v2_import_test"; final String dataSrc = dataRoot + "/data"; final String importDir = dataRoot + "/import"; From 6a8f7fe1df898ae9abedfa54a1427b0d2f978542 Mon Sep 17 00:00:00 2001 From: Dom Garguilo Date: Wed, 1 Jul 2026 12:26:33 -0400 Subject: [PATCH 4/4] remove header added by accident --- .../test/v2_import_test/data/distcp.txt | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/distcp.txt b/test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/distcp.txt index c07955431fb..672c11fba8f 100644 --- a/test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/distcp.txt +++ b/test/src/main/resources/org/apache/accumulo/test/v2_import_test/data/distcp.txt @@ -1,22 +1,3 @@ -==== - 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 - - https://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. -==== - hdfs://localhost:8020/accumulo/tables/1/default_tablet/A000000b.rf hdfs://localhost:8020/accumulo/tables/1/t-0000002/A000000a.rf hdfs://localhost:8020/accumulo/tables/1/t-0000001/A0000009.rf