use of org.json.JSONObject in project solo by b3log.
the class PageMgmtServiceTestCase method addPage.
/**
* Add Page.
*
* @throws Exception exception
*/
@Test(dependsOnMethods = "init")
public void addPage() throws Exception {
final PageMgmtService pageMgmtService = getPageMgmtService();
final JSONObject requestJSONObject = new JSONObject();
final JSONObject page = new JSONObject();
requestJSONObject.put(Page.PAGE, page);
page.put(Page.PAGE_CONTENT, "page1 content");
page.put(Page.PAGE_PERMALINK, "page1 permalink");
page.put(Page.PAGE_TITLE, "page1 title");
page.put(Page.PAGE_COMMENTABLE, true);
page.put(Page.PAGE_TYPE, "page");
page.put(Page.PAGE_OPEN_TARGET, "_self");
final String pageId = pageMgmtService.addPage(requestJSONObject);
Assert.assertNotNull(pageId);
}
use of org.json.JSONObject in project solo by b3log.
the class PageQueryServiceTestCase method addPage.
/**
* Add Page.
*
* @throws Exception exception
*/
@Test(dependsOnMethods = "init")
public void addPage() throws Exception {
final PageMgmtService pageMgmtService = getPageMgmtService();
final JSONObject requestJSONObject = new JSONObject();
final JSONObject page = new JSONObject();
requestJSONObject.put(Page.PAGE, page);
page.put(Page.PAGE_CONTENT, "page1 content");
page.put(Page.PAGE_PERMALINK, "page1 permalink");
page.put(Page.PAGE_TITLE, "page1 title");
page.put(Page.PAGE_COMMENTABLE, true);
page.put(Page.PAGE_TYPE, "page");
page.put(Page.PAGE_OPEN_TARGET, "_self");
final String pageId = pageMgmtService.addPage(requestJSONObject);
Assert.assertNotNull(pageId);
}
use of org.json.JSONObject in project solo by b3log.
the class PageQueryServiceTestCase method getPages.
/**
* Get Pages.
*
* @throws Exception exception
*/
@Test(dependsOnMethods = "addPage")
public void getPages() throws Exception {
final PageQueryService pageQueryService = getPageQueryService();
final JSONObject paginationRequest = Requests.buildPaginationRequest("1/10/20");
final JSONObject result = pageQueryService.getPages(paginationRequest);
Assert.assertNotNull(result);
Assert.assertEquals(result.getJSONArray(Page.PAGES).length(), 1);
}
use of org.json.JSONObject in project solo by b3log.
the class PreferenceMgmtServiceTestCase method updateReplyNotificationTemplate.
/**
* Update Reply Notification Template.
*
* @throws Exception exception
*/
@Test(dependsOnMethods = "init")
public void updateReplyNotificationTemplate() throws Exception {
final PreferenceMgmtService preferenceMgmtService = getPreferenceMgmtService();
final PreferenceQueryService preferenceQueryService = getPreferenceQueryService();
JSONObject replyNotificationTemplate = preferenceQueryService.getReplyNotificationTemplate();
Assert.assertEquals(replyNotificationTemplate.toString(), Option.DefaultPreference.DEFAULT_REPLY_NOTIFICATION_TEMPLATE);
replyNotificationTemplate.put("subject", "updated subject");
preferenceMgmtService.updateReplyNotificationTemplate(replyNotificationTemplate);
replyNotificationTemplate = preferenceQueryService.getReplyNotificationTemplate();
Assert.assertEquals(replyNotificationTemplate.getString("subject"), "updated subject");
}
use of org.json.JSONObject in project solo by b3log.
the class PreferenceMgmtServiceTestCase method init.
/**
* Init.
*
* @throws Exception exception
*/
@Test
public void init() throws Exception {
final InitService initService = getInitService();
final JSONObject requestJSONObject = new JSONObject();
requestJSONObject.put(User.USER_EMAIL, "test@gmail.com");
requestJSONObject.put(User.USER_NAME, "Admin");
requestJSONObject.put(User.USER_PASSWORD, "pass");
initService.init(requestJSONObject);
final UserQueryService userQueryService = getUserQueryService();
Assert.assertNotNull(userQueryService.getUserByEmail("test@gmail.com"));
}
Aggregations