[OLINGO-1472]Support string-based scales in property metadata
This commit is contained in:
parent
162750f2ce
commit
e32302bc32
|
@ -939,7 +939,9 @@ public class MetadataDocumentXmlSerializer {
|
|||
writer.writeAttribute(XML_PRECISION, "" + property.getPrecision());
|
||||
}
|
||||
|
||||
if (property.getScale() != null) {
|
||||
if (property.getScaleAsString() != null) {
|
||||
writer.writeAttribute(XML_SCALE, property.getScaleAsString());
|
||||
} else if (property.getScale() != null) {
|
||||
writer.writeAttribute(XML_SCALE, "" + property.getScale());
|
||||
}
|
||||
|
||||
|
|
|
@ -344,6 +344,13 @@ public class MetadataDocumentXmlSerializerTest {
|
|||
assertTrue(metadata.contains("<Term Name=\"Term4\" Type=\"Edm.String\" BaseTerm=\"Alias.Term1\"></Term>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void entityTypeProperties() throws Exception {
|
||||
String metadata = localMetadata();
|
||||
assertTrue(metadata.contains("<Property Name=\"PropertyDecimal\" " +
|
||||
"Type=\"Edm.Decimal\" Scale=\"variable\"></Property>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void annotationsTest() throws Exception {
|
||||
String metadata = localMetadata();
|
||||
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue