[infinispan-issues] [JBoss JIRA] (ISPN-3143) Cannot store custom objects via HotRod and read via REST

Mircea Markus (JIRA) jira-events at lists.jboss.org
Thu May 30 02:36:54 EDT 2013


     [ https://issues.jboss.org/browse/ISPN-3143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mircea Markus updated ISPN-3143:
--------------------------------

    Fix Version/s: 5.3.0.CR1
                       (was: 5.3.0.Final)

    
> 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.CR1
>
>
> 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