コード例 #1
0
 private JSONObject makeJson() {
   response.setContentType("text/json");
   JSONObject jsonObject = new JSONObject();
   String attributes[] =
       new String[] {
         TEST.toString(),
         PropertySEARCH,
         PropertyEDIT,
         PropertyPROPERTIES,
         PropertyVERSIONS,
         PropertyREFACTOR,
         PropertyWHERE_USED,
         PropertyRECENT_CHANGES,
         SUITE.toString(),
         PropertyPRUNE,
         PropertySECURE_READ,
         PropertySECURE_WRITE,
         PropertySECURE_TEST,
         PropertyFILES
       };
   for (String attribute : attributes) addJsonAttribute(jsonObject, attribute);
   if (pageData.hasAttribute(PropertyHELP)) {
     jsonObject.put(PropertyHELP, pageData.getAttribute(PropertyHELP));
   }
   if (pageData.hasAttribute(PropertySUITES)) {
     JSONArray tags = new JSONArray();
     for (String tag : pageData.getAttribute(PropertySUITES).split(",")) {
       if (StringUtils.isNotBlank(tag)) {
         tags.put(tag.trim());
       }
     }
     jsonObject.put(PropertySUITES, tags);
   }
   return jsonObject;
 }
コード例 #2
0
 @Test
 public void testDefaultAttributesForSuitePageNames() throws Exception {
   WikiPage suitePage3 = WikiPageUtil.addPage(root, PathParser.parse("TestPageSuite"));
   PageData data = suitePage3.getData();
   assertFalse(data.hasAttribute(TEST.toString()));
   assertTrue(data.hasAttribute(SUITE.toString()));
 }
コード例 #3
0
 @Test
 public void testThatTestAtEndOfNameSetsTestProperty() throws Exception {
   WikiPage testPage2 = WikiPageUtil.addPage(root, PathParser.parse("PageTest"));
   PageData data = testPage2.getData();
   assertTrue(data.hasAttribute(TEST.toString()));
   assertFalse(data.hasAttribute(SUITE.toString()));
 }
コード例 #4
0
 @Test
 public void testThatSuiteAtBeginningOfNameSetsSuiteProperty() throws Exception {
   WikiPage suitePage1 = WikiPageUtil.addPage(root, PathParser.parse("SuitePage"));
   PageData data = suitePage1.getData();
   assertFalse(data.hasAttribute(TEST.toString()));
   assertTrue(data.hasAttribute(SUITE.toString()));
 }
コード例 #5
0
 @Test
 public void testDefaultAttributesForNormalPageNames() throws Exception {
   WikiPage normalPage = WikiPageUtil.addPage(root, PathParser.parse("NormalPage"));
   PageData data = normalPage.getData();
   assertTrue(data.hasAttribute(PropertyEDIT));
   assertTrue(data.hasAttribute(PropertySEARCH));
   assertTrue(data.hasAttribute(PropertyVERSIONS));
   assertTrue(data.hasAttribute(PropertyFILES));
   assertFalse(data.hasAttribute(TEST.toString()));
   assertFalse(data.hasAttribute(SUITE.toString()));
 }
コード例 #6
0
  public static PageType fromWikiPage(WikiPage page) {
    PageData data = page.getData();
    if (data.hasAttribute(SUITE.toString())) {
      return SUITE;
    }

    if (data.hasAttribute(TEST.toString())) {
      return TEST;
    }

    return STATIC;
  }
コード例 #7
0
  private JSONObject makeJson() {
    response.setContentType("text/json");
    JSONObject jsonObject = new JSONObject();
    String attributes[] =
        new String[] {
          TEST.toString(),
          PropertySEARCH,
          PropertyEDIT,
          PropertyPROPERTIES,
          PropertyVERSIONS,
          PropertyREFACTOR,
          PropertyWHERE_USED,
          PropertyRECENT_CHANGES,
          SUITE.toString(),
          PropertyPRUNE,
          PropertySECURE_READ,
          PropertySECURE_WRITE,
          PropertySECURE_TEST
        };
    for (String attribute : attributes) addJsonAttribute(jsonObject, attribute);

    return jsonObject;
  }
コード例 #8
0
 @Test
 public void testThatExampleAtEndOfNameSetsTestProperty() throws Exception {
   WikiPage page = WikiPageUtil.addPage(root, PathParser.parse("PageExample"));
   PageData data = page.getData();
   assertTrue(data.hasAttribute(TEST.toString()));
 }