Пример #1
0
 @Test
 public void testMap_complexContext() {
   OSGiCleanMapper mapper = new OSGiCleanMapper();
   mapper.addGrizzlyAdapter("/a", null);
   mapper.addGrizzlyAdapter("/a/b", null);
   assertNull(
       "Should not be able to map not registered resource.", OSGiCleanMapper.map("/a/b/c", false));
   assertNull(
       "Should not be able to map not registered resource.", OSGiCleanMapper.map("/a/b/", false));
   assertEquals("Registered alias should be found.", "/a/b", OSGiCleanMapper.map("/a/b/c", true));
   assertEquals("Registered alias should be found.", "/a/b", OSGiCleanMapper.map("/a/b/", true));
   assertEquals("Registered alias should be found.", "/a", OSGiCleanMapper.map("/a/b", true));
   assertEquals("Registered alias should be found.", "/a/b", OSGiCleanMapper.map("/a/b", false));
   assertNull(
       "Should not be able to map not registered resource.", OSGiCleanMapper.map("/a", true));
 }
Пример #2
0
 @Test
 public void testMap_simpleContextSub() {
   OSGiCleanMapper mapper = new OSGiCleanMapper();
   mapper.addGrizzlyAdapter("/a", null);
   assertEquals(
       "Registered alias should be found.", "/a", OSGiCleanMapper.map("/a/index.html", true));
 }
Пример #3
0
 @Test
 public void testMap_simpleContext() {
   OSGiCleanMapper mapper = new OSGiCleanMapper();
   mapper.addGrizzlyAdapter("/testAlias", null);
   assertEquals(
       "Registered alias should be found.",
       "/testAlias",
       OSGiCleanMapper.map("/testAlias", false));
 }
Пример #4
0
 @Test
 public void testMap_notRegistered() {
   OSGiCleanMapper mapper = new OSGiCleanMapper();
   mapper.addGrizzlyAdapter("/testAlias", null);
   assertNull(
       "Should not be able to map not registered resource.",
       OSGiCleanMapper.map("/notregistered", true));
   assertNull(
       "Should not be able to map not registered resource.",
       OSGiCleanMapper.map("/notregistered", false));
 }