| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.extension.repository.aether.internal; |
| 21 |
|
|
| 22 |
|
import java.io.File; |
| 23 |
|
import java.io.IOException; |
| 24 |
|
import java.io.InputStream; |
| 25 |
|
import java.net.URL; |
| 26 |
|
import java.util.ArrayList; |
| 27 |
|
import java.util.Arrays; |
| 28 |
|
import java.util.HashSet; |
| 29 |
|
import java.util.List; |
| 30 |
|
|
| 31 |
|
import org.apache.commons.io.FileUtils; |
| 32 |
|
import org.apache.commons.io.IOUtils; |
| 33 |
|
import org.eclipse.aether.artifact.Artifact; |
| 34 |
|
import org.eclipse.aether.artifact.DefaultArtifact; |
| 35 |
|
import org.eclipse.aether.graph.Dependency; |
| 36 |
|
import org.junit.Assert; |
| 37 |
|
import org.junit.Before; |
| 38 |
|
import org.junit.Rule; |
| 39 |
|
import org.junit.Test; |
| 40 |
|
import org.xwiki.extension.DefaultExtensionAuthor; |
| 41 |
|
import org.xwiki.extension.DefaultExtensionDependency; |
| 42 |
|
import org.xwiki.extension.Extension; |
| 43 |
|
import org.xwiki.extension.ExtensionAuthor; |
| 44 |
|
import org.xwiki.extension.ExtensionDependency; |
| 45 |
|
import org.xwiki.extension.ExtensionException; |
| 46 |
|
import org.xwiki.extension.ExtensionId; |
| 47 |
|
import org.xwiki.extension.ExtensionLicenseManager; |
| 48 |
|
import org.xwiki.extension.ExtensionNotFoundException; |
| 49 |
|
import org.xwiki.extension.ResolveException; |
| 50 |
|
import org.xwiki.extension.repository.ExtensionRepositoryDescriptor; |
| 51 |
|
import org.xwiki.extension.repository.ExtensionRepositoryManager; |
| 52 |
|
import org.xwiki.extension.repository.result.IterableResult; |
| 53 |
|
import org.xwiki.extension.test.MockitoRepositoryUtilsRule; |
| 54 |
|
import org.xwiki.extension.version.Version; |
| 55 |
|
import org.xwiki.extension.version.internal.DefaultVersionConstraint; |
| 56 |
|
import org.xwiki.test.annotation.AllComponents; |
| 57 |
|
|
| 58 |
|
@AllComponents |
| |
|
| 100% |
Uncovered Elements: 0 (170) |
Complexity: 21 |
Complexity Density: 0.14 |
|
| 59 |
|
public class AetherDefaultRepositoryManagerTest |
| 60 |
|
{ |
| 61 |
|
private static final String GROUPID = "groupid"; |
| 62 |
|
|
| 63 |
|
private static final String ARTIfACTID = "artifactid"; |
| 64 |
|
|
| 65 |
|
@Rule |
| 66 |
|
public MockitoRepositoryUtilsRule repositoryUtil = new MockitoRepositoryUtilsRule(); |
| 67 |
|
|
| 68 |
|
private ExtensionRepositoryManager repositoryManager; |
| 69 |
|
|
| 70 |
|
private ExtensionId extensionId; |
| 71 |
|
|
| 72 |
|
private ExtensionId snapshotExtensionId; |
| 73 |
|
|
| 74 |
|
private ExtensionId extensionDependencyId; |
| 75 |
|
|
| 76 |
|
private ExtensionId extensionIdClassifier; |
| 77 |
|
|
| 78 |
|
private ExtensionDependency dependencyExtensionId; |
| 79 |
|
|
| 80 |
|
private ExtensionDependency dependencyExtensionIdRange; |
| 81 |
|
|
| 82 |
|
private ExtensionLicenseManager extensionLicenseManager; |
| 83 |
|
|
| 84 |
|
private ExtensionId bundleExtensionId; |
| 85 |
|
|
| 86 |
|
private ExtensionId sextensionId; |
| 87 |
|
|
| 88 |
|
private ExtensionId sextensionDependencyId; |
| 89 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
|
| 90 |
20 |
@Before... |
| 91 |
|
public void setUp() throws Exception |
| 92 |
|
{ |
| 93 |
20 |
this.extensionId = new ExtensionId(GROUPID + ':' + ARTIfACTID, "version"); |
| 94 |
20 |
this.snapshotExtensionId = new ExtensionId(GROUPID + ':' + ARTIfACTID, "1.0-SNAPSHOT"); |
| 95 |
20 |
this.extensionDependencyId = new ExtensionId("dgroupid:dartifactid", "dversion"); |
| 96 |
|
|
| 97 |
20 |
this.extensionIdClassifier = new ExtensionId(GROUPID + ':' + ARTIfACTID + ":classifier", "version"); |
| 98 |
20 |
this.dependencyExtensionId = new DefaultExtensionDependency(this.extensionDependencyId.getId(), |
| 99 |
|
new DefaultVersionConstraint(this.extensionDependencyId.getVersion().getValue())); |
| 100 |
20 |
this.dependencyExtensionIdRange = new DefaultExtensionDependency(this.extensionDependencyId.getId(), |
| 101 |
|
new DefaultVersionConstraint("[dversion,)")); |
| 102 |
|
|
| 103 |
20 |
this.bundleExtensionId = new ExtensionId("groupid:bundleartifactid", "version"); |
| 104 |
|
|
| 105 |
20 |
this.sextensionId = new ExtensionId("sgroupid:sartifactid", "version"); |
| 106 |
20 |
this.sextensionDependencyId = new ExtensionId("sgroupid:sdartifactid", "version"); |
| 107 |
|
|
| 108 |
|
|
| 109 |
|
|
| 110 |
20 |
this.repositoryManager = |
| 111 |
|
this.repositoryUtil.getComponentManager().getInstance(ExtensionRepositoryManager.class); |
| 112 |
20 |
this.extensionLicenseManager = |
| 113 |
|
this.repositoryUtil.getComponentManager().getInstance(ExtensionLicenseManager.class); |
| 114 |
|
} |
| 115 |
|
|
| 116 |
|
|
| 117 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (35) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
| 118 |
1 |
@Test... |
| 119 |
|
public void testResolve() throws ResolveException, IOException |
| 120 |
|
{ |
| 121 |
1 |
Extension extension = this.repositoryManager.resolve(this.extensionId); |
| 122 |
|
|
| 123 |
1 |
Assert.assertNotNull(extension); |
| 124 |
1 |
Assert.assertEquals(this.extensionId.getId(), extension.getId().getId()); |
| 125 |
1 |
Assert.assertEquals(this.extensionId.getVersion(), extension.getId().getVersion()); |
| 126 |
1 |
Assert.assertEquals("type", extension.getType()); |
| 127 |
1 |
Assert.assertEquals(this.repositoryUtil.getMavenRepositoryId(), |
| 128 |
|
extension.getRepository().getDescriptor().getId()); |
| 129 |
1 |
Assert.assertEquals("name", extension.getName()); |
| 130 |
1 |
Assert.assertEquals("summary", extension.getSummary()); |
| 131 |
1 |
Assert.assertEquals("http://website", extension.getWebSite()); |
| 132 |
1 |
Assert.assertEquals("category", extension.getCategory()); |
| 133 |
1 |
Assert.assertEquals(Arrays.asList(new DefaultExtensionAuthor("Full Name", new URL("http://profile"))), |
| 134 |
|
new ArrayList<ExtensionAuthor>(extension.getAuthors())); |
| 135 |
1 |
Assert.assertEquals(new HashSet<String>(Arrays.asList("groupid1:feature1", "groupid2:feature2")), |
| 136 |
|
new HashSet<String>(extension.getFeatures())); |
| 137 |
1 |
Assert.assertEquals( |
| 138 |
|
new HashSet<ExtensionId>(Arrays.asList(new ExtensionId("groupid1:feature1", this.extensionId.getVersion()), |
| 139 |
|
new ExtensionId("groupid2:feature2", "42"))), |
| 140 |
|
new HashSet<ExtensionId>(extension.getExtensionFeatures())); |
| 141 |
1 |
Assert.assertEquals(new HashSet<String>(Arrays.asList("namespace1", "{root}")), |
| 142 |
|
new HashSet<String>(extension.getAllowedNamespaces())); |
| 143 |
1 |
Assert.assertSame(this.extensionLicenseManager.getLicense("GNU Lesser General Public License 2.1"), |
| 144 |
|
extension.getLicenses().iterator().next()); |
| 145 |
|
|
| 146 |
1 |
Assert.assertEquals("http://url", extension.getIssueManagement().getURL()); |
| 147 |
1 |
Assert.assertEquals("system", extension.getIssueManagement().getSystem()); |
| 148 |
|
|
| 149 |
1 |
Assert.assertEquals("http://url", extension.getScm().getUrl()); |
| 150 |
1 |
Assert.assertEquals("git", extension.getScm().getConnection().getSystem()); |
| 151 |
1 |
Assert.assertEquals("git://url.git", extension.getScm().getConnection().getPath()); |
| 152 |
1 |
Assert.assertEquals("git", extension.getScm().getDeveloperConnection().getSystem()); |
| 153 |
1 |
Assert.assertEquals("git@url.git", extension.getScm().getDeveloperConnection().getPath()); |
| 154 |
|
|
| 155 |
1 |
List<ExtensionRepositoryDescriptor> repositories = new ArrayList<>(); |
| 156 |
1 |
repositories.add(extension.getRepository().getDescriptor()); |
| 157 |
|
|
| 158 |
1 |
Assert.assertEquals(repositories, extension.getRepositories()); |
| 159 |
|
|
| 160 |
1 |
ExtensionDependency dependency = extension.getDependencies().iterator().next(); |
| 161 |
1 |
Assert.assertEquals(this.dependencyExtensionId.getId(), dependency.getId()); |
| 162 |
1 |
Assert.assertEquals(this.dependencyExtensionId.getVersionConstraint(), dependency.getVersionConstraint()); |
| 163 |
1 |
Assert.assertEquals(repositories, dependency.getRepositories()); |
| 164 |
|
|
| 165 |
|
|
| 166 |
1 |
extension = this.repositoryManager.resolve(this.extensionId); |
| 167 |
1 |
Assert.assertEquals(this.repositoryUtil.getMavenRepositoryId(), |
| 168 |
|
extension.getRepository().getDescriptor().getId()); |
| 169 |
|
|
| 170 |
|
|
| 171 |
1 |
File pomFile = new File(this.repositoryUtil.getMavenRepository(), |
| 172 |
|
this.extensionId.getId().replace('.', '/').replace(':', '/') + '/' + this.extensionId.getVersion() + '/' |
| 173 |
|
+ ARTIfACTID + '-' + this.extensionId.getVersion() + ".pom"); |
| 174 |
1 |
FileUtils.writeStringToFile(pomFile, FileUtils.readFileToString(pomFile, "UTF-8") |
| 175 |
|
.replace("<description>summary</description>", "<description>modified summary</description>"), "UTF-8"); |
| 176 |
1 |
extension = this.repositoryManager.resolve(this.extensionId); |
| 177 |
1 |
Assert.assertEquals("modified summary", extension.getSummary()); |
| 178 |
|
} |
| 179 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
| 180 |
1 |
@Test... |
| 181 |
|
public void testResolveSNAPSHOT() throws ResolveException |
| 182 |
|
{ |
| 183 |
1 |
Extension extension = this.repositoryManager.resolve(this.snapshotExtensionId); |
| 184 |
|
|
| 185 |
1 |
Assert.assertNotNull(extension); |
| 186 |
1 |
Assert.assertEquals(this.snapshotExtensionId.getId(), extension.getId().getId()); |
| 187 |
1 |
Assert.assertEquals(this.snapshotExtensionId.getVersion(), extension.getId().getVersion()); |
| 188 |
1 |
Assert.assertEquals("type", extension.getType()); |
| 189 |
1 |
Assert.assertEquals(this.repositoryUtil.getMavenRepositoryId(), |
| 190 |
|
extension.getRepository().getDescriptor().getId()); |
| 191 |
|
} |
| 192 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
| 193 |
1 |
@Test... |
| 194 |
|
public void testResolveAetherDependency() throws ResolveException |
| 195 |
|
{ |
| 196 |
1 |
Artifact artifact = new DefaultArtifact("groupid", "artifactid", "", "type", "version"); |
| 197 |
1 |
Dependency aetherDependency = new Dependency(artifact, null); |
| 198 |
1 |
AetherExtensionDependency dependency = new AetherExtensionDependency(aetherDependency); |
| 199 |
|
|
| 200 |
1 |
Extension extension = this.repositoryManager.resolve(dependency); |
| 201 |
|
|
| 202 |
1 |
Assert.assertNotNull(extension); |
| 203 |
1 |
Assert.assertEquals(this.extensionId.getId(), extension.getId().getId()); |
| 204 |
1 |
Assert.assertEquals(this.extensionId.getVersion(), extension.getId().getVersion()); |
| 205 |
1 |
Assert.assertEquals("type", extension.getType()); |
| 206 |
|
} |
| 207 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
| 208 |
1 |
@Test... |
| 209 |
|
public void testResolveAetherDependencySNAPSHOT() throws ResolveException |
| 210 |
|
{ |
| 211 |
1 |
Artifact artifact = new DefaultArtifact("groupid", "artifactid", "", "type", "1.0-SNAPSHOT"); |
| 212 |
1 |
Dependency aetherDependency = new Dependency(artifact, null); |
| 213 |
1 |
AetherExtensionDependency dependency = new AetherExtensionDependency(aetherDependency); |
| 214 |
|
|
| 215 |
1 |
Extension extension = this.repositoryManager.resolve(dependency); |
| 216 |
|
|
| 217 |
1 |
Assert.assertNotNull(extension); |
| 218 |
1 |
Assert.assertEquals(this.snapshotExtensionId.getId(), extension.getId().getId()); |
| 219 |
1 |
Assert.assertEquals(this.snapshotExtensionId.getVersion(), extension.getId().getVersion()); |
| 220 |
1 |
Assert.assertEquals("type", extension.getType()); |
| 221 |
1 |
Assert.assertEquals(this.repositoryUtil.getMavenRepositoryId(), |
| 222 |
|
extension.getRepository().getDescriptor().getId()); |
| 223 |
|
} |
| 224 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
| 225 |
1 |
@Test... |
| 226 |
|
public void testResolveAetherDependencyRange() throws ResolveException |
| 227 |
|
{ |
| 228 |
1 |
Artifact artifact = new DefaultArtifact("groupid", "artifactid", "", "type", "[1.0,)"); |
| 229 |
1 |
Dependency aetherDependency = new Dependency(artifact, null); |
| 230 |
1 |
AetherExtensionDependency dependency = new AetherExtensionDependency(aetherDependency); |
| 231 |
|
|
| 232 |
1 |
Extension extension = this.repositoryManager.resolve(dependency); |
| 233 |
|
|
| 234 |
1 |
Assert.assertNotNull(extension); |
| 235 |
1 |
Assert.assertEquals(this.extensionId.getId(), extension.getId().getId()); |
| 236 |
1 |
Assert.assertEquals("2.0", extension.getId().getVersion().toString()); |
| 237 |
|
} |
| 238 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
| 239 |
1 |
@Test... |
| 240 |
|
public void testResolveAetherDependencyRange2() throws ResolveException |
| 241 |
|
{ |
| 242 |
1 |
Artifact artifact = new DefaultArtifact("groupid", "artifactid", "", "type", "[1.0,2.0)"); |
| 243 |
1 |
Dependency aetherDependency = new Dependency(artifact, null); |
| 244 |
1 |
AetherExtensionDependency dependency = new AetherExtensionDependency(aetherDependency); |
| 245 |
|
|
| 246 |
1 |
Extension extension = this.repositoryManager.resolve(dependency); |
| 247 |
|
|
| 248 |
1 |
Assert.assertNotNull(extension); |
| 249 |
1 |
Assert.assertEquals(this.extensionId.getId(), extension.getId().getId()); |
| 250 |
1 |
Assert.assertEquals("1.0", extension.getId().getVersion().toString()); |
| 251 |
|
} |
| 252 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 253 |
1 |
@Test... |
| 254 |
|
public void testResolveOverriddenProperties() throws ResolveException |
| 255 |
|
{ |
| 256 |
1 |
Extension extension = this.repositoryManager.resolve(new ExtensionId("groupid:oartifactid", "version")); |
| 257 |
|
|
| 258 |
1 |
Assert.assertNotNull(extension); |
| 259 |
1 |
Assert.assertEquals("oname", extension.getName()); |
| 260 |
1 |
Assert.assertEquals("osummary", extension.getSummary()); |
| 261 |
1 |
Assert.assertEquals("http://owebsite", extension.getWebSite()); |
| 262 |
|
} |
| 263 |
|
|
| 264 |
|
|
| 265 |
|
|
| 266 |
|
|
| 267 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
| 268 |
1 |
@Test... |
| 269 |
|
public void testResolveWithVersionAsSystemProperty() throws ResolveException |
| 270 |
|
{ |
| 271 |
1 |
System.setProperty("version", "systemversion"); |
| 272 |
1 |
System.setProperty("groupId", "systemgroupId"); |
| 273 |
|
|
| 274 |
1 |
Extension extension = this.repositoryManager.resolve(this.sextensionId); |
| 275 |
|
|
| 276 |
1 |
Assert.assertNotNull(extension); |
| 277 |
1 |
Assert.assertEquals(this.sextensionId.getId(), extension.getId().getId()); |
| 278 |
1 |
Assert.assertEquals(this.sextensionId.getVersion(), extension.getId().getVersion()); |
| 279 |
|
|
| 280 |
1 |
ExtensionDependency dependency = extension.getDependencies().iterator().next(); |
| 281 |
1 |
Assert.assertEquals(this.sextensionDependencyId.getId(), dependency.getId()); |
| 282 |
1 |
Assert.assertEquals(this.sextensionDependencyId.getVersion().getValue(), |
| 283 |
|
dependency.getVersionConstraint().getValue()); |
| 284 |
|
} |
| 285 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
| 286 |
1 |
@Test... |
| 287 |
|
public void testResolveVersionClassifier() throws ResolveException |
| 288 |
|
{ |
| 289 |
1 |
Extension extension = this.repositoryManager.resolve(this.extensionIdClassifier); |
| 290 |
|
|
| 291 |
1 |
Assert.assertNotNull(extension); |
| 292 |
1 |
Assert.assertEquals(this.extensionIdClassifier.getId(), extension.getId().getId()); |
| 293 |
1 |
Assert.assertEquals(this.extensionIdClassifier.getVersion(), extension.getId().getVersion()); |
| 294 |
|
} |
| 295 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
| 296 |
1 |
@Test... |
| 297 |
|
public void testResolveVersionRange() throws ResolveException |
| 298 |
|
{ |
| 299 |
1 |
Extension extension = this.repositoryManager.resolve(this.dependencyExtensionIdRange); |
| 300 |
|
|
| 301 |
1 |
Assert.assertNotNull(extension); |
| 302 |
1 |
Assert.assertEquals(this.extensionDependencyId.getId(), extension.getId().getId()); |
| 303 |
1 |
Assert.assertEquals(this.extensionDependencyId.getVersion(), extension.getId().getVersion()); |
| 304 |
|
} |
| 305 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 306 |
1 |
@Test... |
| 307 |
|
public void testDownload() throws ExtensionException, IOException |
| 308 |
|
{ |
| 309 |
1 |
Extension extension = this.repositoryManager.resolve(this.extensionId); |
| 310 |
|
|
| 311 |
1 |
InputStream is = extension.getFile().openStream(); |
| 312 |
|
|
| 313 |
1 |
try { |
| 314 |
1 |
Assert.assertEquals("content", IOUtils.toString(is)); |
| 315 |
|
} finally { |
| 316 |
1 |
is.close(); |
| 317 |
|
} |
| 318 |
|
} |
| 319 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 320 |
1 |
@Test... |
| 321 |
|
public void testDownloadSNAPSHOT() throws ExtensionException, IOException |
| 322 |
|
{ |
| 323 |
1 |
Extension extension = this.repositoryManager.resolve(this.snapshotExtensionId); |
| 324 |
|
|
| 325 |
1 |
InputStream is = extension.getFile().openStream(); |
| 326 |
|
|
| 327 |
1 |
try { |
| 328 |
1 |
Assert.assertEquals("snapshot content", IOUtils.toString(is)); |
| 329 |
|
} finally { |
| 330 |
1 |
is.close(); |
| 331 |
|
} |
| 332 |
|
} |
| 333 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 334 |
1 |
@Test... |
| 335 |
|
public void testDownloadClassifier() throws ExtensionException, IOException |
| 336 |
|
{ |
| 337 |
1 |
Extension extension = this.repositoryManager.resolve(this.extensionIdClassifier); |
| 338 |
|
|
| 339 |
1 |
InputStream is = extension.getFile().openStream(); |
| 340 |
|
|
| 341 |
1 |
try { |
| 342 |
1 |
Assert.assertEquals("classifier content", IOUtils.toString(is)); |
| 343 |
|
} finally { |
| 344 |
1 |
is.close(); |
| 345 |
|
} |
| 346 |
|
} |
| 347 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 348 |
1 |
@Test... |
| 349 |
|
public void testDownloadBundle() throws ExtensionException, IOException |
| 350 |
|
{ |
| 351 |
1 |
Extension extension = this.repositoryManager.resolve(this.bundleExtensionId); |
| 352 |
|
|
| 353 |
1 |
InputStream is = extension.getFile().openStream(); |
| 354 |
|
|
| 355 |
1 |
try { |
| 356 |
1 |
Assert.assertEquals("content", IOUtils.toString(is)); |
| 357 |
|
} finally { |
| 358 |
1 |
is.close(); |
| 359 |
|
} |
| 360 |
|
} |
| 361 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
| 362 |
1 |
@Test... |
| 363 |
|
public void testResolveVersions() throws ExtensionException |
| 364 |
|
{ |
| 365 |
1 |
IterableResult<Version> versions = this.repositoryManager.resolveVersions(this.extensionId.getId(), 0, -1); |
| 366 |
|
|
| 367 |
1 |
Assert.assertEquals(4, versions.getTotalHits()); |
| 368 |
1 |
Assert.assertEquals(4, versions.getSize()); |
| 369 |
1 |
Assert.assertEquals(0, versions.getOffset()); |
| 370 |
|
} |
| 371 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
| 372 |
1 |
@Test... |
| 373 |
|
public void testResolveWithExternalParent() throws ResolveException |
| 374 |
|
{ |
| 375 |
1 |
ExtensionId extensionId = new ExtensionId("lgroupid:lartifactid", "version"); |
| 376 |
|
|
| 377 |
1 |
Extension extension = this.repositoryManager.resolve(extensionId); |
| 378 |
|
|
| 379 |
1 |
Assert.assertNotNull(extension); |
| 380 |
1 |
Assert.assertEquals(extensionId.getId(), extension.getId().getId()); |
| 381 |
1 |
Assert.assertEquals(extensionId.getVersion(), extension.getId().getVersion()); |
| 382 |
1 |
Assert.assertEquals("type", extension.getType()); |
| 383 |
1 |
Assert.assertEquals(this.repositoryUtil.getMavenRepositoryId(), |
| 384 |
|
extension.getRepository().getDescriptor().getId()); |
| 385 |
|
|
| 386 |
1 |
Assert.assertEquals("parent description", extension.getSummary()); |
| 387 |
|
} |
| 388 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
| 389 |
1 |
@Test... |
| 390 |
|
public void testResolveWithEmptyScmAndIssueManagement() throws ResolveException |
| 391 |
|
{ |
| 392 |
1 |
ExtensionId extensionId = new ExtensionId("groupid:emptyscmandissuemanagement", "version"); |
| 393 |
|
|
| 394 |
1 |
Extension extension = this.repositoryManager.resolve(extensionId); |
| 395 |
|
|
| 396 |
1 |
Assert.assertNotNull(extension); |
| 397 |
1 |
Assert.assertEquals(extensionId.getId(), extension.getId().getId()); |
| 398 |
1 |
Assert.assertEquals(extensionId.getVersion(), extension.getId().getVersion()); |
| 399 |
1 |
Assert.assertEquals("type", extension.getType()); |
| 400 |
1 |
Assert.assertEquals(this.repositoryUtil.getMavenRepositoryId(), |
| 401 |
|
extension.getRepository().getDescriptor().getId()); |
| 402 |
|
|
| 403 |
1 |
Assert.assertNull(extension.getIssueManagement()); |
| 404 |
1 |
Assert.assertNull(extension.getScm()); |
| 405 |
|
} |
| 406 |
|
|
| 407 |
|
|
| 408 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
| 409 |
1 |
@Test(expected = ExtensionNotFoundException.class)... |
| 410 |
|
public void testResolveWithNotExistingVersion() throws ResolveException |
| 411 |
|
{ |
| 412 |
1 |
this.repositoryManager.resolve(new ExtensionId(this.extensionId.getId(), "noversion")); |
| 413 |
|
} |
| 414 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
| 415 |
1 |
@Test(expected = ExtensionNotFoundException.class)... |
| 416 |
|
public void testResolveNotExistingExtension() throws ResolveException |
| 417 |
|
{ |
| 418 |
1 |
this.repositoryManager.resolve(new ExtensionId("nogroupid:noartifactid", "noversion")); |
| 419 |
|
} |
| 420 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
| 421 |
1 |
@Test(expected = ExtensionNotFoundException.class)... |
| 422 |
|
public void testResolveNotExistingExtensionVersions() throws ExtensionException |
| 423 |
|
{ |
| 424 |
1 |
this.repositoryManager.resolveVersions("nogroupid:noartifactid", 0, -1); |
| 425 |
|
} |
| 426 |
|
} |