001    /*
002     * Copyright 2007-2008 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.test.server;
017    
018    import java.lang.annotation.Documented;
019    import java.lang.annotation.ElementType;
020    import java.lang.annotation.Inherited;
021    import java.lang.annotation.Retention;
022    import java.lang.annotation.RetentionPolicy;
023    import java.lang.annotation.Target;
024    
025    import org.kuali.rice.test.lifecycles.JettyServerLifecycle.ConfigMode;
026    
027    /**
028     * Annotation for bringing up an embedded JettyServer in unit tests 
029     * @author Kuali Rice Team (rice.collab@kuali.org)
030     */
031    @Documented
032    @Target({ElementType.TYPE, ElementType.METHOD})
033    @Retention(RetentionPolicy.RUNTIME)
034    @Inherited
035    public @interface JettyServer {
036        /**
037         * Indicate that the port should be pulled from a configuration parameter
038         */
039        public static final int CONFIG_PARAM_PORT = -1;
040    
041        /**
042         * The webapp file location, relative to the working directory of the unit test
043         */
044        String webapp() default "../src/test/webapp";
045        /**
046         * The context name; this will be prepended with a slash "/", so don't prepend a slash
047         */
048        String context() default "SampleRiceClient";
049        /**
050         * The port to bring jetty up on; CONFIG_PARAM_PORT to refer to a port from a config param
051         */
052        int port() default CONFIG_PARAM_PORT;
053        /**
054         * The name of the config param from which to read the port
055         */
056        String portConfigParam() default "kns.port";
057        /**
058         * What to do with the webapp's Config: NONE - nothing,
059         * OVERRIDE - replace the current context config (the test harness config) with the webapp's config
060         * MERGE - merge the properties and objects into the current context config (but don't replace the whole config)
061         */
062        ConfigMode configMode() default ConfigMode.OVERRIDE;
063        /**
064         * Whether to explicitly add the webapp's ResourceLoader to the GlobalResourceLoader 
065         */
066        boolean addWebappResourceLoader() default true;
067    }