All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.atteo.moonshine.tests.MoonshineConfiguration Maven / Gradle / Ivy

The newest version!
package org.atteo.moonshine.tests;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.atteo.moonshine.Moonshine;

/**
 * Can be specified on a test class extending {@link MoonshineTest}. Allows to
 * specify configuration resources to use when starting {@link Moonshine}
 * framework.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface MoonshineConfiguration {

	/**
	 * Represents one possible configuration.
	 */
	public @interface Config {
		/**
		 * Configuration name.
		 */
		String id();

		/**
		 * List of resources to use as configuration for {@link Moonshine}.
		 */
		String[] value() default {};

		/**
		 * In-place configuration.
		 */
		String fromString() default "";
	}

	/**
	 * Represents a list of configurations from which at most only one will be used at given time.
	 */
	public @interface Alternatives {
		Config[] value() default {};
	}

	/**
	 * List of resources to use as configuration for {@link Moonshine}.
	 */
	String[] value() default {};

	/**
	 * Executes the test multiple times. Once for each provided {@link Config}.
	 * 

*

	 * For instance:
	 * @MoonshineConfiguration(forEach =
	 *     @Config("/a.xml"),
	 *     @Config("/b.xml")
	 * )
	 * 
* This will execute the test 2 times. Once with a.xml and the second tiem with b.xml configuration file. *

*/ Config[] forEach() default {}; /** * Executes the test multiple times. For each execution one {@link Config} will be taken from * each {@link Alternatives} list. The test will be run for every possible combination of Configs. *

* For instance: *

	 * @MoonshineConfiguration(forCartesianProductOf =
	 *      @Alternatives(
	 *          @Config("/a.xml"),
	 *          @Config("/b.xml")
	 *      ),
	 *      @Alternatives(
	 *          @Config("/1.xml"),
	 *          @Config("/2.xml"),
	 *          @Config("/3.xml")
	 *      )
	 * )
	 * 
* * This will execute the test 6 times for *
    *
  1. a.xml combined with 1.xml
  2. *
  3. a.xml combined with 2.xml
  4. *
  5. a.xml combined with 3.xml
  6. *
  7. b.xml combined with 1.xml
  8. *
  9. b.xml combined with 2.xml
  10. *
  11. b.xml combined with 3.xml
  12. *

    * */ Alternatives[] forCartesianProductOf() default {}; /** * In-place configuration. */ String fromString() default ""; /** * Allows to enable auto-configuration. *

    * Auto configuration is automatically generated and consists of every top-level service found on classpath * which does not require any configuration. It is always stored in ${configHome}/auto-config.xml * file. *

    */ boolean autoConfiguration() default false; /** * Skip reading default configuration from '/default-config.xml' classpath resource. */ boolean skipDefault() default false; /** * If true, a request (scope) per entire test class will be created, * default means that a request is created per method. */ boolean oneRequestPerClass() default false; /** * Command line arguments. */ String[] arguments() default {}; /** * Specifies external configurator for Moonshine. */ Class configurator() default MoonshineConfigurator.class; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy