1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.aether.internal.test.util;
20
21 import java.util.ArrayList;
22 import java.util.Collections;
23 import java.util.Iterator;
24 import java.util.List;
25
26 import org.eclipse.aether.RepositorySystemSession;
27 import org.eclipse.aether.collection.VersionFilter;
28 import org.eclipse.aether.graph.Dependency;
29 import org.eclipse.aether.repository.ArtifactRepository;
30 import org.eclipse.aether.repository.RemoteRepository;
31 import org.eclipse.aether.resolution.VersionRangeResult;
32 import org.eclipse.aether.version.Version;
33 import org.eclipse.aether.version.VersionConstraint;
34
35
36
37 class TestVersionFilterContext implements VersionFilter.VersionFilterContext {
38
39 private final RepositorySystemSession session;
40
41 private final Dependency dependency;
42
43 private final VersionRangeResult result;
44
45 private final List<Version> versions;
46
47 TestVersionFilterContext(RepositorySystemSession session, VersionRangeResult result) {
48 this.session = session;
49 this.result = result;
50 dependency = new Dependency(result.getRequest().getArtifact(), "");
51 versions = new ArrayList<>(result.getVersions());
52 }
53
54 public RepositorySystemSession getSession() {
55 return session;
56 }
57
58 public Dependency getDependency() {
59 return dependency;
60 }
61
62 public int getCount() {
63 return versions.size();
64 }
65
66 public Iterator<Version> iterator() {
67 return versions.iterator();
68 }
69
70 public VersionConstraint getVersionConstraint() {
71 return result.getVersionConstraint();
72 }
73
74 public ArtifactRepository getRepository(Version version) {
75 return result.getRepository(version);
76 }
77
78 public List<RemoteRepository> getRepositories() {
79 return Collections.unmodifiableList(result.getRequest().getRepositories());
80 }
81 }