use of org.json.JSONObject in project solo by b3log.
the class LinkMgmtServiceTestCase method addLink.
/**
* Add Link.
*
* @throws Exception exception
*/
@Test(dependsOnMethods = "init")
public void addLink() throws Exception {
final LinkMgmtService linkMgmtService = getLinkMgmtService();
final JSONObject requestJSONObject = new JSONObject();
final JSONObject link = new JSONObject();
requestJSONObject.put(Link.LINK, link);
link.put(Link.LINK_TITLE, "link1 title");
link.put(Link.LINK_ADDRESS, "link1 address");
link.put(Link.LINK_DESCRIPTION, "link1 description");
final String linkId = linkMgmtService.addLink(requestJSONObject);
Assert.assertNotNull(linkId);
}
use of org.json.JSONObject in project solo by b3log.
the class LinkQueryServiceTestCase method getLinks.
/**
* Get Links.
*
* @throws Exception exception
*/
@Test(dependsOnMethods = "addLink")
public void getLinks() throws Exception {
final LinkQueryService linkQueryService = getLinkQueryService();
final JSONObject paginationRequest = Requests.buildPaginationRequest("1/10/20");
final JSONObject result = linkQueryService.getLinks(paginationRequest);
Assert.assertNotNull(result);
Assert.assertEquals(result.getJSONArray(Link.LINKS).length(), 2);
}
use of org.json.JSONObject in project solo by b3log.
the class LinkQueryServiceTestCase 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"));
}
use of org.json.JSONObject in project solo by b3log.
the class OptionMgmtServiceTestCase method add.
/**
* Add.
*
* @throws Exception exception
*/
@Test
public void add() throws Exception {
final OptionMgmtService optionMgmtService = getOptionMgmtService();
final JSONObject option = new JSONObject();
option.put(Keys.OBJECT_ID, Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_BROADCAST);
option.put(Option.OPTION_VALUE, 0L);
final String id = optionMgmtService.addOrUpdateOption(option);
System.out.println(id);
Assert.assertNotNull(id);
}
use of org.json.JSONObject in project solo by b3log.
the class TagProcessorTestCase 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