OLINGO-1230: adding missing OpenType attribute to complex and entity type in metadata document

This commit is contained in:
Ramesh Reddy 2018-08-03 15:59:00 -05:00
parent c2c5111a62
commit d0f52977e6
2 changed files with 11 additions and 2 deletions

View File

@ -139,6 +139,7 @@ public class MetadataDocumentXmlSerializer {
private static final String ABSTRACT = "Abstract";
private static final String XML_ANNOTATIONS = "Annotations";
private static final String OPEN_TYPE = "OpenType";
private static final String EDMX = "Edmx";
private static final String PREFIX_EDMX = "edmx";
@ -772,7 +773,11 @@ public class MetadataDocumentXmlSerializer {
if (complexType.isAbstract()) {
writer.writeAttribute(ABSTRACT, TRUE);
}
if (complexType.isOpenType()) {
writer.writeAttribute(OPEN_TYPE, TRUE);
}
appendProperties(writer, complexType);
appendNavigationProperties(writer, complexType);
@ -801,6 +806,10 @@ public class MetadataDocumentXmlSerializer {
writer.writeAttribute(ABSTRACT, TRUE);
}
if (entityType.isOpenType()) {
writer.writeAttribute(OPEN_TYPE, TRUE);
}
appendKey(writer, entityType);
appendProperties(writer, entityType);

View File

@ -450,7 +450,7 @@ public class MetadataDocumentXmlSerializerTest {
InputStream metadataStream = serializer.metadataDocument(serviceMetadata).getContent();
String metadata = IOUtils.toString(metadataStream);
assertTrue(metadata.contains("<ComplexType Name=\"ComplexType\" Abstract=\"true\">"
assertTrue(metadata.contains("<ComplexType Name=\"ComplexType\" Abstract=\"true\" OpenType=\"true\">"
+ "<Property Name=\"prop1\" Type=\"Edm.String\"/>"
+ "<Property Name=\"prop2\" Type=\"Edm.String\"/>"
+ "</ComplexType>"));