Search in sources :

Example 1 with ArchiveDateArticleRepository

use of org.b3log.solo.repository.ArchiveDateArticleRepository in project solo by b3log.

the class ArchiveDateArticleRepositoryImplTestCase method getByArchiveDateId.

/**
     * Get By ArchiveDate Id.
     *
     * @throws Exception exception
     */
@Test(dependsOnMethods = "add")
public void getByArchiveDateId() throws Exception {
    final ArchiveDateArticleRepository archiveDateArticleRepository = getArchiveDateArticleRepository();
    final JSONObject found = archiveDateArticleRepository.getByArchiveDateId("archiveDateId", 1, Integer.MAX_VALUE);
    Assert.assertNotNull(found);
    final JSONObject notFound = archiveDateArticleRepository.getByArchiveDateId("not found", 1, Integer.MAX_VALUE);
    Assert.assertNotNull(notFound);
}
Also used : JSONObject(org.json.JSONObject) ArchiveDateArticleRepository(org.b3log.solo.repository.ArchiveDateArticleRepository) Test(org.testng.annotations.Test)

Example 2 with ArchiveDateArticleRepository

use of org.b3log.solo.repository.ArchiveDateArticleRepository in project solo by b3log.

the class ArchiveDateArticleRepositoryImplTestCase method add.

/**
     * Adds successfully.
     *
     * @throws Exception exception
     */
@Test
public void add() throws Exception {
    final ArchiveDateArticleRepository archiveDateArticleRepository = getArchiveDateArticleRepository();
    final JSONObject archiveDateArticle = new JSONObject();
    archiveDateArticle.put(ArchiveDate.ARCHIVE_DATE + "_" + Keys.OBJECT_ID, "archiveDateId");
    archiveDateArticle.put(Article.ARTICLE + "_" + Keys.OBJECT_ID, "articleId");
    final Transaction transaction = archiveDateArticleRepository.beginTransaction();
    archiveDateArticleRepository.add(archiveDateArticle);
    transaction.commit();
    final JSONObject found = archiveDateArticleRepository.getByArticleId("articleId");
    Assert.assertNotNull(found);
    final JSONObject notFound = archiveDateArticleRepository.getByArticleId("not found");
    Assert.assertNull(notFound);
}
Also used : JSONObject(org.json.JSONObject) Transaction(org.b3log.latke.repository.Transaction) ArchiveDateArticleRepository(org.b3log.solo.repository.ArchiveDateArticleRepository) Test(org.testng.annotations.Test)

Example 3 with ArchiveDateArticleRepository

use of org.b3log.solo.repository.ArchiveDateArticleRepository in project solo by b3log.

the class ArchiveDateArticleRepositoryImplTestCase method getByArticleId.

/**
     * Get By Archive Id.
     *
     * @throws Exception exception
     */
@Test(dependsOnMethods = "add")
public void getByArticleId() throws Exception {
    final ArchiveDateArticleRepository archiveDateArticleRepository = getArchiveDateArticleRepository();
    Assert.assertNotNull(archiveDateArticleRepository.getByArticleId("articleId"));
    Assert.assertNull(archiveDateArticleRepository.getByArticleId("not found"));
}
Also used : ArchiveDateArticleRepository(org.b3log.solo.repository.ArchiveDateArticleRepository) Test(org.testng.annotations.Test)

Aggregations

ArchiveDateArticleRepository (org.b3log.solo.repository.ArchiveDateArticleRepository)3 Test (org.testng.annotations.Test)3 JSONObject (org.json.JSONObject)2 Transaction (org.b3log.latke.repository.Transaction)1