use of com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao in project pinpoint by naver.
the class WebhookServiceImplTest method insertAndDeleteWebhookTest.
@Test
public void insertAndDeleteWebhookTest() {
WebhookSendInfoDao webhookSendInfoDao = new MemoryWebhookSendInfoDao(mock(WebhookDao.class));
WebhookDao webhookDao = new MemoryWebhookDao(mock(AlarmDao.class));
WebhookService webhookService = new WebhookServiceImpl(webhookDao, webhookSendInfoDao);
Webhook webhook = new Webhook("0", "alias", "url", "applicationId", "groupId");
webhookService.insertWebhook(webhook);
Webhook selectedWebhook = webhookDao.selectWebhook("0");
assertEquals(webhook.getWebhookId(), selectedWebhook.getWebhookId());
assertEquals(webhook.getAlias(), selectedWebhook.getAlias());
assertEquals(webhook.getUrl(), selectedWebhook.getUrl());
assertEquals(webhook.getApplicationId(), selectedWebhook.getApplicationId());
assertEquals(webhook.getServiceName(), selectedWebhook.getServiceName());
webhookService.deleteWebhook(webhook);
selectedWebhook = webhookDao.selectWebhook("0");
assertNull(selectedWebhook);
}
use of com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao in project pinpoint by naver.
the class WebhookServiceImplTest method selectWebhookByServiceNameTest.
@Test
public void selectWebhookByServiceNameTest() {
WebhookSendInfoDao webhookSendInfoDao = new MemoryWebhookSendInfoDao(mock(WebhookDao.class));
WebhookDao webhookDao = new MemoryWebhookDao(mock(AlarmDao.class));
WebhookService webhookService = new WebhookServiceImpl(webhookDao, webhookSendInfoDao);
for (Webhook webhook : webhookList) {
webhookService.insertWebhook(webhook);
}
List<Webhook> selectedWebhooks = webhookService.selectWebhookByServiceName("testGroup1");
assertEquals(2, selectedWebhooks.size());
webhookService.deleteWebhookByServiceName("testGroup1");
selectedWebhooks = webhookService.selectWebhookByServiceName("testGroup1");
assertEquals(0, selectedWebhooks.size());
}
use of com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao in project pinpoint by naver.
the class WebhookServiceImplTest method updateWebhookSendInfoTest.
@Test
public void updateWebhookSendInfoTest() {
WebhookSendInfoDao webhookSendInfoDao = new MemoryWebhookSendInfoDao(mock(WebhookDao.class));
WebhookDao webhookDao = new MemoryWebhookDao(mock(AlarmDao.class));
WebhookService webhookService = new WebhookServiceImpl(webhookDao, webhookSendInfoDao);
Webhook webhook = new Webhook("0", "alias", "url", "applicationId", "groupId");
webhookService.insertWebhook(webhook);
Webhook updateWebhook = new Webhook("0", "alias1", "url1", "applicationId1", "groupId1");
webhookService.updateWebhook(updateWebhook);
Webhook selectedWebhook = webhookDao.selectWebhook("0");
assertNotEquals(webhook, selectedWebhook);
assertEquals(updateWebhook.getWebhookId(), selectedWebhook.getWebhookId());
assertEquals(updateWebhook.getAlias(), selectedWebhook.getAlias());
assertEquals(updateWebhook.getUrl(), selectedWebhook.getUrl());
assertEquals(updateWebhook.getApplicationId(), selectedWebhook.getApplicationId());
assertEquals(updateWebhook.getServiceName(), selectedWebhook.getServiceName());
}
use of com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao in project pinpoint by naver.
the class WebhookServiceImplTest method deleteAndSelectWebhookByApplicationIdTest.
@Test
public void deleteAndSelectWebhookByApplicationIdTest() {
WebhookSendInfoDao webhookSendInfoDao = new MemoryWebhookSendInfoDao(mock(WebhookDao.class));
WebhookDao webhookDao = new MemoryWebhookDao(mock(AlarmDao.class));
WebhookService webhookService = new WebhookServiceImpl(webhookDao, webhookSendInfoDao);
for (Webhook webhook : webhookList) {
webhookService.insertWebhook(webhook);
}
List<Webhook> selectedWebhooks = webhookService.selectWebhookByApplicationId("testApp");
assertEquals(2, selectedWebhooks.size());
webhookService.deleteWebhookByApplicationId("testApp");
selectedWebhooks = webhookService.selectWebhookByApplicationId("testApp");
assertEquals(0, selectedWebhooks.size());
}
Aggregations