Source:
public void testChecksumsStorage(TestInfo testInfo) throws Exception { String repositoryId = getRepositoryName("checksums-storage", testInfo); MutableRepository repository = mavenRepositoryFactory.createRepository(repositoryId); repository.setLayout(Maven2LayoutProvider.ALIAS); createRepositoryWithArtifacts(STORAGE0, repository, "org.carlspring.strongbox:strongbox-utils", "8.7"); String gavtc = "org.carlspring.strongbox:strongbox-utils:8.4:jar"; File repositoryBasedir = getRepositoryBasedir(STORAGE0, repositoryId); generateArtifact(repositoryBasedir.getAbsolutePath(), gavtc); Artifact artifact = ArtifactUtils.getArtifactFromGAVTC(gavtc); String artifactPath = ArtifactUtils.convertArtifactToPath(artifact); RepositoryPath repositoryPath = repositoryPathResolver.resolve(STORAGE0, repositoryId, artifactPath); File repositoryDir = getRepositoryBasedir(STORAGE0, repositoryId); InputStream is = generateArtifactInputStream(repositoryDir.toPath().getParent().toAbsolutePath().toString(), repositoryId, gavtc, true); mavenArtifactManagementService.store(repositoryPath, is); ArtifactEntry artifactEntryForTest = artifactEntryService.findOneArtifact(STORAGE0, repositoryId, artifactPath); Field field = ArtifactManagementService.class.getDeclaredField("checksumCacheManager"); field.setAccessible(true); ChecksumCacheManager reflectedChecksumsManager = (ChecksumCacheManager) field.get(mavenArtifactManagementService); String artifactBasePath = artifactPath.substring(0, artifactPath.lastIndexOf('.')); ArtifactChecksum expectedChecksum = reflectedChecksumsManager.getArtifactChecksum(artifactBasePath); assertNotNull(artifactEntryForTest.getChecksums()); assertNotNull(expectedChecksum); assertEquals(expectedChecksum, artifactEntryForTest.getChecksums()); }

Target:
public void testChecksumsStorage(TestInfo testInfo) throws Exception { String repositoryId = getRepositoryName("checksums-storage", testInfo); MutableRepository repository = mavenRepositoryFactory.createRepository(repositoryId); repository.setPolicy(RepositoryPolicyEnum.SNAPSHOT.getPolicy()); repository.setLayout(Maven2LayoutProvider.ALIAS); createRepository(STORAGE0, repository); String gavtc = "org.carlspring.strongbox:strongbox-utils:8.4:jar"; File repositoryBasedir = getRepositoryBasedir(STORAGE0, repositoryId); MavenArtifact artifact = generateArtifact(repositoryBasedir.getAbsolutePath(), gavtc); String artifactPath = ArtifactUtils.convertArtifactToPath(artifact); RepositoryPath repositoryPath = repositoryPathResolver.resolve(STORAGE0, repositoryId, artifactPath); File artifactFile = new File(repositoryBasedir, ArtifactUtils.convertArtifactToPath(artifact)); InputStream is = new FileInputStream(artifactFile); mavenArtifactManagementService.store(repositoryPath, is); String sha1Checksum = new String(Files.readAllBytes(new File(repositoryBasedir, ArtifactUtils.convertArtifactToPath(artifact) + ".sha1").toPath())); String md5Checksum = new String(Files.readAllBytes(new File(repositoryBasedir, ArtifactUtils.convertArtifactToPath(artifact) + ".md5").toPath())); Map <String, String> expectedChecksums = new HashMap<>(); expectedChecksums.put("SHA-1", sha1Checksum); expectedChecksums.put("MD5", md5Checksum); ArtifactEntry artifactEntryForTest = artifactEntryService.findOneArtifact(STORAGE0, repositoryId, artifactPath); assertNotNull(expectedChecksums); assertNotNull(artifactEntryForTest.getChecksums()); assertEquals(expectedChecksums, artifactEntryForTest.getChecksums()); }