use of com.navercorp.pinpoint.web.vo.Webhook 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.vo.Webhook 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.vo.Webhook 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());
}
use of com.navercorp.pinpoint.web.vo.Webhook in project pinpoint by naver.
the class MemoryWebhookSendInfoDao method selectWebhookSendInfoByServiceName.
@Override
public List<WebhookSendInfo> selectWebhookSendInfoByServiceName(String serviceName) {
List<WebhookSendInfo> selectedWebhookSendInfos = new LinkedList<>();
List<Webhook> webhooks = webhookDao.selectWebhookByServiceName(serviceName);
for (Webhook webhook : webhooks) {
for (WebhookSendInfo webhookSendInfo : webhookSendInfos.values()) {
if (webhook.getWebhookId().equals(webhookSendInfo.getWebhookId())) {
selectedWebhookSendInfos.add(webhookSendInfo);
}
}
}
return selectedWebhookSendInfos;
}
Aggregations