1 package org.apache.maven.it;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23
24 import org.apache.maven.it.util.ResourceExtractor;
25
26
27
28
29
30
31
32 public class MavenITmng3379ParallelArtifactDownloadsTest
33 extends AbstractMavenIntegrationTestCase
34 {
35
36 public MavenITmng3379ParallelArtifactDownloadsTest()
37 {
38 super( "[2.0.5,3.0-alpha-1),[3.0-alpha-2,)" );
39 }
40
41
42
43
44
45
46
47 public void testitMNG3379()
48 throws Exception
49 {
50 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3379" );
51
52 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
53 verifier.setAutoclean( false );
54 verifier.deleteArtifacts( "org.apache.maven.its.mng3379.a" );
55 verifier.deleteArtifacts( "org.apache.maven.its.mng3379.b" );
56 verifier.deleteArtifacts( "org.apache.maven.its.mng3379.c" );
57 verifier.deleteArtifacts( "org.apache.maven.its.mng3379.d" );
58 verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() );
59 verifier.addCliOption( "--settings" );
60 verifier.addCliOption( "settings.xml" );
61 verifier.setSystemProperty( "maven.artifact.threads", "16" );
62 verifier.executeGoal( "validate" );
63 verifier.verifyErrorFreeLog();
64 verifier.resetStreams();
65
66 String gid = "org.apache.maven.its.mng3379.";
67 assertArtifact( verifier, gid + "a", "x", "0.2-SNAPSHOT", "", "jar",
68 "69c041c12f35894230c7c23c49cd245886c6fb6f" );
69 assertArtifact( verifier, gid + "a", "x", "0.2-SNAPSHOT", "", "pom",
70 "f0abcb2aa6d99f045c013ecb2671a3a3e71bd715" );
71 assertArtifact( verifier, gid + "a", "x", "0.2-SNAPSHOT", "tests", "jar",
72 "69c041c12f35894230c7c23c49cd245886c6fb6f" );
73 assertArtifact( verifier, gid + "a", "x", "0.2-SNAPSHOT", "sources", "jar",
74 "166f8bef02b9e92f99ec3b163d8321dd1d087e34" );
75 assertArtifact( verifier, gid + "a", "x", "0.2-SNAPSHOT", "javadoc", "jar",
76 "4d96e09f7e93870685a317c574f851b407224415" );
77 assertMetadata( verifier, gid + "a", "x", "0.2-SNAPSHOT",
78 "e1cfc3a77657fc46bb624dee25c61b290e5b4dd7" );
79
80 assertArtifact( verifier, gid + "b", "x", "0.2-SNAPSHOT", "", "jar",
81 "efb7c4046565774cd7e44645e02f06ecdf91098d" );
82 assertArtifact( verifier, gid + "b", "x", "0.2-SNAPSHOT", "", "pom",
83 "a057baebe5cdae3978b530c0bfea8b523b3d4506" );
84 assertArtifact( verifier, gid + "b", "x", "0.2-SNAPSHOT", "tests", "jar",
85 "efb7c4046565774cd7e44645e02f06ecdf91098d" );
86 assertArtifact( verifier, gid + "b", "x", "0.2-SNAPSHOT", "sources", "jar",
87 "9ad231fc04ea1114987c377cc5cbccfbf83e3dbf" );
88 assertArtifact( verifier, gid + "b", "x", "0.2-SNAPSHOT", "javadoc", "jar",
89 "7807daefd3af3be73d3b92f9c5ab1b52510c0767" );
90 assertMetadata( verifier, gid + "b", "x", "0.2-SNAPSHOT",
91 "5ccc4edfb503f9a5ccadedf102dff8943250d830" );
92 assertMetadata( verifier, gid + "b", "x",
93 "8f38b1041871f22dcb031544d8a3436c335bfcdb" );
94
95 assertArtifact( verifier, gid + "c", "x", "0.2-SNAPSHOT", "", "jar",
96 "1eb0d5a421b3074e8a69b0dcca7e325c0636a932" );
97 assertArtifact( verifier, gid + "c", "x", "0.2-SNAPSHOT", "", "pom",
98 "9c993bdebc7bd1b673891f203511fed9085996f3" );
99 assertArtifact( verifier, gid + "c", "x", "0.2-SNAPSHOT", "tests", "jar",
100 "1eb0d5a421b3074e8a69b0dcca7e325c0636a932" );
101 assertArtifact( verifier, gid + "c", "x", "0.2-SNAPSHOT", "sources", "jar",
102 "82f9664b3a910fb861fc4ed2b79e39d8f95e3675" );
103 assertArtifact( verifier, gid + "c", "x", "0.2-SNAPSHOT", "javadoc", "jar",
104 "64a3bfe19b294f67b1c52a2514c58922b88e5f97" );
105 assertMetadata( verifier, gid + "c", "x", "0.2-SNAPSHOT",
106 "b31ef40a51bdab4e6e44bfe3f2d1da42e5e42e46" );
107 assertMetadata( verifier, gid + "c", "x",
108 "c4848e60d226ec6304df3abd9eba8fdb301b3660" );
109
110 assertArtifact( verifier, gid + "d", "x", "0.2-SNAPSHOT", "", "jar",
111 "3d606c564625a594165bcbbe4a24c8f11b18b5a0" );
112 assertArtifact( verifier, gid + "d", "x", "0.2-SNAPSHOT", "", "pom",
113 "e7b6322cea42970e61316b161f79da690f042f7e" );
114 assertArtifact( verifier, gid + "d", "x", "0.2-SNAPSHOT", "tests", "jar",
115 "3d606c564625a594165bcbbe4a24c8f11b18b5a0" );
116 assertArtifact( verifier, gid + "d", "x", "0.2-SNAPSHOT", "sources", "jar",
117 "35a7e140307f4bb67984dc72aa551f0faabacd36" );
118 assertArtifact( verifier, gid + "d", "x", "0.2-SNAPSHOT", "javadoc", "jar",
119 "2fe3487f496fe66f23772b1bada066ec6bd9222f" );
120 assertMetadata( verifier, gid + "d", "x", "0.2-SNAPSHOT",
121 "a0d0b5efd5d6f6a921a3f7c1a6a503359fccef04" );
122 assertMetadata( verifier, gid + "d", "x",
123 "1d2bf926862f2131f1229328e588b906b087bdb3" );
124 }
125
126 private void assertArtifact( Verifier verifier, String gid, String aid, String ver, String cls, String ext, String sha1 )
127 throws Exception
128 {
129 File file = new File( verifier.getArtifactPath( gid, aid, ver, ext, cls ) );
130 assertTrue( file.getAbsolutePath(), file.isFile() );
131 assertEquals( sha1, ItUtils.calcHash( file, "SHA-1" ) );
132 }
133
134 private void assertMetadata( Verifier verifier, String gid, String aid, String ver, String sha1 )
135 throws Exception
136 {
137 String name = "maven-metadata-maven-core-it.xml";
138 File file = new File( verifier.getArtifactMetadataPath( gid, aid, ver, name ) );
139 assertTrue( file.getAbsolutePath(), file.isFile() );
140 assertEquals( sha1, ItUtils.calcHash( file, "SHA-1" ) );
141 }
142
143 private void assertMetadata( Verifier verifier, String gid, String aid, String sha1 )
144 throws Exception
145 {
146 String name = "maven-metadata-maven-core-it.xml";
147 File file = new File( verifier.getArtifactMetadataPath( gid, aid, null, name ) );
148 assertTrue( file.getAbsolutePath(), file.isFile() );
149 assertEquals( sha1, ItUtils.calcHash( file, "SHA-1" ) );
150 }
151
152 }