org.sonar.db.webhook.WebhookDeliveryDao.countDeliveriesByWebhookUuid()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中org.sonar.db.webhook.WebhookDeliveryDao.countDeliveriesByWebhookUuid()方法的一些代码示例,展示了WebhookDeliveryDao.countDeliveriesByWebhookUuid()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebhookDeliveryDao.countDeliveriesByWebhookUuid()方法的具体详情如下:
包路径:org.sonar.db.webhook.WebhookDeliveryDao
类名称:WebhookDeliveryDao
方法名:countDeliveriesByWebhookUuid

WebhookDeliveryDao.countDeliveriesByWebhookUuid介绍

暂无

代码示例

代码示例来源:origin: SonarSource/sonarqube

private Data loadFromDatabase(@Nullable String webhookUuid, @Nullable String ceTaskId, @Nullable String componentKey, int page, int pageSize) {
 ComponentDto component;
 List<WebhookDeliveryLiteDto> deliveries;
 int totalElements;
 try (DbSession dbSession = dbClient.openSession(false)) {
  if (isNotBlank(webhookUuid)) {
   totalElements = dbClient.webhookDeliveryDao().countDeliveriesByWebhookUuid(dbSession, webhookUuid);
   deliveries = dbClient.webhookDeliveryDao().selectByWebhookUuid(dbSession, webhookUuid, offset(page, pageSize), pageSize);
   component = getComponentDto(dbSession, deliveries);
  } else if (componentKey != null) {
   component = componentFinder.getByKey(dbSession, componentKey);
   totalElements = dbClient.webhookDeliveryDao().countDeliveriesByComponentUuid(dbSession, component.uuid());
   deliveries = dbClient.webhookDeliveryDao().selectOrderedByComponentUuid(dbSession, component.uuid(), offset(page, pageSize), pageSize);
  } else {
   totalElements = dbClient.webhookDeliveryDao().countDeliveriesByCeTaskUuid(dbSession, ceTaskId);
   deliveries = dbClient.webhookDeliveryDao().selectOrderedByCeTaskUuid(dbSession, ceTaskId, offset(page, pageSize), pageSize);
   component = getComponentDto(dbSession, deliveries);
  }
 }
 return new Data(component, deliveries).withPagingInfo(page, pageSize, totalElements);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void delete_a_project_webhook() {
 ComponentDto project = componentDbTester.insertPrivateProject();
 WebhookDto dto = webhookDbTester.insertWebhook(project);
 webhookDeliveryDbTester.insert(newDto().setWebhookUuid(dto.getUuid()));
 webhookDeliveryDbTester.insert(newDto().setWebhookUuid(dto.getUuid()));
 userSession.logIn().addProjectPermission(ADMIN, project);
 TestResponse response = wsActionTester.newRequest()
  .setParam(KEY_PARAM, dto.getUuid())
  .execute();
 assertThat(response.getStatus()).isEqualTo(HTTP_NO_CONTENT);
 Optional<WebhookDto> reloaded = webhookDbTester.selectWebhook(dto.getUuid());
 assertThat(reloaded).isEmpty();
 int deliveriesCount = deliveryDao.countDeliveriesByWebhookUuid(dbSession, dto.getUuid());
 assertThat(deliveriesCount).isEqualTo(0);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void delete_an_organization_webhook() {
 OrganizationDto organization = organizationDbTester.insert();
 WebhookDto dto = webhookDbTester.insertWebhook(organization);
 webhookDeliveryDbTester.insert(newDto().setWebhookUuid(dto.getUuid()));
 webhookDeliveryDbTester.insert(newDto().setWebhookUuid(dto.getUuid()));
 userSession.logIn().addPermission(ADMINISTER, organization.getUuid());
 TestResponse response = wsActionTester.newRequest()
  .setParam(KEY_PARAM, dto.getUuid())
  .execute();
 assertThat(response.getStatus()).isEqualTo(HTTP_NO_CONTENT);
 Optional<WebhookDto> reloaded = webhookDbTester.selectWebhook(dto.getUuid());
 assertThat(reloaded).isEmpty();
 int deliveriesCount = deliveryDao.countDeliveriesByWebhookUuid(dbSession, dto.getUuid());
 assertThat(deliveriesCount).isEqualTo(0);
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-server

private Data loadFromDatabase(@Nullable String webhookUuid, @Nullable String ceTaskId, @Nullable String componentKey, int page, int pageSize) {
 ComponentDto component;
 List<WebhookDeliveryLiteDto> deliveries;
 int totalElements;
 try (DbSession dbSession = dbClient.openSession(false)) {
  if (isNotBlank(webhookUuid)) {
   totalElements = dbClient.webhookDeliveryDao().countDeliveriesByWebhookUuid(dbSession, webhookUuid);
   deliveries = dbClient.webhookDeliveryDao().selectByWebhookUuid(dbSession, webhookUuid, offset(page, pageSize), pageSize);
   component = getComponentDto(dbSession, deliveries);
  } else if (componentKey != null) {
   component = componentFinder.getByKey(dbSession, componentKey);
   totalElements = dbClient.webhookDeliveryDao().countDeliveriesByComponentUuid(dbSession, component.uuid());
   deliveries = dbClient.webhookDeliveryDao().selectOrderedByComponentUuid(dbSession, component.uuid(), offset(page, pageSize), pageSize);
  } else {
   totalElements = dbClient.webhookDeliveryDao().countDeliveriesByCeTaskUuid(dbSession, ceTaskId);
   deliveries = dbClient.webhookDeliveryDao().selectOrderedByCeTaskUuid(dbSession, ceTaskId, offset(page, pageSize), pageSize);
   component = getComponentDto(dbSession, deliveries);
  }
 }
 return new Data(component, deliveries).withPagingInfo(page, pageSize, totalElements);
}

相关文章