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); }
/** * <dependency> element should not include parent <resource> in list * * @throws Exception */ public void testGetReferencedElementsAllowed4() throws Exception { loadContentPackage1(); Element resourceElement = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.RESOURCE1_ID); Element dependencyElement = resourceElement.getChild(CP_Core.DEPENDENCY, resourceElement.getNamespace()); Element[] elements = cpCore.getReferencedElementsAllowed(dependencyElement); assertTrue("List should not be empty", elements.length > 0); for (int i = 0; i < elements.length; i++) { assertTrue("Should not contain parent Resource in list", elements[i] != resourceElement); } }
public void testGetReferencedElementsAllowed2() throws Exception { loadContentPackage1(); // <dependency> element - should only reference Resources Element element = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.RESOURCE1_ID); element = element.getChild(CP_Core.DEPENDENCY, element.getNamespace()); Element[] elements = cpCore.getReferencedElementsAllowed(element); assertTrue("List should not be empty", elements.length > 0); for (int i = 0; i < elements.length; i++) { String name = elements[i].getName(); assertEquals("Referenced Element should be Resource", CP_Core.RESOURCE, name); } }
public void testGetReferencedElementsAllowed1() throws Exception { loadContentPackage1(); // Item - should be OK Element element = cpCore.getElementByIdentifier(cpCore.getRootManifestElement(), CP_Package1.ITEM1_ID); Element[] elements = cpCore.getReferencedElementsAllowed(element); assertTrue("List should not be empty", elements.length > 0); for (int i = 0; i < elements.length; i++) { String name = elements[i].getName(); assertTrue( "Referenced Element should be Resource or sub-Manifest", name.equals(CP_Core.RESOURCE) || name.equals(CP_Core.MANIFEST)); } }