cstamas commented on code in PR #203:
URL: https://github.com/apache/maven-resolver/pull/203#discussion_r1004108378
##########
maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/checksum/FileTrustedChecksumsSourceTestSupport.java:
##########
@@ -51,58 +56,79 @@
private FileTrustedChecksumsSourceSupport subject;
+ private boolean checksumWritten;
+
@Before
public void before() throws Exception
{
session = TestUtils.newSession();
// populate local repository
- Path basedir = session.getLocalRepository().getBasedir().toPath()
- .resolve(
FileTrustedChecksumsSourceSupport.LOCAL_REPO_PREFIX_DIR );
checksumAlgorithmFactory = new Sha1ChecksumAlgorithmFactory();
- subject = prepareSubject( basedir );
+ subject = prepareSubject();
+ checksumWritten = false;
+
+ try ( DefaultRepositorySystemSession prepareSession = new
DefaultRepositorySystemSession( session ) )
+ {
+ enableSource( prepareSession );
+ try ( TrustedChecksumsSource.Writer writer =
subject.getTrustedArtifactChecksumsWriter( prepareSession ) )
+ {
+ if ( writer != null )
+ {
+ HashMap<String, String> checksums = new HashMap<>();
+ checksums.put( checksumAlgorithmFactory.getName(),
ARTIFACT_TRUSTED_CHECKSUM );
+ writer.addTrustedArtifactChecksums(
ARTIFACT_WITH_CHECKSUM, prepareSession.getLocalRepository(),
+ Collections.singletonList(
checksumAlgorithmFactory ), checksums );
+ checksumWritten = true;
+ }
+ }
+ }
}
- protected abstract FileTrustedChecksumsSourceSupport prepareSubject( Path
basedir ) throws IOException;
+ protected abstract FileTrustedChecksumsSourceSupport prepareSubject();
- protected abstract void enableSource();
+ protected abstract void enableSource( DefaultRepositorySystemSession
session );
Review Comment:
see c87798a898f45d1d4998b5c9146fa0f2fa06c3cd
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]