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


Java CodeLocations类代码示例

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


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

示例1: configuration

import org.jbehave.core.io.CodeLocations; //导入依赖的package包/类
@Override
public Configuration configuration() {
    Class<? extends Embeddable> embeddableClass = this.getClass();
    // Start from default ParameterConverters instance
    ParameterConverters parameterConverters = new ParameterConverters();
    // factory to allow parameter conversion and loading from external resources (used by StoryParser too)
    ExamplesTableFactory examplesTableFactory = new ExamplesTableFactory(new LocalizedKeywords(), new LoadFromClasspath(embeddableClass), parameterConverters);
    // add custom converters
    parameterConverters.addConverters(
            new DateConverter(new SimpleDateFormat("yyyy-MM-dd")),
            new ParameterConverters.EnumConverter()
    );
    return new MostUsefulConfiguration()
            .useStoryLoader(new LoadFromClasspath(embeddableClass))
            .useStoryParser(new RegexStoryParser(examplesTableFactory))
            .useStoryReporterBuilder(new StoryReporterBuilder()
                    .withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass))
                    .withDefaultFormats()
                    .withFormats(CONSOLE, TXT, HTML, XML))
            .useParameterConverters(parameterConverters);
}
 
开发者ID:apache,项目名称:rave,代码行数:22,代码来源:Stories.java

示例2: configuration

import org.jbehave.core.io.CodeLocations; //导入依赖的package包/类
@Override
public Configuration configuration() {
    Class<? extends Embeddable> embeddableClass = this.getClass();
    // Start from default ParameterConverters instance
    ParameterConverters parameterConverters = new ParameterConverters();
    // factory to allow parameter conversion and loading from external resources (used by StoryParser too)
    ExamplesTableFactory examplesTableFactory = new ExamplesTableFactory(new LocalizedKeywords(), new LoadFromClasspath(embeddableClass), parameterConverters);
    // add custom converters
    parameterConverters.addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")),
            new ExamplesTableConverter(examplesTableFactory));
    return new MostUsefulConfiguration()
        .useStoryLoader(new LoadFromClasspath(embeddableClass))
        .useStoryParser(new RegexStoryParser(examplesTableFactory)) 
        .useStoryReporterBuilder(new StoryReporterBuilder()
            .withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass))
            .withDefaultFormats()
            .withFormats(CONSOLE, TXT, HTML, XML))
        .useParameterConverters(parameterConverters);
}
 
开发者ID:wemanity,项目名称:Acceptance-Tests-with-JBehave,代码行数:20,代码来源:MyStories.java

示例3: configuration

import org.jbehave.core.io.CodeLocations; //导入依赖的package包/类
@Override
public Configuration configuration() {
    Class<? extends Embeddable> embeddableClass = this.getClass();
    Properties viewResources = new Properties();
    viewResources.put("decorateNonHtml", "true");
    return new MostUsefulConfiguration()
            .useParanamer(paranamer)
            .useStoryLoader(new LoadFromClasspath(embeddableClass))
            .useStoryPathResolver(new UnderscoredCamelCaseResolver().removeFromClassName("Story"))
            .useStoryReporterBuilder(new StoryReporterBuilder()
                    .withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass))
                    .withDefaultFormats()
                    .withPathResolver(new FilePrintStreamFactory.ResolveToPackagedName())
                    .withViewResources(viewResources)
                    .withFormats(CONSOLE, TXT, HTML, XML))
            .useParameterConverters(new ParameterConverters()
                    .addConverters(new ParameterConverters.NumberConverter(), new DateConverter(new SimpleDateFormat("yyyy-MM-dd")))) // use custom date pattern
            .useStepPatternParser(new RegexPrefixCapturingPatternParser(
                    "$")) // use '%' instead of '$' to identify parameters
            .useStepMonitor(new SilentStepMonitor());
}
 
开发者ID:yujunliang,项目名称:seleniumcapsules,代码行数:22,代码来源:AllStoryRunner.java

示例4: runStories

