[OLINGO-260] fix type seraialization + opentype integration test extension
This commit is contained in:
parent
4bdc91951a
commit
1dd8c987bf
|
@ -119,9 +119,9 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
|
|||
assertEquals(String.class, rowIndex.getAdditionalProperty("aString").getClass());
|
||||
assertEquals(Boolean.class, rowIndex.getAdditionalProperty("aBoolean").getClass());
|
||||
assertEquals(Double.class, rowIndex.getAdditionalProperty("aDouble").getClass());
|
||||
// assertEquals(Short.class, rowIndex.getAdditionalProperty("aByte").getClass()); // trova integer
|
||||
// assertEquals(Byte.MAX_VALUE, rowIndex.getAdditionalProperty("aByte"));
|
||||
// assertEquals(Calendar.class, rowIndex.getAdditionalProperty("aDate").getClass()); // trova stringa
|
||||
assertEquals(Byte.class, rowIndex.getAdditionalProperty("aByte").getClass());
|
||||
assertEquals(Byte.MAX_VALUE, rowIndex.getAdditionalProperty("aByte"));
|
||||
assertTrue(Calendar.class.isAssignableFrom(rowIndex.getAdditionalProperty("aDate").getClass()));
|
||||
// assertEquals(ContactDetails.class, rowIndex.getAdditionalProperty("aContact").getClass().getInterfaces()[0]);
|
||||
|
||||
entityContext.detachAll();
|
||||
|
|
|
@ -157,8 +157,12 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
|
|||
rowIndex.getProperty("aBoolean").getPrimitiveValue().getTypeKind());
|
||||
assertTrue(rowIndex.getProperty("aDouble").hasPrimitiveValue());
|
||||
assertTrue(rowIndex.getProperty("aByte").hasPrimitiveValue());
|
||||
assertEquals(EdmPrimitiveTypeKind.SByte, rowIndex.getProperty("aByte").getPrimitiveValue().getTypeKind());
|
||||
assertTrue(rowIndex.getProperty("aDate").hasPrimitiveValue());
|
||||
assertEquals(EdmPrimitiveTypeKind.DateTime, rowIndex.getProperty("aDate").getPrimitiveValue().getTypeKind());
|
||||
assertTrue(rowIndex.getProperty("aContact").hasComplexValue());
|
||||
assertEquals("Microsoft.Test.OData.Services.OpenTypesService.ContactDetails",
|
||||
rowIndex.getProperty("aContact").getValue().getTypeName());
|
||||
assertTrue(rowIndex.getProperty("aContact").getComplexValue().get("SignedByte").hasPrimitiveValue());
|
||||
|
||||
final ODataDeleteResponse deleteRes = getClient().getCUDRequestFactory().
|
||||
|
|
|
@ -132,7 +132,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
|
|||
newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Blue")));
|
||||
product.getProperties().add(getClient().getObjectFactory().newCollectionProperty("CoverColors",
|
||||
getClient().getObjectFactory().
|
||||
newCollectionValue("Microsoft.Test.OData.Services.ODataWCFService.ProductDetail")));
|
||||
newCollectionValue("Microsoft.Test.OData.Services.ODataWCFService.Color")));
|
||||
product.getProperty("CoverColors").getCollectionValue().add(getClient().getObjectFactory().
|
||||
newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Green"));
|
||||
product.getProperty("CoverColors").getCollectionValue().add(getClient().getObjectFactory().
|
||||
|
|
|
@ -209,7 +209,7 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
|
|||
}
|
||||
|
||||
protected void valuable(final JsonGenerator jgen, final Valuable valuable, final String name) throws IOException {
|
||||
if (serverMode && !Constants.VALUE.equals(name) && !(valuable instanceof Annotation)) {
|
||||
if (!Constants.VALUE.equals(name) && !(valuable instanceof Annotation) && !valuable.getValue().isComplex()) {
|
||||
String type = valuable.getType();
|
||||
if (StringUtils.isBlank(type) && valuable.getValue().isPrimitive() || valuable.getValue().isNull()) {
|
||||
type = EdmPrimitiveTypeKind.String.getFullQualifiedName().toString();
|
||||
|
|
|
@ -47,7 +47,7 @@ public abstract class AbstractODataCollectionValue<OV extends ODataValue>
|
|||
* @param typeName type name.
|
||||
*/
|
||||
public AbstractODataCollectionValue(final String typeName) {
|
||||
super(typeName);
|
||||
super(typeName == null || typeName.startsWith("Collection(") ? typeName : "Collection(" + typeName + ")");
|
||||
}
|
||||
|
||||
protected abstract ODataCollectionValue<OV> getThis();
|
||||
|
|
|
@ -153,5 +153,4 @@ public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implement
|
|||
public ODataDelta newDelta(final URI next) {
|
||||
return new ODataDeltaImpl(next);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue