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