Search in sources :

Example 1 with JacksonResourceResolver

use of com.manydesigns.portofino.dispatcher.resolvers.JacksonResourceResolver in project Portofino by ManyDesigns.

the class TestJacksonResourceResolver method person.

@Test
public void person() throws Exception {
    FileObject root = getRoot();
    ResourceResolver resourceResolver = new CachingResourceResolver(new JacksonResourceResolver());
    Map personMap = resourceResolver.resolve(root.resolveFile("test/person.json"), Map.class);
    assertEquals("person", personMap.get("title"));
    Entity personEntity = resourceResolver.resolve(root.resolveFile("test/person.json"), Entity.class);
    assertEquals("person", personEntity.title);
    personMap = resourceResolver.resolve(root.resolveFile("test"), "person", Map.class);
    assertEquals("person", personMap.get("title"));
    personEntity = resourceResolver.resolve(root.resolveFile("test"), "person", Entity.class);
    assertEquals("person", personEntity.title);
}
Also used : CachingResourceResolver(com.manydesigns.portofino.dispatcher.resolvers.CachingResourceResolver) JacksonResourceResolver(com.manydesigns.portofino.dispatcher.resolvers.JacksonResourceResolver) CachingResourceResolver(com.manydesigns.portofino.dispatcher.resolvers.CachingResourceResolver) JacksonResourceResolver(com.manydesigns.portofino.dispatcher.resolvers.JacksonResourceResolver) FileObject(org.apache.commons.vfs2.FileObject) Map(java.util.Map) Test(org.testng.annotations.Test)

Aggregations

CachingResourceResolver (com.manydesigns.portofino.dispatcher.resolvers.CachingResourceResolver)1 JacksonResourceResolver (com.manydesigns.portofino.dispatcher.resolvers.JacksonResourceResolver)1 Map (java.util.Map)1 FileObject (org.apache.commons.vfs2.FileObject)1 Test (org.testng.annotations.Test)1