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