use of com.navercorp.pinpoint.web.vo.WebhookSendInfo in project pinpoint by naver.
the class AlarmServiceImpl method updateRuleWithWebhooks.
@Override
public void updateRuleWithWebhooks(Rule rule, List<String> webhookIds) {
updateRule(rule);
List<WebhookSendInfo> oldListofWebhookInfos = webhookSendInfoDao.selectWebhookSendInfoByRuleId(rule.getRuleId());
for (WebhookSendInfo webhookSendInfo : oldListofWebhookInfos) {
// remove already existing webhook mapping to this alarm from webhookIds
if (!webhookIds.remove(webhookSendInfo.getWebhookId())) {
// webhook not linked to this alarm anymore, so delete from mysql
webhookSendInfoDao.deleteWebhookSendInfo(webhookSendInfo);
}
}
// adds newly mapped webhooks to this alarm
for (String webhookId : webhookIds) {
webhookSendInfoDao.insertWebhookSendInfo(new WebhookSendInfo("", webhookId, rule.getRuleId()));
}
}
use of com.navercorp.pinpoint.web.vo.WebhookSendInfo in project pinpoint by naver.
the class MemoryWebhookSendInfoDao method selectWebhookSendInfoByApplicationId.
@Override
public List<WebhookSendInfo> selectWebhookSendInfoByApplicationId(String applicationId) {
List<WebhookSendInfo> selectedWebhookSendInfos = new LinkedList<>();
List<Webhook> webhooks = webhookDao.selectWebhookByApplicationId(applicationId);
for (Webhook webhook : webhooks) {
for (WebhookSendInfo webhookSendInfo : webhookSendInfos.values()) {
if (webhook.getWebhookId().equals(webhookSendInfo.getWebhookId())) {
selectedWebhookSendInfos.add(webhookSendInfo);
}
}
}
return selectedWebhookSendInfos;
}
use of com.navercorp.pinpoint.web.vo.WebhookSendInfo in project pinpoint by naver.
the class WebhookSendInfoServiceImplTest method deleteAndSelectWebhookSendInfoByWebhookIdTest.
@Test
public void deleteAndSelectWebhookSendInfoByWebhookIdTest() {
WebhookSendInfoDao webhookSendInfoDao = new MemoryWebhookSendInfoDao(mock(WebhookDao.class));
WebhookSendInfoService webhookSendInfoService = new WebhookSendInfoServiceImpl(webhookSendInfoDao);
for (WebhookSendInfo webhookSendInfo : webhookSendInfoList) {
webhookSendInfoService.insertWebhookSendInfo(webhookSendInfo);
}
List<WebhookSendInfo> selectedWebhookSendInfos = webhookSendInfoService.selectWebhookSendInfoByWebhookId("5134");
assertEquals(2, selectedWebhookSendInfos.size());
webhookSendInfoService.deleteWebhookSendInfoByWebhookId("5134");
selectedWebhookSendInfos = webhookSendInfoService.selectWebhookSendInfoByWebhookId("5134");
assertEquals(0, selectedWebhookSendInfos.size());
}
use of com.navercorp.pinpoint.web.vo.WebhookSendInfo in project pinpoint by naver.
the class WebhookSendInfoServiceImplTest method before.
@Before
public void before() {
webhookSendInfoList = new ArrayList<>(3);
webhookSendInfoList.add(new WebhookSendInfo("0", "1340", "4115234"));
webhookSendInfoList.add(new WebhookSendInfo("1", "5134", "4115234"));
webhookSendInfoList.add(new WebhookSendInfo("2", "5134", "4115230"));
webhookList = new ArrayList<>(2);
webhookList.add(new Webhook("1340", "webhook", "testUrl", "testApp", "testGroup"));
webhookList.add(new Webhook("1341", "webhook1", "testUrl1", "testApp", "testGroup"));
}
use of com.navercorp.pinpoint.web.vo.WebhookSendInfo in project pinpoint by naver.
the class WebhookSendInfoServiceImplTest method deleteAndSelectWebhookSendInfoByRuleIdTest.
@Test
public void deleteAndSelectWebhookSendInfoByRuleIdTest() {
WebhookSendInfoDao webhookSendInfoDao = new MemoryWebhookSendInfoDao(mock(WebhookDao.class));
WebhookSendInfoService webhookSendInfoService = new WebhookSendInfoServiceImpl(webhookSendInfoDao);
for (WebhookSendInfo webhookSendInfo : webhookSendInfoList) {
webhookSendInfoService.insertWebhookSendInfo(webhookSendInfo);
}
List<WebhookSendInfo> selectedWebhookSendInfos = webhookSendInfoService.selectWebhookSendInfoByRuleId("4115234");
assertEquals(2, selectedWebhookSendInfos.size());
webhookSendInfoService.deleteWebhookSendInfoByRuleId("4115234");
selectedWebhookSendInfos = webhookSendInfoService.selectWebhookSendInfoByWebhookId("4115234");
assertEquals(0, selectedWebhookSendInfos.size());
}
Aggregations