]
Martin Gencur commented on ISPN-3143:
-------------------------------------
The same applies when storing object Person in embedded mode and trying to read it via
REST. Reading via HotRod works nicely in this case.
Cannot store custom objects via HotRod and read via REST
--------------------------------------------------------
Key: ISPN-3143
URL:
https://issues.jboss.org/browse/ISPN-3143
Project: Infinispan
Issue Type: Feature Request
Affects Versions: 5.3.0.Beta2
Reporter: Martin Gencur
Assignee: Galder ZamarreƱo
Fix For: 5.3.0.Final
The following test fails when added to EmbeddedRestHotRodTest
{code:java}
public void testCustomObjectHotRodPutEmbeddedRestGet() throws Exception{
final String key = "4";
Person p = new Person("Martin");
// 1. Put with Hot Rod
RemoteCache<String, Object> remote = cacheFactory.getHotRodCache();
assertEquals(null, remote.withFlags(Flag.FORCE_RETURN_VALUE).put(key, p));
// 2. Get with Embedded
assertTrue(cacheFactory.getEmbeddedCache().get(key) instanceof Person);
assertEquals(p.getName(), ((Person)
cacheFactory.getEmbeddedCache().get(key)).getName());
// 3. Get with REST
HttpMethod get = new GetMethod(cacheFactory.getRestUrl() + "/" + key);
cacheFactory.getRestClient().executeMethod(get);
assertEquals(HttpServletResponse.SC_OK, get.getStatusCode());
//^^^ fails here - status code 500, status text: NullPointerException
Object returnedPerson =
remote.getRemoteCacheManager().getMarshaller().objectFromByteBuffer(get.getResponseBodyAsString().getBytes());
assertTrue(returnedPerson instanceof Person);
assertEquals(p.getName(), ((Person) returnedPerson).getName());
}
public static class Person implements Serializable {
private String name;
public Person(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
{code}
Storing and retrieving String keys works correctly.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: