use of org.junit.jupiter.api.AfterAll in project jnosql-diana-driver by eclipse.
the class CouchbaseSetTest method afterClass.
@AfterAll
public static void afterClass() {
CouchbaseKeyValueConfiguration configuration = new CouchbaseKeyValueConfiguration();
BucketManagerFactory keyValueEntityManagerFactory = configuration.get();
BucketManager keyValueEntityManager = keyValueEntityManagerFactory.getBucketManager(CouchbaseUtil.BUCKET_NAME);
keyValueEntityManager.remove("jnosql:set");
}
use of org.junit.jupiter.api.AfterAll in project rubia-forums by flashboss.
the class SearchTest method stop.
@AfterAll
public static void stop() {
log.debug("stopped test");
Response response = get(FORUMS_URL + "findCategories/1", authorization);
List<CategoryBean> categoryBeans = response.readEntity(new GenericType<List<CategoryBean>>() {
});
CategoryRequestBean categoryRequestBean = new CategoryRequestBean();
categoryRequestBean.setCategory(categoryBeans.stream().filter(x -> x.getTitle().equals("First Test Category")).collect(toList()).get(0));
categoryRequestBean.setLimit(3);
response = post(FORUMS_URL + "findPostsFromCategoryDesc", authorization, categoryRequestBean);
List<PostBean> postBeans = response.readEntity(new GenericType<List<PostBean>>() {
});
assertEquals(3, postBeans.size(), "Posts size");
response = get(FORUMS_URL + "removePost/" + postBeans.get(0).getId() + "/false", authorization);
response = get(FORUMS_URL + "removePost/" + postBeans.get(1).getId() + "/false", authorization);
response = get(FORUMS_URL + "removePost/" + postBeans.get(2).getId() + "/true", authorization);
response = post(FORUMS_URL + "findPostsFromCategoryDesc", authorization, categoryRequestBean);
postBeans = response.readEntity(new GenericType<List<PostBean>>() {
});
response = get(FORUMS_URL + "findTopics/1", authorization);
List<TopicBean> topicBeans = response.readEntity(new GenericType<List<TopicBean>>() {
});
PosterBean posterBean = topicBeans.get(0).getPoster();
topicBeans.forEach(x -> {
get(FORUMS_URL + "removeTopic/" + x.getId(), authorization);
});
response = get(FORUMS_URL + "findTopics/1", authorization);
topicBeans = response.readEntity(new GenericType<List<TopicBean>>() {
});
response = get(FORUMS_URL + "removePoster/" + posterBean.getId(), authorization);
PosterBean removedPosterBean = response.readEntity(PosterBean.class);
response = get(FORUMS_URL + "findPosterByUserId/" + removedPosterBean.getUserId(), authorization);
posterBean = response.readEntity(PosterBean.class);
response = get(FORUMS_URL + "findForums/1", authorization);
List<ForumBean> forumBeans = response.readEntity(new GenericType<List<ForumBean>>() {
});
response = get(FORUMS_URL + "findCategories/1", authorization);
categoryBeans = response.readEntity(new GenericType<List<CategoryBean>>() {
});
get(FORUMS_URL + "removeForum/" + forumBeans.get(1).getId(), authorization);
get(FORUMS_URL + "removeCategory/" + categoryBeans.get(1).getId(), authorization);
response.close();
}
use of org.junit.jupiter.api.AfterAll in project rubia-forums by flashboss.
the class CategoryTest method stop.
@AfterAll
public static void stop() {
log.debug("stopped test");
Response response = get(url + "findCategories/1", authorization);
List<CategoryBean> categoryBeans = response.readEntity(new GenericType<List<CategoryBean>>() {
});
assertEquals(3, categoryBeans.size(), "Categories size");
response = get(url + "removeCategory/" + categoryBeans.get(1).getId(), authorization);
response = get(url + "findCategoryById/" + categoryBeans.get(1).getId(), authorization);
try {
response.readEntity(CategoryBean.class);
fail("Category not removed");
} catch (ProcessingException ex) {
}
response = get(url + "removeCategory/" + categoryBeans.get(2).getId(), authorization);
response = get(url + "findCategoryById/" + categoryBeans.get(2).getId(), authorization);
try {
response.readEntity(CategoryBean.class);
fail("Category not removed");
} catch (ProcessingException ex) {
}
response.close();
}
use of org.junit.jupiter.api.AfterAll in project rubia-forums by flashboss.
the class AttachmentTest method stop.
@AfterAll
public static void stop() {
log.debug("stopped test");
Response response = get(url + "findCategories/1", authorization);
List<CategoryBean> categoryBeans = response.readEntity(new GenericType<List<CategoryBean>>() {
});
CategoryRequestBean categoryRequestBean = new CategoryRequestBean();
categoryRequestBean.setCategory(categoryBeans.stream().filter(x -> x.getTitle().equals("First Test Category")).collect(toList()).get(0));
categoryRequestBean.setLimit(3);
response = post(url + "findPostsFromCategoryDesc", authorization, categoryRequestBean);
List<PostBean> postBeans = response.readEntity(new GenericType<List<PostBean>>() {
});
assertEquals(2, postBeans.size(), "Posts size");
PostBean postBean = postBeans.get(0);
response = post(url + "removeAttachments", authorization, postBean);
postBean = response.readEntity(PostBean.class);
postBean = postBeans.get(1);
response = post(url + "removeAttachments", authorization, postBean);
postBean = response.readEntity(PostBean.class);
response = post(url + "findPostsFromCategoryDesc", authorization, categoryRequestBean);
postBeans = response.readEntity(new GenericType<List<PostBean>>() {
});
assertTrue(postBeans.get(0).getAttachments().isEmpty());
assertTrue(postBeans.get(1).getAttachments().isEmpty());
get(url + "removePost/" + postBeans.get(1).getId() + "/false", authorization);
response = get(url + "findTopics/1", authorization);
List<TopicBean> topicBeans = response.readEntity(new GenericType<List<TopicBean>>() {
});
assertEquals(1, topicBeans.size(), "Topics size");
PosterBean posterBean = topicBeans.get(0).getPoster();
topicBeans.forEach(x -> {
get(url + "removeTopic/" + x.getId(), authorization);
});
response = get(url + "removePoster/" + posterBean.getId(), authorization);
PosterBean removedPosterBean = response.readEntity(PosterBean.class);
assertNotNull(removedPosterBean, "Poster removed by poster operations");
response = get(url + "findForums/1", authorization);
List<ForumBean> forumBeans = response.readEntity(new GenericType<List<ForumBean>>() {
});
assertEquals(3, forumBeans.size(), "Forums size");
response = get(url + "findCategories/1", authorization);
categoryBeans = response.readEntity(new GenericType<List<CategoryBean>>() {
});
assertEquals(2, categoryBeans.size(), "Categories size");
get(url + "removeForum/" + forumBeans.get(1).getId(), authorization);
get(url + "removeCategory/" + categoryBeans.get(1).getId(), authorization);
response.close();
}
use of org.junit.jupiter.api.AfterAll in project rubia-forums by flashboss.
the class WatchTest method stop.
@AfterAll
public static void stop() {
log.debug("stopped test");
WatchRequestBean watchRequestBean = new WatchRequestBean();
watchRequestBean.setIndexInstance(1);
UserBean user = new UserBean();
user.setId("root");
watchRequestBean.setUser(user);
Response response = post(url + "findForumWatches", authorization, watchRequestBean);
Map<String, ForumWatchBean> forumWatches = response.readEntity(new GenericType<Map<String, ForumWatchBean>>() {
});
assertEquals(1, forumWatches.size());
ForumWatchBean forumWatchBean = forumWatches.values().iterator().next();
post(url + "removeWatch", authorization, forumWatchBean);
response = post(url + "findForumWatches", authorization, watchRequestBean);
forumWatches = response.readEntity(new GenericType<Map<String, ForumWatchBean>>() {
});
assertEquals(0, forumWatches.size());
response = post(url + "findTopicWatches", authorization, watchRequestBean);
Map<String, TopicWatchBean> topicWatches = response.readEntity(new GenericType<Map<String, TopicWatchBean>>() {
});
assertEquals(1, topicWatches.size());
TopicWatchBean topicWatchBean = topicWatches.values().iterator().next();
post(url + "removeWatch", authorization, topicWatchBean);
response = post(url + "findTopicWatches", authorization, watchRequestBean);
topicWatches = response.readEntity(new GenericType<Map<String, TopicWatchBean>>() {
});
assertEquals(0, topicWatches.size());
response = get(url + "findTopics/1", authorization);
List<TopicBean> topicBeans = response.readEntity(new GenericType<List<TopicBean>>() {
});
assertEquals(2, topicBeans.size(), "Topics size");
PosterBean posterBean = topicBeans.get(0).getPoster();
topicBeans.forEach(x -> {
get(url + "removeTopic/" + x.getId(), authorization);
});
response = get(url + "findTopics/1", authorization);
topicBeans = response.readEntity(new GenericType<List<TopicBean>>() {
});
assertEquals(0, topicBeans.size(), "Topics size");
response = get(url + "removePoster/" + posterBean.getId(), authorization);
PosterBean removedPosterBean = response.readEntity(PosterBean.class);
assertNotNull(removedPosterBean, "Poster removed by poster operations");
response = get(url + "findPosterByUserId/" + removedPosterBean.getUserId(), authorization);
posterBean = response.readEntity(PosterBean.class);
assertNull(posterBean, "Poster removed verified by poster operations");
response = get(url + "findForums/1", authorization);
List<ForumBean> forumBeans = response.readEntity(new GenericType<List<ForumBean>>() {
});
assertEquals(3, forumBeans.size(), "Forums size");
response = get(url + "findCategories/1", authorization);
List<CategoryBean> categoryBeans = response.readEntity(new GenericType<List<CategoryBean>>() {
});
assertEquals(2, categoryBeans.size(), "Categories size");
get(url + "removeForum/" + forumBeans.get(1).getId(), authorization);
get(url + "removeCategory/" + categoryBeans.get(1).getId(), authorization);
response.close();
}
Aggregations