[infinispan-issues] [JBoss JIRA] (ISPN-3143) Cannot store custom objects via HotRod and read via REST
Martin Gencur (JIRA)
jira-events at lists.jboss.org
Tue May 28 09:02:07 EDT 2013
Martin Gencur created ISPN-3143:
-----------------------------------
Summary: 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
More information about the infinispan-issues
mailing list