diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java index 71af4add5..0d862f3ad 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java @@ -939,8 +939,10 @@ public class MetadataDocumentXmlSerializer { writer.writeAttribute(XML_PRECISION, "" + property.getPrecision()); } - if (property.getScale() != null) { - writer.writeAttribute(XML_SCALE, "" + property.getScale()); + if (property.getScaleAsString() != null) { + writer.writeAttribute(XML_SCALE, property.getScaleAsString()); + } else if (property.getScale() != null) { + writer.writeAttribute(XML_SCALE, "" + property.getScale()); } if (property.getSrid() != null) { diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java index c5017a8b9..8a68c74fb 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java @@ -343,6 +343,13 @@ public class MetadataDocumentXmlSerializerTest { + "AppliesTo=\"Property EntitySet Schema\">")); assertTrue(metadata.contains("")); } + + @Test + public void entityTypeProperties() throws Exception { + String metadata = localMetadata(); + assertTrue(metadata.contains("")); + } @Test public void annotationsTest() throws Exception { @@ -495,6 +502,7 @@ public class MetadataDocumentXmlSerializerTest { private final FullQualifiedName nameInt16 = EdmPrimitiveTypeKind.Int16.getFullQualifiedName(); private final FullQualifiedName nameString = EdmPrimitiveTypeKind.String.getFullQualifiedName(); + private final FullQualifiedName nameDecimal = EdmPrimitiveTypeKind.Decimal.getFullQualifiedName(); private final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(nameSpace, "UARTPrimParam"); private final FullQualifiedName nameUARTOtherEntity = new FullQualifiedName(nameSpace, "UARTOtherEntity"); private final FullQualifiedName nameUARTEntity = new FullQualifiedName(nameSpace, "UARTEntity"); @@ -505,6 +513,11 @@ public class MetadataDocumentXmlSerializerTest { private final CsdlProperty propertyString = new CsdlProperty() .setName("PropertyString") .setType(nameString); + private final CsdlProperty propertyDecimal_VariableScale = new CsdlProperty() + .setName("PropertyDecimal") + .setType(nameDecimal) + .setScale(0) + .setScaleAsString("variable"); private final CsdlNavigationProperty navProperty = new CsdlNavigationProperty() .setName("NavProperty") @@ -556,7 +569,7 @@ public class MetadataDocumentXmlSerializerTest { return new CsdlEntityType() .setName("ET") .setKey(Collections.singletonList(new CsdlPropertyRef().setName("PropertyInt16"))) - .setProperties(Collections.singletonList(propertyInt16_NotNullable)) + .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyDecimal_VariableScale)) .setNavigationProperties(Collections.singletonList(navProperty)); } return null;