4
4
import org .redline_rpm .Scanner ;
5
5
import org .redline_rpm .header .Format ;
6
6
import org .redline_rpm .header .Header .HeaderTag ;
7
+ import org .redline_rpm .header .Header ;
8
+ import org .redline_rpm .payload .Directive ;
7
9
8
10
import java .io .File ;
9
11
import java .util .Arrays ;
10
12
13
+ import static org .junit .Assert .assertArrayEquals ;
11
14
import static org .junit .Assert .assertEquals ;
12
15
import static org .junit .Assert .assertArrayEquals ;
13
16
import static org .redline_rpm .ScannerTest .channelWrapper ;
@@ -33,6 +36,30 @@ public void testLongNameTruncation() throws Exception {
33
36
34
37
assertEquals ("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" , format .getLead ().getName ());
35
38
}
39
+
40
+ @ Test
41
+ public void testFiles () throws Exception {
42
+ Builder builder = new Builder ();
43
+ builder .setPackage ("filestest" , "1.0" , "1" );
44
+ builder .setBuildHost ( "localhost" );
45
+ builder .setLicense ( "GPL" );
46
+ builder .setPlatform ( NOARCH , LINUX );
47
+ builder .setType ( BINARY );
48
+ builder .addFile ( "/etc" , new File ("src/test/resources/prein.sh" ), 0755 , 0755 ,
49
+ new Directive (Directive .RPMFILE_CONFIG | Directive .RPMFILE_DOC | Directive .RPMFILE_NOREPLACE ),
50
+ "jabberwocky" , "vorpal" );
51
+
52
+ builder .build ( new File ( getTargetDir ()));
53
+
54
+ Format format = new Scanner ().run (channelWrapper ("target" + File .separator + "filestest-1.0-1.noarch.rpm" ));
55
+
56
+ assertArrayEquals (new String [] { "jabberwocky" },
57
+ (String [])format .getHeader ().getEntry (Header .HeaderTag .FILEUSERNAME ).getValues ());
58
+ assertArrayEquals (new String [] { "vorpal" },
59
+ (String [])format .getHeader ().getEntry (Header .HeaderTag .FILEGROUPNAME ).getValues ());
60
+ assertArrayEquals (new int [] { Directive .RPMFILE_CONFIG | Directive .RPMFILE_DOC | Directive .RPMFILE_NOREPLACE },
61
+ (int [])format .getHeader ().getEntry (Header .HeaderTag .FILEFLAGS ).getValues ());
62
+ }
36
63
37
64
@ Test
38
65
public void testBuildWithoutSignature () throws Exception {
0 commit comments