Search in sources :

Example 1 with WebhookSendInfoDao

use of com.navercorp.pinpoint.web.dao.WebhookSendInfoDao 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());
}
Also used : WebhookSendInfoDao(com.navercorp.pinpoint.web.dao.WebhookSendInfoDao) MemoryWebhookSendInfoDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookSendInfoDao) MemoryWebhookDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao) WebhookDao(com.navercorp.pinpoint.web.dao.WebhookDao) MemoryWebhookSendInfoDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookSendInfoDao) WebhookSendInfo(com.navercorp.pinpoint.web.vo.WebhookSendInfo) Test(org.junit.Test)

Example 2 with WebhookSendInfoDao

use of com.navercorp.pinpoint.web.dao.WebhookSendInfoDao 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);
}
Also used : WebhookSendInfoDao(com.navercorp.pinpoint.web.dao.WebhookSendInfoDao) MemoryWebhookSendInfoDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookSendInfoDao) MemoryWebhookDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao) WebhookDao(com.navercorp.pinpoint.web.dao.WebhookDao) MemoryWebhookDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao) MemoryWebhookSendInfoDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookSendInfoDao) Webhook(com.navercorp.pinpoint.web.vo.Webhook) AlarmDao(com.navercorp.pinpoint.web.dao.AlarmDao) Test(org.junit.Test)

Example 3 with WebhookSendInfoDao

use of com.navercorp.pinpoint.web.dao.WebhookSendInfoDao 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());
}
Also used : WebhookSendInfoDao(com.navercorp.pinpoint.web.dao.WebhookSendInfoDao) MemoryWebhookSendInfoDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookSendInfoDao) MemoryWebhookDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao) WebhookDao(com.navercorp.pinpoint.web.dao.WebhookDao) MemoryWebhookDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao) MemoryWebhookSendInfoDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookSendInfoDao) Webhook(com.navercorp.pinpoint.web.vo.Webhook) AlarmDao(com.navercorp.pinpoint.web.dao.AlarmDao) Test(org.junit.Test)

Example 4 with WebhookSendInfoDao

use of com.navercorp.pinpoint.web.dao.WebhookSendInfoDao 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());
}
Also used : WebhookSendInfoDao(com.navercorp.pinpoint.web.dao.WebhookSendInfoDao) MemoryWebhookSendInfoDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookSendInfoDao) MemoryWebhookDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao) WebhookDao(com.navercorp.pinpoint.web.dao.WebhookDao) MemoryWebhookDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao) MemoryWebhookSendInfoDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookSendInfoDao) Webhook(com.navercorp.pinpoint.web.vo.Webhook) AlarmDao(com.navercorp.pinpoint.web.dao.AlarmDao) Test(org.junit.Test)

Example 5 with WebhookSendInfoDao

use of com.navercorp.pinpoint.web.dao.WebhookSendInfoDao 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());
}
Also used : WebhookSendInfoDao(com.navercorp.pinpoint.web.dao.WebhookSendInfoDao) MemoryWebhookSendInfoDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookSendInfoDao) MemoryWebhookDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao) WebhookDao(com.navercorp.pinpoint.web.dao.WebhookDao) MemoryWebhookDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao) MemoryWebhookSendInfoDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookSendInfoDao) Webhook(com.navercorp.pinpoint.web.vo.Webhook) AlarmDao(com.navercorp.pinpoint.web.dao.AlarmDao) Test(org.junit.Test)

Aggregations

WebhookDao (com.navercorp.pinpoint.web.dao.WebhookDao)10 WebhookSendInfoDao (com.navercorp.pinpoint.web.dao.WebhookSendInfoDao)10 MemoryWebhookDao (com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao)10 MemoryWebhookSendInfoDao (com.navercorp.pinpoint.web.dao.memory.MemoryWebhookSendInfoDao)10 Test (org.junit.Test)10 WebhookSendInfo (com.navercorp.pinpoint.web.vo.WebhookSendInfo)6 AlarmDao (com.navercorp.pinpoint.web.dao.AlarmDao)4 Webhook (com.navercorp.pinpoint.web.vo.Webhook)4