[
https://issues.jboss.org/browse/ISPN-3143?page=com.atlassian.jira.plugin....
]
Galder Zamarreño commented on ISPN-3143:
----------------------------------------
This was the result of a test set up issue (didn't register the ServerBootstrap
listener), and wrong expectations in REST read. What the cache contains is a deserialized
Person instance, so the REST server returns a java serialized object. Pull req coming
up...
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:
http://www.atlassian.com/software/jira