1 | public final void testAttributes() {↵ | | 1 | public final void testAttributes() {↵
|
2 | TarFileSet f = (TarFileSet)getInstance();↵ | | 2 | ZipFileSet f = (ZipFileSet)getInstance();↵
|
3 | //check that dir and src are incompatible↵ | | 3 | //check that dir and src are incompatible↵
|
4 | f.setSrc(new File("example.tar"));↵ | | 4 | f.setSrc(new File("example.zip"));↵
|
5 | try {↵ | | 5 | try {↵
|
6 | f.setDir(new File("examples"));↵ | | 6 | f.setDir(new File("examples"));↵
|
7 | fail("can add dir to "↵ | | 7 | fail("can add dir to "↵
|
8 | + f.getDataTypeName()↵ | | 8 | + f.getDataTypeName()↵
|
9 | + " when a src is already present");↵ | | 9 | + " when a src is already present");↵
|
10 | } catch (BuildException be) {↵ | | 10 | } catch (BuildException be) {↵
|
11 | assertEquals("Cannot set both dir and src attributes",be.getMessage());↵ | | 11 | assertEquals("Cannot set both dir and src attributes",be.getMessage());↵
|
12 | }↵ | | 12 | }↵
|
13 | f = (TarFileSet)getInstance();↵ | | 13 | f = (ZipFileSet)getInstance();↵
|
14 | //check that dir and src are incompatible↵ | | 14 | //check that dir and src are incompatible↵
|
15 | f.setDir(new File("examples"));↵ | | 15 | f.setDir(new File("examples"));↵
|
16 | try {↵ | | 16 | try {↵
|
17 | f.setSrc(new File("example.tar"));↵ | | 17 | f.setSrc(new File("example.zip"));↵
|
18 | fail("can add src to "↵ | | 18 | fail("can add src to "↵
|
19 | + f.getDataTypeName()↵ | | 19 | + f.getDataTypeName()↵
|
20 | + " when a dir is already present");↵ | | 20 | + " when a dir is already present");↵
|
21 | } catch (BuildException be) {↵ | | 21 | } catch (BuildException be) {↵
|
22 | assertEquals("Cannot set both dir and src attributes",be.getMessage());↵ | | 22 | assertEquals("Cannot set both dir and src attributes",be.getMessage());↵
|
23 | }↵ | | 23 | }↵
|
24 | //check that fullpath and prefix are incompatible↵ | | 24 | //check that fullpath and prefix are incompatible↵
|
25 | f = (TarFileSet)getInstance();↵ | | 25 | f = (ZipFileSet)getInstance();↵
|
26 | f.setSrc(new File("example.tar"));↵ | | 26 | f.setSrc(new File("example.zip"));↵
|
27 | f.setPrefix("/examples");↵ | | 27 | f.setPrefix("/examples");↵
|
28 | try {↵ | | 28 | try {↵
|
29 | f.setFullpath("/doc/manual/index.html");↵ | | 29 | f.setFullpath("/doc/manual/index.html");↵
|
30 | fail("Can add fullpath to "↵ | | 30 | fail("Can add fullpath to "↵
|
31 | + f.getDataTypeName()↵ | | 31 | + f.getDataTypeName()↵
|
32 | + " when a prefix is already present");↵ | | 32 | + " when a prefix is already present");↵
|
33 | } catch (BuildException be) {↵ | | 33 | } catch (BuildException be) {↵
|
34 | assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());↵ | | 34 | assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());↵
|
35 | }↵ | | 35 | }↵
|
36 | f = (TarFileSet)getInstance();↵ | | 36 | f = (ZipFileSet)getInstance();↵
|
37 | f.setSrc(new File("example.tar"));↵ | | 37 | f.setSrc(new File("example.zip"));↵
|
38 | f.setFullpath("/doc/manual/index.html");↵ | | 38 | f.setFullpath("/doc/manual/index.html");↵
|
39 | try {↵ | | 39 | try {↵
|
40 | f.setPrefix("/examples");↵ | | 40 | f.setPrefix("/examples");↵
|
41 | fail("Can add prefix to "↵ | | 41 | fail("Can add prefix to "↵
|
42 | + f.getDataTypeName()↵ | | 42 | + f.getDataTypeName()↵
|
43 | + " when a fullpath is already present");↵ | | 43 | + " when a fullpath is already present");↵
|
44 | } catch (BuildException be) {↵ | | 44 | } catch (BuildException be) {↵
|
45 | assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());↵ | | 45 | assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());↵
|
46 | }↵ | | 46 | }↵
|
47 | // check that reference tarfilesets cannot have specific attributes↵ | | 47 | // check that reference zipfilesets cannot have specific attributes↵
|
48 | f = (TarFileSet)getInstance();↵ | | 48 | f = (ZipFileSet)getInstance();↵
|
49 | f.setRefid(new Reference("test"));↵ | | 49 | f.setRefid(new Reference("test"));↵
|
50 | try {↵ | | 50 | try {↵
|
51 | f.setSrc(new File("example.tar"));↵ | | 51 | f.setSrc(new File("example.zip"));↵
|
52 | fail("Can add src to "↵ | | 52 | fail("Can add src to "↵
|
53 | + f.getDataTypeName()↵ | | 53 | + f.getDataTypeName()↵
|
54 | + " when a refid is already present");↵ | | 54 | + " when a refid is already present");↵
|
55 | } catch (BuildException be) {↵ | | 55 | } catch (BuildException be) {↵
|
56 | assertEquals("You must not specify more than one "↵ | | 56 | assertEquals("You must not specify more than one "↵
|
57 | + "attribute when using refid", be.getMessage());↵ | | 57 | + "attribute when using refid", be.getMessage());↵
|
58 | }↵ | | 58 | }↵
|
59 | // check that a reference tarfileset gets the same attributes as the original↵ | | 59 | // check that a reference zipfileset gets the same attributes as the original↵
|
60 | f = (TarFileSet)getInstance();↵ | | 60 | f = (ZipFileSet)getInstance();↵
|
61 | f.setSrc(new File("example.tar"));↵ | | 61 | f.setSrc(new File("example.zip"));↵
|
62 | f.setPrefix("/examples");↵ | | 62 | f.setPrefix("/examples");↵
|
63 | f.setFileMode("600");↵ | | 63 | f.setFileMode("600");↵
|
64 | f.setDirMode("530");↵ | | 64 | f.setDirMode("530");↵
|
65 | getProject().addReference("test",f);↵ | | 65 | getProject().addReference("test",f);↵
|
66 | TarFileSet zid=(TarFileSet)getInstance();↵ | | 66 | ZipFileSet zid=(ZipFileSet)getInstance();↵
|
67 | zid.setRefid(new Reference("test"));↵ | | 67 | zid.setRefid(new Reference("test"));↵
|
68 | assertTrue("src attribute copied by copy constructor",zid.getSrc(getProject()).equals(f.getSrc(getProject())));↵ | | 68 | assertTrue("src attribute copied by copy constructor",zid.getSrc(getProject()).equals(f.getSrc(getProject())));↵
|
69 | assertTrue("prefix attribute copied by copy constructor",f.getPrefix(getProject()).equals(zid.getPrefix(getProject())));↵ | | 69 | assertTrue("prefix attribute copied by copy constructor",f.getPrefix(getProject()).equals(zid.getPrefix(getProject())));↵
|
70 | assertTrue("file mode attribute copied by copy constructor",f.getFileMode(getProject())==zid.getFileMode(getProject()));↵ | | 70 | assertTrue("file mode attribute copied by copy constructor",f.getFileMode(getProject())==zid.getFileMode(getProject()));↵
|
71 | assertTrue("dir mode attribute copied by copy constructor",f.getDirMode(getProject())==zid.getDirMode(getProject()));↵ | | 71 | assertTrue("dir mode attribute copied by copy constructor",f.getDirMode(getProject())==zid.getDirMode(getProject()));↵
|
72 | | | 72 |
|