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