当前位置: 首页>>代码示例>>Java>>正文


Java MultiLoader类代码示例

本文整理汇总了Java中cucumber.runtime.io.MultiLoader的典型用法代码示例。如果您正苦于以下问题:Java MultiLoader类的具体用法?Java MultiLoader怎么用?Java MultiLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MultiLoader类属于cucumber.runtime.io包,在下文中一共展示了MultiLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testContextConfiguration

import cucumber.runtime.io.MultiLoader; //导入依赖的package包/类
private void testContextConfiguration(String profile, String springProfile) {
    GenericXmlApplicationContext context = createContext(profile, springProfile);
    AutowireCapableBeanFactory factory = context.getAutowireCapableBeanFactory();

    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    ResourceLoader resourceLoader = new MultiLoader(classLoader);
    ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
    Collection<Class<?>> descendants = classFinder.getDescendants(Object.class, "com.hotwire.test.steps");

    List<Throwable> throwables = new ArrayList<>();
    for (Class<?> clazz : descendants) {
        if (Utils.isInstantiable(clazz) & !clazz.isEnum()) {
            context.registerBeanDefinition(clazz.getName(),
                    BeanDefinitionBuilder.genericBeanDefinition(clazz).getBeanDefinition());
            try {
                factory.getBean(clazz.getName());
            }
            catch (Throwable t) {
                while (t.getCause() != null) {
                    t = t.getCause();
                }
                System.err.println(t.getMessage());
                throwables.add(t);
            }
        }
    }
    assertThat(throwables)
            .as("List of throwables should be empty!")
            .isEmpty();
}
 
开发者ID:HotwireDotCom,项目名称:bdd-test-automation-for-mobile,代码行数:31,代码来源:ContextConfigurationTest.java

示例2: CucumberLoadRunner

import cucumber.runtime.io.MultiLoader; //导入依赖的package包/类
/**
 * Constructor called by JUnit.
 *
 * @param clazz the class with the @RunWith annotation.
 * @throws java.io.IOException                         if there is a problem
 * @throws org.junit.runners.model.InitializationError if there is another problem
 */
public CucumberLoadRunner(Class clazz) throws InitializationError, IOException {
    super(clazz);

    System.setProperty(cukesProperty(CONTEXT_INFLATING_ENABLED), "false");
    System.setProperty(cukesProperty(ASSERTIONS_DISABLED), "true");
    System.setProperty(cukesProperty(LOADRUNNER_FILTER_BLOCKS_REQUESTS), "true");

    filter = SingletonObjectFactory.instance().getInstance(LoadRunnerFilter.class);

    ClassLoader classLoader = clazz.getClassLoader();
    Assertions.assertNoCucumberAnnotatedMethods(clazz);

    RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory(clazz);
    RuntimeOptions runtimeOptions = runtimeOptionsFactory.create();

    ResourceLoader resourceLoader = new MultiLoader(classLoader);
    runtime = createRuntime(resourceLoader, classLoader, runtimeOptions);

    final List<CucumberFeature> cucumberFeatures = runtimeOptions.cucumberFeatures(resourceLoader);
    jUnitReporter = new JUnitReporter(runtimeOptions.reporter(classLoader),
        runtimeOptions.formatter(classLoader), runtimeOptions.isStrict(), new JUnitOptions(runtimeOptions.getJunitOptions()));
    addChildren(cucumberFeatures);
}
 
开发者ID:ctco,项目名称:cukes,代码行数:31,代码来源:CucumberLoadRunner.java

示例3: getResourceLoader

import cucumber.runtime.io.MultiLoader; //导入依赖的package包/类
private ResourceLoader getResourceLoader() {
	List<Path> fileSystemFeaturePaths = getFileSystemFeaturePaths();
	if (fileSystemFeaturePaths.size() == 0)
		return new MultiLoader(cucumberClassLoader);
	URL[] urls = new URL[fileSystemFeaturePaths.size()];
	int index = 0;
	for (Path featurePath : fileSystemFeaturePaths) {
		try {
			urls[index] = featurePath.toUri().toURL();
		} catch (MalformedURLException e) {
			throw new CucumberException(e);
		}
		index++;
	}
	URLClassLoader featuresLoader = new URLClassLoader(urls, cucumberClassLoader);
	return new MultiLoader(featuresLoader);
}
 
开发者ID:djb61,项目名称:parallel-cucumber-jvm,代码行数:18,代码来源:CucumberRuntimeFactory.java

示例4: execute

