/*
 * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0, which is available at
 * http://www.eclipse.org/legal/epl-2.0.
 *
 * This Source Code may also be made available under the following Secondary
 * Licenses when the conditions for such availability set forth in the
 * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
 * version 2 with the GNU Classpath Exception, which is available at
 * https://www.gnu.org/software/classpath/license.html.
 *
 * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
 */

package com.sun.ts.tests.signaturetest.<your_test_dir_name>;

import java.util.List;
import java.util.LinkedList;
import java.util.Properties;
import com.sun.ts.lib.harness.EETest.Fault;
import com.sun.javatest.Status;
import com.sun.ts.tests.signaturetest.*;

/*
 * This class is a simple example of a signature test that extends the
 * SigTestEE framework class.  This signature test must be run from
 * within the Java EE containers.  This class also contains the boilerplate
 * code necessary to create a signature test using the test framework.
 * To see a complete TCK example see the javaee directory for the Java EE
 * TCK signature test class.
 */
public class <your_test_class_name> extends SigTestEE {

    public  static final String EJB_VEHICLE        = "ejb";
    public  static final String SERVLET_VEHICLE    = "servlet";
    public  static final String JSP_VEHICLE        = "jsp";
    public  static final String APP_CLIENT_VEHICLE = "appclient";

    private static final String[] ejbPackages     = {"javax.sql",
						     "javax.ejb",
						     "javax.ejb.spi"};
    private static final String[] servletPackages = {"javax.sql",
						     "javax.ejb",
						     "javax.ejb.spi",
						     "javax.servlet",
						     "javax.servlet.http"};
    private static final String[] jspPackages     = {"javax.sql",
						     "javax.ejb",
						     "javax.ejb.spi",
						     "javax.servlet.jsp",
						     "javax.servlet.jsp.tagext"};
    private static final String[] appPackages     = {"javax.sql"};


    /***** Abstract Method Implementation *****/

    /**
     * Returns a list of strings where each string represents a
     * package name.  Each package name will have it's signature
     * tested by the signature test framework.
     * 
     * @param vehicleName The name of the Java EE container where the
     *                    signature tests should be conducted.
     * @return String[] A list of packages that the developer wishes to test
     *         using the signature test framework.  If the developer does
     *         not wish to test any package signatures in the specified
     *         vehicle this method should return null.<p>
     *         Note, The proper way to insure that this method is not called
     *               with a vehicle name that has no package signatures to
     *               verify is to modify the vehicle.properties in the
     *               $TS_HOME/src directory.  This file provides a mapping
     *               that maps test directories to a list of vehicles where
     *               the tests in those directory should be run.  As an extra
     *               precaution users are encouraged to return null from this
     *               method if the specified vehicle has no package signatures
     *               to be verified within it.
     */
    protected String[] getPackages(String vehicleName) {
	if (EJB_VEHICLE.equals(vehicleName)) {
	    return ejbPackages;
	} else if (SERVLET_VEHICLE.equals(vehicleName)) {
	    return servletPackages;
	} else if (JSP_VEHICLE.equals(vehicleName)) {
	    return jspPackages;
	} else if (APP_CLIENT_VEHICLE.equals(vehicleName)) {
	    return appPackages;
	} else {
	    // Unknown vehicle type, should never happen
	}
    }


    /***** Boilerplate Code *****/

    /*
     * Initial entry point for JavaTest.
     */
    public static void main(String[] args) {
	<your_test_class_name> theTests = new <your_test_class_name>();
	Status s = theTests.run(args, System.out, System.err);
	s.exit();
    }

    /*
     * The following comments are specified in the base class that
     * defines the signature tests.  This is done so the test finders
     * will find the right class to run.  The implementation of these
     * methods is inherited from the super class which is part of the
     * signature test framework.
     */

    // NOTE: If the API under test is not part of your testing runtime environment,
    //       you may use the property sigTestClasspath to specify where the API
    //       under test lives.  This should almost never be used.  Normally the API
    //       under test should be specified in the classpath of the VM running the
    //       signature tests.  Use either the first comment or the one below it depending
    //       on which properties your signature tests need.  Please do not use both
    //       comments.

    /*
     *   @class.setup_props: ts_home, The base path of this TCK;
     */

    /*
     *   @class.setup_props: ts_home, The base path of this TCK;
     *                       sigTestClasspath, The classpath of the API under test.
     *                                         This should only be used when the API
     *                                         under test is not available within the
     *                                         test environment;
     */

    /*
     * @testName:         signatureTest
     * @assertion:        A Java EE platform must implement the required classes and
     *                    and APIs specified in the Java EE Platform Specification.
     * @test_Strategy:    Using reflection, gather the implementation specific classes 
     *                    and APIs.  Compare these results with the expected (required)
     *                    classes and APIs.
     *
     */

    /*
     * Call the parent class's cleanup method.
     */

} // end class CTSSigTest
