Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2010-11-19 10:59:44 -0500
committerkmoore2010-11-19 10:59:44 -0500
commit8ada8a51a9c2f73516b44a130790ccc1323498c3 (patch)
tree7539263cd2b2be9ec7b1930de1e791d0527747b4
parentbd10a0342f9aa1a2e650928a63bf5c7986fc1078 (diff)
downloadwebtools.dali-8ada8a51a9c2f73516b44a130790ccc1323498c3.tar.gz
webtools.dali-8ada8a51a9c2f73516b44a130790ccc1323498c3.tar.xz
webtools.dali-8ada8a51a9c2f73516b44a130790ccc1323498c3.zip
Fixed test in the build again, cannot test order of packages and persistentClasses
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/GenericRootContextNodeTests.java592
1 files changed, 18 insertions, 574 deletions
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/GenericRootContextNodeTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/GenericRootContextNodeTests.java
index 8f5150edd5..781f007ba8 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/GenericRootContextNodeTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/GenericRootContextNodeTests.java
@@ -21,6 +21,8 @@ import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass;
import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage;
import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
@@ -82,11 +84,15 @@ public class GenericRootContextNodeTests extends JaxbContextModelTestCase
}
});
- packages = this.getRootContextNode().getPackages().iterator();
+ Iterable<String> packageNames = new TransformationIterable<JaxbPackage, String>(this.getRootContextNode().getPackages()) {
+ @Override
+ protected String transform(JaxbPackage o) {
+ return o.getName();
+ }
+ };
assertEquals(2, this.getRootContextNode().getPackagesSize());
- assertEquals(PACKAGE_NAME, packages.next().getName());
- assertEquals("foo", packages.next().getName());
- assertFalse(packages.hasNext());
+ assertTrue(CollectionTools.contains(packageNames, PACKAGE_NAME));
+ assertTrue(CollectionTools.contains(packageNames, "foo"));
//remove the annotation from the package-info.java and test it's removed from the root context node
annotatedElement.edit(new Member.Editor() {
@@ -133,11 +139,15 @@ public class GenericRootContextNodeTests extends JaxbContextModelTestCase
}
});
- persistentClasses = this.getRootContextNode().getPersistentClasses().iterator();
+ Iterable<String> persistentClassNames = new TransformationIterable<JaxbPersistentClass, String>(this.getRootContextNode().getPersistentClasses()) {
+ @Override
+ protected String transform(JaxbPersistentClass o) {
+ return o.getName();
+ }
+ };
assertEquals(2, this.getRootContextNode().getPersistentClassesSize());
- assertEquals("test.Foo", persistentClasses.next().getName());
- assertEquals(FULLY_QUALIFIED_TYPE_NAME, persistentClasses.next().getName());
- assertFalse(persistentClasses.hasNext());
+ assertTrue(CollectionTools.contains(persistentClassNames, "test.Foo"));
+ assertTrue(CollectionTools.contains(persistentClassNames, FULLY_QUALIFIED_TYPE_NAME));
//remove the annotation from the package-info.java and test it's removed from the root context node
annotatedElement.edit(new Member.Editor() {
@@ -151,570 +161,4 @@ public class GenericRootContextNodeTests extends JaxbContextModelTestCase
assertEquals(FULLY_QUALIFIED_TYPE_NAME, persistentClasses.next().getName());
assertFalse(persistentClasses.hasNext());
}
-
-// public void testGetXmlSchemaTypesSize() throws Exception {
-// this.createPackageInfoWithAccessorOrder();
-// JaxbPackageInfo contextPackageInfo = CollectionTools.get(getRootContextNode().getPackages(), 0).getPackageInfo();
-// JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage();
-//
-// assertEquals(0, contextPackageInfo.getXmlSchemaTypesSize());
-//
-// //add 2 XmlSchemaTypes
-// AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage);
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.addXmlSchemaType(declaration, 0, "bar");
-// GenericRootContextNodeTests.this.addXmlSchemaType(declaration, 1, "foo");
-// }
-// });
-// assertEquals(2, contextPackageInfo.getXmlSchemaTypesSize());
-// }
-//
-// public void testAddXmlSchemaType() throws Exception {
-// //create a package info with an annotation other than XmlSchema to test
-// //adding things to the null schema annotation
-// this.createPackageInfoWithAccessorType();
-// JaxbPackageInfo contextPackageInfo = CollectionTools.get(getRootContextNode().getPackages(), 0).getPackageInfo();
-// JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage();
-//
-// contextPackageInfo.addXmlSchemaType(0).setName("bar");
-// contextPackageInfo.addXmlSchemaType(0).setName("foo");
-// contextPackageInfo.addXmlSchemaType(0).setName("baz");
-//
-// Iterator<XmlSchemaTypeAnnotation> xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage);
-//
-// assertEquals("baz", xmlSchemaTypes.next().getName());
-// assertEquals("foo", xmlSchemaTypes.next().getName());
-// assertEquals("bar", xmlSchemaTypes.next().getName());
-// assertFalse(xmlSchemaTypes.hasNext());
-// }
-//
-// @SuppressWarnings("unchecked")
-// protected Iterator<XmlSchemaTypeAnnotation> getSchemaTypeAnnotations(JavaResourcePackage resourcePackage) {
-// return (Iterator<XmlSchemaTypeAnnotation>) resourcePackage.getAnnotations(JAXB.XML_SCHEMA_TYPE).iterator();
-// }
-//
-// public void testAddXmlSchemaType2() throws Exception {
-// //create a package info with an annotation other than XmlSchema to test
-// //adding things to the null schema annotation
-// this.createPackageInfoWithAccessorType();
-// JaxbPackageInfo contextPackageInfo = CollectionTools.get(getRootContextNode().getPackages(), 0).getPackageInfo();
-// JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage();
-//
-// contextPackageInfo.addXmlSchemaType(0).setName("bar");
-// contextPackageInfo.addXmlSchemaType(1).setName("foo");
-// contextPackageInfo.addXmlSchemaType(0).setName("baz");
-//
-// Iterator<XmlSchemaTypeAnnotation> xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage);
-//
-// assertEquals("baz", xmlSchemaTypes.next().getName());
-// assertEquals("bar", xmlSchemaTypes.next().getName());
-// assertEquals("foo", xmlSchemaTypes.next().getName());
-// assertFalse(xmlSchemaTypes.hasNext());
-// }
-//
-// public void testRemoveXmlSchemaType() throws Exception {
-// this.createPackageInfoWithAccessorType();
-// JaxbPackageInfo contextPackageInfo = CollectionTools.get(getRootContextNode().getPackages(), 0).getPackageInfo();
-// JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage();
-//
-// contextPackageInfo.addXmlSchemaType(0).setName("bar");
-// contextPackageInfo.addXmlSchemaType(1).setName("foo");
-// contextPackageInfo.addXmlSchemaType(2).setName("baz");
-//
-// Iterator<XmlSchemaTypeAnnotation> xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage);
-// assertEquals("bar", xmlSchemaTypes.next().getName());
-// assertEquals("foo", xmlSchemaTypes.next().getName());
-// assertEquals("baz", xmlSchemaTypes.next().getName());
-// assertFalse(xmlSchemaTypes.hasNext());
-//
-// contextPackageInfo.removeXmlSchemaType(1);
-//
-// xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage);
-// assertEquals("bar", xmlSchemaTypes.next().getName());
-// assertEquals("baz", xmlSchemaTypes.next().getName());
-// assertFalse(xmlSchemaTypes.hasNext());
-//
-// contextPackageInfo.removeXmlSchemaType(1);
-// xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage);
-// assertEquals("bar", xmlSchemaTypes.next().getName());
-// assertFalse(xmlSchemaTypes.hasNext());
-//
-// contextPackageInfo.removeXmlSchemaType(0);
-// xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage);
-// assertFalse(xmlSchemaTypes.hasNext());
-// }
-//
-// public void testMoveXmlSchemaType() throws Exception {
-// this.createPackageInfoWithAccessorType();
-// JaxbPackageInfo contextPackageInfo = CollectionTools.get(getRootContextNode().getPackages(), 0).getPackageInfo();
-// JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage();
-//
-// contextPackageInfo.addXmlSchemaType(0).setName("bar");
-// contextPackageInfo.addXmlSchemaType(1).setName("foo");
-// contextPackageInfo.addXmlSchemaType(2).setName("baz");
-//
-// Iterator<XmlSchemaTypeAnnotation> xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage);
-// assertEquals("bar", xmlSchemaTypes.next().getName());
-// assertEquals("foo", xmlSchemaTypes.next().getName());
-// assertEquals("baz", xmlSchemaTypes.next().getName());
-// assertFalse(xmlSchemaTypes.hasNext());
-//
-// contextPackageInfo.moveXmlSchemaType(2, 0);
-// xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage);
-// assertEquals("foo", xmlSchemaTypes.next().getName());
-// assertEquals("baz", xmlSchemaTypes.next().getName());
-// assertEquals("bar", xmlSchemaTypes.next().getName());
-// assertFalse(xmlSchemaTypes.hasNext());
-//
-// contextPackageInfo.moveXmlSchemaType(0, 1);
-// xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage);
-// assertEquals("baz", xmlSchemaTypes.next().getName());
-// assertEquals("foo", xmlSchemaTypes.next().getName());
-// assertEquals("bar", xmlSchemaTypes.next().getName());
-// assertFalse(xmlSchemaTypes.hasNext());
-// }
-//
-// public void testSyncXmlSchemaTypes() throws Exception {
-// this.createPackageInfoWithAccessorType();
-// JaxbPackageInfo contextPackageInfo = CollectionTools.get(getRootContextNode().getPackages(), 0).getPackageInfo();
-// JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage();
-//
-// ListIterable<XmlSchemaType> xmlSchemaTypes = contextPackageInfo.getXmlSchemaTypes();
-// assertFalse(xmlSchemaTypes.iterator().hasNext());
-//
-// //add 3 XmlSchemaTypes
-// AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage);
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.addXmlSchemaType(declaration, 0, "bar");
-// GenericRootContextNodeTests.this.addXmlSchemaType(declaration, 1, "foo");
-// GenericRootContextNodeTests.this.addXmlSchemaType(declaration, 2, "baz");
-// }
-// });
-//
-// xmlSchemaTypes = contextPackageInfo.getXmlSchemaTypes();
-// ListIterator<XmlSchemaType> xmlSchemaTypesIterator = xmlSchemaTypes.iterator();
-// assertTrue(xmlSchemaTypesIterator.hasNext());
-// assertEquals("bar", xmlSchemaTypesIterator.next().getName());
-// assertEquals("foo", xmlSchemaTypesIterator.next().getName());
-// assertEquals("baz", xmlSchemaTypesIterator.next().getName());
-// assertFalse(xmlSchemaTypesIterator.hasNext());
-//
-//
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.moveXmlSchemaType(declaration, 2, 0);
-// }
-// });
-//
-// xmlSchemaTypesIterator = xmlSchemaTypes.iterator();
-// assertTrue(xmlSchemaTypesIterator.hasNext());
-// assertEquals("foo", xmlSchemaTypesIterator.next().getName());
-// assertEquals("baz", xmlSchemaTypesIterator.next().getName());
-// assertEquals("bar", xmlSchemaTypesIterator.next().getName());
-// assertFalse(xmlSchemaTypesIterator.hasNext());
-//
-//
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.moveXmlSchemaType(declaration, 0, 1);
-// }
-// });
-//
-// xmlSchemaTypesIterator = xmlSchemaTypes.iterator();
-// assertTrue(xmlSchemaTypesIterator.hasNext());
-// assertEquals("baz", xmlSchemaTypesIterator.next().getName());
-// assertEquals("foo", xmlSchemaTypesIterator.next().getName());
-// assertEquals("bar", xmlSchemaTypesIterator.next().getName());
-// assertFalse(xmlSchemaTypesIterator.hasNext());
-//
-//
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.removeXmlSchemaType(declaration, 1);
-// }
-// });
-//
-// xmlSchemaTypesIterator = xmlSchemaTypes.iterator();
-// assertTrue(xmlSchemaTypesIterator.hasNext());
-// assertEquals("baz", xmlSchemaTypesIterator.next().getName());
-// assertEquals("bar", xmlSchemaTypesIterator.next().getName());
-// assertFalse(xmlSchemaTypesIterator.hasNext());
-//
-//
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.removeXmlSchemaType(declaration, 1);
-// }
-// });
-//
-// xmlSchemaTypesIterator = xmlSchemaTypes.iterator();
-// assertTrue(xmlSchemaTypesIterator.hasNext());
-// assertEquals("baz", xmlSchemaTypesIterator.next().getName());
-// assertFalse(xmlSchemaTypesIterator.hasNext());
-//
-//
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.removeXmlSchemaType(declaration, 0);
-// }
-// });
-//
-// xmlSchemaTypesIterator = xmlSchemaTypes.iterator();
-// assertFalse(xmlSchemaTypesIterator.hasNext());
-// }
-//
-// public void testSyncAddXmlSchemaTypes() throws Exception {
-// this.createPackageInfoWithAccessorType();
-// JaxbPackageInfo contextPackageInfo = CollectionTools.get(getRootContextNode().getPackages(), 0).getPackageInfo();
-// JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage();
-//
-// ListIterable<XmlSchemaType> xmlSchemaTypes = contextPackageInfo.getXmlSchemaTypes();
-// assertFalse(xmlSchemaTypes.iterator().hasNext());
-//
-// //add 1 XmlSchemaType when none exist
-// AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage);
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.addXmlSchemaType(declaration, 0, "bar");
-// }
-// });
-//
-// xmlSchemaTypes = contextPackageInfo.getXmlSchemaTypes();
-// ListIterator<XmlSchemaType> xmlSchemaTypesIterator = xmlSchemaTypes.iterator();
-// assertTrue(xmlSchemaTypesIterator.hasNext());
-// assertEquals("bar", xmlSchemaTypesIterator.next().getName());
-// assertFalse(xmlSchemaTypesIterator.hasNext());
-//
-//
-// //add 1 XmlSchemaType when 1 standalone exists
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.addXmlSchemaType(declaration, 1, "foo");
-// }
-// });
-//
-// xmlSchemaTypes = contextPackageInfo.getXmlSchemaTypes();
-// xmlSchemaTypesIterator = xmlSchemaTypes.iterator();
-// assertTrue(xmlSchemaTypesIterator.hasNext());
-// assertEquals("bar", xmlSchemaTypesIterator.next().getName());
-// assertEquals("foo", xmlSchemaTypesIterator.next().getName());
-// assertFalse(xmlSchemaTypesIterator.hasNext());
-//
-// //add 1 XmlSchemaType when a container annotations exists
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.addXmlSchemaType(declaration, 2, "baz");
-// }
-// });
-//
-// xmlSchemaTypes = contextPackageInfo.getXmlSchemaTypes();
-// xmlSchemaTypesIterator = xmlSchemaTypes.iterator();
-// assertTrue(xmlSchemaTypesIterator.hasNext());
-// assertEquals("bar", xmlSchemaTypesIterator.next().getName());
-// assertEquals("foo", xmlSchemaTypesIterator.next().getName());
-// assertEquals("baz", xmlSchemaTypesIterator.next().getName());
-// assertFalse(xmlSchemaTypesIterator.hasNext());
-//
-// //add 1 XmlSchemaType to beginning of list when a container annotations exists
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.addXmlSchemaType(declaration, 0, "foobaz");
-// }
-// });
-//
-// xmlSchemaTypes = contextPackageInfo.getXmlSchemaTypes();
-// xmlSchemaTypesIterator = xmlSchemaTypes.iterator();
-// assertTrue(xmlSchemaTypesIterator.hasNext());
-// assertEquals("foobaz", xmlSchemaTypesIterator.next().getName());
-// assertEquals("bar", xmlSchemaTypesIterator.next().getName());
-// assertEquals("foo", xmlSchemaTypesIterator.next().getName());
-// assertEquals("baz", xmlSchemaTypesIterator.next().getName());
-// assertFalse(xmlSchemaTypesIterator.hasNext());
-// }
-//
-// protected void moveXmlSchemaType(ModifiedDeclaration declaration, int targetIndex, int sourceIndex) {
-// this.moveArrayElement((NormalAnnotation) declaration.getAnnotationNamed(JAXB.XML_SCHEMA_TYPES), JAXB.XML_SCHEMA_TYPES__VALUE, targetIndex, sourceIndex);
-// }
-//
-// protected void removeXmlSchemaType(ModifiedDeclaration declaration, int index) {
-// this.removeArrayElement((NormalAnnotation) declaration.getAnnotationNamed(JAXB.XML_SCHEMA_TYPES), JAXB.XML_SCHEMA_TYPES__VALUE, index);
-// }
-//
-//
-//
-//
-//
-// public void testGetXmlJavaTypeAdapters() throws Exception {
-// this.createPackageInfoWithAccessorOrder();
-// JaxbPackageInfo contextPackageInfo = CollectionTools.get(getRootContextNode().getPackages(), 0).getPackageInfo();
-// JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage();
-//
-// ListIterable<XmlJavaTypeAdapter> xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters();
-// assertFalse(xmlJavaTypeAdapters.iterator().hasNext());
-//
-// //add 2 XmlJavaTypeAdapters
-// AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage);
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.addXmlJavaTypeAdapter(declaration, 0, "String");
-// GenericRootContextNodeTests.this.addXmlJavaTypeAdapter(declaration, 1, "Integer");
-// }
-// });
-//
-// xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters();
-// ListIterator<XmlJavaTypeAdapter> xmlJavaTypeAdaptersIterator = xmlJavaTypeAdapters.iterator();
-// assertTrue(xmlJavaTypeAdaptersIterator.hasNext());
-// assertEquals("String", xmlJavaTypeAdaptersIterator.next().getValue());
-// assertEquals("Integer", xmlJavaTypeAdaptersIterator.next().getValue());
-// assertFalse(xmlJavaTypeAdaptersIterator.hasNext());
-// }
-//
-// protected void addXmlJavaTypeAdapter(ModifiedDeclaration declaration, int index, String name) {
-// NormalAnnotation arrayElement = this.newXmlJavaTypeAdapterAnnotation(declaration.getAst(), name);
-// this.addArrayElement(declaration, JAXB.XML_JAVA_TYPE_ADAPTERS, index, JAXB.XML_JAVA_TYPE_ADAPTERS__VALUE, arrayElement);
-// }
-//
-// protected NormalAnnotation newXmlJavaTypeAdapterAnnotation(AST ast, String valueTypeName) {
-// NormalAnnotation annotation = this.newNormalAnnotation(ast, JAXB.XML_JAVA_TYPE_ADAPTER);
-// this.addMemberValuePair(
-// annotation,
-// JAXB.XML_JAVA_TYPE_ADAPTER__VALUE,
-// this.newTypeLiteral(ast, valueTypeName));
-// return annotation;
-// }
-//
-// public void testGetXmlJavaTypeAdaptersSize() throws Exception {
-// this.createPackageInfoWithAccessorOrder();
-// JaxbPackageInfo contextPackageInfo = CollectionTools.get(getRootContextNode().getPackages(), 0).getPackageInfo();
-// JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage();
-//
-// assertEquals(0, contextPackageInfo.getXmlJavaTypeAdaptersSize());
-//
-// //add 2 XmlJavaTypeAdapters
-// AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage);
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.addXmlJavaTypeAdapter(declaration, 0, "String");
-// GenericRootContextNodeTests.this.addXmlJavaTypeAdapter(declaration, 1, "Integer");
-// }
-// });
-// assertEquals(2, contextPackageInfo.getXmlJavaTypeAdaptersSize());
-// }
-//
-// public void testAddXmlJavaTypeAdapter() throws Exception {
-// //create a package info with an annotation other than XmlSchema to test
-// //adding things to the null schema annotation
-// this.createPackageInfoWithAccessorType();
-// JaxbPackageInfo contextPackageInfo = CollectionTools.get(getRootContextNode().getPackages(), 0).getPackageInfo();
-// JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage();
-//
-// contextPackageInfo.addXmlJavaTypeAdapter(0).setValue("bar");
-// contextPackageInfo.addXmlJavaTypeAdapter(0).setValue("foo");
-// contextPackageInfo.addXmlJavaTypeAdapter(0).setValue("baz");
-//
-// Iterator<XmlJavaTypeAdapterAnnotation> xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage);
-//
-// assertEquals("baz", xmlJavaTypeAdapters.next().getValue());
-// assertEquals("foo", xmlJavaTypeAdapters.next().getValue());
-// assertEquals("bar", xmlJavaTypeAdapters.next().getValue());
-// assertFalse(xmlJavaTypeAdapters.hasNext());
-// }
-//
-// @SuppressWarnings("unchecked")
-// protected Iterator<XmlJavaTypeAdapterAnnotation> getXmlJavaTypeAdapterAnnotations(JavaResourcePackage resourcePackage) {
-// return (Iterator<XmlJavaTypeAdapterAnnotation>) resourcePackage.getAnnotations(JAXB.XML_JAVA_TYPE_ADAPTER).iterator();
-// }
-//
-// public void testAddXmlJavaTypeAdapter2() throws Exception {
-// //create a package info with an annotation other than XmlSchema to test
-// //adding things to the null schema annotation
-// this.createPackageInfoWithAccessorType();
-// JaxbPackageInfo contextPackageInfo = CollectionTools.get(getRootContextNode().getPackages(), 0).getPackageInfo();
-// JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage();
-//
-// contextPackageInfo.addXmlJavaTypeAdapter(0).setValue("bar");
-// contextPackageInfo.addXmlJavaTypeAdapter(1).setValue("foo");
-// contextPackageInfo.addXmlJavaTypeAdapter(0).setValue("baz");
-//
-// Iterator<XmlJavaTypeAdapterAnnotation> xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage);
-//
-// assertEquals("baz", xmlJavaTypeAdapters.next().getValue());
-// assertEquals("bar", xmlJavaTypeAdapters.next().getValue());
-// assertEquals("foo", xmlJavaTypeAdapters.next().getValue());
-// assertFalse(xmlJavaTypeAdapters.hasNext());
-// }
-//
-// public void testRemoveXmlJavaTypeAdapter() throws Exception {
-// this.createPackageInfoWithAccessorType();
-// JaxbPackageInfo contextPackageInfo = CollectionTools.get(getRootContextNode().getPackages(), 0).getPackageInfo();
-// JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage();
-//
-// contextPackageInfo.addXmlJavaTypeAdapter(0).setValue("String");
-// contextPackageInfo.addXmlJavaTypeAdapter(1).setValue("foo");
-// contextPackageInfo.addXmlJavaTypeAdapter(2).setValue("baz");
-//
-// Iterator<XmlJavaTypeAdapterAnnotation> xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage);
-// XmlJavaTypeAdapterAnnotation adapterAnnotation = xmlJavaTypeAdapters.next();
-// assertEquals("String", adapterAnnotation.getValue());
-// assertEquals("java.lang.String", adapterAnnotation.getFullyQualifiedValue());
-// assertEquals("foo", xmlJavaTypeAdapters.next().getValue());
-// assertEquals("baz", xmlJavaTypeAdapters.next().getValue());
-// assertFalse(xmlJavaTypeAdapters.hasNext());
-//
-// contextPackageInfo.removeXmlJavaTypeAdapter(1);
-//
-// xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage);
-// adapterAnnotation = xmlJavaTypeAdapters.next();
-// assertEquals("String", adapterAnnotation.getValue());
-// assertEquals("java.lang.String", adapterAnnotation.getFullyQualifiedValue());
-// assertEquals("baz", xmlJavaTypeAdapters.next().getValue());
-// assertFalse(xmlJavaTypeAdapters.hasNext());
-//
-// contextPackageInfo.removeXmlJavaTypeAdapter(1);
-// xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage);
-// adapterAnnotation = xmlJavaTypeAdapters.next();
-// assertEquals("String", adapterAnnotation.getValue());
-// assertEquals("java.lang.String", adapterAnnotation.getFullyQualifiedValue());
-// assertFalse(xmlJavaTypeAdapters.hasNext());
-//
-// contextPackageInfo.removeXmlJavaTypeAdapter(0);
-// xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage);
-// assertFalse(xmlJavaTypeAdapters.hasNext());
-// }
-//
-// public void testMoveXmlJavaTypeAdapter() throws Exception {
-// this.createPackageInfoWithAccessorType();
-// JaxbPackageInfo contextPackageInfo = CollectionTools.get(getRootContextNode().getPackages(), 0).getPackageInfo();
-// JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage();
-//
-// contextPackageInfo.addXmlJavaTypeAdapter(0).setValue("bar");
-// contextPackageInfo.addXmlJavaTypeAdapter(1).setValue("foo");
-// contextPackageInfo.addXmlJavaTypeAdapter(2).setValue("baz");
-//
-// Iterator<XmlJavaTypeAdapterAnnotation> xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage);
-// assertEquals("bar", xmlJavaTypeAdapters.next().getValue());
-// assertEquals("foo", xmlJavaTypeAdapters.next().getValue());
-// assertEquals("baz", xmlJavaTypeAdapters.next().getValue());
-// assertFalse(xmlJavaTypeAdapters.hasNext());
-//
-// contextPackageInfo.moveXmlJavaTypeAdapter(2, 0);
-// xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage);
-// assertEquals("foo", xmlJavaTypeAdapters.next().getValue());
-// assertEquals("baz", xmlJavaTypeAdapters.next().getValue());
-// assertEquals("bar", xmlJavaTypeAdapters.next().getValue());
-// assertFalse(xmlJavaTypeAdapters.hasNext());
-//
-// contextPackageInfo.moveXmlJavaTypeAdapter(0, 1);
-// xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage);
-// assertEquals("baz", xmlJavaTypeAdapters.next().getValue());
-// assertEquals("foo", xmlJavaTypeAdapters.next().getValue());
-// assertEquals("bar", xmlJavaTypeAdapters.next().getValue());
-// assertFalse(xmlJavaTypeAdapters.hasNext());
-// }
-//
-// public void testSyncXmlJavaTypeAdapters() throws Exception {
-// this.createPackageInfoWithAccessorType();
-// JaxbPackageInfo contextPackageInfo = CollectionTools.get(getRootContextNode().getPackages(), 0).getPackageInfo();
-// JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage();
-//
-// ListIterable<XmlJavaTypeAdapter> xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters();
-// assertFalse(xmlJavaTypeAdapters.iterator().hasNext());
-//
-// //add 3 XmlJavaTypeAdapters
-// AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage);
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.addXmlJavaTypeAdapter(declaration, 0, "bar");
-// GenericRootContextNodeTests.this.addXmlJavaTypeAdapter(declaration, 1, "foo");
-// GenericRootContextNodeTests.this.addXmlJavaTypeAdapter(declaration, 2, "baz");
-// }
-// });
-//
-// xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters();
-// ListIterator<XmlJavaTypeAdapter> xmlJavaTypeAdaptersIterator = xmlJavaTypeAdapters.iterator();
-// assertTrue(xmlJavaTypeAdaptersIterator.hasNext());
-// assertEquals("bar", xmlJavaTypeAdaptersIterator.next().getValue());
-// assertEquals("foo", xmlJavaTypeAdaptersIterator.next().getValue());
-// assertEquals("baz", xmlJavaTypeAdaptersIterator.next().getValue());
-// assertFalse(xmlJavaTypeAdaptersIterator.hasNext());
-//
-//
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.moveXmlJavaTypeAdapter(declaration, 2, 0);
-// }
-// });
-//
-// xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters();
-// xmlJavaTypeAdaptersIterator = xmlJavaTypeAdapters.iterator();
-// assertTrue(xmlJavaTypeAdaptersIterator.hasNext());
-// assertEquals("foo", xmlJavaTypeAdaptersIterator.next().getValue());
-// assertEquals("baz", xmlJavaTypeAdaptersIterator.next().getValue());
-// assertEquals("bar", xmlJavaTypeAdaptersIterator.next().getValue());
-// assertFalse(xmlJavaTypeAdaptersIterator.hasNext());
-//
-//
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.moveXmlJavaTypeAdapter(declaration, 0, 1);
-// }
-// });
-//
-// xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters();
-// xmlJavaTypeAdaptersIterator = xmlJavaTypeAdapters.iterator();
-// assertTrue(xmlJavaTypeAdaptersIterator.hasNext());
-// assertEquals("baz", xmlJavaTypeAdaptersIterator.next().getValue());
-// assertEquals("foo", xmlJavaTypeAdaptersIterator.next().getValue());
-// assertEquals("bar", xmlJavaTypeAdaptersIterator.next().getValue());
-// assertFalse(xmlJavaTypeAdaptersIterator.hasNext());
-//
-//
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.removeXmlJavaTypeAdapter(declaration, 1);
-// }
-// });
-//
-// xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters();
-// xmlJavaTypeAdaptersIterator = xmlJavaTypeAdapters.iterator();
-// assertTrue(xmlJavaTypeAdaptersIterator.hasNext());
-// assertEquals("baz", xmlJavaTypeAdaptersIterator.next().getValue());
-// assertEquals("bar", xmlJavaTypeAdaptersIterator.next().getValue());
-// assertFalse(xmlJavaTypeAdaptersIterator.hasNext());
-//
-//
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.removeXmlJavaTypeAdapter(declaration, 1);
-// }
-// });
-//
-// xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters();
-// xmlJavaTypeAdaptersIterator = xmlJavaTypeAdapters.iterator();
-// assertTrue(xmlJavaTypeAdaptersIterator.hasNext());
-// assertEquals("baz", xmlJavaTypeAdaptersIterator.next().getValue());
-// assertFalse(xmlJavaTypeAdaptersIterator.hasNext());
-//
-//
-// annotatedElement.edit(new Member.Editor() {
-// public void edit(ModifiedDeclaration declaration) {
-// GenericRootContextNodeTests.this.removeXmlJavaTypeAdapter(declaration, 0);
-// }
-// });
-//
-// xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters();
-// xmlJavaTypeAdaptersIterator = xmlJavaTypeAdapters.iterator();
-// assertFalse(xmlJavaTypeAdaptersIterator.hasNext());
-// }
-//
-//
-// protected void moveXmlJavaTypeAdapter(ModifiedDeclaration declaration, int targetIndex, int sourceIndex) {
-// this.moveArrayElement((NormalAnnotation) declaration.getAnnotationNamed(JAXB.XML_JAVA_TYPE_ADAPTERS), JAXB.XML_JAVA_TYPE_ADAPTERS__VALUE, targetIndex, sourceIndex);
-// }
-//
-// protected void removeXmlJavaTypeAdapter(ModifiedDeclaration declaration, int index) {
-// this.removeArrayElement((NormalAnnotation) declaration.getAnnotationNamed(JAXB.XML_JAVA_TYPE_ADAPTERS), JAXB.XML_JAVA_TYPE_ADAPTERS__VALUE, index);
-// }
}

Back to the top