/** * 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); }
/** * 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); }
/** * 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])); }
public Option[] getOptions() { return OptionUtils.expand(options.toArray(new Option[options.size()])); }
public Option[] getOptions() { return OptionUtils.expand(options.toArray(new Option[options.size()])); }
/** * Removes from the provided options all options that are instance of the provided class, * returning the remaining options. * * @param optionType * class of the desired options to be removed * @param options * options to be filtered (can be null or empty array) * * @return array of remaining options (never null) after removing the desired type */ public static Option[] remove(final Class<? extends Option> optionType, final Option... options) { final List<Option> filtered = new ArrayList<Option>(); for (Option option : expand(options)) { if (!optionType.isAssignableFrom(option.getClass())) { filtered.add(option); } } return filtered.toArray(new Option[filtered.size()]); }
/** * Removes from the provided options all options that are instance of the provided class, * returning the remaining options. * * @param optionType * class of the desired options to be removed * @param options * options to be filtered (can be null or empty array) * * @return array of remaining options (never null) after removing the desired type */ public static Option[] remove(final Class<? extends Option> optionType, final Option... options) { final List<Option> filtered = new ArrayList<Option>(); for (Option option : expand(options)) { if (!optionType.isAssignableFrom(option.getClass())) { filtered.add(option); } } return filtered.toArray(new Option[filtered.size()]); }
/** * Filters the provided options by class returning an array of those option that are instance of * the provided class. Before filtering the options are expanded {@link #expand(Option[])}. * * @param optionType * class of the desired options * @param options * options to be filtered (can be null or empty array) * @param <T> * type of desired options * * @return array of desired option type (never null). In case that the array of filtered options * is null, empty or there is no option that matches the desired type an empty array is * returned */ @SuppressWarnings("unchecked") public static <T extends Option> T[] filter(final Class<T> optionType, final Option... options) { final List<T> filtered = new ArrayList<T>(); for (Option option : expand(options)) { if (optionType.isAssignableFrom(option.getClass())) { filtered.add((T) option); } } final T[] result = (T[]) Array.newInstance(optionType, filtered.size()); return filtered.toArray(result); }
/** * Filters the provided options by class returning an array of those option that are instance of * the provided class. Before filtering the options are expanded {@link #expand(Option[])}. * * @param optionType * class of the desired options * @param options * options to be filtered (can be null or empty array) * @param <T> * type of desired options * * @return array of desired option type (never null). In case that the array of filtered options * is null, empty or there is no option that matches the desired type an empty array is * returned */ @SuppressWarnings("unchecked") public static <T extends Option> T[] filter(final Class<T> optionType, final Option... options) { final List<T> filtered = new ArrayList<T>(); for (Option option : expand(options)) { if (optionType.isAssignableFrom(option.getClass())) { filtered.add((T) option); } } final T[] result = (T[]) Array.newInstance(optionType, filtered.size()); return filtered.toArray(result); }
/** * Replacement for {@link CoreOptions#options(Option...)} to workaround Pax-Exam 'feature' * where only the last 'editConfigurationFileExtend' for a given property key is honoured. */ public static Option[] options(final Option... options) { final List<Option> result = new ArrayList<>(); final List<String> nexusFeatures = new ArrayList<>(); for (final Option o : OptionUtils.expand(options)) { // filter out the individual nexus-features values if (o instanceof KarafDistributionConfigurationFileExtendOption) { if ("nexus-features".equals(((KarafDistributionConfigurationFileExtendOption) o).getKey())) { nexusFeatures.add(((KarafDistributionConfigurationFileExtendOption) o).getValue()); continue; } } // provide default start level for any additional test bundles else if (o instanceof ProvisionOption<?> && ((ProvisionOption<?>) o).getStartLevel() == null) { ((ProvisionOption<?>) o).startLevel(NEXUS_TEST_START_LEVEL); } result.add(o); } if (nexusFeatures.size() > 0) { // combine the nexus-features values into a single request result.add(editConfigurationFileExtend(NEXUS_PROPERTIES_FILE, // "nexus-features", Joiner.on(',').join(nexusFeatures))); } return result.toArray(new Option[result.size()]); }
combinedOptions = expand(options); configDirectory = new File(System.getProperty("user.home") + "/.pax/exam/"); configDirectory.mkdirs();
/** * 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>(); }