use of com.nixmash.blog.jpa.model.Post in project nixmash-blog by mintster.
the class PostCachingTests method validateCacheByPostName.
@Test
public void validateCacheByPostName() throws Exception {
assertThat(postCache.get("a-java-collection-of-value-pairs-tuples")).isNull();
Post post = postService.getPost("a-java-collection-of-value-pairs-tuples");
assertThat((Post) postCache.get(post.getPostName()).get()).isEqualTo(post);
}
use of com.nixmash.blog.jpa.model.Post in project nixmash-blog by mintster.
the class JsoupServiceImpl method updateAllPostMeta.
// endregion
// region TwitterCards
@Override
public void updateAllPostMeta(List<Post> posts) {
for (Post post : posts) {
PostMeta updated = updatePostMeta(PostUtils.postToPostDTO(post));
post.setPostMeta(updated);
}
}
use of com.nixmash.blog.jpa.model.Post in project nixmash-blog by mintster.
the class PostDocServiceImpl method addAllToIndex.
@Transactional
@Override
public void addAllToIndex(List<Post> posts) {
logger.debug("Saving all Post Documents to Index");
List<PostDoc> postDocs = new ArrayList<>();
for (Post post : posts) {
postDocs.add(SolrUtils.createPostDoc(post));
}
customPostDocRepository.save(postDocs);
commit();
}
use of com.nixmash.blog.jpa.model.Post in project nixmash-blog by mintster.
the class SolrPostReindexTests method cleanAndReindexPostDocuments_AddIndividually.
@Test
@Ignore(value = "It works, no need to wait for it to run each time")
public void cleanAndReindexPostDocuments_AddIndividually() throws Exception {
posts = postService.getAllPublishedPosts();
postCount = posts.size();
for (Post post : posts) {
postDocService.addToIndex(post);
}
List<PostDoc> postDocs = postDocService.getAllPostDocuments();
assertEquals(postDocs.size(), postCount);
postDocs = postDocService.getPostsWithUserQuery("bootstrap");
assertEquals(BOOTSTRAP_POST_COUNT, postDocs.size());
Query query = new SimpleQuery(new SimpleStringCriteria("doctype:post"));
solrOperations.delete(query);
solrOperations.commit();
}
use of com.nixmash.blog.jpa.model.Post in project nixmash-blog by mintster.
the class SolrPostTests method addPostWithRepository.
@Test
public void addPostWithRepository() throws Exception {
// using postId 10 which is "Solr Rama"
Post post = postService.getPostById(10L);
PostDoc postDoc = SolrUtils.createPostDoc(post);
customPostDocRepository.save(postDoc);
PostDoc found = customPostDocRepository.findOne("10");
assertEquals(found.getPostName(), "solr-rama");
customPostDocRepository.delete("10");
}
Aggregations