- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.sonar.db.webhook.WebhookDto.getUuid()
方法的一些代码示例,展示了WebhookDto.getUuid()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebhookDto.getUuid()
方法的具体详情如下:
包路径:org.sonar.db.webhook.WebhookDto
类名称:WebhookDto
方法名:getUuid
暂无
代码示例来源:origin: SonarSource/sonarqube
public Map<String, WebhookDeliveryLiteDto> selectLatestDeliveries(DbSession dbSession, List<WebhookDto> webhooks) {
return webhooks.stream()
.flatMap(webhook -> selectByWebhookUuid(dbSession, webhook.getUuid(),0,1).stream())
.collect(toMap(WebhookDeliveryLiteDto::getWebhookUuid, identity()));
}
代码示例来源:origin: SonarSource/sonarqube
public void deleteByWebhook(DbSession dbSession, WebhookDto webhook) {
mapper(dbSession).deleteByWebhookUuid(webhook.getUuid());
}
}
代码示例来源:origin: SonarSource/sonarqube
private void deleteWebhook(DbSession dbSession, WebhookDto webhookDto) {
dbClient.webhookDeliveryDao().deleteByWebhook(dbSession, webhookDto);
dbClient.webhookDao().delete(dbSession, webhookDto.getUuid());
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void selectLatestDelivery_of_a_webhook() {
WebhookDto webhook1 = dbWebhooks.insert(newProjectWebhook("COMPONENT_1"));
underTest.insert(dbSession, WebhookDeliveryTesting.newDto("WH1-DELIVERY-1-UUID", webhook1.getUuid(), "COMPONENT_1", "TASK_1").setCreatedAt(BEFORE));
underTest.insert(dbSession, WebhookDeliveryTesting.newDto("WH1-DELIVERY-2-UUID", webhook1.getUuid(), "COMPONENT_1", "TASK_2").setCreatedAt(NOW));
WebhookDto webhook2 = dbWebhooks.insert(newProjectWebhook("COMPONENT_1"));
underTest.insert(dbSession, WebhookDeliveryTesting.newDto("WH2-DELIVERY-1-UUID", webhook2.getUuid(), "COMPONENT_1", "TASK_1").setCreatedAt(BEFORE));
underTest.insert(dbSession, WebhookDeliveryTesting.newDto("WH2-DELIVERY-2-UUID", webhook2.getUuid(), "COMPONENT_1", "TASK_2").setCreatedAt(NOW));
Map<String, WebhookDeliveryLiteDto> map = underTest.selectLatestDeliveries(dbSession, of(webhook1, webhook2));
assertThat(map).containsKeys(webhook1.getUuid());
assertThat(map.get(webhook1.getUuid())).extracting(WebhookDeliveryLiteDto::getUuid).contains("WH1-DELIVERY-2-UUID");
assertThat(map).containsKeys(webhook2.getUuid());
assertThat(map.get(webhook2.getUuid())).extracting(WebhookDeliveryLiteDto::getUuid).contains("WH2-DELIVERY-2-UUID");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void delete() {
OrganizationDto organization = organizationDbTester.insert();
WebhookDto dto = webhookDbTester.insertWebhook(organization);
underTest.delete(dbSession, dto.getUuid());
Optional<WebhookDto> reloaded = underTest.selectByUuid(dbSession, dto.getUuid());
assertThat(reloaded).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void update() {
OrganizationDto organization = organizationDbTester.insert();
WebhookDto dto = webhookDbTester.insertWebhook(organization);
underTest.update(dbSession, dto.setName("a-fancy-webhook").setUrl("http://www.fancy-webhook.io"));
WebhookDto reloaded = underTest.selectByUuid(dbSession, dto.getUuid()).get();
assertThat(reloaded.getUuid()).isEqualTo(dto.getUuid());
assertThat(reloaded.getName()).isEqualTo("a-fancy-webhook");
assertThat(reloaded.getUrl()).isEqualTo("http://www.fancy-webhook.io");
assertThat(reloaded.getProjectUuid()).isNull();
assertThat(reloaded.getOrganizationUuid()).isEqualTo(dto.getOrganizationUuid());
assertThat(reloaded.getCreatedAt()).isEqualTo(dto.getCreatedAt());
assertThat(new Date(reloaded.getUpdatedAt())).isInSameMinuteWindowAs(new Date(system2.now()));
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void insert_row_with_organization() {
WebhookDto dto = new WebhookDto()
.setUuid("UUID_1")
.setName("NAME_1")
.setUrl("URL_1")
.setOrganizationUuid("UUID_2");
underTest.insert(dbSession, dto);
WebhookDto stored = selectByUuid(dto.getUuid());
assertThat(stored.getUuid()).isEqualTo(dto.getUuid());
assertThat(stored.getName()).isEqualTo(dto.getName());
assertThat(stored.getUrl()).isEqualTo(dto.getUrl());
assertThat(stored.getOrganizationUuid()).isEqualTo(dto.getOrganizationUuid());
assertThat(stored.getProjectUuid()).isNull();
assertThat(new Date(stored.getCreatedAt())).isInSameMinuteWindowAs(new Date(system2.now()));
assertThat(new Date(stored.getUpdatedAt())).isInSameMinuteWindowAs(new Date(system2.now()));
}
代码示例来源:origin: SonarSource/sonarqube
private static void writeResponse(Request request, Response response, List<WebhookDto> webhookDtos, Map<String, WebhookDeliveryLiteDto> lastDeliveries) {
ListResponse.Builder responseBuilder = ListResponse.newBuilder();
webhookDtos
.forEach(webhook -> {
ListResponseElement.Builder responseElementBuilder = responseBuilder.addWebhooksBuilder();
responseElementBuilder
.setKey(webhook.getUuid())
.setName(webhook.getName())
.setUrl(obfuscateCredentials(webhook.getUrl()));
addLastDelivery(responseElementBuilder, webhook, lastDeliveries);
});
writeProtobuf(responseBuilder.build(), request, response);
}
代码示例来源:origin: SonarSource/sonarqube
@SafeVarargs
public final WebhookDeliveryLiteDto insert(WebhookDto webhook, Consumer<WebhookDeliveryDto>... dtoPopulators) {
WebhookDeliveryDto dto = newDto();
stream(dtoPopulators).forEach(dtoPopulator -> dtoPopulator.accept(dto));
String projectUuid = webhook.getProjectUuid();
dto.setComponentUuid(Objects.requireNonNull(projectUuid, "Project uuid of webhook cannot be null"));
dto.setWebhookUuid(webhook.getUuid());
dbTester.getDbClient().webhookDeliveryDao().insert(dbTester.getSession(), dto);
dbTester.getSession().commit();
return dto;
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void list_webhooks_when_no_delivery() {
WebhookDto webhook1 = webhookDbTester.insert(newOrganizationWebhook("aaa", defaultOrganizationProvider.get().getUuid()));
WebhookDto webhook2 = webhookDbTester.insert(newOrganizationWebhook("bbb", defaultOrganizationProvider.get().getUuid()));
userSession.logIn().addPermission(ADMINISTER, db.getDefaultOrganization().getUuid());
ListResponse response = wsActionTester.newRequest().executeProtobuf(ListResponse.class);
List<Webhooks.ListResponseElement> elements = response.getWebhooksList();
assertThat(elements.size()).isEqualTo(2);
assertThat(elements.get(0)).extracting(Webhooks.ListResponseElement::getKey).containsExactly(webhook1.getUuid());
assertThat(elements.get(0)).extracting(Webhooks.ListResponseElement::getName).containsExactly("aaa");
assertThat(elements.get(0).hasLatestDelivery()).isFalse();
assertThat(elements.get(1)).extracting(Webhooks.ListResponseElement::getKey).containsExactly(webhook2.getUuid());
assertThat(elements.get(1)).extracting(Webhooks.ListResponseElement::getName).containsExactly("bbb");
assertThat(elements.get(1).hasLatestDelivery()).isFalse();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void selectByWebhookUuid_returns_records_ordered_by_date() {
WebhookDto webhookDto = dbWebhooks.insert(WebhookTesting.newProjectWebhook("COMPONENT_1"));
WebhookDeliveryDto dto1 = WebhookDeliveryTesting.newDto("D1", webhookDto.getUuid(), "COMPONENT_1", "TASK_1").setCreatedAt(BEFORE);
WebhookDeliveryDto dto2 = WebhookDeliveryTesting.newDto("D2", webhookDto.getUuid(), "COMPONENT_1", "TASK_2").setCreatedAt(NOW);
WebhookDeliveryDto dto3 = WebhookDeliveryTesting.newDto("D3", "fake-webhook-uuid", "COMPONENT_2", "TASK_1").setCreatedAt(NOW);
underTest.insert(dbSession, dto3);
underTest.insert(dbSession, dto2);
underTest.insert(dbSession, dto1);
List<WebhookDeliveryLiteDto> deliveries = underTest.selectByWebhookUuid(dbSession, webhookDto.getUuid(), 0, 10);
assertThat(deliveries).extracting(WebhookDeliveryLiteDto::getUuid).containsExactly("D2", "D1");
}
代码示例来源:origin: SonarSource/sonarqube
private static void writeResponse(Request request, Response response, WebhookDto element) {
Webhooks.CreateWsResponse.Builder responseBuilder = newBuilder();
responseBuilder.setWebhook(Webhook.newBuilder()
.setKey(element.getUuid())
.setName(element.getName())
.setUrl(element.getUrl()));
writeProtobuf(responseBuilder.build(), request, response);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void fail_if_not_logged_in() throws Exception {
OrganizationDto organization = organizationDbTester.insert();
WebhookDto dto = webhookDbTester.insertWebhook(organization);
userSession.anonymous();
expectedException.expect(UnauthorizedException.class);
wsActionTester.newRequest()
.setParam(KEY_PARAM, dto.getUuid())
.execute();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void fail_if_no_permission_on_webhook_scope_project() {
ComponentDto project = componentDbTester.insertPrivateProject();
WebhookDto dto = webhookDbTester.insertWebhook(project);
userSession.logIn();
expectedException.expect(ForbiddenException.class);
expectedException.expectMessage("Insufficient privileges");
wsActionTester.newRequest()
.setParam(KEY_PARAM, dto.getUuid())
.execute();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void fail_if_no_permission_on_webhook_scope_organization() {
OrganizationDto organization = organizationDbTester.insert();
WebhookDto dto = webhookDbTester.insertWebhook(organization);
userSession.logIn();
expectedException.expect(ForbiddenException.class);
expectedException.expectMessage("Insufficient privileges");
wsActionTester.newRequest()
.setParam(KEY_PARAM, dto.getUuid())
.execute();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void fail_if_not_logged_in() throws Exception {
OrganizationDto organization = organizationDbTester.insert();
WebhookDto dto = webhookDbTester.insertWebhook(organization);
userSession.anonymous();
expectedException.expect(UnauthorizedException.class);
wsActionTester.newRequest()
.setParam(KEY_PARAM, dto.getUuid())
.setParam(NAME_PARAM, NAME_WEBHOOK_EXAMPLE_001)
.setParam(URL_PARAM, URL_WEBHOOK_EXAMPLE_001)
.execute();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void fail_if_no_permission_on_webhook_scope_organization() {
OrganizationDto organization = organizationDbTester.insert();
WebhookDto dto = webhookDbTester.insertWebhook(organization);
userSession.logIn();
expectedException.expect(ForbiddenException.class);
expectedException.expectMessage("Insufficient privileges");
wsActionTester.newRequest()
.setParam(KEY_PARAM, dto.getUuid())
.setParam(NAME_PARAM, NAME_WEBHOOK_EXAMPLE_001)
.setParam(URL_PARAM, URL_WEBHOOK_EXAMPLE_001)
.execute();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void fail_if_url_is_not_valid() throws Exception {
ComponentDto project = componentDbTester.insertPrivateProject();
WebhookDto dto = webhookDbTester.insertWebhook(project);
userSession.logIn().addProjectPermission(ADMIN, project);
expectedException.expect(IllegalArgumentException.class);
wsActionTester.newRequest()
.setParam(KEY_PARAM, dto.getUuid())
.setParam(NAME_PARAM, NAME_WEBHOOK_EXAMPLE_001)
.setParam(URL_PARAM, "htp://www.wrong-protocol.com/")
.execute();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void fail_if_credential_in_url_is_have_a_wrong_format() throws Exception {
ComponentDto project = componentDbTester.insertPrivateProject();
WebhookDto dto = webhookDbTester.insertWebhook(project);
userSession.logIn().addProjectPermission(ADMIN, project);
expectedException.expect(IllegalArgumentException.class);
wsActionTester.newRequest()
.setParam(KEY_PARAM, dto.getUuid())
.setParam(NAME_PARAM, NAME_WEBHOOK_EXAMPLE_001)
.setParam(URL_PARAM, "http://:www.wrong-protocol.com/")
.execute();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void fail_if_no_permission_on_webhook_scope_project() {
ComponentDto project = componentDbTester.insertPrivateProject();
WebhookDto dto = webhookDbTester.insertWebhook(project);
userSession.logIn();
expectedException.expect(ForbiddenException.class);
expectedException.expectMessage("Insufficient privileges");
wsActionTester.newRequest()
.setParam(KEY_PARAM, dto.getUuid())
.setParam(NAME_PARAM, NAME_WEBHOOK_EXAMPLE_001)
.setParam(URL_PARAM, URL_WEBHOOK_EXAMPLE_001)
.execute();
}
ngCordova getUUID() 返回设备未定义 我正在使用 Ionic 框架构建移动应用程序,我需要检索设备 UUID我使用 ngCordova 使用这里的缩小版本 ngCordova ! 这
我在 Android JUnit3 单元测试中有以下代码: public void testWTF() { UUID uuidExpected = UUID.fromString("00001
我正在尝试使用低功耗蓝牙 (BLE) 通过 Android 应用程序连接到 Arduino Uno。 我正在 Android Studio 上开发,使用 Samsung Galaxy S4 和 And
我正在尝试扫描 BLE 设备并仅使用我的设备 UUID 过滤结果。 我使用了 here 中的谷歌示例代码 它会找到设备并列出它们。 但是当我尝试按我的 UUID 过滤时,方法 device.getUu
本文整理了Java中org.sonar.db.webhook.WebhookDto.getUuid()方法的一些代码示例,展示了WebhookDto.getUuid()的具体用法。这些代码示例主要来源
本文整理了Java中org.zstack.header.zone.ZoneInventory.getUuid()方法的一些代码示例,展示了ZoneInventory.getUuid()的具体用法。这些
对于下面的类,当我做深拷贝时,这样写代码安全吗 this.id = original.getId(); 在我的测试中,这似乎没问题,因为当我想更新 UUID 字段时,我总是为它分配一个新的 UUID
我是一名优秀的程序员,十分优秀!