Blame SOURCES/CheckVendor.java

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