Blame SOURCES/CheckVendor.java

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