コード例 #1
0
ファイル: CP_CoreTest.java プロジェクト: aniket134/brihaspati
 /**
  * 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);
 }
コード例 #2
0
ファイル: CP_CoreTest.java プロジェクト: aniket134/brihaspati
 /**
  * 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);
 }
コード例 #3
0
ファイル: CP_CoreTest.java プロジェクト: aniket134/brihaspati
 /**
  * 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);
 }
コード例 #4
0
ファイル: CP_CoreTest.java プロジェクト: aniket134/brihaspati
 /**
  * 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)));
 }
コード例 #5
0
ファイル: CP_CoreTest.java プロジェクト: aniket134/brihaspati
 /**
  * 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));
 }