Package org.jbehave.core.io.rest

Examples of org.jbehave.core.io.rest.Resource


  @Test
  public void canFormatAsJSONWithGivenSyntax() {
      UploadToXWiki uploader = new UploadToXWiki(Type.JSON);
    String resourcePath = "http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/some_story";
    String content = read("xwiki.json");
    Resource resource = new Resource(resourcePath);
    resource.setContent(content);
    resource.setSyntax("jbehave/3.0");
    String entity = uploader.entity(resource, Type.JSON);
    assertThat(entity, containsString("\"title\":\"some_story\""));
    assertThat(entity, containsString("\"syntax\":\"jbehave/3.0\""));
  }
View Full Code Here


  @Test
  public void canFormatAsJSON() {
      UploadToRedmine uploader = new UploadToRedmine(Type.JSON);
    String resourcePath = "http://demo.redmine.org/project/jbehave/wiki/some_story";
    String text = read("redmine.json");
    Resource resource = new Resource(resourcePath);
    resource.setContent(text);
    String entity = uploader.entity(resource, Type.JSON);
    assertThat(entity, startsWith("{\"wiki_page\""));
  }
View Full Code Here

        // Given
        final ResourceIndexer indexer = mock(ResourceIndexer.class);
        final ResourceLoader loader = mock(ResourceLoader.class);
        String rootURI = "http://wiki";
        Map<String, Resource> index = new HashMap<String, Resource>();
        index.put("one", new Resource(rootURI + "/one"));
        index.put("two", new Resource(rootURI + "/two"));
        when(indexer.indexResources(rootURI)).thenReturn(index);
        String text1 = "story text 1";
        when(loader.loadResourceAsText(index.get("one").getURI())).thenReturn(text1);
        String text2 = "story text 2";
        when(loader.loadResourceAsText(index.get("two").getURI())).thenReturn(text2);
View Full Code Here

  }

  @When("story $name text contains '$text'")
  public void storyIsLoaded(String name, String text) {
    ResourceLoader loader = resourceLoader();
    Resource resource = index.get(name);
    String asText = loader.loadResourceAsText(resource.getURI());
    assertThat(asText, containsString(text));
  }
View Full Code Here

  }

  @When("story $name is uploaded appending '$text'")
  public void storyIsUploaded(String name, String text) {
    ResourceUploader uploader = resourceupLoader();
    Resource resource = index.get(name);
    resource.setContent(resource.getContent()+" "+text);
    uploader.uploadResource(resource);
  }
View Full Code Here

TOP

Related Classes of org.jbehave.core.io.rest.Resource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.