]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8756 add guarded flag to response of api/organizations/search 1640/head
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Wed, 8 Feb 2017 16:55:19 +0000 (17:55 +0100)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Fri, 10 Feb 2017 08:48:36 +0000 (09:48 +0100)
server/sonar-server/src/main/java/org/sonar/server/organization/ws/OrganizationsWsSupport.java
server/sonar-server/src/main/resources/org/sonar/server/organization/ws/example-create.json
server/sonar-server/src/main/resources/org/sonar/server/organization/ws/example-search.json
server/sonar-server/src/test/java/org/sonar/server/organization/ws/SearchActionTest.java
sonar-ws/src/main/protobuf/ws-organizations.proto

index bdbc004de868c258f29ec280bee077a06521725d..394c7934b127dcbdaa9f0e0a7fddb20b7eba8598 100644 (file)
@@ -119,7 +119,8 @@ public class OrganizationsWsSupport {
     builder
       .clear()
       .setName(dto.getName())
-      .setKey(dto.getKey());
+      .setKey(dto.getKey())
+      .setGuarded(dto.isGuarded());
     setNullable(dto.getDescription(), builder::setDescription);
     setNullable(dto.getUrl(), builder::setUrl);
     setNullable(dto.getAvatarUrl(), builder::setAvatar);
index a350af2f7a43e1a588cefe4713e1501ef566f13e..3acbecf41484248f31d711aef5812ada06d1ce39 100644 (file)
@@ -4,6 +4,7 @@
     "name": "Foo Company",
     "description": "The Foo company produces quality software for Bar.",
     "url": "https://www.foo.com",
-    "avatar": "https://www.foo.com/foo.png"
+    "avatar": "https://www.foo.com/foo.png",
+    "guarded": false
   }
 }
index ef0b9d84d24aa3e68d442b6299d16789c9c2fc69..81566290cf12088b14ab9f13bddc71e3089a324c 100644 (file)
@@ -2,14 +2,16 @@
   "organizations": [
     {
       "key": "foo-company",
-      "name": "Foo Company"
+      "name": "Foo Company",
+      "guarded": true
     },
     {
       "key": "bar-company",
       "name": "Bar Company",
       "description": "The Bar company produces quality software too.",
       "url": "https://www.bar.com",
-      "avatar": "https://www.bar.com/logo.png"
+      "avatar": "https://www.bar.com/logo.png",
+      "guarded": false
     }
   ]
 }
index d3e9ba208b0139097cc1b9365a635bc72947f5df..6b064c813b6a8da20c49964f22b69f7da4a21ce5 100644 (file)
@@ -107,11 +107,13 @@ public class SearchActionTest {
       .setName("Bar Company")
       .setDescription("The Bar company produces quality software too.")
       .setUrl("https://www.bar.com")
-      .setAvatarUrl("https://www.bar.com/logo.png"));
+      .setAvatarUrl("https://www.bar.com/logo.png")
+      .setGuarded(false));
     insertOrganization(new OrganizationDto()
       .setUuid(Uuids.UUID_EXAMPLE_01)
       .setKey("foo-company")
-      .setName("Foo Company"));
+      .setName("Foo Company")
+      .setGuarded(true));
 
     String response = executeJsonRequest(null, null);
 
@@ -199,14 +201,14 @@ public class SearchActionTest {
 
     // verify paging
     assertThat(executeRequest(1, 1, "key-1", "key-3", "key-5"))
-        .extracting(Organization::getKey)
-        .containsExactly("key-5");
+      .extracting(Organization::getKey)
+      .containsExactly("key-5");
     assertThat(executeRequest(1, 2, "key-1", "key-3", "key-5"))
-        .extracting(Organization::getKey)
-        .containsExactly("key-5", "key-1");
+      .extracting(Organization::getKey)
+      .containsExactly("key-5", "key-1");
     assertThat(executeRequest(2, 2, "key-1", "key-3", "key-5"))
-        .extracting(Organization::getKey)
-        .containsExactly("key-3");
+      .extracting(Organization::getKey)
+      .containsExactly("key-3");
   }
 
   @Test
index e4087f6c91b05b38da17fddec8e9029a728e1ae0..fa0251a9549935b23978d8b06c371df7df562008 100644 (file)
@@ -45,4 +45,5 @@ message Organization {
   optional string description = 3;
   optional string url = 4;
   optional string avatar = 5;
+  optional bool guarded = 6;
 }