Package smartrics.rest.fitnesse.fixture.support

Examples of smartrics.rest.fitnesse.fixture.support.Config


    private PartsFactory f;

    @Before
    public void setUp() {
        Config c = Config.getConfig();
        c.add("http.client.use.new.http.uri.factory", "false");
        f = new PartsFactory();
    }
View Full Code Here


        assertThat(f.buildRestRequest(), is(instanceOf(RestRequest.class)));
    }

    @Test
    public void buildsRestClientWithStandardUri() throws Exception {
        Config c = Config.getConfig();
        RestClient restClient = f.buildRestClient(c);
        assertThat(restClient, is(instanceOf(RestClient.class)));
        Method m = getCreateUriMethod(restClient);
        m.setAccessible(true);
        Object r = m.invoke(restClient, "http://localhost:9900?something", false);
View Full Code Here

    }

    @Test
    public void buildsRestClientWithoutSquareBracketsInUri() throws Exception {
        // URI validation will throw an exception as per httpclient 3.1
        Config c = Config.getConfig();
        RestClient restClient = f.buildRestClient(c);
        assertThat(restClient, is(instanceOf(RestClient.class)));
        Method m = getCreateUriMethod(restClient);
        m.setAccessible(true);
        try {
View Full Code Here

    }

    @Test
    public void buildsRestClientWithEscapedSquareBracketsInUri() throws Exception {
        // URI will be escaped as per httpclient 3.1
        Config c = Config.getConfig();
        RestClient restClient = f.buildRestClient(c);
        assertThat(restClient, is(instanceOf(RestClient.class)));
        Method m = getCreateUriMethod(restClient);
        m.setAccessible(true);
        Object r = m.invoke(restClient, "http://localhost:9900?something[data]=1", false);
View Full Code Here

        assertThat(r.toString(), is(equalTo("http://localhost:9900?something%5Bdata%5D=1")));
    }

    @Test
    public void buildsRestClientWithSquareBracketsInUri() throws Exception {
        Config c = Config.getConfig();
        c.add("http.client.use.new.http.uri.factory", "true");
        RestClient restClient = f.buildRestClient(c);
        assertThat(restClient, is(instanceOf(RestClient.class)));
        Method m = getCreateUriMethod(restClient);
        m.setAccessible(true);
        Object r = m.invoke(restClient, "http://localhost:9900?something[data]=1", false);
View Full Code Here

        assertThat(u.getQuery(), is(equalTo("something[data]=1")));
    }

    @Test
    public void buildsRestClientWithDefaultURIFactory() throws Exception {
        Config c = Config.getConfig();
        RestClient restClient = f.buildRestClient(c);
        assertThat(restClient, is(instanceOf(RestClient.class)));
        Method m = getGetMethodClassnameFromMethodNameMethod(restClient);
        m.setAccessible(true);
        Object r = m.invoke(restClient, "Some");
View Full Code Here

        assertThat(r.toString(), is(equalTo("org.apache.commons.httpclient.methods.SomeMethod")));
    }

    @Test
    public void buildsRestClientWithNewURIFactory() throws Exception {
        Config c = Config.getConfig();
        c.add("http.client.use.new.http.uri.factory", "true");
        RestClient restClient = f.buildRestClient(c);
        assertThat(restClient, is(instanceOf(RestClient.class)));
        Method m = getGetMethodClassnameFromMethodNameMethod(restClient);
        m.setAccessible(true);
        Object r = m.invoke(restClient, "Some");
View Full Code Here

   *
   * @param rows
   * @return the content as a list (of rows) of lists of strings (the cells).
   */
  public List<List<String>> doTable(List<List<String>> rows) {
    Config c = getConfig();
    for (List<String> row : rows) {
      String k = row.get(0);
      if (row.size() == 2) {
        k = row.get(0);
        String v = row.get(1);
        c.add(k, v);
        row.set(0, "");
        row.set(1, "pass:" + Tools.toHtml(v));
      } else {
        row.set(0,
            "error:"
View Full Code Here

  public void doRow(Parse p) {
    Parse cells = p.parts;
    try {
      String key = cells.text();
      String value = cells.more.text();
      Config c = getConfig();
      c.add(key, value);
      String fValue = Tools.toHtml(value);
      Parse valueParse = cells.more;
      valueParse.body = fValue;
      right(valueParse);
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of smartrics.rest.fitnesse.fixture.support.Config

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.