Author: desruisseaux
Date: Fri Sep 5 15:46:56 2014
New Revision: 1622726
URL: http://svn.apache.org/r1622726
Log:
Renomed some tests method for making clearer which names are XML names (as opposed to UML
names).
Modified:
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java
Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java?rev=1622726&r1=1622725&r2=1622726&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
[UTF-8] Fri Sep 5 15:46:56 2014
@@ -228,7 +228,7 @@ public final strictfp class AllMetadataT
* @return {@inheritDoc}
*/
@Override
- protected String getExpectedPropertyName(final UML uml) {
+ protected String getExpectedXmlElementName(final UML uml) {
String name = uml.identifier();
if (name.equals("distributedComputingPlatform")) {
name = "DCP";
@@ -246,7 +246,7 @@ public final strictfp class AllMetadataT
* @return {@inheritDoc}
*/
@Override
- protected String getExpectedTypeName(final UML uml) {
+ protected String getExpectedXmlRootElementName(final UML uml) {
String name = uml.identifier();
if (name.equals("MD_Scope")) { // ISO 19115:2014
name = "DQ_Scope"; // ISO 19115:2003
@@ -277,7 +277,7 @@ public final strictfp class AllMetadataT
* @return {@inheritDoc}
*/
@Override
- protected String getExpectedTypeForElement(final Class<?> type, final Class<?>
impl) {
+ protected String getExpectedXmlTypeForElement(final Class<?> type, final Class<?>
impl) {
final String rootName = type.getAnnotation(UML.class).identifier();
switch (rootName) {
// We don't know yet what is the type of this one.
Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java?rev=1622726&r1=1622725&r2=1622726&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java
[UTF-8] Fri Sep 5 15:46:56 2014
@@ -45,9 +45,11 @@ import static org.apache.sis.test.TestUt
* <ul>
* <li>All implementation classes have {@link XmlRootElement} and {@link XmlType}
annotations.</li>
* <li>The name declared in the {@code XmlType} annotations matches the
- * {@linkplain #getExpectedTypeForElement expected value}.</li>
+ * {@link #getExpectedXmlTypeForElement expected value}.</li>
* <li>The name declared in the {@code XmlRootElement} (classes) or {@link XmlElement}
(methods)
- * annotations matches the identifier declared in the {@link UML} annotation of the
GeoAPI interfaces.</li>
+ * annotations matches the identifier declared in the {@link UML} annotation of the
GeoAPI interfaces.
+ * The UML - XML name mapping can be changed by overriding {@link #getExpectedXmlElementName(UML)}
and
+ * {@link #getExpectedXmlRootElementName(UML)}.</li>
* <li>The {@code XmlElement.required()} boolean is consistent with the UML {@linkplain
Obligation obligation}.</li>
* <li>The namespace declared in the {@code XmlRootElement} or {@code XmlElement}
annotations
* is not redundant with the {@link XmlSchema} annotation in the package.</li>
@@ -198,7 +200,7 @@ public abstract strictfp class Annotatio
*
* @see #testImplementationAnnotations()
*/
- protected abstract String getExpectedTypeForElement(Class<?> type, Class<?>
impl);
+ protected abstract String getExpectedXmlTypeForElement(Class<?> type, Class<?>
impl);
/**
* Returns the expected namespace for an element defined by the given specification.
@@ -236,7 +238,7 @@ public abstract strictfp class Annotatio
* @param uml The UML element.
* @return The corresponding XML element name.
*/
- protected String getExpectedTypeName(final UML uml) {
+ protected String getExpectedXmlRootElementName(final UML uml) {
return uml.identifier();
}
@@ -246,7 +248,7 @@ public abstract strictfp class Annotatio
* @param uml The UML element.
* @return The corresponding XML element name.
*/
- protected String getExpectedPropertyName(final UML uml) {
+ protected String getExpectedXmlElementName(final UML uml) {
return uml.identifier();
}
@@ -453,7 +455,7 @@ public abstract strictfp class Annotatio
* <ul>
* <li>All implementation classes have {@link XmlRootElement} and {@link XmlType}
annotations.</li>
* <li>The name declared in the {@code XmlType} annotations matches the
- * {@linkplain #getExpectedTypeForElement expected value}.</li>
+ * {@link #getExpectedXmlTypeForElement expected value}.</li>
* <li>The name declared in the {@code XmlRootElement} annotations matches the
identifier declared
* in the {@link UML} annotation of the GeoAPI interfaces.</li>
* <li>The namespace declared in the {@code XmlRootElement} annotations is not
redundant with
@@ -490,7 +492,7 @@ public abstract strictfp class Annotatio
assertNotNull("Missing @XmlRootElement annotation.", root);
final UML uml = type.getAnnotation(UML.class);
if (uml != null) {
- assertEquals("Wrong @XmlRootElement.name().", getExpectedTypeName(uml), root.name());
+ assertEquals("Wrong @XmlRootElement.name().", getExpectedXmlRootElementName(uml),
root.name());
}
/*
* Check that the namespace is the expected one (according subclass)
@@ -502,7 +504,7 @@ public abstract strictfp class Annotatio
*/
final XmlType xmlType = impl.getAnnotation(XmlType.class);
assertNotNull("Missing @XmlType annotation.", xmlType);
- String expected = getExpectedTypeForElement(type, impl);
+ String expected = getExpectedXmlTypeForElement(type, impl);
if (expected == null) {
expected = DEFAULT;
}
@@ -562,7 +564,7 @@ public abstract strictfp class Annotatio
* is because subclasses may choose to override the above test method.
*/
if (uml != null) {
- assertEquals("Wrong @XmlElement.name().", getExpectedPropertyName(uml),
element.name());
+ assertEquals("Wrong @XmlElement.name().", getExpectedXmlElementName(uml),
element.name());
assertEquals("Wrong @XmlElement.required().", uml.obligation() == Obligation.MANDATORY,
element.required());
}
/*
|