import cucumber.runtime.io.MultiLoader; //导入依赖的package包/类
@Override
public final void execute() throws MojoExecutionException, MojoFailureException {
    before();
    try {
        final RuntimeOptions runtimeOptions = new RuntimeOptions(new Env("cucumber-jvm", System.getProperties()), args());
        final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        final ResourceLoader resourceLoader = new MultiLoader(classLoader);
        final ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
        final Runtime runtime = new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions);
        runtime.writeStepdefsJson();
        runtime.run();
        runtime.getErrors();
        if (runtime.exitStatus() != 0) {
            throw new MojoExecutionException("Got non-zero exit status " + runtime.exitStatus());
        }
    } catch (final IOException e) {
        throw new MojoExecutionException("Failure to write Json Stepdefs during Cucumber-JVM run", e);
    } finally {
        after();
    }
}
 
开发者ID:timezra,项目名称:cucumber-jvm-maven-plugin,代码行数:22,代码来源:CucumberMojo.java

示例5: EscCucumber

import cucumber.runtime.io.MultiLoader; //导入依赖的package包/类
/**
 * Constructor called by JUnit.
 *
 * @param clazz
 *            the class with the @RunWith annotation.
 * @throws java.io.IOException
 *             if there is a problem
 * @throws org.junit.runners.model.InitializationError
 *             if there is another problem
 */
public EscCucumber(Class<?> clazz) throws InitializationError, IOException {
    super(clazz);
    ClassLoader classLoader = clazz.getClassLoader();
    Assertions.assertNoCucumberAnnotatedMethods(clazz);

    final List<String> argList = new ArrayList<String>();
    final EscCucumberArgs args = clazz.getAnnotation(EscCucumberArgs.class);
    if (args == null) {
        argList.add("NONE");
    } else {
        argList.addAll(EscSpiUtils.asList(args.value()));
    }

    RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory(
            clazz);
    RuntimeOptions runtimeOptions = runtimeOptionsFactory.create();
    ResourceLoader resourceLoader = new MultiLoader(classLoader);
    ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader,
            classLoader);
    runtime = new Runtime(resourceLoader, classFinder, classLoader,
            runtimeOptions);
    jUnitReporter = new JUnitReporter(runtimeOptions.reporter(classLoader),
            runtimeOptions.formatter(classLoader),
            runtimeOptions.isStrict());

    for (final String arg : argList) {
        addChildren(runtimeOptions.cucumberFeatures(resourceLoader), arg);

    }

}
 
开发者ID:fuinorg,项目名称:event-store-commons,代码行数:42,代码来源:EscCucumber.java

示例6: getFileSystemFeaturePaths

import cucumber.runtime.io.MultiLoader; //导入依赖的package包/类
private List<Path> getFileSystemFeaturePaths() {
	List<Path> fileSystemFeaturePaths = new ArrayList<Path>();
	for (String featurePath : runtimeConfiguration.featurePaths) {
		if (!featurePath.startsWith(MultiLoader.CLASSPATH_SCHEME))
			fileSystemFeaturePaths.add(Paths.get(featurePath));
	}
	return fileSystemFeaturePaths;
}
 
开发者ID:djb61,项目名称:parallel-cucumber-jvm,代码行数:9,代码来源:CucumberRuntimeFactory.java

示例7: getBackends

import cucumber.runtime.io.MultiLoader; //导入依赖的package包/类
@Override
public List<Backend> getBackends() {
	wasInvoked = true;
	ResourceLoader resourceLoader = new MultiLoader(Thread.currentThread().getContextClassLoader());
	Backend backend = new JavaBackend(resourceLoader);
	return Arrays.asList(backend);
}
 
开发者ID:djb61,项目名称:parallel-cucumber-jvm,代码行数:8,代码来源:FakeCucumberBackendFactory.java

示例8: getRuntime

import cucumber.runtime.io.MultiLoader; //导入依赖的package包/类
@Override
public synchronized Runtime getRuntime(List<String> additionalCucumberArgs) {
	RuntimeOptions runtimeOptions = new RuntimeOptions(additionalCucumberArgs);
	ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
	ResourceLoader resourceLoader = new MultiLoader(classLoader);
	ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
	byte exitCode = perInvocationExitCodes[invocationCount % perInvocationExitCodes.length];
	boolean shouldThrowException = perInvocationShouldThrowException[invocationCount % perInvocationExitCodes.length];
	invocationCount++;
	ThreadExecutionRecorder threadExecutionRecorder = new ThreadExecutionRecorder();
	return new FakeCucumberRuntime(exitCode, shouldThrowException, resourceLoader, classFinder, classLoader, runtimeOptions, threadExecutionRecorder);
}
 
开发者ID:djb61,项目名称:parallel-cucumber-jvm,代码行数:13,代码来源:FakeCucumberRuntimeFactory.java

示例9: execute

