Ticket #16010: v2-0019-tests-add-PluginHandlerJOSMTooOldTest.patch
File v2-0019-tests-add-PluginHandlerJOSMTooOldTest.patch, 27.0 KB (added by , 6 years ago) |
---|
-
new file 2001
From a4cd57b6a24e2b6e38c48a9624d306500db7359f Mon Sep 17 00:00:00 2001 From: Robert Scott <code@humanleg.org.uk> Date: Sat, 24 Feb 2018 11:48:11 +0000 Subject: [PATCH v2 19/28] tests: add PluginHandlerJOSMTooOldTest this test is a good example which exercises ExtendedDialogMocker and HelpAwareOptionPaneMocker. also consolidate dummy plugins together in __files/ directory --- test/data/__files/plugin/baz_plugin.v6.jar | Bin 0 -> 2890 bytes test/data/__files/plugin/baz_plugin.v7.jar | Bin 0 -> 2999 bytes test/data/__files/plugin/dummy_plugin.v31701.jar | Bin 0 -> 3130 bytes .../{dummy_plugin.jar => dummy_plugin.v31772.jar} | Bin test/data/plugin/dummy_plugin.jar | Bin 3043 -> 0 bytes .../downloadtasks/PluginDownloadTaskTest.java | 4 +- .../preferences/plugin/PluginPreferenceTest.java | 2 +- .../josm/plugins/PluginHandlerJOSMTooOldTest.java | 276 +++++++++++++++++++++ 8 files changed, 279 insertions(+), 3 deletions(-) create mode 100644 test/data/__files/plugin/baz_plugin.v6.jar create mode 100644 test/data/__files/plugin/baz_plugin.v7.jar create mode 100644 test/data/__files/plugin/dummy_plugin.v31701.jar rename test/data/__files/plugin/{dummy_plugin.jar => dummy_plugin.v31772.jar} (100%) delete mode 100644 test/data/plugin/dummy_plugin.jar create mode 100644 test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java diff --git a/test/data/__files/plugin/baz_plugin.v6.jar b/test/data/__files/plugin/baz_plugin.v6.jar new file mode 100644 index 0000000000000000000000000000000000000000..5e4210de44b2646bbc56ea847ce3dbc507e191e7 GIT binary patch literal 2890 zcmWIWW@Zs#;Nak3$Ss`f!+-=h8CV#6T|*poJ^kGD|D9rBU}gyLX6FE@V1g<Oz^PdT zr~<Cp*U`_@%{4eg&)3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6yv3gC4+s9}Jv6}eUeH3SgA7RZEaMQRp+ zOyFX`UHc(S=mI(yUKirl1gZ@YU_C+;tZu}u6;wMSz%6vGu(}cvTA<nzxljSsmI%NN z3`D4dA$CIyfYzPJ9!Jl8sA2vO$b}S02&bd#02N6Hpuh^zfnGr2)(<M85Fh}nerSP( z+YnHZg#fL%4M7xOxD5jpVF+-Duwjq_4G}q@AVN;&pdt+cn1QVmP@tj)5!j0`*MST~ XE8qgWSwXED1|A^P24)>jaHALig%OZ+
-
new file 0
literal 0 HcmV?d00001 diff --git a/test/data/__files/plugin/baz_plugin.v7.jar b/test/data/__files/plugin/baz_plugin.v7.jar new file mode 100644 index 0000000000000000000000000000000000000000..e00bd97b820bfbc096eff5ab30b3b32cc98e1d02 GIT binary patch literal 2999 zcmWIWW@h1HVBlb22xgz}&42_r8CV#6T|*poJ^kGD|D9rB2mmS-Vc_84VBp>7<%6V> zK?KNwEA@5s^K^3!4$<><^9?xdci2E+kNYY69~|uaFMVmu&)umIc#-*0*R&13yq&p~ zu_3>{TI6!hxn^x`y?Gw5#cpS>Kdj1;?|CjeO+9+)uk$p<S+<*co<5vAW9rdu)?2Q9 ztX`saYl5E6HtQW}73CgBK5*2&n9yo$sx5cv-f<u6@NF`#ZnJ-KthH7!I&(biM?+tb zi;peK$A>G$#a)H+3xu>Sa@Vt6zuTU6VUz6^k4w+mQbOfdNAZ1maBJcY#@GAm_KJJG zEc}#lcX{IPDNK@@>*WP|->c5)f3DE(ToI<zUFzcT<6QWC=MwIPaiwc_&f7G5IfpM_ z!rSBzf^7+T|0kWcZVUA~zjNIW7klm0W!%PrNnzosfnxRn-s~JPl|7D}j0_AjfEW~% zkWddo3w3s2P-f;Prl%I`<5t9rP?VXRpNCJWFuGDBlL{jfB(wd|9KZt9kYALJM}-hn zMSekQUU5lLYHCStVgVlY;#k#Z<rnAT(Ik&sQ$bE?dM1je(fy!ISaVWh71(x2g2omL zKAz65e!;HApTCC}6!8RcaFl-fSQ5sN6uv(pT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w3S11pZ}yn*_(4YcW>_c8UAfytKAp&AB&Gz&sK1al1fi_cgOnsoa*<9 z@7~q_W!ummDxbP%WfI?KQIncIN3Hqa+tws#)CWb~WN!QW^?-_^IrGZk*&dn6h7YEz z_5M^i<+L=oZr1JO+Pp~-5ve8Bk9!uDWc-@6P)<X4e_CO<+I<)EMIOcmwt{mzT`cQm zbZ&A_HG1=BeONfp&vZkXsX4-afst)@pMO7L;2i1R+40oSca_VMwoT^?KAo>T?DKK5 z;S$@xNtYKUEvkEGxW<=7sbkvp<c|A>k(VaBpXxOEYVq^j(j7vk6)P%!L>y)kv(>q} zp+~gs?Q;(gU*9D%&WEQynRr3*{hcLY$9P;PN4AAc*spQeUwCP5dxp!KCx5+X9F(@u zS2}d9>I3`Ir3D^MiJbZ`f_H^76boO9RDIv@hw0|0XV?5U-2QWS`Q`JA?H0yeVoP(6 zT=6jUT+lI*S4SL$6ROU9Z7u3bS$#h+L#%$mmnrM~Ql%~LKGOI&ab1^MTF0@wahK1U z-aK`2Ge0O5+>E&YYZ<T_3ugwU0!Ah-2HZ^uPzpi-cq;+YpkQPY0X80BO$y{164azX z0Bs->t`(_)fowT?xeKaE5ugm{TzI{Ta51_jP|b<}vk{tL^(=0!pqdr|j-hLX)w>7- z&~pu_=0$+-Km#E4Fm4^7niv5jfq4=$*C7WHx{aWU3jsW_>W9|TxE%qisS%(Kw;`~s zkIzM*ni~Oj6E+M|k0a6%C_<6zWz<yg2WTL)UI)1XmiR!LkV`gDm5l%%z*LUA0!KCn o6u!uL15^$ofHkl-$BZ9BrDA|LE2tH~zzc*4K$kcIo9YY<00j=C$p8QV
-
new file 0
literal 0 HcmV?d00001 diff --git a/test/data/__files/plugin/dummy_plugin.v31701.jar b/test/data/__files/plugin/dummy_plugin.v31701.jar new file mode 100644 index 0000000000000000000000000000000000000000..530f5fc107b7869d3b437c76bb8eb53ba2ebd301 GIT binary patch literal 3130 zcmWIWW@Zs#;Nak3aLbwN!+-=h8CV#6T|*poJ^kGD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@W@-H;c$X7?gZVbRw3Tg`U$&njokNVS;h6w>{B(acZoPU=5Qg<n_ZBusu-@amC7 z*}qU>=VjAscG*7MD((H-=}W~M*JP%Z(os8%mb}&|TY5#9bMB4LEg3zEi~;*M_DarL znqqkCOK!^Z6U7;uc&xgse>-m|m-z0S5;w7S;S9#^H%dk+r(4!9XwZ5VtbbIYzjexH zkM&%d#fC?9YneguXJ9a6do-~AI}D7&0B=Sn5eC#246JzqYQdlac#{Owo<Y}&T(yGQ zF9=`@WWu!~wPrvja4}%7%0N{x0_*`g7g`}B+zTq!k!wy+m5c!QVOpRSG(O8v{TT!d z07yNH+j*dx76D42I#AO(J{v(bF9IyVsvlYp<8}n7CPsjpxDA12ID9TrLYM?(i7^wC zd-0hEs;Lnmj41P<^)_l0BNsQIni~OT6K^PvdK}~dSn>xYC*-UFD!`Bcu&^VuI1BJ* RWdj++1B59+Cm#TJ0szu62Ic?&
-
deleted file literal
literal 0 HcmV?d00001 diff --git a/test/data/__files/plugin/dummy_plugin.jar b/test/data/__files/plugin/dummy_plugin.v31772.jar similarity index 100% rename from test/data/__files/plugin/dummy_plugin.jar rename to test/data/__files/plugin/dummy_plugin.v31772.jar diff --git a/test/data/plugin/dummy_plugin.jar b/test/data/plugin/dummy_plugin.jar deleted file mode 100644 index 0a1f4086917323129dc8fda92a29389be0d053ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001
-
test/unit/org/openstreetmap/josm/actions/downloadtasks/PluginDownloadTaskTest.java
literal 3043 zcmb7Gc|6ql8z1Km#x@M%r`*Xsj`gEL&S4B@NIAn`7<OjN8VtsfNE@-Obv0s<DMyY% zuBDK>(b(iF6-m;mytW)K_B$liM!V1J_4$7OdEW2m^L?Jr^LalQ6c;x?2m}U!cz%(! z0)1k9Aa0PYg`<f&(hdP%=>>r>A6&s8ZopLlzY?a;0Rl|`O9X&@bhS0HLn15=IcnG< zj$%yEZJOfE@X^>Ap&if0WbNqT*E#Iv<BI1Vo`@psE=#`}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U zwe_e06b&#a=!FS;|2R#o4;~xPua6#V0NaY<RDthD=qH27cEQ<_x^C>?8Nem_Ag~)j z|Ea=kiQR<M1CVvW-5SA`+)c#T2gK*k{&t6COYkP1AGqaP-0<y4*pj?Sa&T*s4ei;E zOm2f~t!7c*CR-Eituw@y>~&+8;g5gC_d&onNWU)O8?;4n99*9Z`sVMgBfnJUO{6b? s+#=x{x%!4qe;Mn`2WvA{1Mh!|_3874LGb`!_T&Nqv5y=8jP)SU-wCz|b^rhX diff --git a/test/unit/org/openstreetmap/josm/actions/downloadtasks/PluginDownloadTaskTest.java b/test/unit/org/openstreetmap/josm/actions/downloadtasks/PluginDownloadTaskTest.java index 39de9a2b3..f9e3a0668 100644
a b public class PluginDownloadTaskTest extends AbstractDownloadTaskTestParent { 55 55 */ 56 56 @Test 57 57 public void testUpdatePluginValid() throws Exception { 58 this.pluginPath = "plugin/dummy_plugin. jar";58 this.pluginPath = "plugin/dummy_plugin.v31772.jar"; 59 59 this.mockHttp(); 60 60 61 61 final File srcPluginFile = new File( … … public class PluginDownloadTaskTest extends AbstractDownloadTaskTestParent { 73 73 } 74 74 75 75 // get PluginInformation from jar file 76 final PluginInformation pluginInformation = new PluginInformation(srcPluginFile );76 final PluginInformation pluginInformation = new PluginInformation(srcPluginFile, "dummy_plugin"); 77 77 // ...and grafting on the downloadlink 78 78 pluginInformation.downloadlink = this.getRemoteFileUrl(); 79 79 -
test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java
diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java index 7c89cd081..dc2c05575 100644
a b public class PluginPreferenceTest { 50 50 */ 51 51 public static PluginInformation getDummyPluginInformation() throws PluginException { 52 52 return new PluginInformation( 53 new File(TestUtils.getTestDataRoot() + " plugin/dummy_plugin.jar"), "dummy_plugin");53 new File(TestUtils.getTestDataRoot() + "__files/plugin/dummy_plugin.v31772.jar"), "dummy_plugin"); 54 54 } 55 55 56 56 /** -
new file test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java
diff --git a/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java b/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java new file mode 100644 index 000000000..66499ec93
- + 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.plugins; 3 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertFalse; 6 import static org.junit.Assert.assertNotEquals; 7 8 import java.io.File; 9 import java.nio.file.Files; 10 import java.util.List; 11 12 import org.junit.Before; 13 import org.junit.Rule; 14 import org.junit.Test; 15 import org.openstreetmap.josm.Main; 16 import org.openstreetmap.josm.TestUtils; 17 import org.openstreetmap.josm.spi.preferences.Config; 18 import org.openstreetmap.josm.testutils.ExtendedDialogMocker; 19 import org.openstreetmap.josm.testutils.HelpAwareOptionPaneMocker; 20 import org.openstreetmap.josm.testutils.JOSMTestRules; 21 import org.openstreetmap.josm.testutils.PluginServer; 22 23 import com.google.common.collect.ImmutableList; 24 import com.google.common.collect.ImmutableMap; 25 26 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 27 28 import com.github.tomakehurst.wiremock.client.WireMock; 29 import com.github.tomakehurst.wiremock.junit.WireMockRule; 30 31 import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; 32 33 /** 34 * Test parts of {@link PluginHandler} class when the reported JOSM version is too old for the plugin. 35 */ 36 public class PluginHandlerJOSMTooOldTest { 37 /** 38 * Setup test. 39 */ 40 @Rule 41 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 42 public JOSMTestRules test = new JOSMTestRules().preferences().main().assumeRevision( 43 "Revision: 6000\n" 44 ); 45 46 /** 47 * Plugin server mock. 48 */ 49 @Rule 50 public WireMockRule pluginServerRule = new WireMockRule( 51 options().dynamicPort().usingFilesUnderDirectory(TestUtils.getTestDataRoot()) 52 ); 53 54 @Before 55 public void setUp() throws Exception { 56 Config.getPref().putInt("pluginmanager.version", 999); 57 Config.getPref().put("pluginmanager.lastupdate", "999"); 58 Config.getPref().putList("pluginmanager.sites", 59 ImmutableList.of(String.format("http://localhost:%s/plugins", this.pluginServerRule.port())) 60 ); 61 62 this.referenceDummyJarOld = new File(TestUtils.getTestDataRoot(), "__files/plugin/dummy_plugin.v31701.jar"); 63 this.referenceDummyJarNew = new File(TestUtils.getTestDataRoot(), "__files/plugin/dummy_plugin.v31772.jar"); 64 this.referenceBazJarOld = new File(TestUtils.getTestDataRoot(), "__files/plugin/baz_plugin.v6.jar"); 65 this.referenceBazJarNew = new File(TestUtils.getTestDataRoot(), "__files/plugin/baz_plugin.v7.jar"); 66 this.pluginDir = Main.pref.getPluginsDirectory(); 67 this.targetDummyJar = new File(this.pluginDir, "dummy_plugin.jar"); 68 this.targetDummyJarNew = new File(this.pluginDir, "dummy_plugin.jar.new"); 69 this.targetBazJar = new File(this.pluginDir, "baz_plugin.jar"); 70 this.targetBazJarNew = new File(this.pluginDir, "baz_plugin.jar.new"); 71 this.pluginDir.mkdirs(); 72 } 73 74 private File pluginDir; 75 private File referenceDummyJarOld; 76 private File referenceDummyJarNew; 77 private File referenceBazJarOld; 78 private File referenceBazJarNew; 79 private File targetDummyJar; 80 private File targetDummyJarNew; 81 private File targetBazJar; 82 private File targetBazJarNew; 83 84 private final String bazPluginVersionReqString = "JOSM version 8,001 required for plugin baz_plugin."; 85 private final String dummyPluginVersionReqString = "JOSM version 7,001 required for plugin dummy_plugin."; 86 private final String dummyPluginFailedString = "<html>Updating the following plugin has failed:<ul><li>dummy_plugin</li></ul>" 87 + "Please open the Preference Dialog after JOSM has started and try to update it manually.</html>"; 88 89 /** 90 * test update of plugins when those plugins turn out to require a higher JOSM version, but the 91 * user chooses to update them anyway. 92 */ 93 @Test 94 public void testUpdatePluginsDownloadBoth() throws Exception { 95 final PluginServer pluginServer = new PluginServer( 96 new PluginServer.RemotePlugin(this.referenceDummyJarNew), 97 new PluginServer.RemotePlugin(this.referenceBazJarNew) 98 ); 99 pluginServer.applyToWireMockServer(this.pluginServerRule); 100 Config.getPref().putList("plugins", ImmutableList.of("dummy_plugin", "baz_plugin")); 101 102 final ExtendedDialogMocker edMocker = new ExtendedDialogMocker(ImmutableMap.<String, Object>builder() 103 .put(this.bazPluginVersionReqString, "Download Plugin") 104 .put(this.dummyPluginVersionReqString, "Download Plugin") 105 .build() 106 ); 107 108 Files.copy(this.referenceDummyJarOld.toPath(), this.targetDummyJar.toPath()); 109 Files.copy(this.referenceBazJarOld.toPath(), this.targetBazJar.toPath()); 110 111 final List<PluginInformation> updatedPlugins = PluginHandler.updatePlugins( 112 Main.parent, 113 null, 114 null, 115 false 116 ).stream().sorted((a, b) -> a.name.compareTo(b.name)).collect(ImmutableList.toImmutableList()); 117 118 assertEquals( 119 ImmutableList.of( 120 this.dummyPluginVersionReqString, 121 this.bazPluginVersionReqString 122 ), 123 edMocker.getInvocationLog().stream().map( 124 invocationEntry -> invocationEntry[1] 125 ).sorted().collect(ImmutableList.toImmutableList()) 126 ); 127 128 assertEquals(2, updatedPlugins.size()); 129 130 assertEquals(updatedPlugins.get(0).name, "baz_plugin"); 131 assertEquals("7", updatedPlugins.get(0).localversion); 132 133 assertEquals(updatedPlugins.get(1).name, "dummy_plugin"); 134 assertEquals("31772", updatedPlugins.get(1).localversion); 135 136 assertFalse(targetDummyJarNew.exists()); 137 assertFalse(targetBazJarNew.exists()); 138 139 TestUtils.assertFileContentsEqual(this.referenceDummyJarNew, this.targetDummyJar); 140 TestUtils.assertFileContentsEqual(this.referenceBazJarNew, this.targetBazJar); 141 142 this.pluginServerRule.verify(1, WireMock.getRequestedFor(WireMock.urlEqualTo("/plugins"))); 143 this.pluginServerRule.verify(1, WireMock.getRequestedFor(WireMock.urlEqualTo("/plugin/dummy_plugin.v31772.jar"))); 144 this.pluginServerRule.verify(1, WireMock.getRequestedFor(WireMock.urlEqualTo("/plugin/baz_plugin.v7.jar"))); 145 146 assertEquals(Config.getPref().getInt("pluginmanager.version", 111), 6000); 147 // not mocking the time so just check it's not its original value 148 assertNotEquals(Config.getPref().get("pluginmanager.lastupdate", "999"), "999"); 149 } 150 151 /** 152 * test update of plugins when those plugins turn out to require a higher JOSM version, but the 153 * user chooses to update one and skip the other. 154 */ 155 @Test 156 public void testUpdatePluginsSkipOne() throws Exception { 157 final PluginServer pluginServer = new PluginServer( 158 new PluginServer.RemotePlugin(this.referenceDummyJarNew), 159 new PluginServer.RemotePlugin(this.referenceBazJarNew) 160 ); 161 pluginServer.applyToWireMockServer(this.pluginServerRule); 162 Config.getPref().putList("plugins", ImmutableList.of("dummy_plugin", "baz_plugin")); 163 164 final ExtendedDialogMocker edMocker = new ExtendedDialogMocker(ImmutableMap.<String, Object>builder() 165 .put(this.bazPluginVersionReqString, "Download Plugin") 166 .put(this.dummyPluginVersionReqString, "Skip Download") 167 .build() 168 ); 169 final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker(ImmutableMap.<String, Object>builder() 170 .put(this.dummyPluginFailedString, "OK") 171 .build() 172 ); 173 174 Files.copy(this.referenceDummyJarOld.toPath(), this.targetDummyJar.toPath()); 175 Files.copy(this.referenceBazJarOld.toPath(), this.targetBazJar.toPath()); 176 177 final List<PluginInformation> updatedPlugins = PluginHandler.updatePlugins( 178 Main.parent, 179 null, 180 null, 181 false 182 ).stream().sorted((a, b) -> a.name.compareTo(b.name)).collect(ImmutableList.toImmutableList()); 183 184 assertEquals( 185 ImmutableList.of( 186 this.dummyPluginVersionReqString, 187 this.bazPluginVersionReqString 188 ), 189 edMocker.getInvocationLog().stream().map( 190 invocationEntry -> invocationEntry[1] 191 ).sorted().collect(ImmutableList.toImmutableList()) 192 ); 193 194 assertEquals( 195 ImmutableList.of( 196 this.dummyPluginFailedString 197 ), 198 haMocker.getInvocationLog().stream().map( 199 invocationEntry -> invocationEntry[1] 200 ).sorted().collect(ImmutableList.toImmutableList()) 201 ); 202 203 assertEquals(2, updatedPlugins.size()); 204 205 assertEquals(updatedPlugins.get(0).name, "baz_plugin"); 206 assertEquals("7", updatedPlugins.get(0).localversion); 207 208 assertEquals(updatedPlugins.get(1).name, "dummy_plugin"); 209 assertEquals("31701", updatedPlugins.get(1).localversion); 210 211 assertFalse(targetDummyJarNew.exists()); 212 assertFalse(targetBazJarNew.exists()); 213 214 TestUtils.assertFileContentsEqual(this.referenceDummyJarOld, this.targetDummyJar); 215 TestUtils.assertFileContentsEqual(this.referenceBazJarNew, this.targetBazJar); 216 217 this.pluginServerRule.verify(1, WireMock.getRequestedFor(WireMock.urlEqualTo("/plugins"))); 218 this.pluginServerRule.verify(0, WireMock.getRequestedFor(WireMock.urlEqualTo("/plugin/dummy_plugin.v31772.jar"))); 219 this.pluginServerRule.verify(1, WireMock.getRequestedFor(WireMock.urlEqualTo("/plugin/baz_plugin.v7.jar"))); 220 221 // shouldn't have been updated 222 assertEquals(Config.getPref().getInt("pluginmanager.version", 111), 999); 223 assertEquals(Config.getPref().get("pluginmanager.lastupdate", "999"), "999"); 224 } 225 226 /** 227 * When the plugin list suggests that the jar file at the provided URL *doesn't* require a newer JOSM 228 * but in fact the plugin served *does*, it is installed anyway. 229 * 230 * This is probably NOT desirable and should be fixed, however this test documents the behaviour. 231 */ 232 @Test 233 public void testUpdatePluginsUnexpectedlyJOSMTooOld() throws Exception { 234 final PluginServer pluginServer = new PluginServer( 235 new PluginServer.RemotePlugin(this.referenceDummyJarNew), 236 new PluginServer.RemotePlugin(this.referenceBazJarNew, ImmutableMap.of( 237 "Plugin-Mainversion", "5500" 238 )) 239 ); 240 pluginServer.applyToWireMockServer(this.pluginServerRule); 241 Config.getPref().putList("plugins", ImmutableList.of("baz_plugin")); 242 243 // setting up blank ExtendedDialogMocker which would raise an exception if any attempt to show 244 // and ExtendedDialog were made 245 new ExtendedDialogMocker(); 246 247 Files.copy(this.referenceBazJarOld.toPath(), this.targetBazJar.toPath()); 248 249 final List<PluginInformation> updatedPlugins = ImmutableList.copyOf(PluginHandler.updatePlugins( 250 Main.parent, 251 null, 252 null, 253 false 254 )); 255 256 // questionably correct 257 assertEquals(1, updatedPlugins.size()); 258 259 // questionably correct 260 assertEquals(updatedPlugins.get(0).name, "baz_plugin"); 261 assertEquals("7", updatedPlugins.get(0).localversion); 262 263 assertFalse(targetBazJarNew.exists()); 264 265 // questionably correct 266 TestUtils.assertFileContentsEqual(this.referenceBazJarNew, this.targetBazJar); 267 268 this.pluginServerRule.verify(1, WireMock.getRequestedFor(WireMock.urlEqualTo("/plugins"))); 269 // questionably correct 270 this.pluginServerRule.verify(1, WireMock.getRequestedFor(WireMock.urlEqualTo("/plugin/baz_plugin.v7.jar"))); 271 272 // should have been updated 273 assertEquals(Config.getPref().getInt("pluginmanager.version", 111), 6000); 274 assertNotEquals(Config.getPref().get("pluginmanager.lastupdate", "999"), "999"); 275 } 276 }