46 |
48 |
47 private static void verifyInstall() throws Exception { |
49 private static void verifyInstall() throws Exception { |
48 String app = JPackagePath.getLinuxInstalledApp(TEST_NAME); |
50 String app = JPackagePath.getLinuxInstalledApp(TEST_NAME); |
49 JPackageInstallerHelper.validateApp(app); |
51 JPackageInstallerHelper.validateApp(app); |
50 |
52 |
|
53 if (EXT.equals("rpm")) { |
|
54 verifyInstallRpm(); |
|
55 } |
|
56 } |
|
57 |
|
58 private static File getRpmLicenseFileInstallLocation() throws Exception { |
|
59 final String infoResult = "infoResult.txt"; |
|
60 int retVal = JPackageHelper.execute(new File(infoResult), "rpm", |
|
61 "--eval", "%{_defaultlicensedir}"); |
|
62 if (retVal != 0) { |
|
63 throw new AssertionError("rpm exited with error: " + retVal); |
|
64 } |
|
65 |
|
66 final String rootLicenseDir = Files.readString(Path.of(infoResult)).replaceAll( |
|
67 "(\\r|\\n)", ""); |
|
68 |
|
69 retVal = JPackageHelper.execute(new File(infoResult), "rpm", |
|
70 "-qp", "--queryformat", "%{name}-%{version}", |
|
71 OUTPUT.toLowerCase()); |
|
72 if (retVal != 0) { |
|
73 throw new AssertionError("rpm exited with error: " + retVal); |
|
74 } |
|
75 |
|
76 final String testPackageName = Files.readString(Path.of(infoResult)); |
|
77 |
|
78 return Path.of(rootLicenseDir, testPackageName, new File( |
|
79 JPackagePath.getLicenseFilePath()).getName()).toFile(); |
|
80 } |
|
81 |
|
82 private static void verifyInstallRpm() throws Exception { |
|
83 final File licenseFile = getRpmLicenseFileInstallLocation(); |
|
84 if (!licenseFile.exists()) { |
|
85 throw new AssertionError( |
|
86 "Error: " + licenseFile.getAbsolutePath() + " not found"); |
|
87 } |
51 } |
88 } |
52 |
89 |
53 private static void verifyUnInstall() throws Exception { |
90 private static void verifyUnInstall() throws Exception { |
54 String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME); |
91 String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME); |
55 File folder = new File(folderPath); |
92 File folder = new File(folderPath); |
56 if (folder.exists()) { |
93 if (folder.exists()) { |
57 throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist"); |
94 throw new AssertionError( |
|
95 "Error: " + folder.getAbsolutePath() + " exist"); |
|
96 } |
|
97 |
|
98 if (EXT.equals("rpm")) { |
|
99 final File licenseFileFolder = getRpmLicenseFileInstallLocation().getParentFile(); |
|
100 if (folder.exists()) { |
|
101 throw new AssertionError( |
|
102 "Error: " + licenseFileFolder.getAbsolutePath() + " exist"); |
|
103 } |
58 } |
104 } |
59 } |
105 } |
60 |
106 |
61 private static void init(String name, String ext) throws Exception { |
107 private static void init(String name, String ext) throws Exception { |
62 TEST_NAME = name; |
108 TEST_NAME = name; |