aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce-task
diff options
context:
space:
mode:
authorJacek <jacek.poreda@sonarsource.com>2020-12-17 10:22:36 +0100
committersonartech <sonartech@sonarsource.com>2020-12-22 20:09:38 +0000
commite42e2b18cdef809b793fe6f3b2d30f32dfb66674 (patch)
treeeba459bbe1c05313177de99b32ddcbd3c46f24b4 /server/sonar-ce-task
parent82ed20a6d9aec68faf5bc99e78a25aba42c9fedb (diff)
downloadsonarqube-e42e2b18cdef809b793fe6f3b2d30f32dfb66674.tar.gz
sonarqube-e42e2b18cdef809b793fe6f3b2d30f32dfb66674.zip
SONAR-13999 drop organization from CE steps
Diffstat (limited to 'server/sonar-ce-task')
-rw-r--r--server/sonar-ce-task/src/main/java/org/sonar/ce/task/CeTask.java18
-rw-r--r--server/sonar-ce-task/src/test/java/org/sonar/ce/task/CeTaskTest.java86
-rw-r--r--server/sonar-ce-task/src/test/java/org/sonar/ce/task/log/CeTaskMessagesImplTest.java1
3 files changed, 11 insertions, 94 deletions
diff --git a/server/sonar-ce-task/src/main/java/org/sonar/ce/task/CeTask.java b/server/sonar-ce-task/src/main/java/org/sonar/ce/task/CeTask.java
index ba05dc99382..a60cda39df7 100644
--- a/server/sonar-ce-task/src/main/java/org/sonar/ce/task/CeTask.java
+++ b/server/sonar-ce-task/src/main/java/org/sonar/ce/task/CeTask.java
@@ -37,7 +37,6 @@ import static java.util.Objects.requireNonNull;
@Immutable
public class CeTask {
- private final String organizationUuid;
private final String type;
private final String uuid;
private final Component component;
@@ -46,7 +45,6 @@ public class CeTask {
private final Map<String, String> characteristics;
private CeTask(Builder builder) {
- this.organizationUuid = requireNonNull(emptyToNull(builder.organizationUuid), "organizationUuid can't be null nor empty");
this.uuid = requireNonNull(emptyToNull(builder.uuid), "uuid can't be null nor empty");
this.type = requireNonNull(emptyToNull(builder.type), "type can't be null nor empty");
checkArgument((builder.component == null) == (builder.mainComponent == null),
@@ -106,10 +104,6 @@ public class CeTask {
}
}
- public String getOrganizationUuid() {
- return organizationUuid;
- }
-
public String getUuid() {
return uuid;
}
@@ -138,7 +132,6 @@ public class CeTask {
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
- .add("organizationUuid", organizationUuid)
.add("type", type)
.add("uuid", uuid)
.add("component", component)
@@ -165,7 +158,6 @@ public class CeTask {
}
public static final class Builder {
- private String organizationUuid;
private String uuid;
private String type;
private Component component;
@@ -173,16 +165,6 @@ public class CeTask {
private User submitter;
private Map<String, String> characteristics;
- public Builder setOrganizationUuid(String organizationUuid) {
- this.organizationUuid = organizationUuid;
- return this;
- }
-
- // FIXME remove this method when organization support is added to the Compute Engine queue
- public boolean hasOrganizationUuid() {
- return organizationUuid != null;
- }
-
public Builder setUuid(String uuid) {
this.uuid = uuid;
return this;
diff --git a/server/sonar-ce-task/src/test/java/org/sonar/ce/task/CeTaskTest.java b/server/sonar-ce-task/src/test/java/org/sonar/ce/task/CeTaskTest.java
index 16be9f7773e..e5bd88645ca 100644
--- a/server/sonar-ce-task/src/test/java/org/sonar/ce/task/CeTaskTest.java
+++ b/server/sonar-ce-task/src/test/java/org/sonar/ce/task/CeTaskTest.java
@@ -39,67 +39,8 @@ public class CeTaskTest {
private CeTask.Builder underTest = new CeTask.Builder();
@Test
- public void build_fails_with_NPE_if_organizationUuid_is_null() {
- expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("organizationUuid can't be null nor empty");
-
- underTest.build();
- }
-
- @Test
- public void build_fails_with_NPE_if_organizationUuid_is_empty() {
- underTest.setOrganizationUuid("");
-
- expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("organizationUuid can't be null nor empty");
-
- underTest.build();
- }
-
- @Test
- public void build_fails_with_NPE_if_uid_is_null() {
- underTest.setOrganizationUuid("org1");
-
- expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("uuid can't be null nor empty");
-
- underTest.build();
- }
-
- @Test
- public void build_fails_with_NPE_if_uuid_is_empty() {
- underTest.setOrganizationUuid("org1").setUuid("");
-
- expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("uuid can't be null nor empty");
-
- underTest.build();
- }
-
- @Test
- public void build_fails_with_NPE_if_type_is_null() {
- underTest.setOrganizationUuid("org1").setUuid("uuid");
-
- expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("type can't be null nor empty");
-
- underTest.build();
- }
-
- @Test
- public void build_fails_with_NPE_if_type_is_empty() {
- underTest.setOrganizationUuid("org1").setUuid("uuid").setType("");
-
- expectedException.expect(NullPointerException.class);
- expectedException.expectMessage("type can't be null nor empty");
-
- underTest.build();
- }
-
- @Test
@UseDataProvider("oneAndOnlyOneOfComponentAndMainComponent")
public void build_fails_with_IAE_if_only_one_of_component_and_main_component_is_non_null(CeTask.Component component, CeTask.Component mainComponent) {
- underTest.setOrganizationUuid("org1");
underTest.setType("TYPE_1");
underTest.setUuid("UUID_1");
underTest.setComponent(component);
@@ -125,7 +66,6 @@ public class CeTaskTest {
CeTask.Component component = new CeTask.Component("COMPONENT_UUID_1", "COMPONENT_KEY_1", "The component");
CeTask.Component mainComponent = new CeTask.Component("MAIN_COMPONENT_UUID_1", "MAIN_COMPONENT_KEY_1", "The main component");
CeTask.User submitter = new CeTask.User("UUID_USER_1", "LOGIN_1");
- underTest.setOrganizationUuid("org1");
underTest.setType("TYPE_1");
underTest.setUuid("UUID_1");
underTest.setSubmitter(submitter);
@@ -135,7 +75,6 @@ public class CeTaskTest {
CeTask task = underTest.build();
- assertThat(task.getOrganizationUuid()).isEqualTo("org1");
assertThat(task.getUuid()).isEqualTo("UUID_1");
assertThat(task.getType()).isEqualTo("TYPE_1");
assertThat(task.getSubmitter()).isEqualTo(submitter);
@@ -148,7 +87,6 @@ public class CeTaskTest {
public void verify_toString() {
CeTask.Component component = new CeTask.Component("COMPONENT_UUID_1", "COMPONENT_KEY_1", "The component");
CeTask.Component mainComponent = new CeTask.Component("MAIN_COMPONENT_UUID_1", "MAIN_COMPONENT_KEY_1", "The main component");
- underTest.setOrganizationUuid("org1");
underTest.setType("TYPE_1");
underTest.setUuid("UUID_1");
underTest.setComponent(component);
@@ -159,20 +97,18 @@ public class CeTaskTest {
CeTask task = underTest.build();
System.out.println(task.toString());
- assertThat(task.toString()).isEqualTo("CeTask{" +
- "organizationUuid=org1, " +
- "type=TYPE_1, " +
- "uuid=UUID_1, " +
- "component=Component{uuid='COMPONENT_UUID_1', key='COMPONENT_KEY_1', name='The component'}, " +
- "mainComponent=Component{uuid='MAIN_COMPONENT_UUID_1', key='MAIN_COMPONENT_KEY_1', name='The main component'}, " +
- "submitter=User{uuid='UUID_USER_1', login='LOGIN_1'}" +
- "}"
- );
+ assertThat(task).hasToString("CeTask{" +
+ "type=TYPE_1, " +
+ "uuid=UUID_1, " +
+ "component=Component{uuid='COMPONENT_UUID_1', key='COMPONENT_KEY_1', name='The component'}, " +
+ "mainComponent=Component{uuid='MAIN_COMPONENT_UUID_1', key='MAIN_COMPONENT_KEY_1', name='The main component'}, " +
+ "submitter=User{uuid='UUID_USER_1', login='LOGIN_1'}" +
+ "}");
}
@Test
public void empty_in_submitterLogin_is_considered_as_null() {
- CeTask ceTask = underTest.setOrganizationUuid("org1").setUuid("uuid").setType("type")
+ CeTask ceTask = underTest.setUuid("uuid").setType("type")
.setSubmitter(new CeTask.User("USER_ID", ""))
.build();
@@ -181,10 +117,10 @@ public class CeTaskTest {
@Test
public void equals_and_hashCode_on_uuid() {
- underTest.setOrganizationUuid("org1").setType("TYPE_1").setUuid("UUID_1");
+ underTest.setType("TYPE_1").setUuid("UUID_1");
CeTask task1 = underTest.build();
CeTask task1bis = underTest.build();
- CeTask task2 = new CeTask.Builder().setOrganizationUuid("org1").setType("TYPE_1").setUuid("UUID_2").build();
+ CeTask task2 = new CeTask.Builder().setType("TYPE_1").setUuid("UUID_2").build();
assertThat(task1.equals(task1)).isTrue();
assertThat(task1.equals(task1bis)).isTrue();
@@ -195,7 +131,7 @@ public class CeTaskTest {
@Test
public void setCharacteristics_null_is_considered_as_empty() {
- CeTask task = underTest.setOrganizationUuid("org1").setType("TYPE_1").setUuid("UUID_1")
+ CeTask task = underTest.setType("TYPE_1").setUuid("UUID_1")
.setCharacteristics(null)
.build();
assertThat(task.getCharacteristics()).isEmpty();
diff --git a/server/sonar-ce-task/src/test/java/org/sonar/ce/task/log/CeTaskMessagesImplTest.java b/server/sonar-ce-task/src/test/java/org/sonar/ce/task/log/CeTaskMessagesImplTest.java
index c8a96879a64..df741f7c756 100644
--- a/server/sonar-ce-task/src/test/java/org/sonar/ce/task/log/CeTaskMessagesImplTest.java
+++ b/server/sonar-ce-task/src/test/java/org/sonar/ce/task/log/CeTaskMessagesImplTest.java
@@ -58,7 +58,6 @@ public class CeTaskMessagesImplTest {
private CeTask ceTask = new CeTask.Builder()
.setUuid(taskUuid)
- .setOrganizationUuid(randomAlphabetic(10))
.setType(randomAlphabetic(5))
.build();