@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)); }
@Test public void testMap_simpleContext() { OSGiCleanMapper mapper = new OSGiCleanMapper(); mapper.addGrizzlyAdapter("/testAlias", null); assertEquals( "Registered alias should be found.", "/testAlias", OSGiCleanMapper.map("/testAlias", false)); }
@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)); }
@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)); }