diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-02-15 13:44:14 +0100 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-02-15 14:24:40 +0100 |
commit | 2679df38cca5c450b163ebaad139c435fddc14ca (patch) | |
tree | c7fd658c772eb5b0a8b4c833b0675c2e60b2c3b4 | |
parent | e5047e3c19e5c021a4ea775a5a05d301368ff6c5 (diff) | |
download | sonarqube-2679df38cca5c450b163ebaad139c435fddc14ca.tar.gz sonarqube-2679df38cca5c450b163ebaad139c435fddc14ca.zip |
SONAR-7187 WS api/ce/activity add IT
-rw-r--r-- | it/it-tests/src/test/java/it/ce/CeWsTest.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/it/it-tests/src/test/java/it/ce/CeWsTest.java b/it/it-tests/src/test/java/it/ce/CeWsTest.java new file mode 100644 index 00000000000..8fa6df6e544 --- /dev/null +++ b/it/it-tests/src/test/java/it/ce/CeWsTest.java @@ -0,0 +1,66 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package it.ce; + +import com.sonar.orchestrator.Orchestrator; +import com.sonar.orchestrator.build.SonarRunner; +import it.Category4Suite; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Test; +import org.sonarqube.ws.WsCe; +import org.sonarqube.ws.client.WsClient; +import org.sonarqube.ws.client.ce.ActivityWsRequest; +import util.ItUtils; + +import static com.google.common.collect.Lists.newArrayList; +import static org.assertj.core.api.Assertions.assertThat; +import static util.ItUtils.projectDir; + +public class CeWsTest { + @ClassRule + public static final Orchestrator orchestrator = Category4Suite.ORCHESTRATOR; + private static final String FILE_KEY = "sample:src/main/xoo/sample/Sample.xoo"; + WsClient wsClient; + + @Before + public void inspectProject() { + orchestrator.resetData(); + orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + + wsClient = ItUtils.newAdminWsClient(orchestrator); + } + + @Test + public void activity() { + WsCe.ActivityResponse response = wsClient.ce().activity(new ActivityWsRequest() + .setStatus(newArrayList("SUCCESS")) + .setType("REPORT") + .setOnlyCurrents(true) + .setPage(1) + .setPageSize(100)); + + assertThat(response).isNotNull(); + assertThat(response.getTasksCount()).isGreaterThan(0); + WsCe.Task firstTask = response.getTasks(0); + assertThat(firstTask.getId()).isNotEmpty(); + } +} |