Changeset 3677 for trunk/src/test
- Timestamp:
- 05/03/08 22:48:40 (4 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/test/java/org/sarugo/restlet/jpa/URLMappingTests.java
r3666 r3677 63 63 64 64 public void testGetEntityURL() { 65 assertEquals("/test/foo/" + foo.id, router.getEntityURL(foo));65 assertEquals("/test/foo/" + foo.id, app.getEntityURL(foo)); 66 66 assertEquals("/test/foo/" + foo.id + "/bar/" + bar.id, router 67 67 .getEntityURL(bar)); 68 68 Route barRoute = router.attach("/bar/{barId}", BarResource.class); 69 assertEquals("/bar/" + bar.id, router.getEntityURL(bar));69 assertEquals("/bar/" + bar.id, app.getEntityURL(bar)); 70 70 router.attach("/baz/{barId}", barRoute.getNext()); 71 assertEquals("/bar/" + bar.id, router.getEntityURL(bar));71 assertEquals("/bar/" + bar.id, app.getEntityURL(bar)); 72 72 router.setBaseRef("http://server/path"); 73 73 assertEquals("http://server/path/bar/" + bar.id, router … … 76 76 77 77 public void testGetEntity() { 78 FooEntity foundFoo = (FooEntity) router.getEntity("/test/foo/" + foo.id);78 FooEntity foundFoo = (FooEntity) app.getEntity("/test/foo/" + foo.id); 79 79 assertEquals(foo.id, foundFoo.id); 80 foundFoo = (FooEntity) router.getEntity("/test/foo/" + foo.id + 120485);80 foundFoo = (FooEntity) app.getEntity("/test/foo/" + foo.id + 120485); 81 81 assertNull(foundFoo); 82 foundFoo = (FooEntity) router.getEntity("/test/fool/" + foo.id);82 foundFoo = (FooEntity) app.getEntity("/test/fool/" + foo.id); 83 83 assertNull(foundFoo); 84 BarEntity foundBar = (BarEntity) router.getEntity("/test/foo/" + foo.id84 BarEntity foundBar = (BarEntity) app.getEntity("/test/foo/" + foo.id 85 85 + "/bar/" + bar.id); 86 86 assertEquals(bar.id, foundBar.id); 87 87 Route barRoute = router.attach("/bar/{barId}", BarResource.class); 88 foundBar = (BarEntity) router.getEntity("/bar/" + bar.id);88 foundBar = (BarEntity) app.getEntity("/bar/" + bar.id); 89 89 assertEquals(bar.id, foundBar.id); 90 90 router.attach("/baz/{barId}", barRoute.getNext()); 91 foundBar = (BarEntity) router.getEntity("/baz/" + bar.id);91 foundBar = (BarEntity) app.getEntity("/baz/" + bar.id); 92 92 assertEquals(bar.id, foundBar.id); 93 93 router.setBaseRef("http://server/path"); 94 foundBar = (BarEntity) router.getEntity("http://server/path/bar/"94 foundBar = (BarEntity) app.getEntity("http://server/path/bar/" 95 95 + bar.id); 96 96 assertEquals(bar.id, foundBar.id); 97 foundBar = (BarEntity) router.getEntity("/bar/" + bar.id);97 foundBar = (BarEntity) app.getEntity("/bar/" + bar.id); 98 98 assertEquals(bar.id, foundBar.id); 99 99 }