import cucumber.runtime.io.MultiLoader; //导入依赖的package包/类
public void execute(ClassLoader classLoader, ResultCollector rc) {
    ResourceLoader resourceLoader = new MultiLoader(classLoader);

    // TODO threadlocal runtime cache using junitTestClass as a key
    ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
    RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory(junitTestClass);
    RuntimeOptions runtimeOptions = runtimeOptionsFactory.create();
    Runtime runtime = new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions);
    Reporter reporter = new ReporterAdapter(rc, getDescription());
    LOGGER.fine("Executing cucumber \"" + scenario.getVisualName() + "\"");
    scenario.run(nullFormatter(), reporter, runtime);
}
 
开发者ID:alexvictoor,项目名称:pitest-cucumber-plugin,代码行数:13,代码来源:ScenarioTestUnit.java

示例10: CucumberRunner

import cucumber.runtime.io.MultiLoader; //导入依赖的package包/类
@Test(groups = "cucumber", description = "Runs Cucumber Features")
public void CucumberRunner() throws Throwable {

    ClassLoader classLoader = getClass().getClassLoader();
    ResourceLoader resourceLoader = new MultiLoader(classLoader);

    RuntimeOptionsFactory roFactory = new RuntimeOptionsFactory(getClass());

    RuntimeOptions ro = roFactory.create();

    ro.getGlue().clear();
    ro.getGlue().add("classpath:");

    ro.getFeaturePaths().clear();
    ro.getFeaturePaths().add(feature);

    if (!tags.isEmpty()) {
        for (String s : tags.split("--tags")) {
            if (!s.trim().isEmpty()) {
                ro.getFilters().add(s.trim());
            }
        }
    }

    ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
    runtime = new cucumber.runtime.Runtime(resourceLoader, classFinder, classLoader, ro);
    try {
        ReporterNGExt.logBusiness(String.format("Run Feature - %s", feature));
        runtime.run();
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
    if (!runtime.getErrors().isEmpty()) {
        ReporterNGExt.logBusiness(runtime.getErrors().toString());
        throw new CucumberException(runtime.getErrors().get(0));
    }

}
 
开发者ID:ggasoftware,项目名称:gga-selenium-framework,代码行数:39,代码来源:CukeTestImpl.java

示例11: createResourceLoader

import cucumber.runtime.io.MultiLoader; //导入依赖的package包/类
protected ResourceLoader createResourceLoader(Class<?> clazz) {
    ClassLoader classLoader = clazz.getClassLoader();
    MultiLoader loader = new MultiLoader(classLoader);

    List<Filter<InputStream>> filters = instanciateFilters(clazz);
    if (filters.isEmpty())
        return loader;
    else
        return new ResourceLoaderWrapper(loader, Filters.chain(filters));
}
 
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:11,代码来源:FeatureParser.java

示例12: createResourceLoader

import cucumber.runtime.io.MultiLoader; //导入依赖的package包/类
protected ResourceLoader createResourceLoader(Class<?> clazz) {
    ClassLoader classLoader = clazz.getClassLoader();
    MultiLoader loader = new MultiLoader(classLoader);

    List<Filter<InputStream>> filters = instanciateFilters(clazz);
    if(filters.isEmpty())
        return loader;
    else
        return new ResourceLoaderWrapper(loader, Filters.chain(filters));
}
 
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:11,代码来源:CucumberExt.java

示例13: KarateRuntimeOptions

import cucumber.runtime.io.MultiLoader; //导入依赖的package包/类
public KarateRuntimeOptions(Class clazz) {
    classLoader = clazz.getClassLoader();
    RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory(clazz);
    runtimeOptions = runtimeOptionsFactory.create();
    resourceLoader = new MultiLoader(classLoader);
}
 
开发者ID:intuit,项目名称:karate,代码行数:7,代码来源:KarateRuntimeOptions.java

示例14: createRuntime

import cucumber.runtime.io.MultiLoader; //导入依赖的package包/类
private Runtime createRuntime(RuntimeOptions runtimeOptions) {
    final ResourceLoader resourceLoader = new MultiLoader(classLoader);
    final ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
    return new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions);
}
 
开发者ID:prashant-ramcharan,项目名称:courgette-jvm,代码行数:6,代码来源:Courgette.java

示例15: CourgetteFeatureLoader

import cucumber.runtime.io.MultiLoader; //导入依赖的package包/类
public CourgetteFeatureLoader(CourgetteProperties courgetteProperties) {
    this.courgetteProperties = courgetteProperties;
    this.classLoader = Thread.currentThread().getContextClassLoader();
    this.resourceLoader = new MultiLoader(classLoader);
}
 
开发者ID:prashant-ramcharan,项目名称:courgette-jvm,代码行数:6,代码来源:CourgetteFeatureLoader.java


注:本文中的cucumber.runtime.io.MultiLoader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。