|
|
0df9af |
/* CheckVendor -- Check the vendor properties match specified values.
|
|
|
0df9af |
Copyright (C) 2020 Red Hat, Inc.
|
|
|
0df9af |
|
|
|
0df9af |
This program is free software: you can redistribute it and/or modify
|
|
|
0df9af |
it under the terms of the GNU Affero General Public License as
|
|
|
0df9af |
published by the Free Software Foundation, either version 3 of the
|
|
|
0df9af |
License, or (at your option) any later version.
|
|
|
0df9af |
|
|
|
0df9af |
This program is distributed in the hope that it will be useful,
|
|
|
0df9af |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
0df9af |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
0df9af |
GNU Affero General Public License for more details.
|
|
|
0df9af |
|
|
|
0df9af |
You should have received a copy of the GNU Affero General Public License
|
|
|
0df9af |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
0df9af |
*/
|
|
|
0df9af |
|
|
|
0df9af |
/**
|
|
|
0df9af |
* @test
|
|
|
0df9af |
*/
|
|
|
0df9af |
public class CheckVendor {
|
|
|
0df9af |
|
|
|
0df9af |
public static void main(String[] args) {
|
|
|
0df9af |
if (args.length < 4) {
|
|
|
0df9af |
System.err.println("CheckVendor <VENDOR> <VENDOR-URL> <VENDOR-BUG-URL> <VENDOR-VERSION-STRING>");
|
|
|
0df9af |
System.exit(1);
|
|
|
0df9af |
}
|
|
|
0df9af |
|
|
|
0df9af |
String vendor = System.getProperty("java.vendor");
|
|
|
0df9af |
String expectedVendor = args[0];
|
|
|
0df9af |
String vendorURL = System.getProperty("java.vendor.url");
|
|
|
0df9af |
String expectedVendorURL = args[1];
|
|
|
0df9af |
String vendorBugURL = System.getProperty("java.vendor.url.bug");
|
|
|
0df9af |
String expectedVendorBugURL = args[2];
|
|
|
0df9af |
String vendorVersionString = System.getProperty("java.vendor.version");
|
|
|
0df9af |
String expectedVendorVersionString = args[3];
|
|
|
0df9af |
|
|
|
0df9af |
if (!expectedVendor.equals(vendor)) {
|
|
|
0df9af |
System.err.printf("Invalid vendor %s, expected %s\n",
|
|
|
0df9af |
vendor, expectedVendor);
|
|
|
0df9af |
System.exit(2);
|
|
|
0df9af |
}
|
|
|
0df9af |
|
|
|
0df9af |
if (!expectedVendorURL.equals(vendorURL)) {
|
|
|
0df9af |
System.err.printf("Invalid vendor URL %s, expected %s\n",
|
|
|
0df9af |
vendorURL, expectedVendorURL);
|
|
|
0df9af |
System.exit(3);
|
|
|
0df9af |
}
|
|
|
0df9af |
|
|
|
0df9af |
if (!expectedVendorBugURL.equals(vendorBugURL)) {
|
|
|
0df9af |
System.err.printf("Invalid vendor bug URL %s, expected %s\n",
|
|
|
0df9af |
vendorBugURL, expectedVendorBugURL);
|
|
|
0df9af |
System.exit(4);
|
|
|
0df9af |
}
|
|
|
0df9af |
|
|
|
0df9af |
if (!expectedVendorVersionString.equals(vendorVersionString)) {
|
|
|
0df9af |
System.err.printf("Invalid vendor version string %s, expected %s\n",
|
|
|
0df9af |
vendorVersionString, expectedVendorVersionString);
|
|
|
0df9af |
System.exit(5);
|
|
|
0df9af |
}
|
|
|
0df9af |
|
|
|
0df9af |
System.err.printf("Vendor information verified as %s, %s, %s, %s\n",
|
|
|
0df9af |
vendor, vendorURL, vendorBugURL, vendorVersionString);
|
|
|
0df9af |
}
|
|
|
0df9af |
}
|