Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java')
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTestCase.java34
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTests.java63
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorOrderPackageAnnotationTests.java60
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorOrderTypeAnnotationTests.java94
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorTypePackageAnnotationTests.java66
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorTypeTypeAnnotationTests.java106
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyAttributeAnnotationTests.java51
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyElementAnnotationTests.java136
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttachmentRefAnnotationTests.java51
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttributeAnnotationTests.java174
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementAnnotationTests.java305
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementDeclAnnotationTests.java280
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementRefAnnotationTests.java237
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementRefsAnnotationTests.java290
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementWrapperAnnotationTests.java203
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementsAnnotationTests.java380
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumAnnotationTests.java89
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumValueAnnotationTests.java109
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDAnnotationTests.java51
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDREFAnnotationTests.java51
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlInlineBinaryDataAttributeAnnotationTests.java51
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlInlineBinaryDataTypeAnnotationTests.java49
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlJavaTypeAdapterPackageAnnotationTests.java267
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlJavaTypeAdapterTypeAnnotationTests.java111
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlListAnnotationTests.java51
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMimeTypeAnnotationTests.java108
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMixedAnnotationTests.java51
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlRegistryAnnotationTests.java49
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlRootElementAnnotationTests.java131
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaAnnotationTests.java263
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaTypeAttributeAnnotationTests.java156
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaTypePackageAnnotationTests.java240
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSeeAlsoAnnotationTests.java144
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTransientAttributeAnnotationTests.java51
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTransientTypeAnnotationTests.java49
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTypeAnnotationTests.java340
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlValueAnnotationTests.java51
37 files changed, 0 insertions, 4992 deletions
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTestCase.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTestCase.java
deleted file mode 100644
index b75e22c6e5..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTestCase.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
-import org.eclipse.jpt.common.core.tests.internal.resource.java.JavaResourceModelTestCase;
-import org.eclipse.jpt.jaxb.core.internal.jaxb21.GenericJaxb_2_1_PlatformDefinition;
-
-public class JaxbJavaResourceModelTestCase
- extends JavaResourceModelTestCase {
-
- public JaxbJavaResourceModelTestCase(String name) {
- super(name);
- }
-
-
- @Override
- protected AnnotationDefinition[] annotationDefinitions() {
- return GenericJaxb_2_1_PlatformDefinition.instance().getAnnotationDefinitions();
- }
-
- @Override
- protected NestableAnnotationDefinition[] nestableAnnotationDefinitions() {
- return GenericJaxb_2_1_PlatformDefinition.instance().getNestableAnnotationDefinitions();
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTests.java
deleted file mode 100644
index e3864f284e..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTests.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class JaxbJavaResourceModelTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(JaxbJavaResourceModelTests.class.getName());
- suite.addTestSuite(XmlAccessorOrderPackageAnnotationTests.class);
- suite.addTestSuite(XmlAccessorOrderTypeAnnotationTests.class);
- suite.addTestSuite(XmlAccessorTypePackageAnnotationTests.class);
- suite.addTestSuite(XmlAccessorTypeTypeAnnotationTests.class);
- suite.addTestSuite(XmlAnyAttributeAnnotationTests.class);
- suite.addTestSuite(XmlAnyElementAnnotationTests.class);
- suite.addTestSuite(XmlAttachmentRefAnnotationTests.class);
- suite.addTestSuite(XmlAttributeAnnotationTests.class);
- suite.addTestSuite(XmlElementAnnotationTests.class);
- suite.addTestSuite(XmlElementDeclAnnotationTests.class);
- suite.addTestSuite(XmlElementRefAnnotationTests.class);
- suite.addTestSuite(XmlElementRefsAnnotationTests.class);
- suite.addTestSuite(XmlElementsAnnotationTests.class);
- suite.addTestSuite(XmlElementWrapperAnnotationTests.class);
- suite.addTestSuite(XmlEnumAnnotationTests.class);
- suite.addTestSuite(XmlEnumValueAnnotationTests.class);
- suite.addTestSuite(XmlIDAnnotationTests.class);
- suite.addTestSuite(XmlIDREFAnnotationTests.class);
- suite.addTestSuite(XmlInlineBinaryDataAttributeAnnotationTests.class);
- suite.addTestSuite(XmlInlineBinaryDataTypeAnnotationTests.class);
- suite.addTestSuite(XmlJavaTypeAdapterPackageAnnotationTests.class);
- suite.addTestSuite(XmlJavaTypeAdapterTypeAnnotationTests.class);
- suite.addTestSuite(XmlListAnnotationTests.class);
- suite.addTestSuite(XmlMimeTypeAnnotationTests.class);
- suite.addTestSuite(XmlMixedAnnotationTests.class);
- suite.addTestSuite(XmlRegistryAnnotationTests.class);
- suite.addTestSuite(XmlRootElementAnnotationTests.class);
- suite.addTestSuite(XmlSchemaAnnotationTests.class);
- suite.addTestSuite(XmlSchemaTypeAttributeAnnotationTests.class);
- suite.addTestSuite(XmlSchemaTypePackageAnnotationTests.class);
- suite.addTestSuite(XmlSeeAlsoAnnotationTests.class);
- suite.addTestSuite(XmlTransientAttributeAnnotationTests.class);
- suite.addTestSuite(XmlTransientTypeAnnotationTests.class);
- suite.addTestSuite(XmlTypeAnnotationTests.class);
- suite.addTestSuite(XmlValueAnnotationTests.class);
-
- return suite;
- }
-
- private JaxbJavaResourceModelTests() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorOrderPackageAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorOrderPackageAnnotationTests.java
deleted file mode 100644
index 32cb73c062..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorOrderPackageAnnotationTests.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourcePackage;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlAccessorOrderPackageAnnotationTests
- extends JaxbJavaResourceModelTestCase {
-
- public XmlAccessorOrderPackageAnnotationTests(String name) {
- super(name);
- }
-
-
- private ICompilationUnit createPackageInfoWithAccessorOrder() throws CoreException {
- return createTestPackageInfo(
- "@XmlAccessorOrder(XmlAccessOrder.UNDEFINED)",
- JAXB.XML_ACCESS_ORDER, JAXB.XML_ACCESSOR_ORDER);
- }
-
- public void testValue()
- throws Exception {
-
- ICompilationUnit cu = createPackageInfoWithAccessorOrder();
- JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu);
-
- XmlAccessorOrderAnnotation annotation =
- (XmlAccessorOrderAnnotation) resourcePackage.getAnnotation(JAXB.XML_ACCESSOR_ORDER);
- assertNotNull(annotation);
- assertEquals(XmlAccessOrder.UNDEFINED, annotation.getValue());
-
- annotation.setValue(XmlAccessOrder.ALPHABETICAL);
- assertEquals(XmlAccessOrder.ALPHABETICAL, annotation.getValue());
- assertSourceContains("@XmlAccessorOrder(ALPHABETICAL)", cu);
-
- annotation.setValue(null);
- annotation = (XmlAccessorOrderAnnotation) resourcePackage.getAnnotation(JAXB.XML_ACCESSOR_ORDER);
- assertNull(annotation.getValue());
- assertSourceDoesNotContain("@XmlAccessorOrder(", cu);
-
-// TODO uncomment when bug 328400 is addressed
-// annotation = (XmlAccessorOrderAnnotation) packageResource.addAnnotation(JAXB.XML_ACCESSOR_ORDER);
-// annotation.setValue(XmlAccessOrder.UNDEFINED);
-// assertEquals(XmlAccessOrder.UNDEFINED, annotation.getValue());
-// assertSourceContains("@XmlAccessorOrder(UNDEFINED)", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorOrderTypeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorOrderTypeAnnotationTests.java
deleted file mode 100644
index 1518c916ef..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorOrderTypeAnnotationTests.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlAccessorOrderTypeAnnotationTests
- extends JaxbJavaResourceModelTestCase {
-
- public XmlAccessorOrderTypeAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlAccessorOrder() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ACCESSOR_ORDER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlAccessorOrder");
- }
- });
- }
-
- private ICompilationUnit createTestXmlAccessorOrderWithValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ACCESSOR_ORDER, JAXB.XML_ACCESS_ORDER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlAccessorOrder(value = XmlAccessOrder.ALPHABETICAL)");
- }
- });
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlAccessorOrder();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlAccessorOrderAnnotation xmlAccessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_ORDER);
- assertTrue(xmlAccessorOrderAnnotation != null);
- assertNull(xmlAccessorOrderAnnotation.getValue());
- }
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlAccessorOrderWithValue();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlAccessorOrderAnnotation xmlAccessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_ORDER);
- assertEquals(XmlAccessOrder.ALPHABETICAL, xmlAccessorOrderAnnotation.getValue());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlAccessorOrder();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlAccessorOrderAnnotation xmlAccessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_ORDER);
- assertEquals(null, xmlAccessorOrderAnnotation.getValue());
-
- xmlAccessorOrderAnnotation.setValue(XmlAccessOrder.UNDEFINED);
- assertEquals(XmlAccessOrder.UNDEFINED, xmlAccessorOrderAnnotation.getValue());
-
- assertSourceContains("@XmlAccessorOrder(UNDEFINED)", cu);
- }
-
- public void testSetValueNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlAccessorOrderWithValue();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlAccessorOrderAnnotation xmlAccessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_ORDER);
- assertEquals(XmlAccessOrder.ALPHABETICAL, xmlAccessorOrderAnnotation.getValue());
-
- xmlAccessorOrderAnnotation.setValue(null);
- assertNull(xmlAccessorOrderAnnotation.getValue());
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorTypePackageAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorTypePackageAnnotationTests.java
deleted file mode 100644
index fc3e737548..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorTypePackageAnnotationTests.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourcePackage;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlAccessorTypePackageAnnotationTests
- extends JaxbJavaResourceModelTestCase {
-
- public XmlAccessorTypePackageAnnotationTests(String name) {
- super(name);
- }
-
-
- private ICompilationUnit createPackageInfoWithAccessorType() throws CoreException {
- return createTestPackageInfo(
- "@XmlAccessorType(value = XmlAccessType.PROPERTY)",
- JAXB.XML_ACCESS_TYPE, JAXB.XML_ACCESSOR_TYPE);
- }
-
- public void testValue()
- throws Exception {
-
- ICompilationUnit cu = createPackageInfoWithAccessorType();
- JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu);
-
- XmlAccessorTypeAnnotation annotation =
- (XmlAccessorTypeAnnotation) resourcePackage.getAnnotation(JAXB.XML_ACCESSOR_TYPE);
- assertTrue(annotation != null);
- assertEquals(XmlAccessType.PROPERTY, annotation.getValue());
-
- annotation.setValue(XmlAccessType.FIELD);
- assertEquals(XmlAccessType.FIELD, annotation.getValue());
- assertSourceContains("@XmlAccessorType(value = FIELD)", cu);
-
- annotation.setValue(XmlAccessType.NONE);
- assertEquals(XmlAccessType.NONE, annotation.getValue());
- assertSourceContains("@XmlAccessorType(value = NONE)", cu);
-
- annotation.setValue(XmlAccessType.PUBLIC_MEMBER);
- assertEquals(XmlAccessType.PUBLIC_MEMBER, annotation.getValue());
- assertSourceContains("@XmlAccessorType(value = PUBLIC_MEMBER)", cu);
-
- annotation.setValue(null);
- assertSourceDoesNotContain("@XmlAccessorType(", cu);
-
-// TODO uncomment when bug 328400 is addressed
-// annotation = (XmlAccessorTypeAnnotation) packageResource.addAnnotation(JAXB.XML_ACCESSOR_TYPE);
-// annotation.setValue(XmlAccessType.PROPERTY);
-// assertEquals(XmlAccessType.PROPERTY, annotation.getValue());
-// assertSourceContains("@XmlAccessorType(PROPERTY)", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorTypeTypeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorTypeTypeAnnotationTests.java
deleted file mode 100644
index 4c7c4f32b7..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorTypeTypeAnnotationTests.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlAccessorTypeTypeAnnotationTests
- extends JaxbJavaResourceModelTestCase {
-
- public XmlAccessorTypeTypeAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlAccessorType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ACCESSOR_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlAccessorType");
- }
- });
- }
-
- private ICompilationUnit createTestXmlAccessorTypeWithValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ACCESSOR_TYPE, JAXB.XML_ACCESS_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlAccessorType(value = XmlAccessType.FIELD)");
- }
- });
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlAccessorType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlAccessorTypeAnnotation xmlAccessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_TYPE);
- assertTrue(xmlAccessorTypeAnnotation != null);
- assertNull(xmlAccessorTypeAnnotation.getValue());
- }
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlAccessorTypeWithValue();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlAccessorTypeAnnotation xmlAccessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_TYPE);
- assertEquals(XmlAccessType.FIELD, xmlAccessorTypeAnnotation.getValue());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlAccessorType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlAccessorTypeAnnotation xmlAccessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_TYPE);
- assertEquals(null, xmlAccessorTypeAnnotation.getValue());
-
- xmlAccessorTypeAnnotation.setValue(XmlAccessType.PUBLIC_MEMBER);
- assertEquals(XmlAccessType.PUBLIC_MEMBER, xmlAccessorTypeAnnotation.getValue());
-
- assertSourceContains("@XmlAccessorType(PUBLIC_MEMBER)", cu);
-
- xmlAccessorTypeAnnotation.setValue(XmlAccessType.PROPERTY);
- assertEquals(XmlAccessType.PROPERTY, xmlAccessorTypeAnnotation.getValue());
-
- assertSourceContains("@XmlAccessorType(PROPERTY)", cu);
-
- xmlAccessorTypeAnnotation.setValue(XmlAccessType.NONE);
- assertEquals(XmlAccessType.NONE, xmlAccessorTypeAnnotation.getValue());
-
- assertSourceContains("@XmlAccessorType(NONE)", cu);
- }
-
- public void testSetValueNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlAccessorTypeWithValue();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlAccessorTypeAnnotation xmlAccessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_TYPE);
- assertEquals(XmlAccessType.FIELD, xmlAccessorTypeAnnotation.getValue());
-
- xmlAccessorTypeAnnotation.setValue(null);
- assertNull(xmlAccessorTypeAnnotation.getValue());
-
- assertSourceDoesNotContain("@XmlAccessorType(", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyAttributeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyAttributeAnnotationTests.java
deleted file mode 100644
index 1758e19fb9..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyAttributeAnnotationTests.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyAttributeAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlAnyAttributeAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- public XmlAnyAttributeAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlAnyAttribute() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ANY_ATTRIBUTE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlAnyAttribute");
- }
- });
- }
-
- public void testGetXmlAnyAttribute() throws Exception {
- ICompilationUnit cu = this.createTestXmlAnyAttribute();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlAnyAttributeAnnotation xmlAnyAttributeAnnotation = (XmlAnyAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ANY_ATTRIBUTE);
- assertTrue(xmlAnyAttributeAnnotation != null);
-
- resourceAttribute.removeAnnotation(JAXB.XML_ANY_ATTRIBUTE);
- assertSourceDoesNotContain("@XmlAnyAttribute", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyElementAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyElementAnnotationTests.java
deleted file mode 100644
index 3ae8713f60..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyElementAnnotationTests.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyElementAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlAnyElementAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- private static final String XML_ANY_ELEMENT_VALUE = "String";
-
- public XmlAnyElementAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlAnyElement() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ANY_ELEMENT);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlAnyElement");
- }
- });
- }
-
- private ICompilationUnit createTestXmlAnyElementWithBooleanElement(final String booleanElement) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ANY_ELEMENT);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlAnyElement(" + booleanElement + " = true)");
- }
- });
- }
-
- private ICompilationUnit createTestXmlAnyElementWithValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ANY_ELEMENT);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlAnyElement(value = " + XML_ANY_ELEMENT_VALUE + ".class)");
- }
- });
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlAnyElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlAnyElementAnnotation xmlAnyElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT);
- assertTrue(xmlAnyElementAnnotation != null);
- assertNull(xmlAnyElementAnnotation.getLax());
- assertNull(xmlAnyElementAnnotation.getValue());
- }
-
- public void testGetLax() throws Exception {
- ICompilationUnit cu = this.createTestXmlAnyElementWithBooleanElement("lax");
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlAnyElementAnnotation xmlAnyElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT);
-
- assertEquals(Boolean.TRUE, xmlAnyElementAnnotation.getLax());
- }
-
- public void testSetLax() throws Exception {
- ICompilationUnit cu = this.createTestXmlAnyElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlAnyElementAnnotation xmlAnyElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT);
-
- assertNotNull(xmlAnyElementAnnotation);
- assertNull(xmlAnyElementAnnotation.getLax());
-
- xmlAnyElementAnnotation.setLax(Boolean.FALSE);
- assertEquals(Boolean.FALSE, xmlAnyElementAnnotation.getLax());
-
- assertSourceContains("@XmlAnyElement(lax = false)", cu);
-
- xmlAnyElementAnnotation.setLax(null);
- assertSourceContains("@XmlAnyElement", cu);
- assertSourceDoesNotContain("lax", cu);
- }
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlAnyElementWithValue();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlAnyElementAnnotation xmlAnyElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT);
- assertTrue(xmlAnyElementAnnotation != null);
- assertEquals(XML_ANY_ELEMENT_VALUE, xmlAnyElementAnnotation.getValue());
- assertEquals("java.lang." + XML_ANY_ELEMENT_VALUE, xmlAnyElementAnnotation.getFullyQualifiedValueClassName());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlAnyElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlAnyElementAnnotation xmlAnyElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT);
- assertNull(xmlAnyElementAnnotation.getValue());
- xmlAnyElementAnnotation.setValue(XML_ANY_ELEMENT_VALUE);
- assertEquals(XML_ANY_ELEMENT_VALUE, xmlAnyElementAnnotation.getValue());
-
- assertSourceContains("@XmlAnyElement(" + XML_ANY_ELEMENT_VALUE + ".class)", cu);
-
- xmlAnyElementAnnotation.setValue(null);
- assertNull(xmlAnyElementAnnotation.getValue());
-
- assertSourceContains("@XmlAnyElement", cu);
- assertSourceDoesNotContain("@XmlAnyElement(value = " + XML_ANY_ELEMENT_VALUE + ".class)", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttachmentRefAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttachmentRefAnnotationTests.java
deleted file mode 100644
index 9f10d0714c..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttachmentRefAnnotationTests.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlAttachmentRefAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlAttachmentRefAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- public XmlAttachmentRefAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlAttachmentRef() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ATTACHMENT_REF);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlAttachmentRef");
- }
- });
- }
-
- public void testGetXmlAttachmentRef() throws Exception {
- ICompilationUnit cu = this.createTestXmlAttachmentRef();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlAttachmentRefAnnotation xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTACHMENT_REF);
- assertTrue(xmlAttachmentRefAnnotation != null);
-
- resourceAttribute.removeAnnotation(JAXB.XML_ATTACHMENT_REF);
- assertSourceDoesNotContain("@XmlAttachmentRef", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttributeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttributeAnnotationTests.java
deleted file mode 100644
index d2527290f6..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttributeAnnotationTests.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlAttributeAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- private static final String XML_ATTRIBUTE_NAME = "elementName";
- private static final String XML_ATTRIBUTE_NAMESPACE = "XmlAttributeNamespace";
-
- public XmlAttributeAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlAttribute() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ATTRIBUTE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlAttribute");
- }
- });
- }
-
- private ICompilationUnit createTestXmlAttributeWithName() throws Exception {
- return this.createTestXmlAttributeWithStringElement("name", XML_ATTRIBUTE_NAME);
- }
-
- private ICompilationUnit createTestXmlAttributeWithNamespace() throws Exception {
- return this.createTestXmlAttributeWithStringElement("namespace", XML_ATTRIBUTE_NAMESPACE);
- }
-
- private ICompilationUnit createTestXmlAttributeWithStringElement(final String element, final String value) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ATTRIBUTE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlAttribute(" + element + " = \"" + value + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestXmlAttributeWithBooleanElement(final String booleanElement) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ATTRIBUTE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlAttribute(" + booleanElement + " = true)");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlAttributeWithName();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE);
- assertTrue(xmlAttributeAnnotation != null);
- assertEquals(XML_ATTRIBUTE_NAME, xmlAttributeAnnotation.getName());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlAttribute();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE);
- assertTrue(xmlAttributeAnnotation != null);
- assertNull(xmlAttributeAnnotation.getName());
- assertNull(xmlAttributeAnnotation.getNamespace());
- assertNull(xmlAttributeAnnotation.getRequired());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlAttribute();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE);
- assertNull(xmlAttributeAnnotation.getName());
- xmlAttributeAnnotation.setName(XML_ATTRIBUTE_NAME);
- assertEquals(XML_ATTRIBUTE_NAME, xmlAttributeAnnotation.getName());
-
- assertSourceContains("@XmlAttribute(name = \"" + XML_ATTRIBUTE_NAME + "\")", cu);
-
- xmlAttributeAnnotation.setName(null);
- assertNull(xmlAttributeAnnotation.getName());
-
- assertSourceContains("@XmlAttribute", cu);
- assertSourceDoesNotContain("@XmlAttribute(name = \"" + XML_ATTRIBUTE_NAME + "\")", cu);
- }
-
- public void testGetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlAttributeWithNamespace();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE);
- assertTrue(xmlAttributeAnnotation != null);
- assertEquals(XML_ATTRIBUTE_NAMESPACE, xmlAttributeAnnotation.getNamespace());
- }
-
- public void testSetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlAttribute();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE);
- assertNull(xmlAttributeAnnotation.getNamespace());
- xmlAttributeAnnotation.setNamespace(XML_ATTRIBUTE_NAMESPACE);
- assertEquals(XML_ATTRIBUTE_NAMESPACE, xmlAttributeAnnotation.getNamespace());
-
- assertSourceContains("@XmlAttribute(namespace = \"" + XML_ATTRIBUTE_NAMESPACE + "\")", cu);
-
- xmlAttributeAnnotation.setNamespace(null);
- assertNull(xmlAttributeAnnotation.getNamespace());
-
- assertSourceContains("@XmlAttribute", cu);
- assertSourceDoesNotContain("@XmlAttribute(namespace = \"" + XML_ATTRIBUTE_NAMESPACE + "\")", cu);
- }
-
- public void testGetRequired() throws Exception {
- ICompilationUnit cu = this.createTestXmlAttributeWithBooleanElement("required");
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE);
-
- assertEquals(Boolean.TRUE, xmlAttributeAnnotation.getRequired());
- }
-
- public void testSetRequired() throws Exception {
- ICompilationUnit cu = this.createTestXmlAttribute();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE);
-
- assertNotNull(xmlAttributeAnnotation);
- assertNull(xmlAttributeAnnotation.getRequired());
-
- xmlAttributeAnnotation.setRequired(Boolean.FALSE);
- assertEquals(Boolean.FALSE, xmlAttributeAnnotation.getRequired());
-
- assertSourceContains("@XmlAttribute(required = false)", cu);
-
- xmlAttributeAnnotation.setRequired(null);
- assertSourceContains("@XmlAttribute", cu);
- assertSourceDoesNotContain("required", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementAnnotationTests.java
deleted file mode 100644
index 12589383e8..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementAnnotationTests.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlElementAnnotationTests
- extends JaxbJavaResourceModelTestCase {
-
- private static final String XML_ELEMENT_NAME = "elementName";
- private static final String XML_ELEMENT_NAMESPACE = "XmlElementNamespace";
- private static final String XML_ELEMENT_DEFAULT_VALUE = "myDefaultValue";
- private static final String XML_ELEMENT_TYPE = "String";
-
-
- public XmlElementAnnotationTests(String name) {
- super(name);
- }
-
-
- private ICompilationUnit createTestXmlElement() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElement");
- }
- });
- }
-
- private ICompilationUnit createTestXmlElementWithName() throws Exception {
- return this.createTestXmlElementWithStringElement("name", XML_ELEMENT_NAME);
- }
-
- private ICompilationUnit createTestXmlElementWithNamespace() throws Exception {
- return this.createTestXmlElementWithStringElement("namespace", XML_ELEMENT_NAMESPACE);
- }
-
- private ICompilationUnit createTestXmlElementWithDefaultValue() throws Exception {
- return this.createTestXmlElementWithStringElement("defaultValue", XML_ELEMENT_DEFAULT_VALUE);
- }
-
- private ICompilationUnit createTestXmlElementWithStringElement(final String element, final String value) throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElement(" + element + " = \"" + value + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestXmlElementWithBooleanElement(final String booleanElement) throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElement(" + booleanElement + " = true)");
- }
- });
- }
-
- private ICompilationUnit createTestXmlElementWithType() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElement(type = " + XML_ELEMENT_TYPE + ".class)");
- }
- });
- }
-
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT);
-
- assertTrue(xmlElementAnnotation != null);
- assertNull(xmlElementAnnotation.getName());
- assertNull(xmlElementAnnotation.getNamespace());
- assertNull(xmlElementAnnotation.getDefaultValue());
- assertNull(xmlElementAnnotation.getNillable());
- assertNull(xmlElementAnnotation.getRequired());
- assertNull(xmlElementAnnotation.getType());
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWithName();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT);
-
- assertTrue(xmlElementAnnotation != null);
- assertEquals(XML_ELEMENT_NAME, xmlElementAnnotation.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT);
-
- assertNull(xmlElementAnnotation.getName());
-
- xmlElementAnnotation.setName(XML_ELEMENT_NAME);
-
- assertEquals(XML_ELEMENT_NAME, xmlElementAnnotation.getName());
- assertSourceContains("@XmlElement(name = \"" + XML_ELEMENT_NAME + "\")", cu);
-
- xmlElementAnnotation.setName(null);
-
- assertNull(xmlElementAnnotation.getName());
- assertSourceContains("@XmlElement", cu);
- assertSourceDoesNotContain("@XmlElement(name = \"" + XML_ELEMENT_NAME + "\")", cu);
- }
-
- public void testGetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWithNamespace();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT);
-
- assertTrue(xmlElementAnnotation != null);
- assertEquals(XML_ELEMENT_NAMESPACE, xmlElementAnnotation.getNamespace());
- }
-
- public void testSetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT);
-
- assertNull(xmlElementAnnotation.getNamespace());
-
- xmlElementAnnotation.setNamespace(XML_ELEMENT_NAMESPACE);
-
- assertEquals(XML_ELEMENT_NAMESPACE, xmlElementAnnotation.getNamespace());
- assertSourceContains("@XmlElement(namespace = \"" + XML_ELEMENT_NAMESPACE + "\")", cu);
-
- xmlElementAnnotation.setNamespace(null);
-
- assertNull(xmlElementAnnotation.getNamespace());
- assertSourceContains("@XmlElement", cu);
- assertSourceDoesNotContain("@XmlElement(namespace = \"" + XML_ELEMENT_NAMESPACE + "\")", cu);
- }
-
- public void testGetDefaultValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWithDefaultValue();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT);
-
- assertTrue(xmlElementAnnotation != null);
- assertEquals(XML_ELEMENT_DEFAULT_VALUE, xmlElementAnnotation.getDefaultValue());
- }
-
- public void testSetDefaultValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT);
-
- assertNull(xmlElementAnnotation.getDefaultValue());
-
- xmlElementAnnotation.setDefaultValue(XML_ELEMENT_DEFAULT_VALUE);
-
- assertEquals(XML_ELEMENT_DEFAULT_VALUE, xmlElementAnnotation.getDefaultValue());
- assertSourceContains("@XmlElement(defaultValue = \"" + XML_ELEMENT_DEFAULT_VALUE + "\")", cu);
-
- xmlElementAnnotation.setDefaultValue(null);
-
- assertNull(xmlElementAnnotation.getDefaultValue());
- assertSourceContains("@XmlElement", cu);
- assertSourceDoesNotContain("@XmlElement(defaultValue = \"" + XML_ELEMENT_DEFAULT_VALUE + "\")", cu);
- }
-
- public void testGetNillable() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWithBooleanElement("nillable");
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT);
-
- assertEquals(Boolean.TRUE, xmlElementAnnotation.getNillable());
- }
-
- public void testSetNillable() throws Exception {
- ICompilationUnit cu = this.createTestXmlElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT);
-
- assertNotNull(xmlElementAnnotation);
- assertNull(xmlElementAnnotation.getNillable());
-
- xmlElementAnnotation.setNillable(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, xmlElementAnnotation.getNillable());
- assertSourceContains("@XmlElement(nillable = false)", cu);
-
- xmlElementAnnotation.setNillable(null);
-
- assertSourceContains("@XmlElement", cu);
- assertSourceDoesNotContain("nillable", cu);
- }
-
- public void testGetRequired() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWithBooleanElement("required");
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT);
-
- assertEquals(Boolean.TRUE, xmlElementAnnotation.getRequired());
- }
-
- public void testSetRequired() throws Exception {
- ICompilationUnit cu = this.createTestXmlElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT);
-
- assertNotNull(xmlElementAnnotation);
- assertNull(xmlElementAnnotation.getRequired());
-
- xmlElementAnnotation.setRequired(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, xmlElementAnnotation.getRequired());
- assertSourceContains("@XmlElement(required = false)", cu);
-
- xmlElementAnnotation.setRequired(null);
-
- assertSourceContains("@XmlElement", cu);
- assertSourceDoesNotContain("required", cu);
- }
-
- public void testGetType() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWithType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT);
-
- assertTrue(xmlElementAnnotation != null);
- assertEquals(XML_ELEMENT_TYPE, xmlElementAnnotation.getType());
- assertEquals("java.lang." + XML_ELEMENT_TYPE, xmlElementAnnotation.getFullyQualifiedTypeName());
- }
-
- public void testSetType() throws Exception {
- ICompilationUnit cu = this.createTestXmlElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT);
-
- assertNull(xmlElementAnnotation.getType());
-
- xmlElementAnnotation.setType(XML_ELEMENT_TYPE);
-
- assertEquals(XML_ELEMENT_TYPE, xmlElementAnnotation.getType());
- assertSourceContains("@XmlElement(type = " + XML_ELEMENT_TYPE + ".class", cu);
-
- xmlElementAnnotation.setType(null);
-
- assertNull(xmlElementAnnotation.getType());
- assertSourceContains("@XmlElement", cu);
- assertSourceDoesNotContain("@XmlElement(type = " + XML_ELEMENT_TYPE + ".class", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementDeclAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementDeclAnnotationTests.java
deleted file mode 100644
index a782a0b072..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementDeclAnnotationTests.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlElementDeclAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlElementDeclAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- private static final String XML_ELEMENT_DECL_NAME = "elementName";
- private static final String XML_ELEMENT_DECL_NAMESPACE = "XmlElementDeclNamespace";
- private static final String XML_ELEMENT_DECL_DEFAULT_VALUE = "myDefaultValue";
- private static final String XML_ELEMENT_DECL_SCOPE = "XmlElementDecl.GLOBAL";
-
- public XmlElementDeclAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlElementDecl() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT_DECL);
- }
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElementDecl");
- }
- });
- }
-
- private ICompilationUnit createTestXmlElementDeclWithName() throws Exception {
- return this.createTestXmlElementDeclWithStringElementDecl("name", XML_ELEMENT_DECL_NAME);
- }
-
- private ICompilationUnit createTestXmlElementDeclWithNamespace() throws Exception {
- return this.createTestXmlElementDeclWithStringElementDecl("namespace", XML_ELEMENT_DECL_NAMESPACE);
- }
-
- private ICompilationUnit createTestXmlElementDeclWithDefaultValue() throws Exception {
- return this.createTestXmlElementDeclWithStringElementDecl("defaultValue", XML_ELEMENT_DECL_DEFAULT_VALUE);
- }
-
- private ICompilationUnit createTestXmlElementDeclWithSubstitutionHeadName() throws Exception {
- return this.createTestXmlElementDeclWithStringElementDecl("substitutionHeadName", XML_ELEMENT_DECL_NAME);
- }
-
- private ICompilationUnit createTestXmlElementDeclWithSubstitutionHeadNamespace() throws Exception {
- return this.createTestXmlElementDeclWithStringElementDecl("substitutionHeadNamespace", XML_ELEMENT_DECL_NAME);
- }
-
- private ICompilationUnit createTestXmlElementDeclWithStringElementDecl(final String element, final String value) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT_DECL);
- }
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElementDecl(" + element + " = \"" + value + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestXmlElementDeclWithScope() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT_DECL);
- }
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElementDecl(scope = " + XML_ELEMENT_DECL_SCOPE + ".class)");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementDeclWithName();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceMethod resourceMethod = getMethod(resourceType, 0);
-
- XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL);
- assertTrue(xmlElementDeclAnnotation != null);
- assertEquals(XML_ELEMENT_DECL_NAME, xmlElementDeclAnnotation.getName());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementDecl();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceMethod resourceMethod = getMethod(resourceType, 0);
-
- XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL);
- assertTrue(xmlElementDeclAnnotation != null);
- assertNull(xmlElementDeclAnnotation.getName());
- assertNull(xmlElementDeclAnnotation.getNamespace());
- assertNull(xmlElementDeclAnnotation.getDefaultValue());
- assertNull(xmlElementDeclAnnotation.getScope());
- assertNull(xmlElementDeclAnnotation.getSubstitutionHeadName());
- assertNull(xmlElementDeclAnnotation.getSubstitutionHeadNamespace());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementDecl();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceMethod resourceMethod = getMethod(resourceType, 0);
-
- XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL);
- assertNull(xmlElementDeclAnnotation.getName());
- xmlElementDeclAnnotation.setName(XML_ELEMENT_DECL_NAME);
- assertEquals(XML_ELEMENT_DECL_NAME, xmlElementDeclAnnotation.getName());
-
- assertSourceContains("@XmlElementDecl(name = \"" + XML_ELEMENT_DECL_NAME + "\")", cu);
-
- xmlElementDeclAnnotation.setName(null);
- assertNull(xmlElementDeclAnnotation.getName());
-
- assertSourceContains("@XmlElementDecl", cu);
- assertSourceDoesNotContain("@XmlElementDecl(name = \"" + XML_ELEMENT_DECL_NAME + "\")", cu);
- }
-
- public void testGetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementDeclWithNamespace();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceMethod resourceMethod = getMethod(resourceType, 0);
-
- XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL);
- assertTrue(xmlElementDeclAnnotation != null);
- assertEquals(XML_ELEMENT_DECL_NAMESPACE, xmlElementDeclAnnotation.getNamespace());
- }
-
- public void testSetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementDecl();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceMethod resourceMethod = getMethod(resourceType, 0);
-
- XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL);
- assertNull(xmlElementDeclAnnotation.getNamespace());
- xmlElementDeclAnnotation.setNamespace(XML_ELEMENT_DECL_NAMESPACE);
- assertEquals(XML_ELEMENT_DECL_NAMESPACE, xmlElementDeclAnnotation.getNamespace());
-
- assertSourceContains("@XmlElementDecl(namespace = \"" + XML_ELEMENT_DECL_NAMESPACE + "\")", cu);
-
- xmlElementDeclAnnotation.setNamespace(null);
- assertNull(xmlElementDeclAnnotation.getNamespace());
-
- assertSourceContains("@XmlElementDecl", cu);
- assertSourceDoesNotContain("@XmlElementDecl(namespace = \"" + XML_ELEMENT_DECL_NAMESPACE + "\")", cu);
- }
-
- public void testGetDefaultValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementDeclWithDefaultValue();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceMethod resourceMethod = getMethod(resourceType, 0);
-
- XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL);
- assertTrue(xmlElementDeclAnnotation != null);
- assertEquals(XML_ELEMENT_DECL_DEFAULT_VALUE, xmlElementDeclAnnotation.getDefaultValue());
- }
-
- public void testSetDefaultValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementDecl();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceMethod resourceMethod = getMethod(resourceType, 0);
-
- XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL);
- assertNull(xmlElementDeclAnnotation.getDefaultValue());
- xmlElementDeclAnnotation.setDefaultValue(XML_ELEMENT_DECL_DEFAULT_VALUE);
- assertEquals(XML_ELEMENT_DECL_DEFAULT_VALUE, xmlElementDeclAnnotation.getDefaultValue());
-
- assertSourceContains("@XmlElementDecl(defaultValue = \"" + XML_ELEMENT_DECL_DEFAULT_VALUE + "\")", cu);
-
- xmlElementDeclAnnotation.setDefaultValue(null);
- assertNull(xmlElementDeclAnnotation.getDefaultValue());
-
- assertSourceContains("@XmlElementDecl", cu);
- assertSourceDoesNotContain("@XmlElementDecl(defaultValue = \"" + XML_ELEMENT_DECL_DEFAULT_VALUE + "\")", cu);
- }
-
- public void testGetScope() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementDeclWithScope();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceMethod resourceMethod = getMethod(resourceType, 0);
-
- XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL);
- assertTrue(xmlElementDeclAnnotation != null);
- assertEquals(XML_ELEMENT_DECL_SCOPE, xmlElementDeclAnnotation.getScope());
- assertEquals("javax.xml.bind.annotation." + XML_ELEMENT_DECL_SCOPE, xmlElementDeclAnnotation.getFullyQualifiedScopeClassName());
- }
-
- public void testSetScope() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementDecl();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceMethod resourceMethod = getMethod(resourceType, 0);
-
- XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL);
- assertNull(xmlElementDeclAnnotation.getScope());
- xmlElementDeclAnnotation.setScope(XML_ELEMENT_DECL_SCOPE);
- assertEquals(XML_ELEMENT_DECL_SCOPE, xmlElementDeclAnnotation.getScope());
-
- assertSourceContains("@XmlElementDecl(scope = " + XML_ELEMENT_DECL_SCOPE + ".class", cu);
-
- xmlElementDeclAnnotation.setScope(null);
- assertNull(xmlElementDeclAnnotation.getScope());
-
- assertSourceContains("@XmlElementDecl", cu);
- assertSourceDoesNotContain("@XmlElementDecl(scope = " + XML_ELEMENT_DECL_SCOPE + ".class", cu);
- }
-
- public void testGetSubstitutionHeadName() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementDeclWithSubstitutionHeadName();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceMethod resourceMethod = getMethod(resourceType, 0);
-
- XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL);
- assertTrue(xmlElementDeclAnnotation != null);
- assertEquals(XML_ELEMENT_DECL_NAME, xmlElementDeclAnnotation.getSubstitutionHeadName());
- }
-
- public void testSetSubstitutionHeadName() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementDecl();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceMethod resourceMethod = getMethod(resourceType, 0);
-
- XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL);
- assertNull(xmlElementDeclAnnotation.getSubstitutionHeadName());
- xmlElementDeclAnnotation.setSubstitutionHeadName(XML_ELEMENT_DECL_NAME);
- assertEquals(XML_ELEMENT_DECL_NAME, xmlElementDeclAnnotation.getSubstitutionHeadName());
-
- assertSourceContains("@XmlElementDecl(substitutionHeadName = \"" + XML_ELEMENT_DECL_NAME + "\")", cu);
-
- xmlElementDeclAnnotation.setSubstitutionHeadName(null);
- assertNull(xmlElementDeclAnnotation.getSubstitutionHeadName());
-
- assertSourceContains("@XmlElementDecl", cu);
- assertSourceDoesNotContain("@XmlElementDecl(substitutionHeadName = \"" + XML_ELEMENT_DECL_NAME + "\")", cu);
- }
-
- public void testGetSubstitutionHeadNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementDeclWithSubstitutionHeadNamespace();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceMethod resourceMethod = getMethod(resourceType, 0);
-
- XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL);
- assertTrue(xmlElementDeclAnnotation != null);
- assertEquals(XML_ELEMENT_DECL_NAME, xmlElementDeclAnnotation.getSubstitutionHeadNamespace());
- }
-
- public void testSetSubstitutionHeadNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementDecl();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceMethod resourceMethod = getMethod(resourceType, 0);
-
- XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL);
- assertNull(xmlElementDeclAnnotation.getSubstitutionHeadNamespace());
- xmlElementDeclAnnotation.setSubstitutionHeadNamespace(XML_ELEMENT_DECL_NAME);
- assertEquals(XML_ELEMENT_DECL_NAME, xmlElementDeclAnnotation.getSubstitutionHeadNamespace());
-
- assertSourceContains("@XmlElementDecl(substitutionHeadNamespace = \"" + XML_ELEMENT_DECL_NAME + "\")", cu);
-
- xmlElementDeclAnnotation.setSubstitutionHeadNamespace(null);
- assertNull(xmlElementDeclAnnotation.getSubstitutionHeadNamespace());
-
- assertSourceContains("@XmlElementDecl", cu);
- assertSourceDoesNotContain("@XmlElementDecl(substitutionHeadNamespace = \"" + XML_ELEMENT_DECL_NAME + "\")", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementRefAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementRefAnnotationTests.java
deleted file mode 100644
index 18eb4da02f..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementRefAnnotationTests.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlElementRefAnnotationTests
- extends JaxbJavaResourceModelTestCase {
-
- private static final String XML_ELEMENT_REF_NAME = "elementName";
- private static final String XML_ELEMENT_REF_NAMESPACE = "XmlElementRefNamespace";
- private static final String XML_ELEMENT_REF_TYPE = "String";
-
-
- public XmlElementRefAnnotationTests(String name) {
- super(name);
- }
-
-
- private ICompilationUnit createTestXmlElementRef() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT_REF);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElementRef");
- }
- });
- }
-
- private ICompilationUnit createTestXmlElementRefWithName() throws Exception {
- return this.createTestXmlElementRefWithStringElement("name", XML_ELEMENT_REF_NAME);
- }
-
- private ICompilationUnit createTestXmlElementRefWithNamespace() throws Exception {
- return this.createTestXmlElementRefWithStringElement("namespace", XML_ELEMENT_REF_NAMESPACE);
- }
-
- private ICompilationUnit createTestXmlElementRefWithStringElement(final String element, final String value) throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT_REF);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElementRef(" + element + " = \"" + value + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestXmlElementRefWithBooleanElement(final String booleanElement) throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT_REF);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElementRef(" + booleanElement + " = true)");
- }
- });
- }
-
- private ICompilationUnit createTestXmlElementRefWithType() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT_REF);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElementRef(type = " + XML_ELEMENT_REF_TYPE + ".class)");
- }
- });
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRef();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF);
-
- assertTrue(xmlElementRefAnnotation != null);
- assertNull(xmlElementRefAnnotation.getName());
- assertNull(xmlElementRefAnnotation.getNamespace());
- assertNull(xmlElementRefAnnotation.getType());
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRefWithName();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF);
-
- assertTrue(xmlElementRefAnnotation != null);
- assertEquals(XML_ELEMENT_REF_NAME, xmlElementRefAnnotation.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRef();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF);
-
- assertNull(xmlElementRefAnnotation.getName());
-
- xmlElementRefAnnotation.setName(XML_ELEMENT_REF_NAME);
-
- assertEquals(XML_ELEMENT_REF_NAME, xmlElementRefAnnotation.getName());
- assertSourceContains("@XmlElementRef(name = \"" + XML_ELEMENT_REF_NAME + "\")", cu);
-
- xmlElementRefAnnotation.setName(null);
-
- assertNull(xmlElementRefAnnotation.getName());
- assertSourceContains("@XmlElementRef", cu);
- assertSourceDoesNotContain("@XmlElementRef(name = \"" + XML_ELEMENT_REF_NAME + "\")", cu);
- }
-
- public void testGetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRefWithNamespace();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF);
-
- assertTrue(xmlElementRefAnnotation != null);
- assertEquals(XML_ELEMENT_REF_NAMESPACE, xmlElementRefAnnotation.getNamespace());
- }
-
- public void testSetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRef();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF);
-
- assertNull(xmlElementRefAnnotation.getNamespace());
-
- xmlElementRefAnnotation.setNamespace(XML_ELEMENT_REF_NAMESPACE);
-
- assertEquals(XML_ELEMENT_REF_NAMESPACE, xmlElementRefAnnotation.getNamespace());
- assertSourceContains("@XmlElementRef(namespace = \"" + XML_ELEMENT_REF_NAMESPACE + "\")", cu);
-
- xmlElementRefAnnotation.setNamespace(null);
-
- assertNull(xmlElementRefAnnotation.getNamespace());
- assertSourceContains("@XmlElementRef", cu);
- assertSourceDoesNotContain("@XmlElementRef(namespace = \"" + XML_ELEMENT_REF_NAMESPACE + "\")", cu);
- }
-
- public void testGetRequired() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRefWithBooleanElement("required");
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF);
-
- assertEquals(Boolean.TRUE, xmlElementRefAnnotation.getRequired());
- }
-
- public void testSetRequired() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRef();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF);
-
- assertNotNull(xmlElementRefAnnotation);
- assertNull(xmlElementRefAnnotation.getRequired());
-
- xmlElementRefAnnotation.setRequired(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, xmlElementRefAnnotation.getRequired());
- assertSourceContains("@XmlElementRef(required = false)", cu);
-
- xmlElementRefAnnotation.setRequired(null);
-
- assertSourceContains("@XmlElementRef", cu);
- assertSourceDoesNotContain("required", cu);
- }
-
- public void testGetType() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRefWithType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF);
-
- assertTrue(xmlElementRefAnnotation != null);
- assertEquals(XML_ELEMENT_REF_TYPE, xmlElementRefAnnotation.getType());
- assertEquals("java.lang." + XML_ELEMENT_REF_TYPE, xmlElementRefAnnotation.getFullyQualifiedTypeName());
- }
-
- public void testSetType() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRef();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF);
-
- assertNull(xmlElementRefAnnotation.getType());
-
- xmlElementRefAnnotation.setType(XML_ELEMENT_REF_TYPE);
-
- assertEquals(XML_ELEMENT_REF_TYPE, xmlElementRefAnnotation.getType());
- assertSourceContains("@XmlElementRef(type = " + XML_ELEMENT_REF_TYPE + ".class", cu);
-
- xmlElementRefAnnotation.setType(null);
-
- assertNull(xmlElementRefAnnotation.getType());
- assertSourceContains("@XmlElementRef", cu);
- assertSourceDoesNotContain("@XmlElementRef(type = " + XML_ELEMENT_REF_TYPE + ".class", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementRefsAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementRefsAnnotationTests.java
deleted file mode 100644
index 835c30641e..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementRefsAnnotationTests.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.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.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefsAnnotation;
-
-
-public class XmlElementRefsAnnotationTests
- extends JaxbJavaResourceModelTestCase {
-
- private static final String XML_ELEMENT_REF_NAME = "elementName";
- private static final String XML_ELEMENT_REF_NAMESPACE = "XmlElementRefNamespace";
- private static final String XML_ELEMENT_REF_TYPE = "String";
-
-
- public XmlElementRefsAnnotationTests(String name) {
- super(name);
- }
-
-
- private ICompilationUnit createTestXmlElementRef() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT_REF, JAXB.XML_ELEMENT_REFS);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElementRefs(@XmlElementRef)");
- }
- });
- }
-
- private ICompilationUnit createTestXmlElementRefWithName() throws Exception {
- return this.createTestXmlElementRefWithStringElement("name", XML_ELEMENT_REF_NAME);
- }
-
- private ICompilationUnit createTestXmlElementRefWithNamespace() throws Exception {
- return this.createTestXmlElementRefWithStringElement("namespace", XML_ELEMENT_REF_NAMESPACE);
- }
-
- private ICompilationUnit createTestXmlElementRefWithStringElement(final String element, final String value) throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT_REF, JAXB.XML_ELEMENT_REFS);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElementRefs(@XmlElementRef(" + element + " = \"" + value + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestXmlElementRefWithType() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT_REF, JAXB.XML_ELEMENT_REFS);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElementRefs(@XmlElementRef(type = " + XML_ELEMENT_REF_TYPE + ".class))");
- }
- });
- }
-
- private ICompilationUnit createTestXmlElementRefWithAll() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT_REF, JAXB.XML_ELEMENT_REFS);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElementRefs(@XmlElementRef(name = \"" + XML_ELEMENT_REF_NAME + "\", namespace = \"" + XML_ELEMENT_REF_NAMESPACE + "\", type = " + XML_ELEMENT_REF_TYPE + ".class))");
- }
- });
- }
-
-
- private XmlElementRefAnnotation getXmlElementRefAnnotation(JavaResourceAttribute resourceAttribute) {
- XmlElementRefsAnnotation refsAnnotation
- = (XmlElementRefsAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REFS);
- return refsAnnotation.xmlElementRefAt(0);
- }
-
- private XmlElementRefAnnotation addXmlElementRefAnnotation(int index, JavaResourceAttribute resourceAttribute) {
- XmlElementRefsAnnotation refsAnnotation
- = (XmlElementRefsAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REFS);
- return refsAnnotation.addXmlElementRef(index);
- }
-
- private void removeXmlElementRefAnnotation(int index, JavaResourceAttribute resourceAttribute) {
- XmlElementRefsAnnotation refsAnnotation
- = (XmlElementRefsAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REFS);
- refsAnnotation.removeXmlElementRef(index);
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRef();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementRefAnnotation xmlElementRefAnnotation = getXmlElementRefAnnotation(resourceAttribute);
-
- assertTrue(xmlElementRefAnnotation != null);
- assertNull(xmlElementRefAnnotation.getName());
- assertNull(xmlElementRefAnnotation.getNamespace());
- assertNull(xmlElementRefAnnotation.getType());
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRefWithName();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementRefAnnotation xmlElementRefAnnotation = getXmlElementRefAnnotation(resourceAttribute);
-
- assertTrue(xmlElementRefAnnotation != null);
- assertEquals(XML_ELEMENT_REF_NAME, xmlElementRefAnnotation.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRef();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementRefAnnotation xmlElementRefAnnotation = getXmlElementRefAnnotation(resourceAttribute);
-
- assertNull(xmlElementRefAnnotation.getName());
-
- xmlElementRefAnnotation.setName(XML_ELEMENT_REF_NAME);
- assertEquals(XML_ELEMENT_REF_NAME, xmlElementRefAnnotation.getName());
-
- assertSourceContains("@XmlElementRefs(@XmlElementRef(name = \"" + XML_ELEMENT_REF_NAME + "\"))", cu);
-
- xmlElementRefAnnotation.setName(null);
- assertNull(xmlElementRefAnnotation.getName());
-
- assertSourceContains("@XmlElementRefs(@XmlElementRef)", cu);
- }
-
- public void testGetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRefWithNamespace();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementRefAnnotation xmlElementRefAnnotation = getXmlElementRefAnnotation(resourceAttribute);
-
- assertTrue(xmlElementRefAnnotation != null);
- assertEquals(XML_ELEMENT_REF_NAMESPACE, xmlElementRefAnnotation.getNamespace());
- }
-
- public void testSetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRef();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementRefAnnotation xmlElementRefAnnotation = getXmlElementRefAnnotation(resourceAttribute);
-
- assertNull(xmlElementRefAnnotation.getNamespace());
-
- xmlElementRefAnnotation.setNamespace(XML_ELEMENT_REF_NAMESPACE);
-
- assertEquals(XML_ELEMENT_REF_NAMESPACE, xmlElementRefAnnotation.getNamespace());
- assertSourceContains("@XmlElementRefs(@XmlElementRef(namespace = \"" + XML_ELEMENT_REF_NAMESPACE + "\"))", cu);
-
- xmlElementRefAnnotation.setNamespace(null);
-
- assertNull(xmlElementRefAnnotation.getNamespace());
- assertSourceContains("@XmlElementRefs(@XmlElementRef)", cu);
- }
-
- public void testGetType() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRefWithType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementRefAnnotation xmlElementRefAnnotation = getXmlElementRefAnnotation(resourceAttribute);
-
- assertTrue(xmlElementRefAnnotation != null);
- assertEquals(XML_ELEMENT_REF_TYPE, xmlElementRefAnnotation.getType());
- assertEquals("java.lang." + XML_ELEMENT_REF_TYPE, xmlElementRefAnnotation.getFullyQualifiedTypeName());
- }
-
- public void testSetType() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRef();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementRefAnnotation xmlElementRefAnnotation = getXmlElementRefAnnotation(resourceAttribute);
-
- assertNull(xmlElementRefAnnotation.getType());
-
- xmlElementRefAnnotation.setType(XML_ELEMENT_REF_TYPE);
-
- assertEquals(XML_ELEMENT_REF_TYPE, xmlElementRefAnnotation.getType());
- assertSourceContains("@XmlElementRefs(@XmlElementRef(type = " + XML_ELEMENT_REF_TYPE + ".class))", cu);
-
- xmlElementRefAnnotation.setType(null);
-
- assertNull(xmlElementRefAnnotation.getType());
- assertSourceContains("@XmlElementRefs(@XmlElementRef)", cu);
- }
-
- public void testAddXmlElementRef() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRefWithAll();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- addXmlElementRefAnnotation(1, resourceAttribute);
- XmlElementRefsAnnotation refsAnnotation = (XmlElementRefsAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REFS);
-
- assertSourceContains(
- "@XmlElementRefs({@XmlElementRef(name = \"" + XML_ELEMENT_REF_NAME
- + "\", namespace = \"" + XML_ELEMENT_REF_NAMESPACE
- + "\", type = " + XML_ELEMENT_REF_TYPE
- + ".class),@XmlElementRef})", cu);
- assertNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF));
- assertNotNull(refsAnnotation);
- assertEquals(2, refsAnnotation.getXmlElementRefsSize());
- }
-
- public void testAddXmlElementRefToBeginningOfList() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRefWithAll();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- addXmlElementRefAnnotation(1, resourceAttribute);
- XmlElementRefsAnnotation refsAnnotation = (XmlElementRefsAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REFS);
-
- assertSourceContains(
- "@XmlElementRefs({@XmlElementRef(name = \"" + XML_ELEMENT_REF_NAME
- + "\", namespace = \"" + XML_ELEMENT_REF_NAMESPACE
- + "\", type = " + XML_ELEMENT_REF_TYPE
- + ".class),@XmlElementRef})", cu);
-
- addXmlElementRefAnnotation(0, resourceAttribute);
-
- assertSourceContains(
- "@XmlElementRefs({@XmlElementRef,@XmlElementRef(name = \"" + XML_ELEMENT_REF_NAME
- + "\", namespace = \"" + XML_ELEMENT_REF_NAMESPACE
- + "\", type = " + XML_ELEMENT_REF_TYPE
- + ".class), @XmlElementRef})", cu);
-
- assertNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_REF));
- assertNotNull(refsAnnotation);
- assertEquals(3, refsAnnotation.getXmlElementRefsSize());
- }
-
- public void testRemoveXmlElementRef() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementRefWithAll();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- addXmlElementRefAnnotation(1, resourceAttribute);
-
- assertSourceContains(
- "@XmlElementRefs({@XmlElementRef(name = \"" + XML_ELEMENT_REF_NAME
- + "\", namespace = \"" + XML_ELEMENT_REF_NAMESPACE
- + "\", type = " + XML_ELEMENT_REF_TYPE
- + ".class),@XmlElementRef})", cu);
-
- removeXmlElementRefAnnotation(1, resourceAttribute);
-
- assertSourceContains(
- "@XmlElementRef(name = \"" + XML_ELEMENT_REF_NAME
- + "\", namespace = \"" + XML_ELEMENT_REF_NAMESPACE
- + "\", type = " + XML_ELEMENT_REF_TYPE
- + ".class)", cu);
- }
-} \ No newline at end of file
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementWrapperAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementWrapperAnnotationTests.java
deleted file mode 100644
index 638c375733..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementWrapperAnnotationTests.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlElementWrapperAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- private static final String XML_ELEMENT_WRAPPER_NAME = "elementName";
- private static final String XML_ELEMENT_WRAPPER_NAMESPACE = "XmlElementWrapperNamespace";
-
- public XmlElementWrapperAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlElementWrapper() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT_WRAPPER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElementWrapper");
- }
- });
- }
-
- private ICompilationUnit createTestXmlElementWrapperWithName() throws Exception {
- return this.createTestXmlElementWrapperWithStringElement("name", XML_ELEMENT_WRAPPER_NAME);
- }
-
- private ICompilationUnit createTestXmlElementWrapperWithNamespace() throws Exception {
- return this.createTestXmlElementWrapperWithStringElement("namespace", XML_ELEMENT_WRAPPER_NAMESPACE);
- }
-
- private ICompilationUnit createTestXmlElementWrapperWithStringElement(final String element, final String value) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT_WRAPPER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElementWrapper(" + element + " = \"" + value + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestXmlElementWrapperWithBooleanElement(final String booleanElement) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENT_WRAPPER);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElementWrapper(" + booleanElement + " = true)");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWrapperWithName();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER);
- assertTrue(xmlElementWrapperAnnotation != null);
- assertEquals(XML_ELEMENT_WRAPPER_NAME, xmlElementWrapperAnnotation.getName());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWrapper();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER);
- assertTrue(xmlElementWrapperAnnotation != null);
- assertNull(xmlElementWrapperAnnotation.getName());
- assertNull(xmlElementWrapperAnnotation.getNamespace());
- assertNull(xmlElementWrapperAnnotation.getNillable());
- assertNull(xmlElementWrapperAnnotation.getRequired());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWrapper();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER);
- assertNull(xmlElementWrapperAnnotation.getName());
- xmlElementWrapperAnnotation.setName(XML_ELEMENT_WRAPPER_NAME);
- assertEquals(XML_ELEMENT_WRAPPER_NAME, xmlElementWrapperAnnotation.getName());
-
- assertSourceContains("@XmlElementWrapper(name = \"" + XML_ELEMENT_WRAPPER_NAME + "\")", cu);
-
- xmlElementWrapperAnnotation.setName(null);
- assertNull(xmlElementWrapperAnnotation.getName());
-
- assertSourceContains("@XmlElementWrapper", cu);
- assertSourceDoesNotContain("@XmlElementWrapper(name = \"" + XML_ELEMENT_WRAPPER_NAME + "\")", cu);
- }
-
- public void testGetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWrapperWithNamespace();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER);
- assertTrue(xmlElementWrapperAnnotation != null);
- assertEquals(XML_ELEMENT_WRAPPER_NAMESPACE, xmlElementWrapperAnnotation.getNamespace());
- }
-
- public void testSetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWrapper();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER);
- assertNull(xmlElementWrapperAnnotation.getNamespace());
- xmlElementWrapperAnnotation.setNamespace(XML_ELEMENT_WRAPPER_NAMESPACE);
- assertEquals(XML_ELEMENT_WRAPPER_NAMESPACE, xmlElementWrapperAnnotation.getNamespace());
-
- assertSourceContains("@XmlElementWrapper(namespace = \"" + XML_ELEMENT_WRAPPER_NAMESPACE + "\")", cu);
-
- xmlElementWrapperAnnotation.setNamespace(null);
- assertNull(xmlElementWrapperAnnotation.getNamespace());
-
- assertSourceContains("@XmlElementWrapper", cu);
- assertSourceDoesNotContain("@XmlElementWrapper(namespace = \"" + XML_ELEMENT_WRAPPER_NAMESPACE + "\")", cu);
- }
-
- public void testGetNillable() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWrapperWithBooleanElement("nillable");
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER);
-
- assertEquals(Boolean.TRUE, xmlElementWrapperAnnotation.getNillable());
- }
-
- public void testSetNillable() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWrapper();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER);
-
- assertNotNull(xmlElementWrapperAnnotation);
- assertNull(xmlElementWrapperAnnotation.getNillable());
-
- xmlElementWrapperAnnotation.setNillable(Boolean.FALSE);
- assertEquals(Boolean.FALSE, xmlElementWrapperAnnotation.getNillable());
-
- assertSourceContains("@XmlElementWrapper(nillable = false)", cu);
-
- xmlElementWrapperAnnotation.setNillable(null);
- assertSourceContains("@XmlElementWrapper", cu);
- assertSourceDoesNotContain("nillable", cu);
- }
-
- public void testGetRequired() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWrapperWithBooleanElement("required");
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER);
-
- assertEquals(Boolean.TRUE, xmlElementWrapperAnnotation.getRequired());
- }
-
- public void testSetRequired() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWrapper();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER);
-
- assertNotNull(xmlElementWrapperAnnotation);
- assertNull(xmlElementWrapperAnnotation.getRequired());
-
- xmlElementWrapperAnnotation.setRequired(Boolean.FALSE);
- assertEquals(Boolean.FALSE, xmlElementWrapperAnnotation.getRequired());
-
- assertSourceContains("@XmlElementWrapper(required = false)", cu);
-
- xmlElementWrapperAnnotation.setRequired(null);
- assertSourceContains("@XmlElementWrapper", cu);
- assertSourceDoesNotContain("required", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementsAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementsAnnotationTests.java
deleted file mode 100644
index db85a0cf63..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementsAnnotationTests.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.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.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlElementsAnnotation;
-
-
-public class XmlElementsAnnotationTests
- extends JaxbJavaResourceModelTestCase {
-
- private static final String XML_ELEMENT_NAME = "elementName";
- private static final String XML_ELEMENT_NAMESPACE = "XmlElementNamespace";
- private static final String XML_ELEMENT_DEFAULT_VALUE = "myDefaultValue";
- private static final String XML_ELEMENT_TYPE = "String";
-
-
- public XmlElementsAnnotationTests(String name) {
- super(name);
- }
-
-
- private ICompilationUnit createTestXmlElement() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENTS, JAXB.XML_ELEMENT);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElements(@XmlElement)");
- }
- });
- }
-
- private ICompilationUnit createTestXmlElementWithName() throws Exception {
- return this.createTestXmlElementWithStringElement("name", XML_ELEMENT_NAME);
- }
-
- private ICompilationUnit createTestXmlElementWithNamespace() throws Exception {
- return this.createTestXmlElementWithStringElement("namespace", XML_ELEMENT_NAMESPACE);
- }
-
- private ICompilationUnit createTestXmlElementWithDefaultValue() throws Exception {
- return this.createTestXmlElementWithStringElement("defaultValue", XML_ELEMENT_DEFAULT_VALUE);
- }
-
- private ICompilationUnit createTestXmlElementWithStringElement(final String element, final String value) throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENTS, JAXB.XML_ELEMENT);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElements(@XmlElement(" + element + " = \"" + value + "\"))");
- }
- });
- }
-
- private ICompilationUnit createTestXmlElementWithBooleanElement(final String booleanElement) throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENTS, JAXB.XML_ELEMENT);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElements(@XmlElement(" + booleanElement + " = true))");
- }
- });
- }
-
- private ICompilationUnit createTestXmlElementWithType() throws Exception {
-
- return this.createTestType(new DefaultAnnotationWriter() {
-
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ELEMENTS, JAXB.XML_ELEMENT);
- }
-
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlElements(@XmlElement(type = " + XML_ELEMENT_TYPE + ".class))");
- }
- });
- }
-
-
- private XmlElementAnnotation getXmlElementAnnotation(JavaResourceAttribute resourceAttribute) {
- XmlElementsAnnotation annotation
- = (XmlElementsAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENTS);
- return annotation.xmlElementAt(0);
- }
-
- private XmlElementAnnotation addXmlElementAnnotation(int index, JavaResourceAttribute resourceAttribute) {
- XmlElementsAnnotation annotation
- = (XmlElementsAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENTS);
- return annotation.addXmlElement(index);
- }
-
- private void removeXmlElementAnnotation(int index, JavaResourceAttribute resourceAttribute) {
- XmlElementsAnnotation annotation
- = (XmlElementsAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENTS);
- annotation.removeXmlElement(index);
- }
-
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = getXmlElementAnnotation(resourceAttribute);
-
- assertTrue(xmlElementAnnotation != null);
- assertNull(xmlElementAnnotation.getName());
- assertNull(xmlElementAnnotation.getNamespace());
- assertNull(xmlElementAnnotation.getDefaultValue());
- assertNull(xmlElementAnnotation.getNillable());
- assertNull(xmlElementAnnotation.getRequired());
- assertNull(xmlElementAnnotation.getType());
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWithName();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = getXmlElementAnnotation(resourceAttribute);
-
- assertTrue(xmlElementAnnotation != null);
- assertEquals(XML_ELEMENT_NAME, xmlElementAnnotation.getName());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = getXmlElementAnnotation(resourceAttribute);
-
- assertNull(xmlElementAnnotation.getName());
-
- xmlElementAnnotation.setName(XML_ELEMENT_NAME);
-
- assertEquals(XML_ELEMENT_NAME, xmlElementAnnotation.getName());
- assertSourceContains("@XmlElement(name = \"" + XML_ELEMENT_NAME + "\")", cu);
-
- xmlElementAnnotation.setName(null);
-
- assertNull(xmlElementAnnotation.getName());
- assertSourceContains("@XmlElement", cu);
- assertSourceDoesNotContain("@XmlElement(name = \"" + XML_ELEMENT_NAME + "\")", cu);
- }
-
- public void testGetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWithNamespace();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = getXmlElementAnnotation(resourceAttribute);
-
- assertTrue(xmlElementAnnotation != null);
- assertEquals(XML_ELEMENT_NAMESPACE, xmlElementAnnotation.getNamespace());
- }
-
- public void testSetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = getXmlElementAnnotation(resourceAttribute);
-
- assertNull(xmlElementAnnotation.getNamespace());
-
- xmlElementAnnotation.setNamespace(XML_ELEMENT_NAMESPACE);
-
- assertEquals(XML_ELEMENT_NAMESPACE, xmlElementAnnotation.getNamespace());
- assertSourceContains("@XmlElement(namespace = \"" + XML_ELEMENT_NAMESPACE + "\")", cu);
-
- xmlElementAnnotation.setNamespace(null);
-
- assertNull(xmlElementAnnotation.getNamespace());
- assertSourceContains("@XmlElement", cu);
- assertSourceDoesNotContain("@XmlElement(namespace = \"" + XML_ELEMENT_NAMESPACE + "\")", cu);
- }
-
- public void testGetDefaultValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWithDefaultValue();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = getXmlElementAnnotation(resourceAttribute);
-
- assertTrue(xmlElementAnnotation != null);
- assertEquals(XML_ELEMENT_DEFAULT_VALUE, xmlElementAnnotation.getDefaultValue());
- }
-
- public void testSetDefaultValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = getXmlElementAnnotation(resourceAttribute);
-
- assertNull(xmlElementAnnotation.getDefaultValue());
-
- xmlElementAnnotation.setDefaultValue(XML_ELEMENT_DEFAULT_VALUE);
-
- assertEquals(XML_ELEMENT_DEFAULT_VALUE, xmlElementAnnotation.getDefaultValue());
- assertSourceContains("@XmlElement(defaultValue = \"" + XML_ELEMENT_DEFAULT_VALUE + "\")", cu);
-
- xmlElementAnnotation.setDefaultValue(null);
-
- assertNull(xmlElementAnnotation.getDefaultValue());
- assertSourceContains("@XmlElement", cu);
- assertSourceDoesNotContain("@XmlElement(defaultValue = \"" + XML_ELEMENT_DEFAULT_VALUE + "\")", cu);
- }
-
- public void testGetNillable() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWithBooleanElement("nillable");
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = getXmlElementAnnotation(resourceAttribute);
-
- assertEquals(Boolean.TRUE, xmlElementAnnotation.getNillable());
- }
-
- public void testSetNillable() throws Exception {
- ICompilationUnit cu = this.createTestXmlElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = getXmlElementAnnotation(resourceAttribute);
-
- assertNotNull(xmlElementAnnotation);
- assertNull(xmlElementAnnotation.getNillable());
-
- xmlElementAnnotation.setNillable(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, xmlElementAnnotation.getNillable());
- assertSourceContains("@XmlElement(nillable = false)", cu);
-
- xmlElementAnnotation.setNillable(null);
-
- assertSourceContains("@XmlElement", cu);
- assertSourceDoesNotContain("nillable", cu);
- }
-
- public void testGetRequired() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWithBooleanElement("required");
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = getXmlElementAnnotation(resourceAttribute);
-
- assertEquals(Boolean.TRUE, xmlElementAnnotation.getRequired());
- }
-
- public void testSetRequired() throws Exception {
- ICompilationUnit cu = this.createTestXmlElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = getXmlElementAnnotation(resourceAttribute);
-
- assertNotNull(xmlElementAnnotation);
- assertNull(xmlElementAnnotation.getRequired());
-
- xmlElementAnnotation.setRequired(Boolean.FALSE);
-
- assertEquals(Boolean.FALSE, xmlElementAnnotation.getRequired());
- assertSourceContains("@XmlElement(required = false)", cu);
-
- xmlElementAnnotation.setRequired(null);
-
- assertSourceContains("@XmlElement", cu);
- assertSourceDoesNotContain("required", cu);
- }
-
- public void testGetType() throws Exception {
- ICompilationUnit cu = this.createTestXmlElementWithType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = getXmlElementAnnotation(resourceAttribute);
-
- assertTrue(xmlElementAnnotation != null);
- assertEquals(XML_ELEMENT_TYPE, xmlElementAnnotation.getType());
- assertEquals("java.lang." + XML_ELEMENT_TYPE, xmlElementAnnotation.getFullyQualifiedTypeName());
- }
-
- public void testSetType() throws Exception {
- ICompilationUnit cu = this.createTestXmlElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- XmlElementAnnotation xmlElementAnnotation = getXmlElementAnnotation(resourceAttribute);
-
- assertNull(xmlElementAnnotation.getType());
-
- xmlElementAnnotation.setType(XML_ELEMENT_TYPE);
-
- assertEquals(XML_ELEMENT_TYPE, xmlElementAnnotation.getType());
- assertSourceContains("@XmlElement(type = " + XML_ELEMENT_TYPE + ".class", cu);
-
- xmlElementAnnotation.setType(null);
-
- assertNull(xmlElementAnnotation.getType());
- assertSourceContains("@XmlElement", cu);
- assertSourceDoesNotContain("@XmlElement(type = " + XML_ELEMENT_TYPE + ".class", cu);
- }
-
- public void testAddXmlElement() throws Exception {
- ICompilationUnit cu = createTestXmlElementWithName();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- addXmlElementAnnotation(1, resourceAttribute);
- XmlElementsAnnotation annotation = (XmlElementsAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENTS);
-
- assertSourceContains(
- "@XmlElements({@XmlElement(name = \"" + XML_ELEMENT_NAME + "\"),@XmlElement})",
- cu);
- assertNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT));
- assertNotNull(annotation);
- assertEquals(2, annotation.getXmlElementsSize());
- }
-
- public void testAddXmlElementToBeginningOfList() throws Exception {
- ICompilationUnit cu = createTestXmlElementWithName();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- addXmlElementAnnotation(1, resourceAttribute);
- XmlElementsAnnotation annotation = (XmlElementsAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENTS);
-
- assertSourceContains(
- "@XmlElements({@XmlElement(name = \"" + XML_ELEMENT_NAME + "\"),@XmlElement})",
- cu);
-
- addXmlElementAnnotation(0, resourceAttribute);
-
- assertSourceContains(
- "@XmlElements({@XmlElement,@XmlElement(name = \"" + XML_ELEMENT_NAME + "\"), @XmlElement})",
- cu);
-
- assertNull(resourceAttribute.getAnnotation(JAXB.XML_ELEMENT));
- assertNotNull(annotation);
- assertEquals(3, annotation.getXmlElementsSize());
- }
-
- public void testRemoveXmlElement() throws Exception {
- ICompilationUnit cu = createTestXmlElementWithName();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
- addXmlElementAnnotation(1, resourceAttribute);
-
- assertSourceContains(
- "@XmlElements({@XmlElement(name = \"" + XML_ELEMENT_NAME + "\"),@XmlElement})",
- cu);
-
- removeXmlElementAnnotation(1, resourceAttribute);
-
- assertSourceContains(
- "@XmlElement(name = \"" + XML_ELEMENT_NAME + "\")",
- cu);
- }
-} \ No newline at end of file
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumAnnotationTests.java
deleted file mode 100644
index 02d0d62311..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumAnnotationTests.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceEnum;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlEnumAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- private static final String XML_ENUM_JAVA_TYPE = "String";
-
- public XmlEnumAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlEnum() throws Exception {
- return this.createTestEnum(new DefaultEnumAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ENUM);
- }
- @Override
- public void appendEnumAnnotationTo(StringBuilder sb) {
- sb.append("@XmlEnum");
- }
- });
- }
-
- private ICompilationUnit createTestXmlEnumWithValue() throws Exception {
- return this.createTestEnum(new DefaultEnumAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ENUM);
- }
- @Override
- public void appendEnumAnnotationTo(StringBuilder sb) {
- sb.append("@XmlEnum(value = " + XML_ENUM_JAVA_TYPE + ".class)");
- }
- });
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlEnum();
- JavaResourceEnum resourceEnum = this.buildJavaResourceEnum(cu);
-
- XmlEnumAnnotation xmlEnumAnnotation = (XmlEnumAnnotation) resourceEnum.getAnnotation(JAXB.XML_ENUM);
- assertTrue(xmlEnumAnnotation != null);
- assertNull(xmlEnumAnnotation.getValue());
- }
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlEnumWithValue();
- JavaResourceEnum resourceEnum = this.buildJavaResourceEnum(cu);
-
- XmlEnumAnnotation xmlEnumAnnotation = (XmlEnumAnnotation) resourceEnum.getAnnotation(JAXB.XML_ENUM);
- assertTrue(xmlEnumAnnotation != null);
- assertEquals(XML_ENUM_JAVA_TYPE, xmlEnumAnnotation.getValue());
- assertEquals("java.lang." + XML_ENUM_JAVA_TYPE, xmlEnumAnnotation.getFullyQualifiedValueClassName());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlEnum();
- JavaResourceEnum resourceEnum = this.buildJavaResourceEnum(cu);
-
- XmlEnumAnnotation xmlEnumAnnotation = (XmlEnumAnnotation) resourceEnum.getAnnotation(JAXB.XML_ENUM);
- assertNull(xmlEnumAnnotation.getValue());
- xmlEnumAnnotation.setValue(XML_ENUM_JAVA_TYPE);
- assertEquals(XML_ENUM_JAVA_TYPE, xmlEnumAnnotation.getValue());
-
- assertSourceContains("@XmlEnum(" + XML_ENUM_JAVA_TYPE + ".class)", cu);
-
- xmlEnumAnnotation.setValue(null);
- assertNull(xmlEnumAnnotation.getValue());
-
- assertSourceContains("@XmlEnum", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumValueAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumValueAnnotationTests.java
deleted file mode 100644
index 4629e37f00..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumValueAnnotationTests.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceEnum;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceEnumConstant;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlEnumValueAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- private static final String XML_ENUM_VALUE_VALUE = "myEnumValue";
-
- public XmlEnumValueAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlEnumValue() throws Exception {
- return this.createTestEnum(new DefaultEnumAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ENUM_VALUE);
- }
- @Override
- public void appendSundayEnumConstantAnnotationTo(StringBuilder sb) {
- sb.append("@XmlEnumValue");
- }
- });
- }
-
- private ICompilationUnit createTestXmlEnumValueWithValue() throws Exception {
- return this.createTestXmlEnumValueWithStringElement("value", XML_ENUM_VALUE_VALUE);
- }
-
- private ICompilationUnit createTestXmlEnumValueWithStringElement(final String element, final String value) throws Exception {
- return this.createTestEnum(new DefaultEnumAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ENUM_VALUE);
- }
- @Override
- public void appendSundayEnumConstantAnnotationTo(StringBuilder sb) {
- sb.append("@XmlEnumValue(" + element + " = \"" + value + "\")");
- }
- });
- }
-
- public void testGetXmlEnumValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlEnumValue();
- JavaResourceEnum resourceEnum = buildJavaResourceEnum(cu);
- JavaResourceEnumConstant enumConstant = getEnumConstant(resourceEnum, 0);
-
- XmlEnumValueAnnotation xmlEnumValueAnnotation = (XmlEnumValueAnnotation) enumConstant.getAnnotation(JAXB.XML_ENUM_VALUE);
- assertTrue(xmlEnumValueAnnotation != null);
-
- enumConstant.removeAnnotation(JAXB.XML_ENUM_VALUE);
- assertSourceDoesNotContain("@XmlEnumValue", cu);
- }
-
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlEnumValueWithValue();
- JavaResourceEnum resourceEnum = buildJavaResourceEnum(cu);
- JavaResourceEnumConstant enumConstant = getEnumConstant(resourceEnum, 0);
-
- XmlEnumValueAnnotation xmlEnumValueAnnotation = (XmlEnumValueAnnotation) enumConstant.getAnnotation(JAXB.XML_ENUM_VALUE);
- assertTrue(xmlEnumValueAnnotation != null);
- assertEquals(XML_ENUM_VALUE_VALUE, xmlEnumValueAnnotation.getValue());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlEnumValue();
- JavaResourceEnum resourceEnum = buildJavaResourceEnum(cu);
- JavaResourceEnumConstant enumConstant = getEnumConstant(resourceEnum, 0);
-
- XmlEnumValueAnnotation xmlEnumValueAnnotation = (XmlEnumValueAnnotation) enumConstant.getAnnotation(JAXB.XML_ENUM_VALUE);
- assertTrue(xmlEnumValueAnnotation != null);
- assertNull(xmlEnumValueAnnotation.getValue());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlEnumValue();
- JavaResourceEnum resourceEnum = buildJavaResourceEnum(cu);
- JavaResourceEnumConstant enumConstant = getEnumConstant(resourceEnum, 0);
-
- XmlEnumValueAnnotation xmlEnumValueAnnotation = (XmlEnumValueAnnotation) enumConstant.getAnnotation(JAXB.XML_ENUM_VALUE);
- assertNull(xmlEnumValueAnnotation.getValue());
- xmlEnumValueAnnotation.setValue(XML_ENUM_VALUE_VALUE);
- assertEquals(XML_ENUM_VALUE_VALUE, xmlEnumValueAnnotation.getValue());
-
- assertSourceContains("@XmlEnumValue(\"" + XML_ENUM_VALUE_VALUE + "\")", cu);
-
- xmlEnumValueAnnotation.setValue(null);
- assertNull(xmlEnumValueAnnotation.getValue());
-
- assertSourceDoesNotContain("@XmlEnumValue(", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDAnnotationTests.java
deleted file mode 100644
index 3c13c6e554..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDAnnotationTests.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlIDAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlIDAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- public XmlIDAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlID() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ID);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlID");
- }
- });
- }
-
- public void testGetXmlID() throws Exception {
- ICompilationUnit cu = this.createTestXmlID();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlIDAnnotation xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ID);
- assertTrue(xmlIDAnnotation != null);
-
- resourceAttribute.removeAnnotation(JAXB.XML_ID);
- assertSourceDoesNotContain("@XmlID", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDREFAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDREFAnnotationTests.java
deleted file mode 100644
index 48aacb46ce..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDREFAnnotationTests.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlIDREFAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- public XmlIDREFAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlIDREF() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_IDREF);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlIDREF");
- }
- });
- }
-
- public void testGetXmlIDREF() throws Exception {
- ICompilationUnit cu = this.createTestXmlIDREF();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlIDREFAnnotation xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(JAXB.XML_IDREF);
- assertTrue(xmlIDREFAnnotation != null);
-
- resourceAttribute.removeAnnotation(JAXB.XML_IDREF);
- assertSourceDoesNotContain("@XmlIDREF", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlInlineBinaryDataAttributeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlInlineBinaryDataAttributeAnnotationTests.java
deleted file mode 100644
index 47ad282afd..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlInlineBinaryDataAttributeAnnotationTests.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlInlineBinaryDataAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlInlineBinaryDataAttributeAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- public XmlInlineBinaryDataAttributeAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlInlineBinaryData() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_INLINE_BINARY_DATA);
- }
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@XmlInlineBinaryData");
- }
- });
- }
-
- public void testGetXmlInlineBinaryData() throws Exception {
- ICompilationUnit cu = this.createTestXmlInlineBinaryData();
- JavaResourceType resourceType = this.buildJavaResourceType(cu);
- JavaResourceMethod resourceMethod = this.getMethod(resourceType, 0);
-
- XmlInlineBinaryDataAnnotation xmlInlineBinaryDataAnnotation = (XmlInlineBinaryDataAnnotation) resourceMethod.getAnnotation(JAXB.XML_INLINE_BINARY_DATA);
- assertTrue(xmlInlineBinaryDataAnnotation != null);
-
- resourceMethod.removeAnnotation(JAXB.XML_INLINE_BINARY_DATA);
- assertSourceDoesNotContain("@XmlInlineBinaryData", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlInlineBinaryDataTypeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlInlineBinaryDataTypeAnnotationTests.java
deleted file mode 100644
index 1ed94cbb14..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlInlineBinaryDataTypeAnnotationTests.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlInlineBinaryDataAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlInlineBinaryDataTypeAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- public XmlInlineBinaryDataTypeAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlInlineBinaryData() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_INLINE_BINARY_DATA);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlInlineBinaryData");
- }
- });
- }
-
- public void testGetXmlInlineBinaryData() throws Exception {
- ICompilationUnit cu = this.createTestXmlInlineBinaryData();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlInlineBinaryDataAnnotation xmlInlineBinaryDataAnnotation = (XmlInlineBinaryDataAnnotation) resourceType.getAnnotation(JAXB.XML_INLINE_BINARY_DATA);
- assertTrue(xmlInlineBinaryDataAnnotation != null);
-
- resourceType.removeAnnotation(JAXB.XML_INLINE_BINARY_DATA);
- assertSourceDoesNotContain("@XmlInlineBinaryData", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlJavaTypeAdapterPackageAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlJavaTypeAdapterPackageAnnotationTests.java
deleted file mode 100644
index adeab40f26..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlJavaTypeAdapterPackageAnnotationTests.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourcePackage;
-import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlJavaTypeAdapterPackageAnnotationTests
- extends JaxbJavaResourceModelTestCase {
-
- private static final String TEST_CLASS = "TestClass";
- private static final String TEST_CLASS_2 = "TestClass2";
- private static final String FQ_TEST_CLASS = PACKAGE_NAME + "." + TEST_CLASS;
- private static final String FQ_TEST_CLASS_2 = PACKAGE_NAME + "." + TEST_CLASS_2;
-
-
- public XmlJavaTypeAdapterPackageAnnotationTests(String name) {
- super(name);
- }
-
-
- private void createTestClass() throws CoreException {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("public class ").append(TEST_CLASS).append(" ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, TEST_CLASS + ".java", sourceWriter);
- }
-
- private void createTestClass2() throws CoreException {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("public class ").append(TEST_CLASS_2).append(" ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, TEST_CLASS_2 + ".java", sourceWriter);
- }
-
- private ICompilationUnit createPackageInfoWithJavaTypeAdapter() throws CoreException {
- return createTestPackageInfo(
- "@XmlJavaTypeAdapter",
- JAXB.XML_JAVA_TYPE_ADAPTER);
- }
-
- private ICompilationUnit createPackageInfoWithJavaTypeAdapterAndValue() throws CoreException {
- createTestClass();
- return createTestPackageInfo(
- "@XmlJavaTypeAdapter(" + TEST_CLASS + ".class)",
- JAXB.XML_JAVA_TYPE_ADAPTER, FQ_TEST_CLASS);
- }
-
- private ICompilationUnit createPackageInfoWithJavaTypeAdapterAndType() throws CoreException {
- createTestClass();
- return createTestPackageInfo(
- "@XmlJavaTypeAdapter(type = " + TEST_CLASS + ".class)",
- JAXB.XML_JAVA_TYPE_ADAPTER, FQ_TEST_CLASS);
- }
-
- private ICompilationUnit createPackageInfoWithJavaTypeAdapters() throws CoreException {
- return createTestPackageInfo(
- "@XmlJavaTypeAdapters({@XmlJavaTypeAdapter,@XmlJavaTypeAdapter})",
- JAXB.XML_JAVA_TYPE_ADAPTERS, JAXB.XML_JAVA_TYPE_ADAPTER);
- }
-
- public void testValue()
- throws Exception {
-
- ICompilationUnit cu = createPackageInfoWithJavaTypeAdapterAndValue();
- JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu);
- createTestClass2();
-
- XmlJavaTypeAdapterAnnotation annotation =
- (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
- assertTrue(annotation != null);
- assertEquals(TEST_CLASS, annotation.getValue());
- assertEquals(FQ_TEST_CLASS, annotation.getFullyQualifiedValue());
- assertSourceContains("@XmlJavaTypeAdapter(" + TEST_CLASS + ".class)", cu);
-
- annotation.setValue(TEST_CLASS_2);
- assertEquals(TEST_CLASS_2, annotation.getValue());
- assertEquals(FQ_TEST_CLASS_2, annotation.getFullyQualifiedValue());
- assertSourceContains("@XmlJavaTypeAdapter(" + TEST_CLASS_2 + ".class)", cu);
-
- annotation.setValue(null);
- assertEquals(null, annotation.getValue());
- assertEquals(null, annotation.getFullyQualifiedValue());
- assertSourceContains("@XmlJavaTypeAdapter", cu);
-
- annotation.setValue(TEST_CLASS);
- assertEquals(TEST_CLASS, annotation.getValue());
- assertEquals(FQ_TEST_CLASS, annotation.getFullyQualifiedValue());
- assertSourceContains("@XmlJavaTypeAdapter(" + TEST_CLASS + ".class)", cu);
- }
-
- public void testType()
- throws Exception {
-
- ICompilationUnit cu = createPackageInfoWithJavaTypeAdapterAndType();
- JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu);
- createTestClass2();
-
- XmlJavaTypeAdapterAnnotation annotation =
- (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
- assertTrue(annotation != null);
- assertEquals(TEST_CLASS, annotation.getType());
- assertEquals(FQ_TEST_CLASS, annotation.getFullyQualifiedType());
- assertSourceContains("@XmlJavaTypeAdapter(type = " + TEST_CLASS + ".class)", cu);
-
- annotation.setType(TEST_CLASS_2);
- assertEquals(TEST_CLASS_2, annotation.getType());
- assertEquals(FQ_TEST_CLASS_2, annotation.getFullyQualifiedType());
- assertSourceContains("@XmlJavaTypeAdapter(type = " + TEST_CLASS_2 + ".class)", cu);
-
- annotation.setType(null);
- assertEquals(null, annotation.getType());
- assertEquals(null, annotation.getFullyQualifiedType());
- assertSourceContains("@XmlJavaTypeAdapter", cu);
-
- annotation.setType(TEST_CLASS);
- assertEquals(TEST_CLASS, annotation.getType());
- assertEquals(FQ_TEST_CLASS, annotation.getFullyQualifiedType());
- assertSourceContains("@XmlJavaTypeAdapter(type = " + TEST_CLASS + ".class)", cu);
- }
-
- public void testTypeWithValue()
- throws Exception {
-
- ICompilationUnit cu = createPackageInfoWithJavaTypeAdapterAndValue();
- JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu);
- createTestClass2();
-
- XmlJavaTypeAdapterAnnotation annotation =
- (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
- assertTrue(annotation != null);
- assertEquals(TEST_CLASS, annotation.getValue());
- assertSourceContains("@XmlJavaTypeAdapter(" + TEST_CLASS + ".class)", cu);
-
- annotation.setType(TEST_CLASS_2);
- assertEquals(TEST_CLASS, annotation.getValue());
- assertEquals(TEST_CLASS_2, annotation.getType());
- assertSourceContains("@XmlJavaTypeAdapter(value = " + TEST_CLASS + ".class, type = " + TEST_CLASS_2 + ".class)", cu);
-
- annotation.setValue(null);
- assertEquals(null, annotation.getValue());
- assertEquals(TEST_CLASS_2, annotation.getType());
- assertSourceContains("@XmlJavaTypeAdapter(type = " + TEST_CLASS_2 + ".class)", cu);
-
- annotation.setValue(TEST_CLASS);
- assertEquals(TEST_CLASS, annotation.getValue());
- assertEquals(TEST_CLASS_2, annotation.getType());
- assertSourceContains("@XmlJavaTypeAdapter(type = " + TEST_CLASS_2 + ".class, value = " + TEST_CLASS + ".class)", cu);
-
- annotation.setType(null);
- assertEquals(TEST_CLASS, annotation.getValue());
- assertEquals(null, annotation.getType());
- assertSourceContains("@XmlJavaTypeAdapter(" + TEST_CLASS + ".class)", cu);
- }
-
- public void testContainedWithValue()
- throws Exception {
- // test contained annotation value setting/updating
-
- ICompilationUnit cu = createPackageInfoWithJavaTypeAdapters();
- JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu);
- createTestClass();
-
- XmlJavaTypeAdapterAnnotation adapterAnnotation =
- (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
-
- adapterAnnotation.setValue(TEST_CLASS);
- assertEquals(TEST_CLASS, adapterAnnotation.getValue());
- assertEquals(FQ_TEST_CLASS, adapterAnnotation.getFullyQualifiedValue());
- assertSourceContains(
- "@XmlJavaTypeAdapters({@XmlJavaTypeAdapter(" + TEST_CLASS + ".class),@XmlJavaTypeAdapter})", cu);
-
- adapterAnnotation.setValue(null);
- assertNull(adapterAnnotation.getValue());
- assertNull(FQ_TEST_CLASS, adapterAnnotation.getFullyQualifiedValue());
- assertSourceContains(
- "@XmlJavaTypeAdapters({@XmlJavaTypeAdapter,@XmlJavaTypeAdapter})", cu);
- }
-
- public void testContainedWithType()
- throws Exception {
- // test contained annotation type setting/updating
-
- ICompilationUnit cu = createPackageInfoWithJavaTypeAdapters();
- JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu);
- createTestClass();
-
- XmlJavaTypeAdapterAnnotation adapterAnnotation =
- (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(1, JAXB.XML_JAVA_TYPE_ADAPTER);
-
- adapterAnnotation.setType(TEST_CLASS);
- assertEquals(TEST_CLASS, adapterAnnotation.getType());
- assertEquals(FQ_TEST_CLASS, adapterAnnotation.getFullyQualifiedType());
- assertSourceContains(
- "@XmlJavaTypeAdapters({@XmlJavaTypeAdapter,@XmlJavaTypeAdapter(type = " + TEST_CLASS + ".class)})", cu);
-
- resourcePackage.moveAnnotation(0, 1, JAXB.XML_JAVA_TYPE_ADAPTER);
- adapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
- assertEquals(TEST_CLASS, adapterAnnotation.getType());
- assertEquals(FQ_TEST_CLASS, adapterAnnotation.getFullyQualifiedType());
- assertSourceContains(
- "@XmlJavaTypeAdapters({@XmlJavaTypeAdapter(type = " + TEST_CLASS + ".class),@XmlJavaTypeAdapter})", cu);
-
- adapterAnnotation.setType(null);
- assertNull(adapterAnnotation.getType());
- assertNull(FQ_TEST_CLASS, adapterAnnotation.getFullyQualifiedType());
- assertSourceContains(
- "@XmlJavaTypeAdapters({@XmlJavaTypeAdapter,@XmlJavaTypeAdapter})", cu);
- }
-
- public void testContained()
- throws Exception {
- // test adding/removing/moving
-
- ICompilationUnit cu = createPackageInfoWithJavaTypeAdapter();
- JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu);
- createTestClass();
- createTestClass2();
-
- assertEquals(1, resourcePackage.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
-
- resourcePackage.addAnnotation(1, JAXB.XML_JAVA_TYPE_ADAPTER);
- assertEquals(2, resourcePackage.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
- assertSourceContains("@XmlJavaTypeAdapters({ @XmlJavaTypeAdapter, @XmlJavaTypeAdapter })", cu);
-
- XmlJavaTypeAdapterAnnotation adapterAnnotation1 = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
- adapterAnnotation1.setValue(TEST_CLASS);
- XmlJavaTypeAdapterAnnotation adapterAnnotation2 = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(1, JAXB.XML_JAVA_TYPE_ADAPTER);
- adapterAnnotation2.setValue(TEST_CLASS_2);
- assertSourceContains(
- "@XmlJavaTypeAdapters({ @XmlJavaTypeAdapter(" + TEST_CLASS
- + ".class), @XmlJavaTypeAdapter(" + TEST_CLASS_2
- + ".class) })", cu);
-
- resourcePackage.moveAnnotation(0, 1, JAXB.XML_JAVA_TYPE_ADAPTER);
- assertSourceContains(
- "@XmlJavaTypeAdapters({ @XmlJavaTypeAdapter(" + TEST_CLASS_2
- + ".class), @XmlJavaTypeAdapter(" + TEST_CLASS
- + ".class) })", cu);
-
- resourcePackage.removeAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
- assertEquals(1, resourcePackage.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER));
- assertSourceContains(
- "@XmlJavaTypeAdapter(" + TEST_CLASS + ".class)", cu);
- assertSourceDoesNotContain("@XmlJavaTypeAdapters", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlJavaTypeAdapterTypeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlJavaTypeAdapterTypeAnnotationTests.java
deleted file mode 100644
index 760feb054c..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlJavaTypeAdapterTypeAnnotationTests.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlJavaTypeAdapterTypeAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- private static final String XML_JAVA_TYPE_ADAPTER_CLASS = "MyAdapterClass";
-
- public XmlJavaTypeAdapterTypeAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlJavaTypeAdapter() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_JAVA_TYPE_ADAPTER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlJavaTypeAdapter");
- }
- });
- }
-
- private ICompilationUnit createTestXmlJavaTypeAdapterWithValue() throws Exception {
- this.createTestAdapterClass();
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_JAVA_TYPE_ADAPTER);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlJavaTypeAdapter(value = " + XML_JAVA_TYPE_ADAPTER_CLASS + ".class)");
- }
- });
- }
-
- private void createTestAdapterClass() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("public class ").append(XML_JAVA_TYPE_ADAPTER_CLASS).append(" ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "MyAdapterClass.java", sourceWriter);
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlJavaTypeAdapter();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
- assertTrue(xmlJavaTypeAdapterAnnotation != null);
- assertNull(xmlJavaTypeAdapterAnnotation.getValue());
- }
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlJavaTypeAdapterWithValue();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
- assertTrue(xmlJavaTypeAdapterAnnotation != null);
- assertEquals(XML_JAVA_TYPE_ADAPTER_CLASS, xmlJavaTypeAdapterAnnotation.getValue());
- assertEquals("test." + XML_JAVA_TYPE_ADAPTER_CLASS, xmlJavaTypeAdapterAnnotation.getFullyQualifiedValue());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlJavaTypeAdapter();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
- assertNull(xmlJavaTypeAdapterAnnotation.getValue());
- xmlJavaTypeAdapterAnnotation.setValue(XML_JAVA_TYPE_ADAPTER_CLASS);
- assertEquals(XML_JAVA_TYPE_ADAPTER_CLASS, xmlJavaTypeAdapterAnnotation.getValue());
-
- assertSourceContains("@XmlJavaTypeAdapter(" + XML_JAVA_TYPE_ADAPTER_CLASS + ".class)", cu);
- }
-
- public void testSetValueNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlJavaTypeAdapterWithValue();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER);
- assertEquals(XML_JAVA_TYPE_ADAPTER_CLASS, xmlJavaTypeAdapterAnnotation.getValue());
-
- xmlJavaTypeAdapterAnnotation.setValue(null);
- assertNull(xmlJavaTypeAdapterAnnotation.getValue());
-
- assertSourceContains("@XmlJavaTypeAdapter", cu);
- assertSourceDoesNotContain("@XmlJavaTypeAdapter(" + XML_JAVA_TYPE_ADAPTER_CLASS + ".class)", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlListAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlListAnnotationTests.java
deleted file mode 100644
index c21a90420d..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlListAnnotationTests.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlListAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- public XmlListAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlList() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_LIST);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlList");
- }
- });
- }
-
- public void testGetXmlList() throws Exception {
- ICompilationUnit cu = this.createTestXmlList();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlListAnnotation xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(JAXB.XML_LIST);
- assertTrue(xmlListAnnotation != null);
-
- resourceAttribute.removeAnnotation(JAXB.XML_LIST);
- assertSourceDoesNotContain("@XmlList", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMimeTypeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMimeTypeAnnotationTests.java
deleted file mode 100644
index 510878c149..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMimeTypeAnnotationTests.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlMimeTypeAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlMimeTypeAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- private static final String XML_MIME_TYPE_VALUE = "myMimeType";
-
- public XmlMimeTypeAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlMimeType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_MIME_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlMimeType");
- }
- });
- }
-
- private ICompilationUnit createTestXmlMimeTypeWithValue() throws Exception {
- return this.createTestXmlMimeTypeWithStringElement("value", XML_MIME_TYPE_VALUE);
- }
-
- private ICompilationUnit createTestXmlMimeTypeWithStringElement(final String element, final String value) throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_MIME_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlMimeType(" + element + " = \"" + value + "\")");
- }
- });
- }
-
- public void testGetXmlMimeType() throws Exception {
- ICompilationUnit cu = this.createTestXmlMimeType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlMimeTypeAnnotation xmlMimeTypeAnnotation = (XmlMimeTypeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_MIME_TYPE);
- assertTrue(xmlMimeTypeAnnotation != null);
-
- resourceAttribute.removeAnnotation(JAXB.XML_MIME_TYPE);
- assertSourceDoesNotContain("@XmlMimeType", cu);
- }
-
- public void testGetValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlMimeTypeWithValue();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlMimeTypeAnnotation xmlMimeTypeAnnotation = (XmlMimeTypeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_MIME_TYPE);
- assertTrue(xmlMimeTypeAnnotation != null);
- assertEquals(XML_MIME_TYPE_VALUE, xmlMimeTypeAnnotation.getValue());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlMimeType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlMimeTypeAnnotation xmlMimeTypeAnnotation = (XmlMimeTypeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_MIME_TYPE);
- assertTrue(xmlMimeTypeAnnotation != null);
- assertNull(xmlMimeTypeAnnotation.getValue());
- }
-
- public void testSetValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlMimeType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlMimeTypeAnnotation xmlMimeTypeAnnotation = (XmlMimeTypeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_MIME_TYPE);
- assertNull(xmlMimeTypeAnnotation.getValue());
- xmlMimeTypeAnnotation.setValue(XML_MIME_TYPE_VALUE);
- assertEquals(XML_MIME_TYPE_VALUE, xmlMimeTypeAnnotation.getValue());
-
- assertSourceContains("@XmlMimeType(\"" + XML_MIME_TYPE_VALUE + "\")", cu);
-
- xmlMimeTypeAnnotation.setValue(null);
- assertNull(xmlMimeTypeAnnotation.getValue());
-
- assertSourceDoesNotContain("@XmlMimeType(", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMixedAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMixedAnnotationTests.java
deleted file mode 100644
index fe9e868763..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMixedAnnotationTests.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlMixedAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- public XmlMixedAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlMixed() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_MIXED);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlMixed");
- }
- });
- }
-
- public void testGetXmlMixed() throws Exception {
- ICompilationUnit cu = this.createTestXmlMixed();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlMixedAnnotation xmlMixedAnnotation = (XmlMixedAnnotation) resourceAttribute.getAnnotation(JAXB.XML_MIXED);
- assertTrue(xmlMixedAnnotation != null);
-
- resourceAttribute.removeAnnotation(JAXB.XML_MIXED);
- assertSourceDoesNotContain("@XmlMixed", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlRegistryAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlRegistryAnnotationTests.java
deleted file mode 100644
index 2e7b36bb2e..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlRegistryAnnotationTests.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlRegistryAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlRegistryAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- public XmlRegistryAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlRegistry() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_REGISTRY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlRegistry");
- }
- });
- }
-
- public void testGetXmlRegistry() throws Exception {
- ICompilationUnit cu = this.createTestXmlRegistry();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlRegistryAnnotation xmlRegistryAnnotation = (XmlRegistryAnnotation) resourceType.getAnnotation(JAXB.XML_REGISTRY);
- assertTrue(xmlRegistryAnnotation != null);
-
- resourceType.removeAnnotation(JAXB.XML_REGISTRY);
- assertSourceDoesNotContain("@XmlRegistry", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlRootElementAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlRootElementAnnotationTests.java
deleted file mode 100644
index adb6360444..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlRootElementAnnotationTests.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlRootElementAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- private static final String XML_ROOT_ELEMENT_NAME = "XmlRootElementName";
- private static final String XML_ROOT_ELEMENT_NAMESPACE = "XmlRootElementNamespace";
-
- public XmlRootElementAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlRootElement() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ROOT_ELEMENT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlRootElement");
- }
- });
- }
-
- private ICompilationUnit createTestXmlRootElementWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ROOT_ELEMENT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlRootElement(name = \"" + XML_ROOT_ELEMENT_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestXmlRootElementWithNamespace() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_ROOT_ELEMENT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlRootElement(namespace = \"" + XML_ROOT_ELEMENT_NAMESPACE + "\")");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlRootElementWithName();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlRootElementAnnotation xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(JAXB.XML_ROOT_ELEMENT);
- assertTrue(xmlRootElementAnnotation != null);
- assertEquals(XML_ROOT_ELEMENT_NAME, xmlRootElementAnnotation.getName());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlRootElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlRootElementAnnotation xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(JAXB.XML_ROOT_ELEMENT);
- assertTrue(xmlRootElementAnnotation != null);
- assertNull(xmlRootElementAnnotation.getName());
- assertNull(xmlRootElementAnnotation.getNamespace());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlRootElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlRootElementAnnotation xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(JAXB.XML_ROOT_ELEMENT);
- assertNull(xmlRootElementAnnotation.getName());
- xmlRootElementAnnotation.setName(XML_ROOT_ELEMENT_NAME);
- assertEquals(XML_ROOT_ELEMENT_NAME, xmlRootElementAnnotation.getName());
-
- assertSourceContains("@XmlRootElement(name = \"" + XML_ROOT_ELEMENT_NAME + "\")", cu);
-
- xmlRootElementAnnotation.setName(null);
- assertNull(xmlRootElementAnnotation.getName());
-
- assertSourceContains("@XmlRootElement", cu);
- assertSourceDoesNotContain("@XmlRootElement(name = \"" + XML_ROOT_ELEMENT_NAME + "\")", cu);
- }
-
- public void testGetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlRootElementWithNamespace();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlRootElementAnnotation xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(JAXB.XML_ROOT_ELEMENT);
- assertTrue(xmlRootElementAnnotation != null);
- assertEquals(XML_ROOT_ELEMENT_NAMESPACE, xmlRootElementAnnotation.getNamespace());
- }
-
- public void testSetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlRootElement();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlRootElementAnnotation xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(JAXB.XML_ROOT_ELEMENT);
- assertNull(xmlRootElementAnnotation.getNamespace());
- xmlRootElementAnnotation.setNamespace(XML_ROOT_ELEMENT_NAMESPACE);
- assertEquals(XML_ROOT_ELEMENT_NAMESPACE, xmlRootElementAnnotation.getNamespace());
-
- assertSourceContains("@XmlRootElement(namespace = \"" + XML_ROOT_ELEMENT_NAMESPACE + "\")", cu);
-
- xmlRootElementAnnotation.setNamespace(null);
- assertNull(xmlRootElementAnnotation.getNamespace());
-
- assertSourceContains("@XmlRootElement", cu);
- assertSourceDoesNotContain("@XmlRootElement(namespace = \"" + XML_ROOT_ELEMENT_NAMESPACE + "\")", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaAnnotationTests.java
deleted file mode 100644
index 9a4bbd2ab3..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaAnnotationTests.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourcePackage;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlSchemaAnnotationTests
- extends JaxbJavaResourceModelTestCase {
-
- private static final String TEST_LOCATION = "http://www.eclipse.org/test/schema.xsd";
-
- private static final String TEST_NAMESPACE = "http://www.eclipse.org/test/schema";
-
- private static final String TEST_PREFIX = "ts";
-
- private static final String TEST_NAMESPACE_2 = "http://www.eclipse.org/test/schema2";
-
- private static final String TEST_PREFIX_2 = "ts2";
-
-
- public XmlSchemaAnnotationTests(String name) {
- super(name);
- }
-
-
- private ICompilationUnit createPackageInfoWithSchemaAndAttributeFormDefault() throws CoreException {
- return createTestPackageInfo(
- "@XmlSchema(attributeFormDefault = XmlNsForm.QUALIFIED)",
- JAXB.XML_SCHEMA, JAXB.XML_NS_FORM);
- }
-
- private ICompilationUnit createPackageInfoWithSchemaAndElementFormDefault() throws CoreException {
- return createTestPackageInfo(
- "@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED)",
- JAXB.XML_SCHEMA, JAXB.XML_NS_FORM);
- }
-
- private ICompilationUnit createPackageInfoWithSchemaAndLocation() throws CoreException {
- return createTestPackageInfo(
- "@XmlSchema(location = \"" + TEST_LOCATION + "\")",
- JAXB.XML_SCHEMA);
- }
-
- private ICompilationUnit createPackageInfoWithSchemaAndNamespace() throws CoreException {
- return createTestPackageInfo(
- "@XmlSchema(namespace = \"" + TEST_NAMESPACE + "\")",
- JAXB.XML_SCHEMA);
- }
-
- private ICompilationUnit createPackageInfoWithSchemaAndXmlns() throws CoreException {
- return createTestPackageInfo(
- "@XmlSchema(xmlns = @XmlNs)",
- JAXB.XML_SCHEMA, JAXB.XML_NS);
- }
-
- private ICompilationUnit createPackageInfoWithSchemaAndXmlnsWithNamespace() throws CoreException {
- return createTestPackageInfo(
- "@XmlSchema(xmlns = @XmlNs(namespaceURI = \"" + TEST_NAMESPACE + "\"))",
- JAXB.XML_SCHEMA, JAXB.XML_NS);
- }
-
- private ICompilationUnit createPackageInfoWithSchemaAndXmlnsWithPrefix() throws CoreException {
- return createTestPackageInfo(
- "@XmlSchema(xmlns = @XmlNs(prefix = \"" + TEST_PREFIX + "\"))",
- JAXB.XML_SCHEMA, JAXB.XML_NS);
- }
-
- public void testAttributeFormDefault()
- throws Exception {
-
- ICompilationUnit cu = createPackageInfoWithSchemaAndAttributeFormDefault();
- JavaResourcePackage packageResource = buildJavaResourcePackage(cu);
-
- XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA);
- assertTrue(schemaAnnotation != null);
- assertEquals(XmlNsForm.QUALIFIED, schemaAnnotation.getAttributeFormDefault());
- assertSourceContains("@XmlSchema(attributeFormDefault = XmlNsForm.QUALIFIED)", cu);
-
- schemaAnnotation.setAttributeFormDefault(XmlNsForm.UNQUALIFIED);
- assertEquals(XmlNsForm.UNQUALIFIED, schemaAnnotation.getAttributeFormDefault());
- assertSourceContains("@XmlSchema(attributeFormDefault = UNQUALIFIED)", cu);
-
- schemaAnnotation.setAttributeFormDefault(XmlNsForm.UNSET);
- assertEquals(XmlNsForm.UNSET, schemaAnnotation.getAttributeFormDefault());
- assertSourceContains("@XmlSchema(attributeFormDefault = UNSET)", cu);
-
- schemaAnnotation.setAttributeFormDefault(null);
- schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA);
- assertNull(schemaAnnotation.getAttributeFormDefault());
- assertSourceDoesNotContain("@XmlSchema(", cu);
-
- schemaAnnotation = (XmlSchemaAnnotation) packageResource.addAnnotation(JAXB.XML_SCHEMA);
- schemaAnnotation.setAttributeFormDefault(XmlNsForm.QUALIFIED);
- assertEquals(XmlNsForm.QUALIFIED, schemaAnnotation.getAttributeFormDefault());
- assertSourceContains("@XmlSchema(attributeFormDefault = QUALIFIED)", cu);
- }
-
- public void testElementFormDefault()
- throws Exception {
-
- ICompilationUnit cu = createPackageInfoWithSchemaAndElementFormDefault();
- JavaResourcePackage packageResource = buildJavaResourcePackage(cu);
-
- XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA);
- assertTrue(schemaAnnotation != null);
- assertEquals(XmlNsForm.QUALIFIED, schemaAnnotation.getElementFormDefault());
- assertSourceContains("@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED)", cu);
-
- schemaAnnotation.setElementFormDefault(XmlNsForm.UNQUALIFIED);
- assertEquals(XmlNsForm.UNQUALIFIED, schemaAnnotation.getElementFormDefault());
- assertSourceContains("@XmlSchema(elementFormDefault = UNQUALIFIED)", cu);
-
- schemaAnnotation.setElementFormDefault(XmlNsForm.UNSET);
- assertEquals(XmlNsForm.UNSET, schemaAnnotation.getElementFormDefault());
- assertSourceContains("@XmlSchema(elementFormDefault = UNSET)", cu);
-
- schemaAnnotation.setElementFormDefault(null);
- schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA);
- assertNull(schemaAnnotation.getElementFormDefault());
- assertSourceDoesNotContain("@XmlSchema(", cu);
-
- schemaAnnotation = (XmlSchemaAnnotation) packageResource.addAnnotation(JAXB.XML_SCHEMA);
- schemaAnnotation.setElementFormDefault(XmlNsForm.QUALIFIED);
- assertEquals(XmlNsForm.QUALIFIED, schemaAnnotation.getElementFormDefault());
- assertSourceContains("@XmlSchema(elementFormDefault = QUALIFIED)", cu);
- }
-
- public void testLocation()
- throws Exception {
-
- ICompilationUnit cu = createPackageInfoWithSchemaAndLocation();
- JavaResourcePackage packageResource = buildJavaResourcePackage(cu);
-
- XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA);
- assertNotNull(schemaAnnotation.getLocation());
-
- schemaAnnotation.setLocation(null);
- schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA);
- assertNull(schemaAnnotation.getLocation());
- assertSourceDoesNotContain("@XmlSchema(", cu);
-
- schemaAnnotation = (XmlSchemaAnnotation) packageResource.addAnnotation(JAXB.XML_SCHEMA);
- schemaAnnotation.setLocation(TEST_LOCATION);
- assertEquals(TEST_LOCATION, schemaAnnotation.getLocation());
- assertSourceContains("@XmlSchema(location = \"" + TEST_LOCATION + "\")", cu);
- }
-
- public void testNamespace()
- throws Exception {
-
- ICompilationUnit cu = createPackageInfoWithSchemaAndNamespace();
- JavaResourcePackage packageResource = buildJavaResourcePackage(cu);
-
- XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA);
- assertNotNull(schemaAnnotation.getNamespace());
-
- schemaAnnotation.setNamespace(null);
- schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA);
- assertNull(schemaAnnotation.getNamespace());
- assertSourceDoesNotContain("@XmlSchema(", cu);
-
- schemaAnnotation = (XmlSchemaAnnotation) packageResource.addAnnotation(JAXB.XML_SCHEMA);
- schemaAnnotation.setNamespace(TEST_NAMESPACE);
- assertEquals(TEST_NAMESPACE, schemaAnnotation.getNamespace());
- assertSourceContains("@XmlSchema(namespace = \"" + TEST_NAMESPACE + "\")", cu);
- }
-
- public void testXmlnsNamespace()
- throws Exception {
-
- ICompilationUnit cu = createPackageInfoWithSchemaAndXmlnsWithNamespace();
- JavaResourcePackage packageResource = buildJavaResourcePackage(cu);
-
- XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA);
- XmlNsAnnotation xmlnsAnnotation = schemaAnnotation.xmlnsAt(0);
- assertNotNull(xmlnsAnnotation.getNamespaceURI());
-
- xmlnsAnnotation.setNamespaceURI(null);
- assertNull(xmlnsAnnotation.getNamespaceURI());
- assertSourceContains("@XmlSchema(xmlns = @XmlNs)", cu);
-
- xmlnsAnnotation.setNamespaceURI(TEST_NAMESPACE_2);
- assertEquals(TEST_NAMESPACE_2, xmlnsAnnotation.getNamespaceURI());
- assertSourceContains("@XmlSchema(xmlns = @XmlNs(namespaceURI = \"" + TEST_NAMESPACE_2 + "\"))", cu);
- }
-
- public void testXmlnsPrefix()
- throws Exception {
-
- ICompilationUnit cu = createPackageInfoWithSchemaAndXmlnsWithPrefix();
- JavaResourcePackage packageResource = buildJavaResourcePackage(cu);
-
- XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA);
- XmlNsAnnotation xmlnsAnnotation = schemaAnnotation.xmlnsAt(0);
- assertNotNull(xmlnsAnnotation.getPrefix());
-
- xmlnsAnnotation.setPrefix(null);
- assertNull(xmlnsAnnotation.getPrefix());
- assertSourceContains("@XmlSchema(xmlns = @XmlNs)", cu);
-
- xmlnsAnnotation.setPrefix(TEST_PREFIX_2);
- assertEquals(TEST_PREFIX_2, xmlnsAnnotation.getPrefix());
- assertSourceContains("@XmlSchema(xmlns = @XmlNs(prefix = \"" + TEST_PREFIX_2 + "\"))", cu);
- }
-
- public void testXmlns()
- throws Exception {
-
- ICompilationUnit cu = createPackageInfoWithSchemaAndXmlns();
- JavaResourcePackage packageResource = buildJavaResourcePackage(cu);
-
- XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA);
- assertFalse(CollectionTools.isEmpty(schemaAnnotation.getXmlns()));
- assertEquals(1, schemaAnnotation.getXmlnsSize());
-
- schemaAnnotation.addXmlns(1);
- assertEquals(2, schemaAnnotation.getXmlnsSize());
- assertSourceContains("@XmlSchema(xmlns = {@XmlNs,@XmlNs})", cu);
-
- XmlNsAnnotation xmlnsAnnotation1 = schemaAnnotation.xmlnsAt(0);
- xmlnsAnnotation1.setNamespaceURI(TEST_NAMESPACE);
- xmlnsAnnotation1.setPrefix(TEST_PREFIX);
- XmlNsAnnotation xmlnsAnnotation2 = schemaAnnotation.xmlnsAt(1);
- xmlnsAnnotation2.setNamespaceURI(TEST_NAMESPACE_2);
- xmlnsAnnotation2.setPrefix(TEST_PREFIX_2);
- assertSourceContains(
- "@XmlSchema(xmlns = {@XmlNs(namespaceURI = \"" + TEST_NAMESPACE
- + "\", prefix = \"" + TEST_PREFIX
- + "\"),@XmlNs(namespaceURI = \"" + TEST_NAMESPACE_2
- + "\", prefix = \"" + TEST_PREFIX_2
- + "\")})", cu);
-
- schemaAnnotation.moveXmlns(0, 1);
- assertSourceContains(
- "@XmlSchema(xmlns = {@XmlNs(namespaceURI = \"" + TEST_NAMESPACE_2
- + "\", prefix = \"" + TEST_PREFIX_2
- + "\"),@XmlNs(namespaceURI = \"" + TEST_NAMESPACE
- + "\", prefix = \"" + TEST_PREFIX
- + "\")})", cu);
-
- schemaAnnotation.removeXmlns(1);
- assertEquals(1, schemaAnnotation.getXmlnsSize());
- assertSourceContains(
- "@XmlSchema(xmlns = @XmlNs(namespaceURI = \"" + TEST_NAMESPACE_2
- + "\", prefix = \"" + TEST_PREFIX_2
- + "\"))", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaTypeAttributeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaTypeAttributeAnnotationTests.java
deleted file mode 100644
index adebaa97b8..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaTypeAttributeAnnotationTests.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlSchemaTypeAttributeAnnotationTests
- extends JaxbJavaResourceModelTestCase {
-
- private static final String TEST_NAME = "foo";
- private static final String TEST_NAME_2 = "bar";
-
- private static final String TEST_NAMESPACE = "http://www.eclipse.org/test/schema";
- private static final String TEST_NAMESPACE_2 = "http://www.eclipse.org/test/schema2";
-
- private static final String TEST_CLASS = GregorianCalendar.class.getSimpleName();
- private static final String TEST_CLASS_2 = Date.class.getSimpleName();
- private static final String FQ_TEST_CLASS = GregorianCalendar.class.getName();
- private static final String FQ_TEST_CLASS_2 = Date.class.getName();
-
-
- public XmlSchemaTypeAttributeAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlAttributeWithSchemaTypeAndName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_SCHEMA_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlSchemaType(name = \"" + TEST_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestXmlAttributeWithSchemaTypeAndNamespace() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_SCHEMA_TYPE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlSchemaType(namespace = \"" + TEST_NAMESPACE + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestXmlAttributeWithSchemaTypeAndType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_SCHEMA_TYPE, FQ_TEST_CLASS, FQ_TEST_CLASS_2);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlSchemaType(type = " + TEST_CLASS + ".class)");
- }
- });
- }
-
- public void testName() throws Exception {
- ICompilationUnit cu = this.createTestXmlAttributeWithSchemaTypeAndName();
- JavaResourceType resourceType = this.buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = this.getField(resourceType, 0);
-
- XmlSchemaTypeAnnotation annotation =
- (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
- assertTrue(annotation != null);
- assertEquals(TEST_NAME, annotation.getName());
- assertSourceContains("@XmlSchemaType(name = \"" + TEST_NAME + "\")", cu);
-
- annotation.setName(TEST_NAME_2);
- assertEquals(TEST_NAME_2, annotation.getName());
- assertSourceContains("@XmlSchemaType(name = \"" + TEST_NAME_2 + "\")", cu);
-
- annotation.setName(null);
- assertEquals(null, annotation.getName());
- assertSourceContains("@XmlSchemaType", cu);
-
- annotation.setName(TEST_NAME);
- assertEquals(TEST_NAME, annotation.getName());
- assertSourceContains("@XmlSchemaType(name = \"" + TEST_NAME + "\")", cu);
- }
-
- public void testNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlAttributeWithSchemaTypeAndNamespace();
- JavaResourceType resourceType = this.buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = this.getField(resourceType, 0);
-
- XmlSchemaTypeAnnotation annotation =
- (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
- assertTrue(annotation != null);
- assertEquals(TEST_NAMESPACE, annotation.getNamespace());
- assertSourceContains("@XmlSchemaType(namespace = \"" + TEST_NAMESPACE + "\")", cu);
-
- annotation.setNamespace(TEST_NAMESPACE_2);
- assertEquals(TEST_NAMESPACE_2, annotation.getNamespace());
- assertSourceContains("@XmlSchemaType(namespace = \"" + TEST_NAMESPACE_2 + "\")", cu);
-
- annotation.setNamespace(null);
- assertEquals(null, annotation.getNamespace());
- assertSourceContains("@XmlSchemaType", cu);
-
- annotation.setNamespace(TEST_NAMESPACE);
- assertEquals(TEST_NAMESPACE, annotation.getNamespace());
- assertSourceContains("@XmlSchemaType(namespace = \"" + TEST_NAMESPACE + "\")", cu);
- }
-
- public void testType() throws Exception {
- ICompilationUnit cu = this.createTestXmlAttributeWithSchemaTypeAndType();
- JavaResourceType resourceType = this.buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = this.getField(resourceType, 0);
-
- XmlSchemaTypeAnnotation annotation =
- (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
- assertTrue(annotation != null);
- assertEquals(TEST_CLASS, annotation.getType());
- assertEquals(FQ_TEST_CLASS, annotation.getFullyQualifiedType());
- assertSourceContains("@XmlSchemaType(type = " + TEST_CLASS + ".class)", cu);
-
- annotation.setType(TEST_CLASS_2);
- assertEquals(TEST_CLASS_2, annotation.getType());
- assertEquals(FQ_TEST_CLASS_2, annotation.getFullyQualifiedType());
- assertSourceContains("@XmlSchemaType(type = " + TEST_CLASS_2 + ".class)", cu);
-
- annotation.setType(null);
- assertEquals(null, annotation.getType());
- assertEquals(null, annotation.getFullyQualifiedType());
- assertSourceContains("@XmlSchemaType", cu);
-
- annotation.setType(TEST_CLASS);
- assertEquals(TEST_CLASS, annotation.getType());
- assertEquals(FQ_TEST_CLASS, annotation.getFullyQualifiedType());
- assertSourceContains("@XmlSchemaType(type = " + TEST_CLASS + ".class)", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaTypePackageAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaTypePackageAnnotationTests.java
deleted file mode 100644
index 5e358517c3..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaTypePackageAnnotationTests.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Date;
-import java.util.GregorianCalendar;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourcePackage;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlSchemaTypePackageAnnotationTests
- extends JaxbJavaResourceModelTestCase {
-
- private static final String TEST_NAME = "foo";
- private static final String TEST_NAME_2 = "bar";
-
- private static final String TEST_NAMESPACE = "http://www.eclipse.org/test/schema";
- private static final String TEST_NAMESPACE_2 = "http://www.eclipse.org/test/schema2";
-
- private static final String TEST_CLASS = GregorianCalendar.class.getSimpleName();
- private static final String TEST_CLASS_2 = Date.class.getSimpleName();
- private static final String FQ_TEST_CLASS = GregorianCalendar.class.getName();
- private static final String FQ_TEST_CLASS_2 = Date.class.getName();
-
-
- public XmlSchemaTypePackageAnnotationTests(String name) {
- super(name);
- }
-
-
- private ICompilationUnit createPackageInfoWithSchemaType() throws CoreException {
- return createTestPackageInfo(
- "@XmlSchemaType",
- JAXB.XML_SCHEMA_TYPE);
- }
-
- private ICompilationUnit createPackageInfoWithSchemaTypeAndName() throws CoreException {
- return createTestPackageInfo(
- "@XmlSchemaType(name = \"" + TEST_NAME + "\")",
- JAXB.XML_SCHEMA_TYPE);
- }
-
- private ICompilationUnit createPackageInfoWithSchemaTypeAndNamespace() throws CoreException {
- return createTestPackageInfo(
- "@XmlSchemaType(namespace = \"" + TEST_NAMESPACE + "\")",
- JAXB.XML_SCHEMA_TYPE);
- }
-
- private ICompilationUnit createPackageInfoWithSchemaTypeAndType() throws CoreException {
- return createTestPackageInfo(
- "@XmlSchemaType(type = " + TEST_CLASS + ".class)",
- JAXB.XML_SCHEMA_TYPE, FQ_TEST_CLASS, FQ_TEST_CLASS_2);
- }
-
- private ICompilationUnit createPackageInfoWithSchemaTypes() throws CoreException {
- return createTestPackageInfo(
- "@XmlSchemaTypes({@XmlSchemaType,@XmlSchemaType})",
- JAXB.XML_SCHEMA_TYPES, JAXB.XML_SCHEMA_TYPE, FQ_TEST_CLASS, FQ_TEST_CLASS_2);
- }
-
- public void testName() throws Exception {
- ICompilationUnit cu = createPackageInfoWithSchemaTypeAndName();
- JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu);
-
- XmlSchemaTypeAnnotation annotation =
- (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
- assertTrue(annotation != null);
- assertEquals(TEST_NAME, annotation.getName());
- assertSourceContains("@XmlSchemaType(name = \"" + TEST_NAME + "\")", cu);
-
- annotation.setName(TEST_NAME_2);
- assertEquals(TEST_NAME_2, annotation.getName());
- assertSourceContains("@XmlSchemaType(name = \"" + TEST_NAME_2 + "\")", cu);
-
- annotation.setName(null);
- assertEquals(null, annotation.getName());
- assertSourceContains("@XmlSchemaType", cu);
-
- annotation.setName(TEST_NAME);
- assertEquals(TEST_NAME, annotation.getName());
- assertSourceContains("@XmlSchemaType(name = \"" + TEST_NAME + "\")", cu);
- }
-
- public void testNamespace() throws Exception {
- ICompilationUnit cu = createPackageInfoWithSchemaTypeAndNamespace();
- JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu);
-
- XmlSchemaTypeAnnotation annotation =
- (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
- assertTrue(annotation != null);
- assertEquals(TEST_NAMESPACE, annotation.getNamespace());
- assertSourceContains("@XmlSchemaType(namespace = \"" + TEST_NAMESPACE + "\")", cu);
-
- annotation.setNamespace(TEST_NAMESPACE_2);
- assertEquals(TEST_NAMESPACE_2, annotation.getNamespace());
- assertSourceContains("@XmlSchemaType(namespace = \"" + TEST_NAMESPACE_2 + "\")", cu);
-
- annotation.setNamespace(null);
- assertEquals(null, annotation.getNamespace());
- assertSourceContains("@XmlSchemaType", cu);
-
- annotation.setNamespace(TEST_NAMESPACE);
- assertEquals(TEST_NAMESPACE, annotation.getNamespace());
- assertSourceContains("@XmlSchemaType(namespace = \"" + TEST_NAMESPACE + "\")", cu);
- }
-
- public void testType() throws Exception {
- ICompilationUnit cu = createPackageInfoWithSchemaTypeAndType();
- JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu);
-
- XmlSchemaTypeAnnotation annotation =
- (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
- assertTrue(annotation != null);
- assertEquals(TEST_CLASS, annotation.getType());
- assertEquals(FQ_TEST_CLASS, annotation.getFullyQualifiedType());
- assertSourceContains("@XmlSchemaType(type = " + TEST_CLASS + ".class)", cu);
-
- annotation.setType(TEST_CLASS_2);
- assertEquals(TEST_CLASS_2, annotation.getType());
- assertEquals(FQ_TEST_CLASS_2, annotation.getFullyQualifiedType());
- assertSourceContains("@XmlSchemaType(type = " + TEST_CLASS_2 + ".class)", cu);
-
- annotation.setType(null);
- assertEquals(null, annotation.getType());
- assertEquals(null, annotation.getFullyQualifiedType());
- assertSourceContains("@XmlSchemaType", cu);
-
- annotation.setType(TEST_CLASS);
- assertEquals(TEST_CLASS, annotation.getType());
- assertEquals(FQ_TEST_CLASS, annotation.getFullyQualifiedType());
- assertSourceContains("@XmlSchemaType(type = " + TEST_CLASS + ".class)", cu);
- }
-
- public void testContainedWithName() throws Exception {
- // test contained annotation value setting/updating
-
- ICompilationUnit cu = createPackageInfoWithSchemaTypes();
- JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu);
-
- XmlSchemaTypeAnnotation containedAnnotation =
- (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
-
- containedAnnotation.setName(TEST_NAME);
- assertEquals(TEST_NAME, containedAnnotation.getName());
- assertSourceContains(
- "@XmlSchemaTypes({@XmlSchemaType(name = \"" + TEST_NAME + "\"),@XmlSchemaType})", cu);
-
- containedAnnotation.setName(null);
- assertNull(containedAnnotation.getName());
- assertSourceContains(
- "@XmlSchemaTypes({@XmlSchemaType,@XmlSchemaType})", cu);
- }
-
- public void testContainedWithNamespace() throws Exception {
- // test contained annotation value setting/updating
-
- ICompilationUnit cu = createPackageInfoWithSchemaTypes();
- JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu);
-
- XmlSchemaTypeAnnotation containedAnnotation =
- (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
-
- containedAnnotation.setNamespace(TEST_NAMESPACE);
- assertEquals(TEST_NAMESPACE, containedAnnotation.getNamespace());
- assertSourceContains(
- "@XmlSchemaTypes({@XmlSchemaType(namespace = \"" + TEST_NAMESPACE + "\"),@XmlSchemaType})", cu);
-
- containedAnnotation.setNamespace(null);
- assertNull(containedAnnotation.getNamespace());
- assertSourceContains(
- "@XmlSchemaTypes({@XmlSchemaType,@XmlSchemaType})", cu);
- }
-
- public void testContainedWithType()throws Exception {
- // test contained annotation type setting/updating
-
- ICompilationUnit cu = createPackageInfoWithSchemaTypes();
- JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu);
-
- XmlSchemaTypeAnnotation containedAnnotation =
- (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(1, JAXB.XML_SCHEMA_TYPE);
-
- containedAnnotation.setType(TEST_CLASS);
- assertEquals(TEST_CLASS, containedAnnotation.getType());
- assertEquals(FQ_TEST_CLASS, containedAnnotation.getFullyQualifiedType());
- assertSourceContains(
- "@XmlSchemaTypes({@XmlSchemaType,@XmlSchemaType(type = " + TEST_CLASS + ".class)})", cu);
-
- containedAnnotation.setType(null);
- assertNull(containedAnnotation.getType());
- assertNull(FQ_TEST_CLASS, containedAnnotation.getFullyQualifiedType());
- assertSourceContains(
- "@XmlSchemaTypes({@XmlSchemaType,@XmlSchemaType})", cu);
- }
-
- public void testContained() throws Exception {
- // test adding/removing/moving
-
- ICompilationUnit cu = createPackageInfoWithSchemaType();
- JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu);
-
- assertEquals(1, resourcePackage.getAnnotationsSize(JAXB.XML_SCHEMA_TYPE));
-
- resourcePackage.addAnnotation(1, JAXB.XML_SCHEMA_TYPE);
-
- assertEquals(2, resourcePackage.getAnnotationsSize(JAXB.XML_SCHEMA_TYPE));
- assertSourceContains("@XmlSchemaTypes({ @XmlSchemaType, @XmlSchemaType })", cu);
-
- XmlSchemaTypeAnnotation containedAnnotation1 = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE);
- containedAnnotation1.setName(TEST_NAME);
- XmlSchemaTypeAnnotation containedAnnotation2 = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(1, JAXB.XML_SCHEMA_TYPE);
- containedAnnotation2.setName(TEST_NAME_2);
- assertSourceContains(
- "@XmlSchemaTypes({ @XmlSchemaType(name = \"" + TEST_NAME
- + "\"), @XmlSchemaType(name = \"" + TEST_NAME_2
- + "\") })", cu);
-
- resourcePackage.moveAnnotation(0, 1, JAXB.XML_SCHEMA_TYPE);
- assertSourceContains(
- "@XmlSchemaTypes({ @XmlSchemaType(name = \"" + TEST_NAME_2
- + "\"), @XmlSchemaType(name = \"" + TEST_NAME
- + "\") })", cu);
-
- resourcePackage.removeAnnotation(1, JAXB.XML_SCHEMA_TYPE);
- assertEquals(1, resourcePackage.getAnnotationsSize(JAXB.XML_SCHEMA_TYPE));
- assertSourceContains(
- "@XmlSchemaType(name = \"" + TEST_NAME_2 + "\")", cu);
- assertSourceDoesNotContain("@XmlSchemaTypes", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSeeAlsoAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSeeAlsoAnnotationTests.java
deleted file mode 100644
index a00b7b6718..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSeeAlsoAnnotationTests.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlSeeAlsoAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlSeeAlsoAnnotationTests
- extends JaxbJavaResourceModelTestCase {
-
- public XmlSeeAlsoAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlSeeAlso() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_SEE_ALSO);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlSeeAlso");
- }
- });
- }
-
- private ICompilationUnit createTestXmlSeeAlsoWithValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_SEE_ALSO);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlSeeAlso(value = {Foo.class, Bar.class})");
- }
- });
- }
-
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlSeeAlso();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlSeeAlsoAnnotation xmlSeeAlsoAnnotation = (XmlSeeAlsoAnnotation) resourceType.getAnnotation(JAXB.XML_SEE_ALSO);
- assertTrue(xmlSeeAlsoAnnotation != null);
- assertEquals(0, xmlSeeAlsoAnnotation.getClassesSize());
- }
-
- public void testGetClasses() throws Exception {
- ICompilationUnit cu = this.createTestXmlSeeAlsoWithValue();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlSeeAlsoAnnotation xmlSeeAlsoAnnotation = (XmlSeeAlsoAnnotation) resourceType.getAnnotation(JAXB.XML_SEE_ALSO);
- assertTrue(xmlSeeAlsoAnnotation != null);
- ListIterator<String> classes = xmlSeeAlsoAnnotation.getClasses().iterator();
- assertEquals("Foo", classes.next());
- assertEquals("Bar", classes.next());
- }
-
- public void testGetClassesSize() throws Exception {
- ICompilationUnit cu = this.createTestXmlSeeAlsoWithValue();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlSeeAlsoAnnotation xmlSeeAlsoAnnotation = (XmlSeeAlsoAnnotation) resourceType.getAnnotation(JAXB.XML_SEE_ALSO);
- assertTrue(xmlSeeAlsoAnnotation != null);
- assertEquals(2, xmlSeeAlsoAnnotation.getClassesSize());
- }
-
- public void testAddClass() throws Exception {
- ICompilationUnit cu = this.createTestXmlSeeAlso();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlSeeAlsoAnnotation xmlSeeAlsoAnnotation = (XmlSeeAlsoAnnotation) resourceType.getAnnotation(JAXB.XML_SEE_ALSO);
- assertTrue(xmlSeeAlsoAnnotation != null);
-
- xmlSeeAlsoAnnotation.addClass("Fooo");
- xmlSeeAlsoAnnotation.addClass("Barrr");
-
- assertSourceContains("@XmlSeeAlso({ Fooo.class, Barrr.class })", cu);
- }
-
- public void testAddClassIndex() throws Exception {
- ICompilationUnit cu = this.createTestXmlSeeAlso();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlSeeAlsoAnnotation xmlSeeAlsoAnnotation = (XmlSeeAlsoAnnotation) resourceType.getAnnotation(JAXB.XML_SEE_ALSO);
- assertTrue(xmlSeeAlsoAnnotation != null);
-
- xmlSeeAlsoAnnotation.addClass(0, "Fooo");
- xmlSeeAlsoAnnotation.addClass(0, "Barr");
- xmlSeeAlsoAnnotation.addClass(1, "Blah");
-
- assertSourceContains("@XmlSeeAlso({ Barr.class, Blah.class, Fooo.class })", cu);
- }
-
- public void testRemoveClass() throws Exception {
- ICompilationUnit cu = this.createTestXmlSeeAlsoWithValue();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlSeeAlsoAnnotation xmlSeeAlsoAnnotation = (XmlSeeAlsoAnnotation) resourceType.getAnnotation(JAXB.XML_SEE_ALSO);
- assertTrue(xmlSeeAlsoAnnotation != null);
-
- xmlSeeAlsoAnnotation.removeClass(0);
- assertSourceContains("@XmlSeeAlso(value = Bar.class)", cu);
-
- xmlSeeAlsoAnnotation.removeClass(0);
- assertSourceContains("@XmlSeeAlso", cu);
- assertSourceDoesNotContain("value", cu);
- }
-
- public void testMoveClass() throws Exception {
- ICompilationUnit cu = this.createTestXmlSeeAlso();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlSeeAlsoAnnotation xmlSeeAlsoAnnotation = (XmlSeeAlsoAnnotation) resourceType.getAnnotation(JAXB.XML_SEE_ALSO);
- assertTrue(xmlSeeAlsoAnnotation != null);
-
- xmlSeeAlsoAnnotation.addClass("Fooo");
- xmlSeeAlsoAnnotation.addClass("Barr");
- xmlSeeAlsoAnnotation.addClass("Blah");
- assertSourceContains("@XmlSeeAlso({ Fooo.class, Barr.class, Blah.class })", cu);
-
- xmlSeeAlsoAnnotation.moveClass(0, 1);
- assertSourceContains("@XmlSeeAlso({ Barr.class, Fooo.class, Blah.class })", cu);
-
- xmlSeeAlsoAnnotation.moveClass(2, 1);
- assertSourceContains("@XmlSeeAlso({ Barr.class, Blah.class, Fooo.class })", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTransientAttributeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTransientAttributeAnnotationTests.java
deleted file mode 100644
index 656a5947ed..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTransientAttributeAnnotationTests.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlTransientAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlTransientAttributeAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- public XmlTransientAttributeAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlTransient() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_TRANSIENT);
- }
- @Override
- public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
- sb.append("@XmlTransient");
- }
- });
- }
-
- public void testGetXmlTransient() throws Exception {
- ICompilationUnit cu = this.createTestXmlTransient();
- JavaResourceType resourceType = this.buildJavaResourceType(cu);
- JavaResourceMethod resourceMethod = this.getMethod(resourceType, 0);
-
- XmlTransientAnnotation xmlTransientAnnotation = (XmlTransientAnnotation) resourceMethod.getAnnotation(JAXB.XML_TRANSIENT);
- assertTrue(xmlTransientAnnotation != null);
-
- resourceMethod.removeAnnotation(JAXB.XML_TRANSIENT);
- assertSourceDoesNotContain("@XmlTransient", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTransientTypeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTransientTypeAnnotationTests.java
deleted file mode 100644
index 6a768654ed..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTransientTypeAnnotationTests.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlTransientAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlTransientTypeAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- public XmlTransientTypeAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlTransient() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_TRANSIENT);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlTransient");
- }
- });
- }
-
- public void testGetXmlTransient() throws Exception {
- ICompilationUnit cu = this.createTestXmlTransient();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTransientAnnotation xmlTransientAnnotation = (XmlTransientAnnotation) resourceType.getAnnotation(JAXB.XML_TRANSIENT);
- assertTrue(xmlTransientAnnotation != null);
-
- resourceType.removeAnnotation(JAXB.XML_TRANSIENT);
- assertSourceDoesNotContain("@XmlTransient", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTypeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTypeAnnotationTests.java
deleted file mode 100644
index 6995ed4d5c..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTypeAnnotationTests.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlTypeAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- private static final String XML_TYPE_NAME = "XmlTypeName";
- private static final String XML_TYPE_NAMESPACE = "XmlTypeNamespace";
- private static final String XML_TYPE_FACTORY_METHOD = "myFactoryMethod";
- private static final String XML_TYPE_FACTORY_CLASS = "MyFactoryClass";
-
- public XmlTypeAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlType() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlType");
- }
- });
- }
-
- private ICompilationUnit createTestXmlTypeWithName() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlType(name = \"" + XML_TYPE_NAME + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestXmlTypeWithNamespace() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlType(namespace = \"" + XML_TYPE_NAMESPACE + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestXmlTypeWithFactoryMethod() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlType(factoryMethod = \"" + XML_TYPE_FACTORY_METHOD + "\")");
- }
- });
- }
-
- private ICompilationUnit createTestXmlTypeWithFactoryClass() throws Exception {
- this.createTestFactoryClass();
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlType(factoryClass = " + XML_TYPE_FACTORY_CLASS + ".class)");
- }
- });
- }
-
- private void createTestFactoryClass() throws Exception {
- SourceWriter sourceWriter = new SourceWriter() {
- public void appendSourceTo(StringBuilder sb) {
- sb.append(CR);
- sb.append("public class ").append(XML_TYPE_FACTORY_CLASS).append(" ");
- sb.append("{}").append(CR);
- }
- };
- this.javaProject.createCompilationUnit(PACKAGE_NAME, "MyFactoryClass.java", sourceWriter);
- }
-
- private ICompilationUnit createTestXmlTypeWithPropOrder() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_TYPE);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@XmlType(propOrder = {\"foo\", \"bar\"})");
- }
- });
- }
-
- public void testGetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlTypeWithName();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE);
- assertTrue(xmlTypeAnnotation != null);
- assertEquals(XML_TYPE_NAME, xmlTypeAnnotation.getName());
- }
-
- public void testGetNull() throws Exception {
- ICompilationUnit cu = this.createTestXmlType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE);
- assertTrue(xmlTypeAnnotation != null);
- assertNull(xmlTypeAnnotation.getName());
- assertNull(xmlTypeAnnotation.getNamespace());
- assertNull(xmlTypeAnnotation.getFactoryClass());
- assertNull(xmlTypeAnnotation.getFullyQualifiedFactoryClassName());
- assertNull(xmlTypeAnnotation.getFactoryMethod());
- }
-
- public void testSetName() throws Exception {
- ICompilationUnit cu = this.createTestXmlType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE);
- assertNull(xmlTypeAnnotation.getName());
- xmlTypeAnnotation.setName(XML_TYPE_NAME);
- assertEquals(XML_TYPE_NAME, xmlTypeAnnotation.getName());
-
- assertSourceContains("@XmlType(name = \"" + XML_TYPE_NAME + "\")", cu);
-
- xmlTypeAnnotation.setName(null);
- assertNull(xmlTypeAnnotation.getName());
-
- assertSourceContains("@XmlType", cu);
- assertSourceDoesNotContain("@XmlType(name = \"" + XML_TYPE_NAME + "\")", cu);
- }
-
- public void testGetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlTypeWithNamespace();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE);
- assertTrue(xmlTypeAnnotation != null);
- assertEquals(XML_TYPE_NAMESPACE, xmlTypeAnnotation.getNamespace());
- }
-
- public void testSetNamespace() throws Exception {
- ICompilationUnit cu = this.createTestXmlType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE);
- assertNull(xmlTypeAnnotation.getNamespace());
- xmlTypeAnnotation.setNamespace(XML_TYPE_NAMESPACE);
- assertEquals(XML_TYPE_NAMESPACE, xmlTypeAnnotation.getNamespace());
-
- assertSourceContains("@XmlType(namespace = \"" + XML_TYPE_NAMESPACE + "\")", cu);
-
- xmlTypeAnnotation.setNamespace(null);
- assertNull(xmlTypeAnnotation.getNamespace());
-
- assertSourceContains("@XmlType", cu);
- assertSourceDoesNotContain("@XmlType(namespace = \"" + XML_TYPE_NAMESPACE + "\")", cu);
- }
-
- public void testGetFactoryMethod() throws Exception {
- ICompilationUnit cu = this.createTestXmlTypeWithFactoryMethod();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE);
- assertTrue(xmlTypeAnnotation != null);
- assertEquals(XML_TYPE_FACTORY_METHOD, xmlTypeAnnotation.getFactoryMethod());
- }
-
- public void testSetFactoryMethod() throws Exception {
- ICompilationUnit cu = this.createTestXmlType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE);
- assertNull(xmlTypeAnnotation.getFactoryMethod());
- xmlTypeAnnotation.setFactoryMethod(XML_TYPE_FACTORY_METHOD);
- assertEquals(XML_TYPE_FACTORY_METHOD, xmlTypeAnnotation.getFactoryMethod());
-
- assertSourceContains("@XmlType(factoryMethod = \"" + XML_TYPE_FACTORY_METHOD + "\")", cu);
-
- xmlTypeAnnotation.setFactoryMethod(null);
- assertNull(xmlTypeAnnotation.getFactoryMethod());
-
- assertSourceContains("@XmlType", cu);
- assertSourceDoesNotContain("@XmlType(factoryMethod = \"" + XML_TYPE_FACTORY_METHOD + "\")", cu);
- }
-
- public void testGetFactoryClass() throws Exception {
- ICompilationUnit cu = this.createTestXmlTypeWithFactoryClass();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE);
- assertTrue(xmlTypeAnnotation != null);
- assertEquals(XML_TYPE_FACTORY_CLASS, xmlTypeAnnotation.getFactoryClass());
- assertEquals("test." + XML_TYPE_FACTORY_CLASS, xmlTypeAnnotation.getFullyQualifiedFactoryClassName());
- }
-
- public void testSetFactoryClass() throws Exception {
- ICompilationUnit cu = this.createTestXmlType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE);
- assertNull(xmlTypeAnnotation.getFactoryClass());
- xmlTypeAnnotation.setFactoryClass(XML_TYPE_FACTORY_CLASS);
- assertEquals(XML_TYPE_FACTORY_CLASS, xmlTypeAnnotation.getFactoryClass());
-
- assertSourceContains("@XmlType(factoryClass = " + XML_TYPE_FACTORY_CLASS + ".class", cu);
-
- xmlTypeAnnotation.setFactoryClass(null);
- assertNull(xmlTypeAnnotation.getFactoryClass());
-
- assertSourceContains("@XmlType", cu);
- assertSourceDoesNotContain("@XmlType(factoryClass = " + XML_TYPE_FACTORY_CLASS + ".class", cu);
- }
-
- public void testGetPropOrder() throws Exception {
- ICompilationUnit cu = this.createTestXmlTypeWithPropOrder();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE);
- assertTrue(xmlTypeAnnotation != null);
- ListIterator<String> propOrder = xmlTypeAnnotation.getPropOrder().iterator();
- assertEquals("foo", propOrder.next());
- assertEquals("bar", propOrder.next());
- }
-
- public void testGetPropOrderSize() throws Exception {
- ICompilationUnit cu = this.createTestXmlTypeWithPropOrder();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE);
- assertTrue(xmlTypeAnnotation != null);
- assertEquals(2, xmlTypeAnnotation.getPropOrderSize());
- }
-
- public void testAddProp() throws Exception {
- ICompilationUnit cu = this.createTestXmlType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE);
- assertTrue(xmlTypeAnnotation != null);
-
- xmlTypeAnnotation.addProp("fooo");
- xmlTypeAnnotation.addProp("barr");
-
- assertSourceContains("@XmlType(propOrder = { \"fooo\", \"barr\" })", cu);
- }
-
- public void testAddPropIndex() throws Exception {
- ICompilationUnit cu = this.createTestXmlType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE);
- assertTrue(xmlTypeAnnotation != null);
-
- xmlTypeAnnotation.addProp(0, "fooo");
- xmlTypeAnnotation.addProp(0, "barr");
- xmlTypeAnnotation.addProp(1, "blah");
-
- assertSourceContains("@XmlType(propOrder = { \"barr\", \"blah\", \"fooo\" })", cu);
- }
-
- public void testRemoveProp() throws Exception {
- ICompilationUnit cu = this.createTestXmlTypeWithPropOrder();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE);
- assertTrue(xmlTypeAnnotation != null);
-
- xmlTypeAnnotation.removeProp("foo");
- assertSourceContains("@XmlType(propOrder = \"bar\")", cu);
-
- xmlTypeAnnotation.removeProp("bar");
- assertSourceContains("@XmlType", cu);
- assertSourceDoesNotContain("propOrder", cu);
- }
-
- public void testRemovePropIndex() throws Exception {
- ICompilationUnit cu = this.createTestXmlTypeWithPropOrder();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE);
- assertTrue(xmlTypeAnnotation != null);
-
- xmlTypeAnnotation.removeProp(0);
- assertSourceContains("@XmlType(propOrder = \"bar\")", cu);
-
- xmlTypeAnnotation.removeProp(0);
- assertSourceContains("@XmlType", cu);
- assertSourceDoesNotContain("propOrder", cu);
- }
-
- public void testMoveProp() throws Exception {
- ICompilationUnit cu = this.createTestXmlType();
- JavaResourceType resourceType = buildJavaResourceType(cu);
-
- XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE);
- assertTrue(xmlTypeAnnotation != null);
-
- xmlTypeAnnotation.addProp("fooo");
- xmlTypeAnnotation.addProp("barr");
- xmlTypeAnnotation.addProp("blah");
- assertSourceContains("@XmlType(propOrder = { \"fooo\", \"barr\", \"blah\" })", cu);
-
- xmlTypeAnnotation.moveProp(0, 1);
- assertSourceContains("@XmlType(propOrder = { \"barr\", \"fooo\", \"blah\" })", cu);
-
- xmlTypeAnnotation.moveProp(2, 1);
- assertSourceContains("@XmlType(propOrder = { \"barr\", \"blah\", \"fooo\" })", cu);
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlValueAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlValueAnnotationTests.java
deleted file mode 100644
index eb635a316f..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlValueAnnotationTests.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests.internal.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
-import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation;
-
-@SuppressWarnings("nls")
-public class XmlValueAnnotationTests extends JaxbJavaResourceModelTestCase {
-
- public XmlValueAnnotationTests(String name) {
- super(name);
- }
-
- private ICompilationUnit createTestXmlValue() throws Exception {
- return this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JAXB.XML_VALUE);
- }
- @Override
- public void appendIdFieldAnnotationTo(StringBuilder sb) {
- sb.append("@XmlValue");
- }
- });
- }
-
- public void testGetXmlValue() throws Exception {
- ICompilationUnit cu = this.createTestXmlValue();
- JavaResourceType resourceType = buildJavaResourceType(cu);
- JavaResourceField resourceAttribute = getField(resourceType, 0);
-
- XmlValueAnnotation xmlValueAnnotation = (XmlValueAnnotation) resourceAttribute.getAnnotation(JAXB.XML_VALUE);
- assertTrue(xmlValueAnnotation != null);
-
- resourceAttribute.removeAnnotation(JAXB.XML_VALUE);
- assertSourceDoesNotContain("@XmlValue", cu);
- }
-}

Back to the top