/** * Processes two sequences of options and combines them into a single sequence. */ public static Option[] options(final Option[] options1, final Option... options2) { return options(OptionUtils.combine(options1, options2)); }
/** * Convenience method (more to be used for a nice fluent api) for creating an array of options. * It also expands the composite options. * * @param options * to be used. * @return provided options, expanded * * @see OptionUtils#expand(Option...) */ public static Option[] options(final Option... options) { return expand(options); }
public <T extends Option> T getSingleOption(final Class<T> optionType, Option[] options) { T[] filter = filter(optionType, options); if (filter.length > 0) { return filter[filter.length - 1]; } else { return null; } }
protected List<JUnit4TestMethod> getTestMethods() throws Exception { final Collection<JUnit4ConfigMethod> configMethods = getConfigurationMethods(); final List<JUnit4TestMethod> methods = new ArrayList<JUnit4TestMethod>(); final Collection<Method> testMethods = m_testClass.getAnnotatedMethods( Test.class ); for( Method testMethod : testMethods ) { final Option configOptions = getOptions( testMethod, configMethods ); final FrameworkOption[] frameworkOptions = OptionUtils.filter( FrameworkOption.class, configOptions ); final Option[] filteredOptions = OptionUtils.remove( FrameworkOption.class, configOptions ); if( frameworkOptions.length == 0 ) { methods.add( new JUnit4TestMethod( testMethod, m_testClass, null, filteredOptions ) ); } else { for( FrameworkOption frameworkOption : frameworkOptions ) { methods.add( new JUnit4TestMethod( testMethod, m_testClass, frameworkOption, filteredOptions ) ); } } } return methods; }
/** * Constructor. * * @param javaRunner java runner to be used to start up Pax Runner * @param options user startup options */ PaxRunnerTestContainer( final DefaultJavaRunner javaRunner, final Option... options ) { m_javaRunner = javaRunner; m_startTimeout = getTestContainerStartTimeout( options ); int registryPort = createRegistry(); m_remoteBundleContextClient = new RemoteBundleContextClient( registryPort, getRMITimeout( options ) ); m_arguments = new ArgumentsBuilder( wrap( expand( combine( options, localOptions() ) ) ) ); m_customizers = new CompositeCustomizer( m_arguments.getCustomizers() ); m_store = StoreFactory.sharedLocalStore(); m_cache = new HashMap<String, Handle>(); }
/** * Create a new system based on *this*. The forked System remembers the forked instances in * order to clear resources up (if desired). */ @Override public ExamSystem fork(Option[] options) { try { ExamSystem sys = new DefaultExamSystem(combine(combinedOptions, options)); subsystems.add(sys); return sys; } catch (IOException exc) { throw new TestContainerException(exc); } }
/** * Convenience method (more to be used for a nice fluent api) for creating an array of options. * It also expands the composite options. * * @param options * to be used. * @return provided options, expanded * * @see OptionUtils#expand(Option...) */ public static Option[] options(final Option... options) { return expand(options); }
@Override public <T extends Option> T[] getOptions(final Class<T> optionType) { requestedOptionTypes.add(optionType); return filter(optionType, combinedOptions); }
/** * Return an array of options for setting up a pax-exam test environment for karaf. * * @param sysOptions test-specific system property options * @return an array of pax-exam options */ public static Option[] getDefaultOptions(SystemPropertyOption... sysOptions) { return combine(getDefaultConfigOptions(sysOptions), getDefaultProvisioningOptions()); }
/** * Convenience method (more to be used for a nice fluent api) for creating an array of options. * It also expands the composite options. * * @param options * to be used. * @return provided options, expanded * * @see OptionUtils#expand(Option...) */ public static Option[] options(final Collection<? extends Option> options) { return expand(options.toArray(new Option[0])); }
/** * Helper method for single options. Last occurence has precedence. (support overwrite). * */ @Override public <T extends Option> T getSingleOption(final Class<T> optionType) { requestedOptionTypes.add(optionType); T[] filter = filter(optionType, combinedOptions); if (filter.length > 0) { return filter[filter.length - 1]; } else { return null; } }
/** * Return an array of options for setting up a pax-exam test environment for karaf. * * @param sysOptions test-specific system property options * @return an array of pax-exam options */ public static Option[] getDefaultOptions(SystemPropertyOption... sysOptions) { return combine(getDefaultConfigOptions(sysOptions), getDefaultProvisioningOptions()); }
public Option[] getOptions() { return OptionUtils.expand(options.toArray(new Option[options.size()])); }
public static ExamSystem createServerSystem(Option... options) throws IOException { return DefaultExamSystem.create(OptionUtils.combine(options, defaultServerSystemOptions())); }
public Option[] getOptions() { return OptionUtils.expand(options.toArray(new Option[options.size()])); }
/** * Determine the rmi lookup timeout.<br/> * Timeout is dermined by first looking for a {@link RBCLookupTimeoutOption} in the user options. If not specified a * default is used. * * @param options user options * @return rmi lookup timeout */ private static long getRMITimeout( final Option... options ) { final RBCLookupTimeoutOption[] timeoutOptions = filter( RBCLookupTimeoutOption.class, options ); if ( timeoutOptions.length > 0 ) { return timeoutOptions[0].getTimeout(); } return getTestContainerStartTimeout( options ); }
public static ExamSystem createTestSystem(Option... options) throws IOException { return DefaultExamSystem.create(OptionUtils.combine(options, defaultTestSystemOptions())); }