1 | package de.ugoe.cs.eventbench.assertions;
|
---|
2 |
|
---|
3 | import de.ugoe.cs.eventbench.data.IReplayable;
|
---|
4 | import de.ugoe.cs.util.StringTools;
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * <p>
|
---|
8 | * This class defines the fileEquals assertion type. This type does have two
|
---|
9 | * parameters, actualFile and expectedFile.
|
---|
10 | * </p>
|
---|
11 | *
|
---|
12 | * @author jeffrey.hall
|
---|
13 | * @version 1.0
|
---|
14 | *
|
---|
15 | */
|
---|
16 | public class FileEqualsReplay implements IReplayable {
|
---|
17 |
|
---|
18 | /**
|
---|
19 | * The file that should be equal to expectedFile.
|
---|
20 | */
|
---|
21 | String actualFile = null;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The file that is used as the reference.
|
---|
25 | */
|
---|
26 | String expectedFile = null;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Id for object serialization.
|
---|
30 | */
|
---|
31 | private static final long serialVersionUID = 1L;
|
---|
32 |
|
---|
33 | /**
|
---|
34 | *
|
---|
35 | * @param actualFile
|
---|
36 | * The file that should be equal to expectedFile.
|
---|
37 | */
|
---|
38 | public void setActualFile(String actualFile) {
|
---|
39 | this.actualFile = actualFile;
|
---|
40 | }
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * @param exptectedFile
|
---|
44 | * The file that is used as the reference.
|
---|
45 | */
|
---|
46 | public void setExpectedFile(String expectedFile) {
|
---|
47 | this.expectedFile = expectedFile;
|
---|
48 | }
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Returns the string that has to be written to the replay file.
|
---|
52 | */
|
---|
53 | public String getReplay() {
|
---|
54 |
|
---|
55 | actualFile = StringTools.xmlEntityReplacement(actualFile);
|
---|
56 | expectedFile = StringTools.xmlEntityReplacement(expectedFile);
|
---|
57 |
|
---|
58 | StringBuilder currentMsgStr = new StringBuilder(800);
|
---|
59 | currentMsgStr.append(" <fileEquals ");
|
---|
60 | currentMsgStr.append("actualFile=\"" + actualFile + "\" ");
|
---|
61 | currentMsgStr.append("expectedFile=\"" + expectedFile + "\"/>");
|
---|
62 | currentMsgStr.append(StringTools.ENDLINE);
|
---|
63 | return currentMsgStr.toString();
|
---|
64 | }
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * No target used by fileEquals.
|
---|
68 | */
|
---|
69 | public String getTarget() {
|
---|
70 | return "targetNotUsed";
|
---|
71 | }
|
---|
72 |
|
---|
73 | }
|
---|