Search in sources :

Example 6 with WebhookSendInfo

use of com.navercorp.pinpoint.web.vo.WebhookSendInfo in project pinpoint by naver.

the class WebhookSendInfoServiceImplTest method insertAndDeleteWebhookSendInfoTest.

@Test
public void insertAndDeleteWebhookSendInfoTest() {
    WebhookSendInfoDao webhookSendInfoDao = new MemoryWebhookSendInfoDao(mock(WebhookDao.class));
    WebhookSendInfoService webhookSendInfoService = new WebhookSendInfoServiceImpl(webhookSendInfoDao);
    WebhookSendInfo webhookSendInfo = new WebhookSendInfo("0", "1340", "4115234");
    webhookSendInfoService.insertWebhookSendInfo(webhookSendInfo);
    WebhookSendInfo selectedWebhookSendInfo = webhookSendInfoDao.selectWebhookSendInfo("0");
    assertEquals(webhookSendInfo.getRuleId(), selectedWebhookSendInfo.getRuleId());
    assertEquals(webhookSendInfo.getWebhookId(), selectedWebhookSendInfo.getWebhookId());
    assertEquals(webhookSendInfo.getWebhookSendInfoId(), selectedWebhookSendInfo.getWebhookSendInfoId());
    webhookSendInfoService.deleteWebhookSendInfo(webhookSendInfo);
    selectedWebhookSendInfo = webhookSendInfoDao.selectWebhookSendInfo("0");
    assertNull(selectedWebhookSendInfo);
}
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 7 with WebhookSendInfo

use of com.navercorp.pinpoint.web.vo.WebhookSendInfo in project pinpoint by naver.

the class WebhookSendInfoServiceImplTest method updateWebhookSendInfoTest.

@Test
public void updateWebhookSendInfoTest() {
    WebhookSendInfoDao webhookSendInfoDao = new MemoryWebhookSendInfoDao(mock(WebhookDao.class));
    WebhookSendInfoService webhookSendInfoService = new WebhookSendInfoServiceImpl(webhookSendInfoDao);
    WebhookSendInfo webhookSendInfo = new WebhookSendInfo("0", "1340", "4115234");
    webhookSendInfoService.insertWebhookSendInfo(webhookSendInfo);
    WebhookSendInfo updatewebhookSendInfo = new WebhookSendInfo("0", "1531", "4135");
    webhookSendInfoService.updateWebhookSendInfo(updatewebhookSendInfo);
    WebhookSendInfo selectedWebhookSendInfo = webhookSendInfoDao.selectWebhookSendInfo("0");
    assertNotEquals(webhookSendInfo, selectedWebhookSendInfo);
    assertEquals(updatewebhookSendInfo.getWebhookSendInfoId(), selectedWebhookSendInfo.getWebhookSendInfoId());
    assertEquals(updatewebhookSendInfo.getWebhookId(), selectedWebhookSendInfo.getWebhookId());
    assertEquals(updatewebhookSendInfo.getRuleId(), selectedWebhookSendInfo.getRuleId());
}
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 8 with WebhookSendInfo

use of com.navercorp.pinpoint.web.vo.WebhookSendInfo in project pinpoint by naver.

the class WebhookSendInfoServiceImplTest method selectWebhookSendInfoByServiceApplicationIdTest.

@Test
public void selectWebhookSendInfoByServiceApplicationIdTest() {
    WebhookDao webhookDao = mock(MemoryWebhookDao.class);
    WebhookSendInfoDao webhookSendInfoDao = new MemoryWebhookSendInfoDao(webhookDao);
    WebhookSendInfoService webhookSendInfoService = new WebhookSendInfoServiceImpl(webhookSendInfoDao);
    for (WebhookSendInfo webhookSendInfo : webhookSendInfoList) {
        webhookSendInfoService.insertWebhookSendInfo(webhookSendInfo);
    }
    when(webhookDao.selectWebhookByApplicationId("testApp")).thenReturn(webhookList);
    List<WebhookSendInfo> selectedWebhookSendInfos = webhookSendInfoService.selectWebhookSendInfoByApplicationId("testApp");
    assertEquals(1, selectedWebhookSendInfos.size());
}
Also used : MemoryWebhookDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao) WebhookDao(com.navercorp.pinpoint.web.dao.WebhookDao) WebhookSendInfoDao(com.navercorp.pinpoint.web.dao.WebhookSendInfoDao) MemoryWebhookSendInfoDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookSendInfoDao) MemoryWebhookSendInfoDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookSendInfoDao) WebhookSendInfo(com.navercorp.pinpoint.web.vo.WebhookSendInfo) Test(org.junit.Test)

Example 9 with WebhookSendInfo

use of com.navercorp.pinpoint.web.vo.WebhookSendInfo in project pinpoint by naver.

the class WebhookSendInfoServiceImplTest method selectWebhookSendInfoByServiceNameTest.

@Test
public void selectWebhookSendInfoByServiceNameTest() {
    WebhookDao webhookDao = mock(WebhookDao.class);
    WebhookSendInfoDao webhookSendInfoDao = new MemoryWebhookSendInfoDao(webhookDao);
    when(webhookDao.selectWebhookByServiceName("testGroup")).thenReturn(webhookList);
    WebhookSendInfoService webhookSendInfoService = new WebhookSendInfoServiceImpl(webhookSendInfoDao);
    for (WebhookSendInfo webhookSendInfo : webhookSendInfoList) {
        webhookSendInfoService.insertWebhookSendInfo(webhookSendInfo);
    }
    List<WebhookSendInfo> selectedWebhookSendInfos = webhookSendInfoService.selectWebhookSendInfoByServiceName("testGroup");
    assertEquals(1, selectedWebhookSendInfos.size());
}
Also used : MemoryWebhookDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao) WebhookDao(com.navercorp.pinpoint.web.dao.WebhookDao) WebhookSendInfoDao(com.navercorp.pinpoint.web.dao.WebhookSendInfoDao) MemoryWebhookSendInfoDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookSendInfoDao) MemoryWebhookSendInfoDao(com.navercorp.pinpoint.web.dao.memory.MemoryWebhookSendInfoDao) WebhookSendInfo(com.navercorp.pinpoint.web.vo.WebhookSendInfo) Test(org.junit.Test)

Example 10 with WebhookSendInfo

use of com.navercorp.pinpoint.web.vo.WebhookSendInfo 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;
}
Also used : Webhook(com.navercorp.pinpoint.web.vo.Webhook) WebhookSendInfo(com.navercorp.pinpoint.web.vo.WebhookSendInfo) LinkedList(java.util.LinkedList)

Aggregations

WebhookSendInfo (com.navercorp.pinpoint.web.vo.WebhookSendInfo)10 WebhookDao (com.navercorp.pinpoint.web.dao.WebhookDao)6 WebhookSendInfoDao (com.navercorp.pinpoint.web.dao.WebhookSendInfoDao)6 MemoryWebhookDao (com.navercorp.pinpoint.web.dao.memory.MemoryWebhookDao)6 MemoryWebhookSendInfoDao (com.navercorp.pinpoint.web.dao.memory.MemoryWebhookSendInfoDao)6 Test (org.junit.Test)6 Webhook (com.navercorp.pinpoint.web.vo.Webhook)3 LinkedList (java.util.LinkedList)2 Before (org.junit.Before)1