Blame SOURCES/CheckVendor.java

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