use of org.b3log.solo.repository.ArchiveDateRepository in project solo by b3log.
the class ArchiveDateRepositoryImplTestCase method add.
/**
* Adds successfully.
*
* @throws Exception exception
*/
@Test
public void add() throws Exception {
final ArchiveDateRepository archiveDateRepository = getArchiveDateRepository();
final JSONObject archiveDate = new JSONObject();
archiveDate.put(ArchiveDate.ARCHIVE_TIME, DateUtils.parseDate("2011/12", new String[] { "yyyy/MM" }).getTime());
archiveDate.put(ArchiveDate.ARCHIVE_DATE_ARTICLE_COUNT, 1);
archiveDate.put(ArchiveDate.ARCHIVE_DATE_PUBLISHED_ARTICLE_COUNT, 1);
final Transaction transaction = archiveDateRepository.beginTransaction();
archiveDateRepository.add(archiveDate);
transaction.commit();
final List<JSONObject> archiveDates = archiveDateRepository.getArchiveDates();
Assert.assertNotNull(archiveDates);
Assert.assertEquals(1, archiveDates.size());
}
use of org.b3log.solo.repository.ArchiveDateRepository in project solo by b3log.
the class ArchiveDateRepositoryImplTestCase method getByArchiveDate.
/**
* Get By ArchiveDate.
*
* @throws Exception exception
*/
@Test(dependsOnMethods = "add")
public void getByArchiveDate() throws Exception {
final ArchiveDateRepository archiveDateRepository = getArchiveDateRepository();
final JSONObject archiveDate = archiveDateRepository.getByArchiveDate("2011/12");
Assert.assertNotNull(archiveDate);
System.out.println(archiveDate.toString(SoloServletListener.JSON_PRINT_INDENT_FACTOR));
}
Aggregations