1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.aether.internal.impl;
20
21 import org.eclipse.aether.artifact.Artifact;
22 import org.eclipse.aether.artifact.DefaultArtifact;
23 import org.eclipse.aether.repository.RemoteRepository;
24 import org.junit.jupiter.api.Test;
25
26 import static org.junit.jupiter.api.Assertions.*;
27
28 public class EnhancedSplitLocalRepositoryManagerTest extends EnhancedLocalRepositoryManagerTest {
29
30 @Override
31 protected EnhancedLocalRepositoryManager getManager() {
32 session.setConfigProperty(DefaultLocalPathPrefixComposerFactory.CONFIG_PROP_SPLIT, Boolean.TRUE.toString());
33 return new EnhancedLocalRepositoryManager(
34 basedir,
35 new DefaultLocalPathComposer(),
36 "_remote.repositories",
37 trackingFileManager,
38 new DefaultLocalPathPrefixComposerFactory().createComposer(session));
39 }
40
41 @Test
42 @Override
43 public void testGetPathForLocalArtifact() {
44 Artifact artifact = new DefaultArtifact("g.i.d:a.i.d:1.0-SNAPSHOT");
45 assertEquals("1.0-SNAPSHOT", artifact.getBaseVersion());
46 assertEquals(
47 "installed/g/i/d/a.i.d/1.0-SNAPSHOT/a.i.d-1.0-SNAPSHOT.jar", manager.getPathForLocalArtifact(artifact));
48
49 artifact = new DefaultArtifact("g.i.d:a.i.d:1.0-20110329.221805-4");
50 assertEquals("1.0-SNAPSHOT", artifact.getBaseVersion());
51 assertEquals(
52 "installed/g/i/d/a.i.d/1.0-SNAPSHOT/a.i.d-1.0-SNAPSHOT.jar", manager.getPathForLocalArtifact(artifact));
53 }
54
55 @Test
56 @Override
57 public void testGetPathForRemoteArtifact() {
58 RemoteRepository remoteRepo = new RemoteRepository.Builder("repo", "default", "ram:/void").build();
59
60 Artifact artifact = new DefaultArtifact("g.i.d:a.i.d:1.0-SNAPSHOT");
61 assertEquals("1.0-SNAPSHOT", artifact.getBaseVersion());
62 assertEquals(
63 "cached/g/i/d/a.i.d/1.0-SNAPSHOT/a.i.d-1.0-SNAPSHOT.jar",
64 manager.getPathForRemoteArtifact(artifact, remoteRepo, ""));
65
66 artifact = new DefaultArtifact("g.i.d:a.i.d:1.0-20110329.221805-4");
67 assertEquals("1.0-SNAPSHOT", artifact.getBaseVersion());
68 assertEquals(
69 "cached/g/i/d/a.i.d/1.0-SNAPSHOT/a.i.d-1.0-20110329.221805-4.jar",
70 manager.getPathForRemoteArtifact(artifact, remoteRepo, ""));
71 }
72 }