Index: server/rest/src/test/java/org/infinispan/rest/resources/CacheResourceV2Test.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/server/rest/src/test/java/org/infinispan/rest/resources/CacheResourceV2Test.java b/server/rest/src/test/java/org/infinispan/rest/resources/CacheResourceV2Test.java
--- a/server/rest/src/test/java/org/infinispan/rest/resources/CacheResourceV2Test.java (revision 1bf88ed7dc19e3eb0ce118d3878183428f6e8aae)
+++ b/server/rest/src/test/java/org/infinispan/rest/resources/CacheResourceV2Test.java (date 1660663539193)
@@ -22,6 +22,7 @@
import static org.infinispan.rest.RequestHeader.ACCEPT_HEADER;
import static org.infinispan.rest.RequestHeader.KEY_CONTENT_TYPE_HEADER;
import static org.infinispan.rest.assertion.ResponseAssertion.assertThat;
+import static org.infinispan.util.concurrent.CompletionStages.await;
import static org.infinispan.util.concurrent.CompletionStages.join;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.fail;
@@ -911,6 +912,34 @@
return response.getBody();
}
+ @Test
+ public void testReproducer() throws Exception {
+ RestRawClient rawClient = client.raw();
+
+ String xml = " <replicated-cache name=\"product-cache\" mode=\"SYNC\" statistics=\"true\">\n" +
+ " <encoding media-type=\"application/json\"/>\n" +
+ " <memory max-count=\"1000\" when-full=\"REMOVE\"/>\n" +
+ " <expiration lifespan=\"600000\"/>\n" +
+ " <security>\n" +
+ " <authorization roles=\"product-admin product-reader product-writer\"/>\n" +
+ " </security>\n" +
+ " </replicated-cache>";
+
+ CompletionStage<RestResponse> response = rawClient.post("/rest/v2/caches?action=convert", Collections.singletonMap("Accept", APPLICATION_YAML_TYPE), xml, APPLICATION_XML_TYPE);
+
+ RestResponse r = await(response);
+ assertThat(r).isOk();
+ String yaml = r.getBody();
+
+ response = rawClient.post("/rest/v2/caches?action=convert", Collections.singletonMap("Accept", APPLICATION_XML_TYPE), yaml, APPLICATION_YAML_TYPE);
+ assertThat(response).isOk();
+ checkXML(response);
+
+ response = rawClient.post("/rest/v2/caches?action=convert", Collections.singletonMap("Accept", APPLICATION_JSON_TYPE), yaml, APPLICATION_YAML_TYPE);
+ assertThat(response).isOk();
+ checkJSON(response, "");
+ }
+
@Test
public void testConversionFromXML() {
RestRawClient rawClient = client.raw();