Anna Manukyan created ISPN-6411:
-----------------------------------
Summary: Marshalled value is returned while executing javascript and
returning value from cache over HotRod client
Key: ISPN-6411
URL:
https://issues.jboss.org/browse/ISPN-6411
Project: Infinispan
Issue Type: Bug
Components: Remote Protocols
Reporter: Anna Manukyan
Assignee: Tristan Tarrant
When trying to execute a script over hotrod-client, which puts some data to the cache and
returns it, the test fails with the following exception:
{code}
java.lang.ClassCastException: [B cannot be cast to java.lang.String
at
org.infinispan.client.hotrod.ExecTest.testRemoteScriptRemoteExecution(ExecTest.java:122)
...
{code}
The test code and javascript code are:
{code}
@Test
public void testRemoteScriptRemoteExecution() throws IOException {
String cacheName = "testRemoteScriptRemoteExecution_REPL_SYNC";
ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC,
true);
builder.dataContainer().keyEquivalence(new
AnyServerEquivalence()).valueEquivalence(new
AnyServerEquivalence()).compatibility().enable().marshaller(new
GenericJBossMarshaller());
defineInAll(cacheName, builder);
try (InputStream is = this.getClass().getResourceAsStream("/test1.js")) {
String script = TestingUtil.loadFileAsString(is);
clients.get(0).getCache(SCRIPT_CACHE).put("testRemoteScriptRemoteExecution.js",
script);
}
Map<String, String> params = new HashMap<>();
String result =
clients.get(0).getCache(cacheName).execute("testRemoteScriptRemoteExecution.js",
params); //<- The exception is thrown here while casting to String
assertEquals("hoptimus prime", result);
assertEquals("hoptimus prime",
clients.get(0).getCache(cacheName).get("a"));
}
//test1.js
// mode=local,language=javascript
cache.put("a", "hoptimus prime");
cache.get("a");
{code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)