Blame SOURCES/CheckVendor.java

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