Search in sources :

Example 1 with MemoryWebhookDao

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);
}
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 2 with MemoryWebhookDao

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());
}
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 MemoryWebhookDao

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());
}
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 MemoryWebhookDao

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());
}
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

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