1 7 package com.inversoft.verge.mvc.model.repository.test; 8 9 10 import java.util.HashMap ; 11 import java.util.Map ; 12 13 import com.inversoft.junit.WebTestCase; 14 import com.inversoft.verge.mvc.MVCRequest; 15 import com.inversoft.verge.mvc.model.ModelResolution; 16 import com.inversoft.verge.mvc.model.repository.RepositoryModelResolver; 17 import com.inversoft.verge.repository.Repository; 18 import com.inversoft.verge.repository.test.RepositoryTest; 19 20 21 30 public class RepositoryModelResolverTest extends WebTestCase { 31 32 35 public RepositoryModelResolverTest(String name) { 36 super(name); 37 setLocal(true); 38 } 39 40 41 44 public void testAll() { 45 46 MVCRequest mvcRequest = new MVCRequest(request, response); 47 Map params = new HashMap (); 48 49 try { 50 RepositoryTest rt = new RepositoryTest("testInitialization"); 51 rt.setResponse(response); 52 rt.setRequest(request); 53 rt.setContext(context); 54 rt.testInitialization(); 55 56 RepositoryModelResolver resolver = new RepositoryModelResolver(); 57 ModelResolution resolution = resolver.resolve(mvcRequest, "item1.name", params); 58 Object item = Repository.getInstance().lookupItem(request, "item1"); 59 assertEquals("Objects should be equal", resolution.getModel(), item); 60 61 resolution = resolver.resolve(mvcRequest, "item1.name", null); 63 assertEquals("Objects should be equal", resolution.getModel(), item); 64 } catch (Exception e) { 65 fail(e.toString()); 66 } 67 } 68 } 69 | Popular Tags |