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 import java.util.Locale;
24
25 import org.apache.maven.it.util.ResourceExtractor;
26 import org.apache.maven.shared.utils.io.FileUtils;
27
28
29
30
31
32
33
34 public class MavenITmng3892ReleaseDeploymentTest
35 extends AbstractMavenIntegrationTestCase
36 {
37
38 public MavenITmng3892ReleaseDeploymentTest()
39 {
40 super( ALL_MAVEN_VERSIONS );
41 }
42
43
44
45
46
47
48
49 public void testitMNG3892()
50 throws Exception
51 {
52 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3892" );
53
54 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
55 verifier.setAutoclean( false );
56 verifier.deleteDirectory( "repo" );
57 verifier.deleteArtifacts( "org.apache.maven.its.mng3892" );
58 verifier.executeGoal( "validate" );
59 verifier.verifyErrorFreeLog();
60 verifier.resetStreams();
61
62 verifier.assertArtifactPresent( "org.apache.maven.its.mng3892", "test", "1.0", "pom" );
63 verifier.assertArtifactPresent( "org.apache.maven.its.mng3892", "test", "1.0", "jar" );
64
65 String groupDir = "repo/org/apache/maven/its/mng3892/test/";
66 verifier.assertFilePresent( groupDir + "maven-metadata.xml" );
67 verifier.assertFilePresent( groupDir + "maven-metadata.xml.md5" );
68 verifier.assertFilePresent( groupDir + "maven-metadata.xml.sha1" );
69 verifier.assertFilePresent( groupDir + "1.0/test-1.0.pom" );
70 verifier.assertFilePresent( groupDir + "1.0/test-1.0.pom.md5" );
71 verifier.assertFilePresent( groupDir + "1.0/test-1.0.pom.sha1" );
72 verifier.assertFilePresent( groupDir + "1.0/test-1.0.jar" );
73 verifier.assertFilePresent( groupDir + "1.0/test-1.0.jar.md5" );
74 verifier.assertFilePresent( groupDir + "1.0/test-1.0.jar.sha1" );
75 verifier.assertFilePresent( groupDir + "1.0/test-1.0-it.jar" );
76 verifier.assertFilePresent( groupDir + "1.0/test-1.0-it.jar.md5" );
77 verifier.assertFilePresent( groupDir + "1.0/test-1.0-it.jar.sha1" );
78
79 verify( testDir, groupDir + "1.0/test-1.0.jar.md5", "dd89c30cc71c3cd8a729622243c76770" );
80 verify( testDir, groupDir + "1.0/test-1.0.jar.sha1", "0b0717ff89d3cbadc3564270bf8930163753bf71" );
81 verify( testDir, groupDir + "1.0/test-1.0-it.jar.md5", "dd89c30cc71c3cd8a729622243c76770" );
82 verify( testDir, groupDir + "1.0/test-1.0-it.jar.sha1", "0b0717ff89d3cbadc3564270bf8930163753bf71" );
83 }
84
85 private void verify( File testDir, String file, String checksum )
86 throws Exception
87 {
88 assertEquals( file, checksum, readChecksum( new File( testDir, file ) ) );
89 }
90
91 private String readChecksum( File checksumFile )
92 throws Exception
93 {
94 String checksum = FileUtils.fileRead( checksumFile, "UTF-8" ).trim();
95 if ( checksum.indexOf( ' ' ) >= 0 )
96 {
97 checksum = checksum.substring( 0, checksum.indexOf( ' ' ) );
98 }
99 return checksum.toLowerCase( Locale.ENGLISH );
100 }
101
102 }