< prev index next >
test/jdk/tools/jpackage/linux/base/LicenseBase.java
Print this page
*** 48,59 ****
private static void verifyInstall() throws Exception {
String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
JPackageInstallerHelper.validateApp(app);
if (EXT.equals("rpm")) {
! verifyInstallRpm();
}
}
private static File getRpmLicenseFileInstallLocation() throws Exception {
final String infoResult = "infoResult.txt";
--- 48,66 ----
private static void verifyInstall() throws Exception {
String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
JPackageInstallerHelper.validateApp(app);
+ File licenseFile = null;
if (EXT.equals("rpm")) {
! licenseFile = getRpmLicenseFileInstallLocation();
! } else if (EXT.equals("deb")) {
! licenseFile = getDebLicenseFileInstallLocation();
! }
! if (!licenseFile.exists()) {
! throw new AssertionError(
! "Error: " + licenseFile.getAbsolutePath() + " not found");
}
}
private static File getRpmLicenseFileInstallLocation() throws Exception {
final String infoResult = "infoResult.txt";
*** 65,92 ****
final String rootLicenseDir = Files.readString(Path.of(infoResult)).replaceAll(
"(\\r|\\n)", "");
retVal = JPackageHelper.execute(new File(infoResult), "rpm",
! "-qp", "--queryformat", "%{name}-%{version}",
! OUTPUT.toLowerCase());
if (retVal != 0) {
throw new AssertionError("rpm exited with error: " + retVal);
}
final String testPackageName = Files.readString(Path.of(infoResult));
return Path.of(rootLicenseDir, testPackageName, new File(
JPackagePath.getLicenseFilePath()).getName()).toFile();
}
! private static void verifyInstallRpm() throws Exception {
! final File licenseFile = getRpmLicenseFileInstallLocation();
! if (!licenseFile.exists()) {
! throw new AssertionError(
! "Error: " + licenseFile.getAbsolutePath() + " not found");
! }
}
private static void verifyUnInstall() throws Exception {
String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
File folder = new File(folderPath);
--- 72,96 ----
final String rootLicenseDir = Files.readString(Path.of(infoResult)).replaceAll(
"(\\r|\\n)", "");
retVal = JPackageHelper.execute(new File(infoResult), "rpm",
! "-q", "--queryformat", "%{name}-%{version}",
! TEST_NAME.toLowerCase());
if (retVal != 0) {
throw new AssertionError("rpm exited with error: " + retVal);
}
final String testPackageName = Files.readString(Path.of(infoResult));
return Path.of(rootLicenseDir, testPackageName, new File(
JPackagePath.getLicenseFilePath()).getName()).toFile();
}
! private static File getDebLicenseFileInstallLocation() throws Exception {
! return Path.of("/usr", "share", "doc", TEST_NAME.toLowerCase(),
! "copyright").toFile();
}
private static void verifyUnInstall() throws Exception {
String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
File folder = new File(folderPath);
*** 99,108 ****
--- 103,118 ----
final File licenseFileFolder = getRpmLicenseFileInstallLocation().getParentFile();
if (folder.exists()) {
throw new AssertionError(
"Error: " + licenseFileFolder.getAbsolutePath() + " exist");
}
+ } else if (EXT.equals("deb")) {
+ final File licenseFileFolder = getDebLicenseFileInstallLocation().getParentFile();
+ if (folder.exists()) {
+ throw new AssertionError(
+ "Error: " + licenseFileFolder.getAbsolutePath() + " exist");
+ }
}
}
private static void init(String name, String ext) throws Exception {
TEST_NAME = name;
< prev index next >