@Override
 protected void setUp() throws Exception {
   super.setUp();
   data = TracFixture.init010();
   connector =
       (TracRepositoryConnector) TasksUi.getRepositoryConnector(TracCorePlugin.CONNECTOR_KIND);
   attachmentHandler = connector.getTaskAttachmentHandler();
   repository = TracFixture.current().singleRepository(connector);
 }
 public void testValidateFailNoAuth() throws Exception {
   if (harness.getFixture().requiresAuthentication()) {
     return;
   }
   client = (TracXmlRpcClient) TracFixture.current().connect(client.getUrl(), "", "");
   try {
     client.validate(new NullProgressMonitor());
     fail("Expected TracPermissionDeniedException");
   } catch (TracPermissionDeniedException e) {
   }
 }
示例#3
0
 protected static void addTests(TestSuite suite, TracFixture fixture) {
   fixture.createSuite(suite);
   fixture.add(TracRepositoryConnectorTest.class);
   if (fixture.getAccessMode() == Version.XML_RPC) {
     fixture.add(TracTaskDataHandlerXmlRpcTest.class);
     fixture.add(TracAttachmentHandlerTest.class);
   } else {
     fixture.add(TracRepositoryConnectorWebTest.class);
   }
   fixture.done();
 }
  public void testWikiToHtml() throws Exception {
    String tracUrl = client.getUrl();
    if (tracUrl.endsWith("/")) {
      tracUrl = tracUrl.substring(0, tracUrl.length() - 1);
    }
    String html = client.wikiToHtml("", null);
    assertEquals("", html);

    html = client.wikiToHtml("A simple line of text.", null);
    assertEquals("<p>\nA simple line of text.\n</p>\n", html);

    String source =
        "= WikiFormattingTesting =\n"
            + " * '''bold''', '''!''' can be bold too''', and '''! '''\n"
            + " * ''italic''\n"
            + " * '''''bold italic'''''\n"
            + " * __underline__\n"
            + " * {{{monospace}}} or `monospace`\n"
            + " * ~~strike-through~~\n"
            + " * ^superscript^ \n"
            + " * ,,subscript,,\n"
            + "= Heading =\n"
            + "== Subheading ==\n";

    String expectedHtml;
    if (TracFixture.current().getVersion().compareTo("0.12") >= 0) {
      // the output format has changed in Trac 0.12
      expectedHtml =
          "<h1 id=\"WikiFormattingTesting\"><a class=\"missing wiki\" href=\""
              + tracUrl
              + "/wiki/WikiFormattingTesting\" rel=\"nofollow\">WikiFormattingTesting?</a></h1>\n<ul><li><strong>bold</strong>, <strong>\'\'\' can be bold too</strong>, and <strong>! </strong>\n</li><li><em>italic</em>\n</li><li><strong><em>bold italic</em></strong>\n</li><li><span class=\"underline\">underline</span>\n</li><li><tt>monospace</tt> or <tt>monospace</tt>\n</li><li><del>strike-through</del>\n</li><li><sup>superscript</sup> \n</li><li><sub>subscript</sub>\n</li></ul><h1 id=\"Heading\">Heading</h1>\n<h2 id=\"Subheading\">Subheading</h2>\n";
    } else {
      expectedHtml =
          "<h1 id=\"WikiFormattingTesting\"><a class=\"missing wiki\" href=\""
              + tracUrl
              + "/wiki/WikiFormattingTesting\" rel=\"nofollow\">WikiFormattingTesting?</a></h1>\n<ul><li><strong>bold</strong>, <strong>\'\'\' can be bold too</strong>, and <strong>! </strong>\n</li><li><i>italic</i>\n</li><li><strong><i>bold italic</i></strong>\n</li><li><span class=\"underline\">underline</span>\n</li><li><tt>monospace</tt> or <tt>monospace</tt>\n</li><li><del>strike-through</del>\n</li><li><sup>superscript</sup> \n</li><li><sub>subscript</sub>\n</li></ul><h1 id=\"Heading\">Heading</h1>\n<h2 id=\"Subheading\">Subheading</h2>\n";
    }
    html = client.wikiToHtml(source, null);
    assertEquals(expectedHtml, html);
  }
 @Override
 protected void setUp() throws Exception {
   TracFixture fixture = TracFixture.current();
   harness = fixture.createHarness();
   client = (TracXmlRpcClient) fixture.connect();
 }