Changeset 36272 in osm for applications/editors/josm/plugins/reverter/test
- Timestamp:
- 2024-06-05T19:04:29+02:00 (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reverter/test/unit/reverter/ChangesetReverterTest.java
r36235 r36272 55 55 56 56 import com.github.tomakehurst.wiremock.client.WireMock; 57 import com.github.tomakehurst.wiremock.common.FileSource; 58 import com.github.tomakehurst.wiremock.extension.Parameters; 59 import com.github.tomakehurst.wiremock.extension.ResponseTransformer; 57 import com.github.tomakehurst.wiremock.extension.ResponseTransformerV2; 60 58 import com.github.tomakehurst.wiremock.http.QueryParameter; 61 import com.github.tomakehurst.wiremock.http.Request;62 59 import com.github.tomakehurst.wiremock.http.Response; 63 60 import com.github.tomakehurst.wiremock.junit5.WireMockExtension; 64 61 import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; 62 import com.github.tomakehurst.wiremock.stubbing.ServeEvent; 65 63 import jakarta.json.Json; 66 64 import jakarta.json.JsonArray; … … 89 87 */ 90 88 @Test 91 void testTicket22520(WireMockRuntimeInfo wireMockRuntimeInfo) throws ExecutionException, InterruptedException { 89 void testTicket22520() throws ExecutionException, InterruptedException { 90 final WireMockRuntimeInfo wireMockRuntimeInfo = wireMockExtension.getRuntimeInfo(); 92 91 wireMockRuntimeInfo.getWireMock().loadMappingsFrom(TestUtils.getRegressionDataDir(22520)); 93 92 MultiplePrimitiveTransformer.register(wireMockRuntimeInfo.getWireMock(), 22520); … … 112 111 */ 113 112 @Test 114 void testTicket23582(WireMockRuntimeInfo wireMockRuntimeInfo) { 113 void testTicket23582() { 114 final WireMockRuntimeInfo wireMockRuntimeInfo = wireMockExtension.getRuntimeInfo(); 115 115 wireMockRuntimeInfo.getWireMock().loadMappingsFrom(TestUtils.getRegressionDataDir(23582)); 116 116 MultiplePrimitiveTransformer.register(wireMockRuntimeInfo.getWireMock(), 23582); … … 126 126 127 127 @Test 128 void testTicket23584(WireMockRuntimeInfo wireMockRuntimeInfo) { 128 void testTicket23584() { 129 final WireMockRuntimeInfo wireMockRuntimeInfo = wireMockExtension.getRuntimeInfo(); 129 130 new JOptionPaneSimpleMocker(Collections.singletonMap("Conflicts detected", JOptionPane.OK_OPTION)); 130 131 wireMockRuntimeInfo.getWireMock().loadMappingsFrom(TestUtils.getRegressionDataDir(23584)); … … 148 149 * the same data as {@link MultiplePrimitiveTransformer}. 149 150 */ 150 private static class PrimitiveTransformer extends ResponseTransformer {151 private static class PrimitiveTransformer implements ResponseTransformerV2 { 151 152 /** 152 153 * Register the URLs for this transformer … … 174 175 175 176 @Override 176 public Response transform(Re quest request, Response response,FileSource files, Parameters parameters) {177 final int ticket = parameters.getInt("ticket");178 final String[] parts = request.getUrl().substring(1).split("/", -1);177 public Response transform(Response response, ServeEvent serveEvent) { 178 final int ticket = serveEvent.getTransformerParameters().getInt("ticket"); 179 final String[] parts = serveEvent.getRequest().getUrl().substring(1).split("/", -1); 179 180 final int version = Integer.parseInt(parts[3]); 180 181 final long id = Long.parseLong(parts[2]); … … 204 205 * This is needed since we don't always do the requests in the same order. 205 206 */ 206 private static class MultiplePrimitiveTransformer extends ResponseTransformer {207 private static class MultiplePrimitiveTransformer implements ResponseTransformerV2 { 207 208 208 209 /** … … 226 227 227 228 @Override 228 public Response transform(Re quest request, Response response,FileSource files, Parameters parameters) {229 final int ticket = parameters.getInt("ticket");230 final QueryParameter wayParam = request.queryParameter("ways");231 final QueryParameter nodeParam = request.queryParameter("nodes");232 final QueryParameter relParam = request.queryParameter("relations");229 public Response transform(Response response, ServeEvent serveEvent) { 230 final int ticket = serveEvent.getTransformerParameters().getInt("ticket"); 231 final QueryParameter wayParam = serveEvent.getRequest().queryParameter("ways"); 232 final QueryParameter nodeParam = serveEvent.getRequest().queryParameter("nodes"); 233 final QueryParameter relParam = serveEvent.getRequest().queryParameter("relations"); 233 234 if (wayParam.isPresent()) { 234 235 return Response.Builder.like(response).but().body(getReturnXml(ticket, OsmPrimitiveType.WAY, wayParam)).build();
Note:
See TracChangeset
for help on using the changeset viewer.