Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfullbright2012-04-03 21:24:40 +0000
committerpfullbright2012-04-03 21:24:40 +0000
commita8c296ee167f0fc315d310049d37f536ebb972ed (patch)
treeee9cc61f058d20d3f56a0a2876f1d32498622483 /jaxb/tests
parentf3f7412ac0097ad3fac7b43ea75c13db828ba154 (diff)
downloadwebtools.dali-a8c296ee167f0fc315d310049d37f536ebb972ed.tar.gz
webtools.dali-a8c296ee167f0fc315d310049d37f536ebb972ed.tar.xz
webtools.dali-a8c296ee167f0fc315d310049d37f536ebb972ed.zip
bug 366901 - XmlJoinNode support
Diffstat (limited to 'jaxb/tests')
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/java/ELJavaXmlJoinNodeTests.java209
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/java/ELJavaXmlJoinNodesMappingTests.java197
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/java/ELJaxbCoreJavaContextModelTests.java3
3 files changed, 409 insertions, 0 deletions
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/java/ELJavaXmlJoinNodeTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/java/ELJavaXmlJoinNodeTests.java
new file mode 100644
index 0000000000..0cbe7d3f3e
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/java/ELJavaXmlJoinNodeTests.java
@@ -0,0 +1,209 @@
+package org.eclipse.jpt.jaxb.eclipselink.core.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
+import org.eclipse.jpt.jaxb.core.context.JaxbClass;
+import org.eclipse.jpt.jaxb.core.context.JaxbClassMapping;
+import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.eclipselink.core.ELJaxbPlatform;
+import org.eclipse.jpt.jaxb.eclipselink.core.context.java.ELXmlJoinNode;
+import org.eclipse.jpt.jaxb.eclipselink.core.context.java.ELXmlJoinNodesMapping;
+import org.eclipse.jpt.jaxb.eclipselink.core.internal.context.java.ELJavaXmlJoinNodesMapping;
+import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.ELJaxb;
+import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.XmlJoinNodeAnnotation;
+import org.eclipse.jpt.jaxb.eclipselink.core.tests.internal.context.ELJaxbContextModelTestCase;
+
+
+public class ELJavaXmlJoinNodeTests
+ extends ELJaxbContextModelTestCase {
+
+ public ELJavaXmlJoinNodeTests(String name) {
+ super(name);
+ }
+
+
+ @Override
+ protected JaxbPlatformDescription getPlatform() {
+ return ELJaxbPlatform.VERSION_2_2;
+ }
+
+ private ICompilationUnit createTypeWithXmlJoinNode() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_TYPE, ELJaxb.XML_JOIN_NODE);
+ }
+
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlType");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlJoinNode");
+ }
+ });
+ }
+
+
+ public void testModifyXmlPath() throws Exception {
+ createTypeWithXmlJoinNode();
+
+ JaxbClass jaxbClass = (JaxbClass) CollectionTools.get(getContextRoot().getTypes(), 0);
+ JaxbClassMapping classMapping = jaxbClass.getMapping();
+ JaxbPersistentAttribute persistentAttribute = CollectionTools.get(classMapping.getAttributes(), 0);
+ ELXmlJoinNodesMapping mapping = (ELXmlJoinNodesMapping) persistentAttribute.getMapping();
+ JavaResourceAttribute resourceAttribute = mapping.getPersistentAttribute().getJavaResourceAttribute();
+ ELXmlJoinNode xmlJoinNode = CollectionTools.get(mapping.getXmlJoinNodes(), 0);
+ XmlJoinNodeAnnotation annotation = (XmlJoinNodeAnnotation) resourceAttribute.getAnnotation(0, ELJaxb.XML_JOIN_NODE);
+
+ assertNull(annotation.getXmlPath());
+ assertNull(xmlJoinNode.getXmlPath());
+
+ xmlJoinNode.setXmlPath("foo");
+
+ assertEquals("foo", annotation.getXmlPath());
+ assertEquals("foo", xmlJoinNode.getXmlPath());
+
+ xmlJoinNode.setXmlPath("");
+
+ assertEquals("", annotation.getXmlPath());
+ assertEquals("", xmlJoinNode.getXmlPath());
+
+ xmlJoinNode.setXmlPath(null);
+
+ assertNull(annotation.getXmlPath());
+ assertNull(xmlJoinNode.getXmlPath());
+ }
+
+ public void testUpdateXmlPath() throws Exception {
+ createTypeWithXmlJoinNode();
+
+ JaxbClass jaxbClass = (JaxbClass) CollectionTools.get(getContextRoot().getTypes(), 0);
+ JaxbClassMapping classMapping = jaxbClass.getMapping();
+ JaxbPersistentAttribute persistentAttribute = CollectionTools.get(classMapping.getAttributes(), 0);
+ ELJavaXmlJoinNodesMapping mapping = (ELJavaXmlJoinNodesMapping) persistentAttribute.getMapping();
+ JavaResourceAttribute resourceAttribute = mapping.getPersistentAttribute().getJavaResourceAttribute();
+ ELXmlJoinNode xmlJoinNode = CollectionTools.get(mapping.getXmlJoinNodes(), 0);
+ XmlJoinNodeAnnotation annotation = (XmlJoinNodeAnnotation) resourceAttribute.getAnnotation(0, ELJaxb.XML_JOIN_NODE);
+
+ assertNull(annotation.getXmlPath());
+ assertNull(xmlJoinNode.getXmlPath());
+
+ AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute);
+ annotatedElement.edit(new Member.Editor() {
+ public void edit(ModifiedDeclaration declaration) {
+ ELJavaXmlJoinNodeTests.this.setMemberValuePair(
+ declaration, ELJaxb.XML_JOIN_NODE, ELJaxb.XML_JOIN_NODE__XML_PATH, "foo");
+ }
+ });
+
+ assertEquals("foo", annotation.getXmlPath());
+ assertEquals("foo", xmlJoinNode.getXmlPath());
+
+ annotatedElement.edit(new Member.Editor() {
+ public void edit(ModifiedDeclaration declaration) {
+ ELJavaXmlJoinNodeTests.this.setMemberValuePair(
+ declaration, ELJaxb.XML_JOIN_NODE, ELJaxb.XML_JOIN_NODE__XML_PATH, "");
+ }
+ });
+
+ assertEquals("", annotation.getXmlPath());
+ assertEquals("", xmlJoinNode.getXmlPath());
+
+ annotatedElement.edit(new Member.Editor() {
+ public void edit(ModifiedDeclaration declaration) {
+ ELJavaXmlJoinNodeTests.this.removeMemberValuePair(
+ declaration, ELJaxb.XML_JOIN_NODE, ELJaxb.XML_JOIN_NODE__XML_PATH);
+ }
+ });
+
+ assertNull(annotation.getXmlPath());
+ assertNull(xmlJoinNode.getXmlPath());
+ }
+
+ public void testModifyReferencedXmlPath() throws Exception {
+ createTypeWithXmlJoinNode();
+
+ JaxbClass jaxbClass = (JaxbClass) CollectionTools.get(getContextRoot().getTypes(), 0);
+ JaxbClassMapping classMapping = jaxbClass.getMapping();
+ JaxbPersistentAttribute persistentAttribute = CollectionTools.get(classMapping.getAttributes(), 0);
+ ELXmlJoinNodesMapping mapping = (ELXmlJoinNodesMapping) persistentAttribute.getMapping();
+ JavaResourceAttribute resourceAttribute = mapping.getPersistentAttribute().getJavaResourceAttribute();
+ ELXmlJoinNode xmlJoinNode = CollectionTools.get(mapping.getXmlJoinNodes(), 0);
+ XmlJoinNodeAnnotation annotation = (XmlJoinNodeAnnotation) resourceAttribute.getAnnotation(0, ELJaxb.XML_JOIN_NODE);
+
+ assertNull(annotation.getReferencedXmlPath());
+ assertNull(xmlJoinNode.getReferencedXmlPath());
+
+ xmlJoinNode.setReferencedXmlPath("foo");
+
+ assertEquals("foo", annotation.getReferencedXmlPath());
+ assertEquals("foo", xmlJoinNode.getReferencedXmlPath());
+
+ xmlJoinNode.setReferencedXmlPath("");
+
+ assertEquals("", annotation.getReferencedXmlPath());
+ assertEquals("", xmlJoinNode.getReferencedXmlPath());
+
+ xmlJoinNode.setReferencedXmlPath(null);
+
+ assertNull(annotation.getReferencedXmlPath());
+ assertNull(xmlJoinNode.getReferencedXmlPath());
+ }
+
+ public void testUpdateReferencedXmlPath() throws Exception {
+ createTypeWithXmlJoinNode();
+
+ JaxbClass jaxbClass = (JaxbClass) CollectionTools.get(getContextRoot().getTypes(), 0);
+ JaxbClassMapping classMapping = jaxbClass.getMapping();
+ JaxbPersistentAttribute persistentAttribute = CollectionTools.get(classMapping.getAttributes(), 0);
+ ELJavaXmlJoinNodesMapping mapping = (ELJavaXmlJoinNodesMapping) persistentAttribute.getMapping();
+ JavaResourceAttribute resourceAttribute = mapping.getPersistentAttribute().getJavaResourceAttribute();
+ ELXmlJoinNode xmlJoinNode = CollectionTools.get(mapping.getXmlJoinNodes(), 0);
+ XmlJoinNodeAnnotation annotation = (XmlJoinNodeAnnotation) resourceAttribute.getAnnotation(0, ELJaxb.XML_JOIN_NODE);
+
+ assertNull(annotation.getReferencedXmlPath());
+ assertNull(xmlJoinNode.getReferencedXmlPath());
+
+ AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute);
+ annotatedElement.edit(new Member.Editor() {
+ public void edit(ModifiedDeclaration declaration) {
+ ELJavaXmlJoinNodeTests.this.setMemberValuePair(
+ declaration, ELJaxb.XML_JOIN_NODE, ELJaxb.XML_JOIN_NODE__REFERENCED_XML_PATH, "foo");
+ }
+ });
+
+ assertEquals("foo", annotation.getReferencedXmlPath());
+ assertEquals("foo", xmlJoinNode.getReferencedXmlPath());
+
+ annotatedElement.edit(new Member.Editor() {
+ public void edit(ModifiedDeclaration declaration) {
+ ELJavaXmlJoinNodeTests.this.setMemberValuePair(
+ declaration, ELJaxb.XML_JOIN_NODE, ELJaxb.XML_JOIN_NODE__REFERENCED_XML_PATH, "");
+ }
+ });
+
+ assertEquals("", annotation.getReferencedXmlPath());
+ assertEquals("", xmlJoinNode.getReferencedXmlPath());
+
+ annotatedElement.edit(new Member.Editor() {
+ public void edit(ModifiedDeclaration declaration) {
+ ELJavaXmlJoinNodeTests.this.removeMemberValuePair(
+ declaration, ELJaxb.XML_JOIN_NODE, ELJaxb.XML_JOIN_NODE__REFERENCED_XML_PATH);
+ }
+ });
+
+ assertNull(annotation.getReferencedXmlPath());
+ assertNull(xmlJoinNode.getReferencedXmlPath());
+ }
+} \ No newline at end of file
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/java/ELJavaXmlJoinNodesMappingTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/java/ELJavaXmlJoinNodesMappingTests.java
new file mode 100644
index 0000000000..ce0559ae6a
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/java/ELJavaXmlJoinNodesMappingTests.java
@@ -0,0 +1,197 @@
+package org.eclipse.jpt.jaxb.eclipselink.core.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.NormalAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
+import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
+import org.eclipse.jpt.jaxb.core.context.JaxbClass;
+import org.eclipse.jpt.jaxb.core.context.JaxbClassMapping;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+import org.eclipse.jpt.jaxb.eclipselink.core.ELJaxbPlatform;
+import org.eclipse.jpt.jaxb.eclipselink.core.context.java.ELXmlJoinNode;
+import org.eclipse.jpt.jaxb.eclipselink.core.context.java.ELXmlJoinNodesMapping;
+import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.ELJaxb;
+import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.XmlJoinNodeAnnotation;
+import org.eclipse.jpt.jaxb.eclipselink.core.tests.internal.context.ELJaxbContextModelTestCase;
+
+
+public class ELJavaXmlJoinNodesMappingTests
+ extends ELJaxbContextModelTestCase {
+
+ public ELJavaXmlJoinNodesMappingTests(String name) {
+ super(name);
+ }
+
+
+ @Override
+ protected JaxbPlatformDescription getPlatform() {
+ return ELJaxbPlatform.VERSION_2_2;
+ }
+
+ private ICompilationUnit createTypeWithXmlJoinNodes() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JAXB.XML_TYPE, ELJaxb.XML_JOIN_NODES);
+ }
+
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlType");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@XmlJoinNodes");
+ }
+ });
+ }
+
+ protected NormalAnnotation newXmlJoinNodeAnnotation(AST ast, String xmlPath, String referencedXmlPath) {
+ NormalAnnotation annotation = newNormalAnnotation(ast, ELJaxb.XML_JOIN_NODE);
+ addMemberValuePair(annotation, ELJaxb.XML_JOIN_NODE__XML_PATH, xmlPath);
+ addMemberValuePair(annotation, ELJaxb.XML_JOIN_NODE__REFERENCED_XML_PATH, referencedXmlPath);
+ return annotation;
+ }
+
+ protected void addXmlJoinNode(ModifiedDeclaration declaration, int index, String xmlPath, String referencedXmlPath) {
+ NormalAnnotation annotation = newXmlJoinNodeAnnotation(declaration.getAst(), xmlPath, referencedXmlPath);
+ addArrayElement(declaration, ELJaxb.XML_JOIN_NODES, index, "value", annotation);
+ }
+
+ protected void moveXmlJoinNode(ModifiedDeclaration declaration, int targetIndex, int sourceIndex) {
+ moveArrayElement((NormalAnnotation) declaration.getAnnotationNamed(ELJaxb.XML_JOIN_NODES), "value", targetIndex, sourceIndex);
+ }
+
+ protected void removeXmlJoinNode(ModifiedDeclaration declaration, int index) {
+ removeArrayElement((NormalAnnotation) declaration.getAnnotationNamed(ELJaxb.XML_JOIN_NODES), "value", index);
+ }
+
+
+ public void testUpdateXmlJoinNodes() throws Exception {
+ createTypeWithXmlJoinNodes();
+ JaxbClass jaxbClass = (JaxbClass) CollectionTools.get(getContextRoot().getTypes(), 0);
+ JaxbClassMapping classMapping = jaxbClass.getMapping();
+ ELXmlJoinNodesMapping mapping = (ELXmlJoinNodesMapping) CollectionTools.get(classMapping.getAttributes(), 0).getMapping();
+ JavaResourceAttribute resourceAttribute = mapping.getPersistentAttribute().getJavaResourceAttribute();
+
+ Iterable<ELXmlJoinNode> xmlJoinNodes = mapping.getXmlJoinNodes();
+ assertTrue(CollectionTools.isEmpty(xmlJoinNodes));
+ assertEquals(0, mapping.getXmlJoinNodesSize());
+
+ //add 2 XmlJoinNode annotations
+ AnnotatedElement annotatedElement = annotatedElement(resourceAttribute);
+ annotatedElement.edit(
+ new Member.Editor() {
+ public void edit(ModifiedDeclaration declaration) {
+ ELJavaXmlJoinNodesMappingTests.this.addXmlJoinNode(declaration, 0, "foo", "@foo");
+ ELJavaXmlJoinNodesMappingTests.this.addXmlJoinNode(declaration, 1, "bar", "@bar");
+ }
+ });
+
+ xmlJoinNodes = mapping.getXmlJoinNodes();
+
+ assertFalse(CollectionTools.isEmpty(xmlJoinNodes));
+ assertEquals(2, mapping.getXmlJoinNodesSize());
+ assertEquals("foo", CollectionTools.get(xmlJoinNodes, 0).getXmlPath());
+ assertEquals("@foo", CollectionTools.get(xmlJoinNodes, 0).getReferencedXmlPath());
+ assertEquals("bar", CollectionTools.get(xmlJoinNodes, 1).getXmlPath());
+ assertEquals("@bar", CollectionTools.get(xmlJoinNodes, 1).getReferencedXmlPath());
+
+ // switch XmlJoinNode annotations
+ annotatedElement.edit(
+ new Member.Editor() {
+ public void edit(ModifiedDeclaration declaration) {
+ ELJavaXmlJoinNodesMappingTests.this.moveXmlJoinNode(declaration, 0, 1);
+ }
+ });
+
+ xmlJoinNodes = mapping.getXmlJoinNodes();
+
+ assertFalse(CollectionTools.isEmpty(xmlJoinNodes));
+ assertEquals(2, mapping.getXmlJoinNodesSize());
+ assertEquals("bar", CollectionTools.get(xmlJoinNodes, 0).getXmlPath());
+ assertEquals("@bar", CollectionTools.get(xmlJoinNodes, 0).getReferencedXmlPath());
+ assertEquals("foo", CollectionTools.get(xmlJoinNodes, 1).getXmlPath());
+ assertEquals("@foo", CollectionTools.get(xmlJoinNodes, 1).getReferencedXmlPath());
+
+ // remove XmlJoinNode annotations
+ annotatedElement.edit(
+ new Member.Editor() {
+ public void edit(ModifiedDeclaration declaration) {
+ ELJavaXmlJoinNodesMappingTests.this.removeXmlJoinNode(declaration, 1);
+ ELJavaXmlJoinNodesMappingTests.this.removeXmlJoinNode(declaration, 0);
+ }
+ });
+
+ xmlJoinNodes = mapping.getXmlJoinNodes();
+
+ assertTrue(CollectionTools.isEmpty(xmlJoinNodes));
+ assertEquals(0, mapping.getXmlJoinNodesSize());
+ }
+
+ public void testModifyXmlJoinNodes() throws Exception {
+ createTypeWithXmlJoinNodes();
+ JaxbClass jaxbClass = (JaxbClass) CollectionTools.get(getContextRoot().getTypes(), 0);
+ JaxbClassMapping classMapping = jaxbClass.getMapping();
+ ELXmlJoinNodesMapping mapping = (ELXmlJoinNodesMapping) CollectionTools.get(classMapping.getAttributes(), 0).getMapping();
+ JavaResourceAttribute resourceAttribute = mapping.getPersistentAttribute().getJavaResourceAttribute();
+
+ assertEquals(0, resourceAttribute.getAnnotationsSize(ELJaxb.XML_JOIN_NODE));
+ assertEquals(0, mapping.getXmlJoinNodesSize());
+
+ ELXmlJoinNode joinNode = mapping.addXmlJoinNode(0);
+ joinNode.setXmlPath("foo");
+ joinNode.setReferencedXmlPath("@foo");
+ joinNode = mapping.addXmlJoinNode(1);
+ joinNode.setXmlPath("baz");
+ joinNode.setReferencedXmlPath("@baz");
+ joinNode = mapping.addXmlJoinNode(1);
+ joinNode.setXmlPath("bar");
+ joinNode.setReferencedXmlPath("@bar");
+
+ Iterable<XmlJoinNodeAnnotation> xmlJoinNodeAnnotations =
+ new SubIterableWrapper(resourceAttribute.getAnnotations(ELJaxb.XML_JOIN_NODE));
+
+ assertEquals(3, CollectionTools.size(xmlJoinNodeAnnotations));
+ assertEquals(3, mapping.getXmlJoinNodesSize());
+ assertEquals("foo", CollectionTools.get(xmlJoinNodeAnnotations, 0).getXmlPath());
+ assertEquals("@foo", CollectionTools.get(xmlJoinNodeAnnotations, 0).getReferencedXmlPath());
+ assertEquals("bar", CollectionTools.get(xmlJoinNodeAnnotations, 1).getXmlPath());
+ assertEquals("@bar", CollectionTools.get(xmlJoinNodeAnnotations, 1).getReferencedXmlPath());
+ assertEquals("baz", CollectionTools.get(xmlJoinNodeAnnotations, 2).getXmlPath());
+ assertEquals("@baz", CollectionTools.get(xmlJoinNodeAnnotations, 2).getReferencedXmlPath());
+
+ mapping.moveXmlJoinNode(1, 2);
+
+ xmlJoinNodeAnnotations =
+ new SubIterableWrapper(resourceAttribute.getAnnotations(ELJaxb.XML_JOIN_NODE));
+
+ assertEquals(3, CollectionTools.size(xmlJoinNodeAnnotations));
+ assertEquals(3, mapping.getXmlJoinNodesSize());
+ assertEquals("foo", CollectionTools.get(xmlJoinNodeAnnotations, 0).getXmlPath());
+ assertEquals("@foo", CollectionTools.get(xmlJoinNodeAnnotations, 0).getReferencedXmlPath());
+ assertEquals("baz", CollectionTools.get(xmlJoinNodeAnnotations, 1).getXmlPath());
+ assertEquals("@baz", CollectionTools.get(xmlJoinNodeAnnotations, 1).getReferencedXmlPath());
+ assertEquals("bar", CollectionTools.get(xmlJoinNodeAnnotations, 2).getXmlPath());
+ assertEquals("@bar", CollectionTools.get(xmlJoinNodeAnnotations, 2).getReferencedXmlPath());
+
+ mapping.removeXmlJoinNode(2);
+ mapping.removeXmlJoinNode(0);
+ mapping.removeXmlJoinNode(0);
+
+ xmlJoinNodeAnnotations =
+ new SubIterableWrapper(resourceAttribute.getAnnotations(ELJaxb.XML_JOIN_NODE));
+
+ assertEquals(0, CollectionTools.size(xmlJoinNodeAnnotations));
+ assertEquals(0, mapping.getXmlJoinNodesSize());
+ }
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/java/ELJaxbCoreJavaContextModelTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/java/ELJaxbCoreJavaContextModelTests.java
index aa4e37152c..29bc7f62f8 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/java/ELJaxbCoreJavaContextModelTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/java/ELJaxbCoreJavaContextModelTests.java
@@ -28,7 +28,10 @@ public class ELJaxbCoreJavaContextModelTests
suite.addTestSuite(ELJavaXmlElementMappingTests.class);
suite.addTestSuite(ELJavaXmlElementsMappingTests.class);
suite.addTestSuite(ELJavaXmlInverseReferenceMappingTests.class);
+ suite.addTestSuite(ELJavaXmlJoinNodesMappingTests.class);
+ suite.addTestSuite(ELJavaXmlJoinNodeTests.class);
suite.addTestSuite(ELJavaXmlPathTests.class);
+ suite.addTestSuite(ELJavaXmlValueMappingTests.class);
return suite;
}

Back to the top