Blame SOURCES/CheckVendor.java

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