From eede8ce813a0d21dd5c48c6468a89ecb52de657a Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 12 Apr 2017 21:40:06 +0200 Subject: [PATCH] Drop test PluginsWsMediumTest This test is badly implemented. It is heavily coupled with the build version and does not correctly support all kinds of versions (SNAPSHOT, release on 3 digits, build on 4 digits). --- server/sonar-server/pom.xml | 5 - .../update-center.properties | 57 ----- .../plugins/ws/PluginsWsMediumTest.java | 197 ------------------ .../sonar-decoy-plugin-1.0.jar | Bin 2079 -> 0 bytes .../sonar-decoy-plugin-1.1.jar | Bin 2079 -> 0 bytes .../sonar-foo-plugin-1.0.jar | Bin 2050 -> 0 bytes 6 files changed, 259 deletions(-) delete mode 100644 server/sonar-server/src/test/filteredresources/org/sonar/server/plugins/ws/PluginsWsMediumTest/update-center.properties delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginsWsMediumTest.java delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.0.jar delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.1.jar delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-foo-plugin-1.0.jar diff --git a/server/sonar-server/pom.xml b/server/sonar-server/pom.xml index 129faac8c14..c9d21aa4fb3 100644 --- a/server/sonar-server/pom.xml +++ b/server/sonar-server/pom.xml @@ -264,15 +264,10 @@ src/test/resources false - - src/test/filteredresources - true - src/test/projects false - diff --git a/server/sonar-server/src/test/filteredresources/org/sonar/server/plugins/ws/PluginsWsMediumTest/update-center.properties b/server/sonar-server/src/test/filteredresources/org/sonar/server/plugins/ws/PluginsWsMediumTest/update-center.properties deleted file mode 100644 index 9c778b8945d..00000000000 --- a/server/sonar-server/src/test/filteredresources/org/sonar/server/plugins/ws/PluginsWsMediumTest/update-center.properties +++ /dev/null @@ -1,57 +0,0 @@ -# Current development version (single value) -devVersion=${project.version} - -publicVersions=5.6 - -# Long Term Support release. Must be declared in "publicVersions". -ltsVersion=5.6 - -5.6.description=Long-Term Support version - Many bug fixes and small improvements -5.6.downloadUrl=https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-5.6.zip -5.6.changelogUrl=https://jira.sonarsource.com/jira/secure/ReleaseNote.jspa?projectId=10930&version=12869 -5.6.date=2016-06-01 - -# list of plugins. It is used to load other files from the same directory. No need to sort. -plugins=foo,decoy - -# =============== decoy plugin -# Releases. Note that no need for "privateVersions" for now. -decoy.publicVersions=1.0,1.1 - -decoy.description=decoy -decoy.category=Languages - -decoy.defaults.mavenGroupId=org.codehaus.sonar-plugins -decoy.defaults.mavenArtifactId=sonar-decoy-plugin - -# Metadata of each release -# The range of supported SQ versions accepts the alias LATEST and * -decoy.1.0.date=2012-03-18 -decoy.1.0.sqVersions=6.2,${project.version} -decoy.1.0.description=Surprise -decoy.1.0.downloadUrl=[[decoy.10.jar]] -decoy.1.0.changelogUrl=http://jira.sonarsource.com/foo - -decoy.1.1.date=2012-03-18 -decoy.1.1.sqVersions=6.2,${project.version} -decoy.1.1.description=Surprise -decoy.1.1.downloadUrl=[[decoy.11.jar]] -decoy.1.1.changelogUrl=http://jira.sonarsource.com/foo - -# =============== decoy plugin -# Releases. Note that no need for "privateVersions" for now. -foo.publicVersions=1.0 - -foo.description=Foo -foo.category=Languages - -foo.defaults.mavenGroupId=org.codehaus.sonar-plugins -foo.defaults.mavenArtifactId=sonar-foo-plugin - -# Metadata of each release -# The range of supported SQ versions accepts the alias LATEST and * -foo.1.0.date=2012-03-18 -foo.1.0.sqVersions=6.2,${project.version} -foo.1.0.description=Surprise -foo.1.0.downloadUrl=[[foo.10.jar]] -foo.1.0.changelogUrl=http://jira.sonarsource.com/foo diff --git a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginsWsMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginsWsMediumTest.java deleted file mode 100644 index 33b88bea6ce..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/plugins/ws/PluginsWsMediumTest.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info 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 org.sonar.server.plugins.ws; - -import java.io.File; -import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; -import org.apache.commons.io.FileUtils; -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.sonar.server.tester.ServerTester; -import org.sonar.server.tester.UserSessionRule; -import org.sonar.server.ws.WsTester; - -public class PluginsWsMediumTest { - private static final String ENCODING = "UTF-8"; - - @ClassRule - public static TemporaryFolder temporaryFolder = new TemporaryFolder(); - @ClassRule - public static ServerTester serverTester = new ServerTester() - .withEsIndexes() - .addPluginJar(getFile("sonar-decoy-plugin-1.0.jar")) - .setUpdateCenterUrl(createUpdateCenterPropertiesFile()); - - @Rule - public UserSessionRule userSessionRule = UserSessionRule.forServerTester(serverTester); - - @Test - public void test_update_existing_and_install_new_scenario() throws Exception { - WsTester wsTester = new WsTester(serverTester.get(PluginsWs.class)); - - // 1 - check what's installed, available and pending - userSessionRule.logIn().setSystemAdministrator(); - wsTester.newGetRequest("api/plugins", "installed").execute().assertJson("{" + - " \"plugins\": [" + - " {" + - " \"key\": \"decoy\"," + - " \"version\": \"1.0\"" + - " }" + - " ]" + - "}" - ); - - wsTester.newGetRequest("api/plugins", "available").execute().assertJson("{" + - " \"plugins\": [" + - " {" + - " \"key\": \"foo\"," + - " \"release\": {" + - " \"version\": \"1.0\"" + - " }," + - " \"update\": {" + - " \"status\": \"COMPATIBLE\"," + - " \"requires\": []" + - " }" + - " }" + - " ]" + - "}"); - - wsTester.newGetRequest("api/plugins", "pending").execute().assertJson("{\"installing\":[],\"removing\":[],\"updating\":[]}"); - - // 2 - install one plugin, update another, verify pending status in the process - wsTester.newPostRequest("api/plugins", "update").setParam("key", "decoy").execute().assertNoContent(); - - wsTester.newGetRequest("api/plugins", "pending").execute().assertJson("{" + - " \"updating\": [" + - " {" + - " \"key\": \"decoy\"," + - " \"version\": \"1.1\"" + - " }" + - " ]," + - " \"installing\": []," + - " \"removing\": []" + - "}"); - - wsTester.newPostRequest("api/plugins", "install").setParam("key", "foo").execute().assertNoContent(); - - wsTester.newGetRequest("api/plugins", "pending").execute().assertJson("{" + - " \"installing\": [" + - " {" + - " \"key\": \"foo\"," + - " \"version\": \"1.0\"" + - " }" + - " ]," + - " \"updating\": [" + - " {" + - " \"key\": \"decoy\"," + - " \"version\": \"1.1\"" + - " }" + - " ]," + - " \"removing\": []" + - "}"); - - // 3 - simulate SQ restart - wsTester = restartServerTester(); - - // 4 - make sure plugin is installed - userSessionRule.logIn().setSystemAdministrator(); - wsTester.newGetRequest("api/plugins", "installed").execute().assertJson("{" + - " \"plugins\": [" + - " {" + - " \"key\": \"decoy\"," + - " \"version\": \"1.1\"" + - " }," + - " {" + - " \"key\": \"foo\"," + - " \"version\": \"1.0\"" + - " }" + - " ]" + - "}" - ); - - // 5 - uninstall a plugin, verify pending status in the process - wsTester.newPostRequest("api/plugins", "uninstall").setParam("key", "foo").execute().assertNoContent(); - - wsTester.newGetRequest("api/plugins", "pending").execute().assertJson("{" + - " \"installing\": []," + - " \"updating\": []," + - " \"removing\": [" + - " {" + - " \"key\": \"foo\"," + - " \"version\": \"1.0\"" + - " }" + - " ]," + - "}"); - - // 6 - simulate SQ restart again - wsTester = restartServerTester(); - - // 7 - make sure plugin has been uninstalled - userSessionRule.logIn().setSystemAdministrator(); - wsTester.newGetRequest("api/plugins", "installed").execute().assertJson("{" + - " \"plugins\": [" + - " {" + - " \"key\": \"decoy\"," + - " \"version\": \"1.1\"" + - " }" + - " ]" + - "}" - ); - } - - private WsTester restartServerTester() { - serverTester.restart(); - // correctly simulate a server restart (ie. user is disconnected) - userSessionRule.anonymous(); - // must use a new WsTester to reference the right PluginWs instance - return new WsTester(serverTester.get(PluginsWs.class)); - } - - private static URL createUpdateCenterPropertiesFile() { - try { - temporaryFolder.create(); - String content = FileUtils.readFileToString(getFile("update-center.properties"), ENCODING) - .replace("[[decoy.10.jar]]", getFileUrl("sonar-decoy-plugin-1.0.jar").toString()) - .replace("[[decoy.11.jar]]", getFileUrl("sonar-decoy-plugin-1.1.jar").toString()) - .replace("[[foo.10.jar]]", getFileUrl("sonar-foo-plugin-1.0.jar").toString()); - File res = temporaryFolder.newFile("update-center.properties"); - FileUtils.write(res, content, "UTF-8"); - return res.toURI().toURL(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - private static File getFile(String jarFileName) { - try { - return new File(getFileUrl(jarFileName).toURI()); - } catch (URISyntaxException e) { - throw new RuntimeException(e); - } - } - - private static URL getFileUrl(String fileName) { - return PluginsWsMediumTest.class.getResource(PluginsWsMediumTest.class.getSimpleName() + "/" + fileName); - } -} diff --git a/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.0.jar b/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.0.jar deleted file mode 100644 index e6ba8a4cc4bee52945571c585f6a1cb792317a43..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2079 zcmWIWW@Zs#U|`^2*pj;3ZKeAf#tn=N3{uPt3?d9N48E=*j=G+HZu-8Cex7cw!6ACS zZlNKZ49vk!-l3jATw1}+z{v6vs2oh>2F2#jHV~f-6JBEvI9r+(fy6fT)|Rq57Oj&$8S z*FIdy{_^Qz^}g@?0r1!_?EdYxUCs0MJYZV*55yY4*v~IY*Dub`ODxha$SFE{;-FmTvmZ^O)34leceXURe@{@P84|{|hfI zc3}jj{!}2=B+~!MIf=!^-~f05^n6Zf0D1t#_HXn%Y#`$LKKpV@+mvZc%tAaJOH&Up zCkuKvYC3tizRAmSbz3Q`>gW2OYnc+8T|>XqjfE>X_`loQ&(DspuiIPCu;V}-2mf3F z>lbV%R=?3%&X*3Xi^CcWuG?^2=it2J6(>~?40ESbzz{5hvZYiXG3LVJm0 z{xt_9Q&Wy5Ma~jbobzIp$C0%qefPF{eEDRzI%wrNS*eAr_73)ksqx|?g+PVCJ$-LN}3 z`sB51H@UuKNgtXPx?heh>^8^s7Z;_z-n&ro)7>g<_dc6nY@jga0;VVih6rF7gBehQ z1scZS;M)!iJ`hGrKe%;sp~Mh*W(c8}0ZZk?nFY!*$i9)lY8E8NfK3GD4y-<8WRhdX zRR&9dtpFxSh9!+4CiW7U6;dLjmBsHup&>w%a7F-jleid=O?#T~$4S7VJnRyI)dumfQ`FoK$ZW-u@S0LcuxC;$Ke diff --git a/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.1.jar b/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.1.jar deleted file mode 100644 index 59fc4bcfc75b6e858b4f569ede47901f135a3232..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2079 zcmWIWW@Zs#U|`^2*qyrE?Mr6wy$y^E3{uPt3?d9N48E=*j=G+HZu-8Cex7cw!6ACS zZlNKZ49tm6-l1VYTw1}+z{v6vs2oh>21V!3HV~FS)O19AfO#y{?j$A#ZOgy2XV3wI7qX(2Re#7v1M$J@x#+EMvWr(5Oj&8-mQ1 z7}@N+;5wam>hF1(M}9D`HZQpGDb#bS(u#>cHM;bJDyDe-u5Q_N?m%g;(P70Z`J3tg z?xfFt{NVW?sSl1T`S>PnN}q69^N-LZsd5>vTbemr{`#1yv;M2w9a-mXziyko&T+<+ zrD48jUF}aBKCeISb3tXbYfi>~@0ap3g9CiJ%7VUZJ)g`OK8{PB>ylNKlu^m)RODHo6O&Mls$lXg6tdtXCjkN4^6lSCh}s_EXD z`r(%5mwykf)_s-^fX9Ac_iwlDYM!^}0n@^NAl3lJetuE9esO+YVv&A9PHB2(Ua@{k zYI1(1z6*#901N45C6*U)En$xir1&ocG^5vrk=}%=((w_|5AZ(M&ZQZGDNU?aP^N z%wsz<(`wE~^_b%a7RqF`yk6|Pxq{Ki>m*}Xy6HF1V^TLw-oBZ6Wl0>u{}X}!UwCP; z3nMV~rvkAik^WE4Nh~e~2Y?dL^Essf=m8MhztQiofr#t-?8_}}Q>HO73-NR;O+CPz zEa=^+>Ez-1CNIm?ZKbTLpX-0FWlC&z4gF3x7Ovpn|88qPKRdp@Zf`xqjstZZ{Bs4Y zU$DJky`lPJdXQ(aYX)CiKTH0a^rj2FONGj>)@XIH+ns&0WHMLr=bRR;rD3WI?In)+ z*Bp#YO*xhnIZIG+&WlwZN7k0~-P`K%<&)j&pq1xjr53W}@tmi6QdL5JE8nmdc4U3zTD!eItR@EJ%(4n+VDsSbfOIB*%=a z43+>}0Zfn#OBz8;>?JZQq(nw5jRU+9CS&GrgvnbP{{bx^KDPsH!;;gHZNtn>5ZgdL z0NTbxoNds&1+)&7w=fb0$aA<77R)*UhQE$UED-BLLx3jXi~#H=aWNp9v;b-nq);Ts vJRubGo}ieANPdLfiJAD2-D$vzJAlEi#u|OBY@q022f}t>1T_K8U|;|MIs>gZ diff --git a/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-foo-plugin-1.0.jar b/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-foo-plugin-1.0.jar deleted file mode 100644 index 4e58b7f8b582f75c3c79d3bf9e2b88f112699667..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2050 zcmWIWW@Zs#U|`^2SeUxp?e)P)%_|uh7bawYrbt>CAqTa zWrT!Wzx%3GZm-jEg-c@0Ca>nqyDxEZhVXL3ww=tM^QTFR#n0cQBO2vmxJg|01J_C6 zJxSg|QWvje{*C-x@-xuvhGVDR+(S+pPoBN+NHiBJshBV+Y}v}WNAiwjga<}X4Vtm) zy!*Yp3o{KKu8@pib&tEYz*ISC>SRURn->l~i#x^nta|aOolUuJ_rkxftdO)ioAISq z%=)4G+Uh&n5A;{)E&uPVv0*3Ing!Rd{A$}d$-Vbs-sZTPz4vqG9FhxNJbjbykqrk| z-mjm2`h=@{d&J=n%{i^cFZoQv7wvvf^RifF)%uAE*@7Om?>D~8%GqGL_}dp|iIbO7 z<~fR;?S8}{lmAJj?_gYtX2Fd3gKHXc>S`^%|L^%`-ZME)Bd#-i&y0K9j?Lez_MU&= z^XmPK0q|(w+WXt>R4nh}1;9k`8;Dha(VkzFu3wy=msq4S-QGT6N6snS1Y=S!GFXrmMsezTXA(z0Cae^Zo*T9uG|T zszmrcIVZ8W80>umpx4Vv1JJ!6+rQiIuz^V1|I5n^O*6S!*;E9QvL!zp;7D5eLPT+i z(zh)$PH1dhe8llXm_cCa1I7xC7Fn*TA3n_Q-e3ItPgEU)#bG`720nLj+cw>{T&IeK zTQ*H^d6rP&&f)efPN-_*rBAzN`KK1n_A#FRa>=DQ+vt_vsU@B-_}e}vf11*9YL(BC zRa>63*cpZzPELNRy(>96Zb^|k@1Pe55!9n-eXIm%; zqoo|&y17tdhCDNbP|Sd(ZQ{%V5THpo10K6cTnxx2^+Qd96oBNICxl|&Wfb!e liH@*4F_Rp!JLOq%1uodlSR;;=4HPl#Kv)Zk8lVXb3;?2vxfK8a -- 2.39.5