Ejemplo n.º 1
0
 /**
  * Ensure Relative URL gets "http://" prepended
  *
  * @throws Exception
  */
 public void testGetRelativeURL_WebLink() throws Exception {
   loadContentPackage1();
   Element element =
       cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.ITEM3_ID);
   String url = cpCore.getRelativeURL(element);
   assertEquals("Relative URL not correct", "http://" + CP_Package1.ITEM3_HREF, url);
 }
Ejemplo n.º 2
0
 /**
  * Ensure Relative URL is OK with params appended
  *
  * @throws Exception
  */
 public void testGetRelativeURL_Local() throws Exception {
   loadContentPackage1();
   Element element =
       cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.ITEM1_ID);
   String url = cpCore.getRelativeURL(element);
   assertEquals("Relative URL not correct", CP_Package1.ITEM1_HREF_WITHPARAMS, url);
 }
Ejemplo n.º 3
0
 /**
  * Ensure Relative URL is OK with base attribute
  *
  * @throws Exception
  */
 public void testGetRelativeURL_Local_WithBaseAttribute() throws Exception {
   loadContentPackage1();
   Element element =
       cpCore.getElementByIdentifier(
           cpCore.getRootManifestElement(), CP_Package1.SUBMANIFEST_RESOURCE2_ID);
   String url = cpCore.getRelativeURL(element);
   assertEquals("Relative URL not correct", CP_Package1.SUBMANIFEST_RESOURCE2_HREF, url);
 }
Ejemplo n.º 4
0
 /**
  * Ensure Absolute URL is of form file://d:\whatever.txt
  *
  * @throws Exception
  */
 public void testGetAbsoluteURL_Local1() throws Exception {
   loadContentPackage1();
   Element element =
       cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.ITEM1_ID);
   String url = cpCore.getAbsoluteURL(element);
   assertTrue(
       "Absolute URL does not start with \"file:///\" - " + url, url.startsWith("file:///"));
   assertTrue(
       "Absolute URL does not end with relative URL - " + url,
       url.endsWith(cpCore.getRelativeURL(element)));
 }
Ejemplo n.º 5
0
 /**
  * Ensure parameters are preserved if contained in the Resource itself
  *
  * @throws Exception
  */
 public void testGetAbsoluteURL_Local_ParametersInResource() throws Exception {
   loadContentPackage2();
   Element element =
       cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package2.ITEM1_ID);
   String url = cpCore.getAbsoluteURL(element);
   assertTrue(
       "Absolute URL does not start with \"file:///\" - " + url, url.startsWith("file:///"));
   assertEquals(
       "Absolute URL wrong",
       "CMD_5987023_M/my_files/ims_import/ber/intro.html?ponk",
       cpCore.getRelativeURL(element));
 }