예제 #1
0
  /** Helper function to Create a template provider for the tests in this class. */
  private ViewPage createTemplate(
      String templateProviderName,
      String templateContent,
      String templateTitle,
      boolean saveAndEdit) {
    String space = this.getClass().getSimpleName();
    getUtil().deletePage(space, TEMPLATE_NAME);
    getUtil().deletePage(space, TEMPLATE_NAME + "Provider");

    String templateFullName = space + "." + TEMPLATE_NAME;

    // Create a template
    WikiEditPage editTemplatePage = WikiEditPage.gotoPage(space, TEMPLATE_NAME);
    editTemplatePage.setTitle(templateTitle);
    editTemplatePage.setContent(templateContent);
    editTemplatePage.clickSaveAndView();

    // Create the template provider
    TemplatesAdministrationSectionPage sectionPage = TemplatesAdministrationSectionPage.gotoPage();
    TemplateProviderInlinePage templateProviderInline =
        sectionPage.createTemplateProvider(space, templateProviderName);
    templateProviderInline.setTemplateName("My Template");
    templateProviderInline.setTemplate(templateFullName);
    if (saveAndEdit) {
      templateProviderInline.setSaveAndEdit();
    }
    return templateProviderInline.clickSaveAndView();
  }