import org.jbehave.core.io.CodeLocations; //导入依赖的package包/类
private void runStories(String... storyPaths) {
    StoryReporterBuilder storyReporterBuilder = new StoryReporterBuilder().withDefaultFormats()
            .withCodeLocation(CodeLocations.codeLocationFromClass(ReportTransformBehaviour.class))
            .withFormats(Format.XML);

    Configuration configuration = new MostUsefulConfiguration()
            .useStoryLoader(new LoadFromClasspath(this.getClass())).useStoryReporterBuilder(storyReporterBuilder)
            .useFailureStrategy(new SilentlyAbsorbingFailure())
            .useStepCollector(new MarkUnmatchedStepsAsPending(new StepFinder(new ByLevenshteinDistance())));

    Embedder embedder = new Embedder();
    embedder.useEmbedderControls(new EmbedderControls().doGenerateViewAfterStories(false));
    embedder.useConfiguration(configuration);
    embedder.useCandidateSteps(new InstanceStepsFactory(configuration, new MySteps()).createCandidateSteps());
    embedder.useMetaFilters(asList("-skip true"));

    try {
        embedder.runStoriesAsPaths(asList(storyPaths));
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:23,代码来源:ReportTransformBehaviour.java

示例5: configuration

import org.jbehave.core.io.CodeLocations; //导入依赖的package包/类
@Override
public Configuration configuration() {
	Class<? extends TraderEmbedder> embedderClass = this.getClass();
	return new MostUsefulConfiguration()
		.useStoryLoader(new LoadFromClasspath(embedderClass.getClassLoader()))
		.useStoryReporterBuilder(new StoryReporterBuilder()
       		.withCodeLocation(CodeLocations.codeLocationFromClass(embedderClass))
       		.withDefaultFormats()
			.withFormats(CONSOLE, TXT, HTML, XML)
			.withCrossReference(new CrossReference()))
           .useParameterConverters(new ParameterConverters()
               	.addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")))) // use custom date pattern
           .useStepPatternParser(new RegexPrefixCapturingPatternParser(
						"%")) // use '%' instead of '$' to identify parameters
		.useStepMonitor(new SilentStepMonitor());								
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:17,代码来源:TraderEmbedder.java

示例6: configuration

import org.jbehave.core.io.CodeLocations; //导入依赖的package包/类
@Override
public Configuration configuration() {
    Class<? extends Embeddable> embeddableClass = this.getClass();
    // Start from default ParameterConverters instance
    ParameterConverters parameterConverters = new ParameterConverters();
    // factory to allow parameter conversion and loading from external resources (used by StoryParser too)
    ExamplesTableFactory examplesTableFactory = new ExamplesTableFactory(new LocalizedKeywords(), new LoadFromClasspath(embeddableClass), parameterConverters);
    // add custom converters
    parameterConverters.addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")),
            new ExamplesTableConverter(examplesTableFactory));
    return new MostUsefulConfiguration()
    .useStoryLoader(new LoadFromClasspath(embeddableClass))
    .useStoryParser(new RegexStoryParser(examplesTableFactory))
    .useStoryReporterBuilder(new StoryReporterBuilder()
    .withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass))
    .withDefaultFormats()
    .withFormats(CONSOLE, TXT, HTML, XML))
    .useParameterConverters(parameterConverters);
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:20,代码来源:MyStories.java

示例7: PlayersCanHazTurns

import org.jbehave.core.io.CodeLocations; //导入依赖的package包/类
public PlayersCanHazTurns() {        
   ClassLoader classLoader = this.getClass().getClassLoader();
   URL codeLocation = CodeLocations.codeLocationFromClass(this.getClass());
   Keywords keywords = new LocalizedKeywords(new Locale("lc"),
           "i18n/keywords", classLoader);
   Configuration configuration = new MostUsefulConfiguration()
       .useKeywords(keywords)
       .useStoryParser(new RegexStoryParser(keywords))
       .useStoryPathResolver(new UnderscoredCamelCaseResolver(""))
       .useStoryReporterBuilder(new StoryReporterBuilder()
               .withCodeLocation(codeLocation)
               .withDefaultFormats()
               .withFormats(CONSOLE, TXT)
               .withFailureTrace(true)
               .withKeywords(keywords));
   useConfiguration(configuration);
   WindowControl windowControl = new WindowControl();        
   addSteps(new InstanceStepsFactory(configuration, new LolCatzSteps(windowControl), new BeforeAndAfterSteps(windowControl)).createCandidateSteps());
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:20,代码来源:PlayersCanHazTurns.java

示例8: shouldCreateAndWriteToFilePrintStreamForStoryLocation

import org.jbehave.core.io.CodeLocations; //导入依赖的package包/类
@Test
public void shouldCreateAndWriteToFilePrintStreamForStoryLocation() throws IOException {

    // Given
    String storyPath = storyPath(MyStory.class);
    FilePrintStreamFactory factory = new FilePrintStreamFactory(new StoryLocation(CodeLocations.codeLocationFromClass(this.getClass()), storyPath));
    File file = factory.outputFile();
    file.delete();
    assertThat(file.exists(), is(false));
    
    // When
    PrintStream printStream = factory.createPrintStream();
    file = factory.getOutputFile();
    printStream.print("Hello World");

    // Then
    assertThat(file.exists(), is(true));
    assertThat(IOUtils.toString(new FileReader(file), true), equalTo("Hello World"));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:20,代码来源:PrintStreamOutputBehaviour.java

示例9: shouldAllowOverrideOfDefaultConfiguration

import org.jbehave.core.io.CodeLocations; //导入依赖的package包/类
@Test
public void shouldAllowOverrideOfDefaultConfiguration(){
    // Given
    URL codeLocation = CodeLocations.codeLocationFromClass(this.getClass());
    String storyPath = "org/jbehave/examples/trader/stories/my_given.story";
    FileConfiguration configuration = new FileConfiguration("ext");
    
    // When
    FilePrintStreamFactory factory = new FilePrintStreamFactory(new StoryLocation(codeLocation, storyPath), configuration);
    assertThat(factory.configuration(), equalTo(configuration));        
    FileConfiguration newConfiguration = new FileConfiguration();
    factory.useConfiguration(newConfiguration);
    
    // Then
    assertThat(factory.configuration(), not(equalTo(configuration)));        
    assertThat(factory.configuration().toString(), containsString(FileConfiguration.EXTENSION));        
    assertThat(factory.configuration().toString(), containsString(FileConfiguration.RELATIVE_DIRECTORY));        
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:19,代码来源:FilePrintStreamFactoryBehaviour.java

示例10: shouldFailIfPrintStreamCannotBeCreated

import org.jbehave.core.io.CodeLocations; //导入依赖的package包/类
@Test(expected=PrintStreamCreationFailed.class)
public void shouldFailIfPrintStreamCannotBeCreated(){
    // Given
    URL codeLocation = CodeLocations.codeLocationFromClass(this.getClass());
    String storyPath = "org/jbehave/examples/trader/stories/my_given.story";
    FileConfiguration configuration = new FileConfiguration("ext");
    FilePrintStreamFactory factory = new FilePrintStreamFactory(new StoryLocation(codeLocation, storyPath), configuration){
        protected File outputDirectory() {
            return new File((String)null);
        }
    };
    // When
    factory.createPrintStream();
    
    // Then fail as expected
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:17,代码来源:FilePrintStreamFactoryBehaviour.java

示例11: shouldBuildWithCustomCodeLocation

import org.jbehave.core.io.CodeLocations; //导入依赖的package包/类
@Test
public void shouldBuildWithCustomCodeLocation() throws IOException {
    // Given
    StoryReporterBuilder builder = new StoryReporterBuilder();
    String storyPath = storyPath(MyStory.class);
    URL codeLocation = CodeLocations.codeLocationFromPath("target/custom/location");
    // When
    builder.withFormats(TXT).withCodeLocation(codeLocation).build(storyPath);

    // Then
    assertThat(builder.codeLocation(), equalTo(codeLocation));
    FilePrintStreamFactory factory = builder.filePrintStreamFactory(storyPath);
    assertThat(factory.outputDirectory().getPath().replace('\\', '/'), endsWith("custom/"
            + factory.configuration().getRelativeDirectory()));

}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:17,代码来源:StoryReporterBuilderBehaviour.java

示例12: shouldBuildWithCustomReportersAsProvidedFormat

import org.jbehave.core.io.CodeLocations; //导入依赖的package包/类
@Test
public void shouldBuildWithCustomReportersAsProvidedFormat() throws IOException {
    // Given
    String storyPath = storyPath(MyStory.class);
    FilePrintStreamFactory factory = new FilePrintStreamFactory(new StoryLocation(
            CodeLocations.codeLocationFromClass(MyStory.class), storyPath));
    StoryReporter txtReporter = new TxtOutput(factory.createPrintStream(), new Properties(),
            new LocalizedKeywords(), true);
    StoryReporter htmlReporter = new TxtOutput(factory.createPrintStream(), new Properties(),
            new LocalizedKeywords(), true);
    StoryReporterBuilder builder = new StoryReporterBuilder();

    // When
    StoryReporter reporter = builder.withReporters(txtReporter, htmlReporter).build(storyPath);

    // Then
    assertThat(reporter, instanceOf(ConcurrentStoryReporter.class));
    StoryReporter delegate = ((ConcurrentStoryReporter) reporter).getDelegate();
    assertThat(delegate, instanceOf(DelegatingStoryReporter.class));
    Collection<StoryReporter> delegates = ((DelegatingStoryReporter) delegate).getDelegates();
    assertThat(delegates.size(), equalTo(2));
    assertThat(delegates.contains(txtReporter), is(true));
    assertThat(delegates.contains(htmlReporter), is(true));
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:25,代码来源:StoryReporterBuilderBehaviour.java

示例13: configuration

import org.jbehave.core.io.CodeLocations; //导入依赖的package包/类
@Override
  public Configuration configuration() {
      Class<? extends Embeddable> embeddableClass = this.getClass();
      // Start from default ParameterConverters instance
      ParameterConverters parameterConverters = new ParameterConverters();
      // factory to allow parameter conversion and loading from external resources (used by StoryParser too)
      ExamplesTableFactory examplesTableFactory = new ExamplesTableFactory(new LocalizedKeywords(), new LoadFromClasspath(embeddableClass), parameterConverters);
      // add custom coverters
      parameterConverters.addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")),
              new ExamplesTableConverter(examplesTableFactory));
    //  parameterConverters.addConverters(new MyConverter());
   //   parameterConverters.addConverters(new StudentConverter(new ExamplesTableFactory()));

CrossReference xref = new CrossReference();
return new MostUsefulConfiguration()
          .useStoryLoader(new LoadFromClasspath(embeddableClass))
          .useStoryParser(new RegexStoryParser(examplesTableFactory)) 
          .useStoryReporterBuilder(new StoryReporterBuilder()
              .withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass))
              .withDefaultFormats()
              .withCrossReference(xref )
              .withFormats(CONSOLE, TXT, WebDriverHtmlOutput.WEB_DRIVER_HTML, XML))
          .useParameterConverters(parameterConverters);
  }
 
开发者ID:saikrishna321,项目名称:JBehave-Selendroid-Android-Automation,代码行数:25,代码来源:MyStoriesMaps.java

示例14: runTests

import org.jbehave.core.io.CodeLocations; //导入依赖的package包/类
public void runTests(final long timeOut,StepDefinition... stepDefinitions){
    JBehaveSettings jBehaveSettings = new JBehaveSettings();
    jBehaveSettings.setEmbedder(timeOut, stepDefinitions);
    List<String>s=new StoryFinder ( ).
            findPaths ( CodeLocations.codeLocationFromClass(this.getClass()),
                    "**/*.story", null );
    jBehaveSettings.getEmbedder().runStoriesAsPaths(s);

}
 
开发者ID:kishor32,项目名称:kabo,代码行数:10,代码来源:TestRunner.java

示例15: configuration

import org.jbehave.core.io.CodeLocations; //导入依赖的package包/类
@Override
public Configuration configuration() {
    return new MostUsefulConfiguration()
        .useStoryParser(new RegexStoryParser(new ExamplesTableFactory(new LoadFromClasspath(this.getClass()))))
        .useStoryReporterBuilder(new StoryReporterBuilder()
            .withCodeLocation(CodeLocations.codeLocationFromClass(this.getClass())));
}
 
开发者ID:deniskiriusin,项目名称:combinatorius,代码行数:8,代码来源:CombinatoriusStoryMaps.java


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