Blame SOURCES/CheckVendor.java

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