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