public void testGetResourceFile2() throws Exception { loadContentPackage1(); // Bogus Element Element element = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.ORG1_ID); assertNull("Resource File should not exist", cpCore.getResourceFile(element)); }
public void testIsReferencingElement1() throws Exception { loadContentPackage1(); // Item - true Element element = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.ITEM1_ID); assertTrue("Should be referencing element", cpCore.isReferencingElement(element)); }
public void testGetResourceFile3() throws Exception { loadContentPackage1(); // %20 Element element = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.RESOURCE2_ID); assertNotNull("Resource File should exist", cpCore.getResourceFile(element)); }
public void testIsReferencingElement2() throws Exception { loadContentPackage1(); // Organization - false Element element = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.ORG1_ID); assertFalse("Should not be referencing element", cpCore.isReferencingElement(element)); }
public void testGetResourceElementByHREF4() throws Exception { loadContentPackage1(); // Should be Null if not searching on Resources Element Element element = cpCore.getResourceElementByHREF("www.reload.ac.uk", cpCore.getRootManifestElement()); assertNull("Element should be null", element); }
public void testGetElementBase1() throws Exception { loadContentPackage1(); Element element = cpCore.getElementByIdentifier( cpCore.getRootManifestElement(), CP_Package1.SUBMANIFEST_RESOURCE1_ID); assertEquals("ElementBase not correct", "submanifest1/", cpCore.getElementBase(element)); }
/** * Ensure Absolute URL gets "http://" prepended * * @throws Exception */ public void testGetAbsoluteURL_WebLink() throws Exception { loadContentPackage1(); Element element = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.ITEM3_ID); String url = cpCore.getAbsoluteURL(element); assertEquals("Absolute URL not correct", "http://" + CP_Package1.ITEM3_HREF, url); }
/** * 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); }
public void testGetFileElementByHREF3() throws Exception { loadContentPackage1(); // Should be Null if not searching on Resource Element String href = "Another%20File.txt"; Element element = cpCore.getFileElementByHREF(href, cpCore.getRootManifestElement()); assertNull("Element should be null", element); }
public void testGetElementHREF3() throws Exception { loadContentPackage1(); // Backslash converted to forward Element element = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.ITEM5_ID); String url = cpCore.getElementHREF(element); assertEquals("ElementHREF not correct", "bogus/backslash", url); }
public void testGetElementHREF2() throws Exception { loadContentPackage1(); // External Element element = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.ITEM3_ID); String url = cpCore.getElementHREF(element); assertEquals("ElementHREF not correct", CP_Package1.ITEM3_HREF, url); }
public void testGetElementHREF1() throws Exception { loadContentPackage1(); // Local Element element = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.ITEM1_ID); String url = cpCore.getElementHREF(element); assertEquals("ElementHREF not correct", "zappa/0-intro.html", url); }
/** * 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); }
public void testIsReferencingElement3() throws Exception { loadContentPackage1(); // Dependency Element - true Element element = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.RESOURCE1_ID); element = element.getChild(CP_Core.DEPENDENCY, element.getNamespace()); assertTrue("Should be referencing element", cpCore.isReferencingElement(element)); }
public void testGetReferencedElementsAllowed3() throws Exception { loadContentPackage1(); // Organization - should be empty array Element element = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.ORG1_ID); Element[] elements = cpCore.getReferencedElementsAllowed(element); assertEquals("Referenced Elements should be Empty", 0, elements.length); }
public void testGetElementsInManifest4() throws Exception { loadContentPackage1(); // Metadata Element[] elements = cpCore.getElementsInManifest( cpCore.getRootManifestElement(), MD_Core.ROOT_NAME, IMSMD_NAMESPACE_122); assertTrue("Metadata Elements should be found", elements.length > 0); }
public void testGetResourceFiles2() throws Exception { loadContentPackage1(); // Should be empty if using an Item Element element = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.ITEM1_ID); File[] files = cpCore.getResourceFiles(element); assertEquals("File list should be empty", 0, files.length); }
public void testGetReferencedElement3() throws Exception { loadContentPackage1(); // Organization -> should not reference anything, should return null Element element = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.ORG1_ID); Element refElement = cpCore.getReferencedElement(element); assertNull("Referenced Element should be null", refElement); }
public void testGetElementHREF5() throws Exception { loadContentPackage1(); // External with NO base attribute prefix Element element = cpCore.getElementByIdentifier( cpCore.getRootManifestElement(), CP_Package1.SUBMANIFEST_ITEM1_ID); String url = cpCore.getElementHREF(element); assertEquals("ElementHREF not correct", CP_Package1.SUBMANIFEST_RESOURCE1_HREF, url); }
public void testGetElementByIdentifier2() throws Exception { loadContentPackage1(); Element element = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.ITEM2_ID); assertEquals( "Could not find Element by Identifier", CP_Package1.ITEM2_ID, element.getAttributeValue(CP_Core.IDENTIFIER)); }
public void testGetResourceFiles1() throws Exception { loadContentPackage1(); // Should not be empty Element element = cpCore.getRootManifestElement(); File[] files = cpCore.getResourceFiles(element); assertTrue("File list should not be empty", files.length > 0); for (int i = 0; i < files.length; i++) { assertTrue("File should exist", files[i].exists()); } }
public void testGetOrganizations2() throws Exception { loadContentPackage1(); // False Element orgs_element = cpCore .getRootManifestElement() .getChild(CP_Core.RESOURCES, cpCore.getRootManifestElement().getNamespace()); Element[] orgs = cpCore.getOrganizations(orgs_element); assertEquals("Organizations should be Empty", 0, orgs.length); }
public void testGetFileElementByHREF2() throws Exception { loadContentPackage1(); // %20 Element resource = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.RESOURCE2_ID); String href = "Another%20File.txt"; Element element = cpCore.getFileElementByHREF(href, resource); assertEquals("Wrong File Element", CP_Core.FILE, element.getName()); assertEquals("Wrong File Element", href, element.getAttributeValue(CP_Core.HREF)); }
public void testGetFileElementByHREF1() throws Exception { loadContentPackage1(); // Normal Element resource = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.RESOURCE1_ID); String href = "zappa/assets/bkgrd.jpg"; Element element = cpCore.getFileElementByHREF(href, resource); assertEquals("Wrong File Element", CP_Core.FILE, element.getName()); assertEquals("Wrong File Element", href, element.getAttributeValue(CP_Core.HREF)); }
public void testGetResourceElementByHREF3() throws Exception { loadContentPackage1(); // URL Element resources = cpCore.getResourcesElement(cpCore.getRootManifestElement()); Element element = cpCore.getResourceElementByHREF("www.reload.ac.uk", resources); assertEquals( "Wrong Resource Element", element.getAttributeValue(CP_Core.IDENTIFIER), CP_Package1.RESOURCE3_ID); }
public void testGetResourceElementByHREF2() throws Exception { loadContentPackage1(); // %20 Element resources = cpCore.getResourcesElement(cpCore.getRootManifestElement()); Element element = cpCore.getResourceElementByHREF("Another%20File.txt", resources); assertEquals( "Wrong Resource Element", element.getAttributeValue(CP_Core.IDENTIFIER), CP_Package1.RESOURCE2_ID); }
public void testGetResourceElementByHREF1() throws Exception { loadContentPackage1(); // Normal Element resources = cpCore.getResourcesElement(cpCore.getRootManifestElement()); Element element = cpCore.getResourceElementByHREF("zappa/0-intro.html", resources); assertEquals( "Wrong Resource Element", element.getAttributeValue(CP_Core.IDENTIFIER), CP_Package1.RESOURCE1_ID); }
public void testGetElementsInManifest3() throws Exception { loadContentPackage1(); // Bogus Element[] elements = cpCore.getElementsInManifest( cpCore.getRootManifestElement(), "bogus", cpCore.getRootManifestElement().getNamespace()); assertEquals("Elements should be Empty", 0, elements.length); }
public void testGetResourcesElement1() throws Exception { loadContentPackage1(); // Root manifest Element manifest = cpCore.getRootManifestElement(); Element element = cpCore.getResourcesElement(manifest); assertEquals("Wrong Resources Element", CP_Core.RESOURCES, element.getName()); assertEquals( "Wrong Resources Element", CP_Package1.MANIFEST1_ID, manifest.getAttributeValue(CP_Core.IDENTIFIER)); }
public void testGetReferencedElement2() throws Exception { loadContentPackage1(); // Item -> sub-Manifest Element element = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.ITEM4_ID); Element refElement = cpCore.getReferencedElement(element); assertEquals( "Could not get referenced Element", CP_Package1.SUB_MANIFEST1_ID, refElement.getAttributeValue(CP_Core.IDENTIFIER)); }