use of org.b3log.solo.repository.TagArticleRepository in project solo by b3log.
the class TagArticleRepositoryImplTestCase method add.
/**
* Add.
*
* @throws Exception exception
*/
@Test
public void add() throws Exception {
final TagArticleRepository tagArticleRepository = getTagArticleRepository();
final JSONObject tagArticle = new JSONObject();
tagArticle.put(Article.ARTICLE + "_" + Keys.OBJECT_ID, "article1 id");
tagArticle.put(Tag.TAG + "_" + Keys.OBJECT_ID, "tag1 id");
final Transaction transaction = tagArticleRepository.beginTransaction();
tagArticleRepository.add(tagArticle);
transaction.commit();
}
use of org.b3log.solo.repository.TagArticleRepository in project solo by b3log.
the class TagRepositoryImplTestCase method addTagArticle.
private void addTagArticle() throws Exception {
final TagArticleRepository tagArticleRepository = getTagArticleRepository();
final JSONObject tagArticle = new JSONObject();
tagArticle.put(Article.ARTICLE + "_" + Keys.OBJECT_ID, "article1 id");
tagArticle.put(Tag.TAG + "_" + Keys.OBJECT_ID, "tag1 id");
final Transaction transaction = tagArticleRepository.beginTransaction();
tagArticleRepository.add(tagArticle);
transaction.commit();
}
use of org.b3log.solo.repository.TagArticleRepository in project solo by b3log.
the class TagArticleRepositoryImplTestCase method getByTagId.
/**
* Get By TagId.
*
* @throws Exception exception
*/
@Test(dependsOnMethods = "add")
public void getByTagId() throws Exception {
final TagArticleRepository tagArticleRepository = getTagArticleRepository();
final JSONArray results = tagArticleRepository.getByTagId("tag1 id", 1, Integer.MAX_VALUE).getJSONArray(Keys.RESULTS);
Assert.assertEquals(1, results.length());
}
use of org.b3log.solo.repository.TagArticleRepository in project solo by b3log.
the class TagArticleRepositoryImplTestCase method getByArticleId.
/**
* Get By ArticleId.
*
* @throws Exception exception
*/
@Test(dependsOnMethods = "add")
public void getByArticleId() throws Exception {
final TagArticleRepository tagArticleRepository = getTagArticleRepository();
final List<JSONObject> tagArticle = tagArticleRepository.getByArticleId("article1 id");
Assert.assertNotNull(tagArticle);
Assert.assertEquals(0, tagArticleRepository.getByArticleId("").size());
}
Aggregations