olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chanda...@apache.org
Subject [42/50] [abbrv] olingo-odata4 git commit: [OLINGO-573] Merge branch 'master' into OLINGO-573
Date Sat, 04 Apr 2015 17:05:48 GMT
[OLINGO-573] Merge branch 'master' into OLINGO-573


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/3f79ced1
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/3f79ced1
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/3f79ced1

Branch: refs/heads/OLINGO-549-ODataV4-JPA
Commit: 3f79ced17ab9f7bd92851c264a231d2cb31d7ca3
Parents: de3f7fd fd9ba8b
Author: Michael Bolz <michael.bolz@sap.com>
Authored: Wed Apr 1 20:51:25 2015 +0200
Committer: Michael Bolz <michael.bolz@sap.com>
Committed: Thu Apr 2 08:22:39 2015 +0200

----------------------------------------------------------------------
 .../proxy/commons/EntityInvocationHandler.java  |   2 +-
 .../org/apache/olingo/fit/AbstractServices.java |  10 +-
 .../api/communication/request/ODataRequest.java |   2 -
 .../cud/ODataReferenceAddingRequest.java        |  20 +-
 .../response/ODataBatchResponse.java            |   2 +-
 .../response/ODataReferenceAddingResponse.java  |   2 +-
 .../olingo/client/api/uri/URIBuilder.java       |   2 +-
 .../apache/olingo/client/api/uri/URIFilter.java |   2 +-
 .../request/AbstractODataRequest.java           |   2 -
 .../olingo/client/core/uri/FilterConst.java     |   2 +-
 .../olingo/client/core/uri/FilterLiteral.java   |   2 +-
 .../olingo/client/core/uri/FilterProperty.java  |   2 +-
 .../apache/olingo/client/core/uri/URIUtils.java |   1 -
 .../commons/api/domain/ODataComplexValue.java   |   1 -
 .../commons/api/domain/ODataInlineEntity.java   |   2 -
 .../olingo/commons/api/domain/ODataLink.java    |   1 -
 .../commons/api/domain/ODataLinkType.java       |   1 -
 .../olingo/commons/api/edm/EdmOperation.java    |   4 +-
 .../commons/api/edm/EdmPrimitiveTypeKind.java   |   2 -
 .../commons/api/edm/constants/EdmTypeKind.java  |   2 +-
 .../olingo/commons/api/edm/provider/Schema.java |   4 +-
 .../olingo/commons/api/format/ODataFormat.java  |   1 -
 .../serialization/JsonDeltaDeserializer.java    |  12 +-
 .../core/serialization/JsonDeserializer.java    |  50 +--
 .../serialization/JsonEntityDeserializer.java   |  70 +++--
 .../JsonEntitySetDeserializer.java              |  18 +-
 .../JsonODataErrorDeserializer.java             |   4 +-
 .../serialization/JsonPropertyDeserializer.java |   7 +-
 .../api/deserializer/DeserializerException.java |   4 +-
 .../api/serializer/FixedFormatSerializer.java   |   2 +-
 .../json/ODataJsonDeserializer.java             |  57 ++--
 .../serializer/json/ODataJsonSerializer.java    |  15 +-
 .../server-core-exceptions-i18n.properties      |   2 +
 .../core/edm/provider/EdmTypeImplTest.java      |   4 +-
 .../olingo/server/tecsvc/data/DataCreator.java  | 308 ++++++++-----------
 .../server/tecsvc/provider/ActionProvider.java  | 182 ++++++-----
 .../tecsvc/provider/ContainerProvider.java      |  36 ++-
 .../tecsvc/provider/FunctionProvider.java       |  19 +-
 .../tecsvc/provider/PropertyProvider.java       |   2 +-
 .../server/tecsvc/provider/SchemaProvider.java  |   1 +
 ...ataJsonDeserializerActionParametersTest.java |  31 ++
 .../core/uri/testutil/FilterValidator.java      |   2 +-
 .../core/uri/testutil/ParserValidator.java      |   6 +-
 43 files changed, 445 insertions(+), 456 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3f79ced1/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3f79ced1/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
----------------------------------------------------------------------
diff --cc lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
index 5956e82,aab6624..a7ce16b
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
@@@ -147,9 -145,8 +147,12 @@@ public class ODataJsonSerializer implem
          json.writeNumberField(Constants.JSON_COUNT, entitySet.getCount());
        }
        json.writeFieldName(Constants.VALUE);
-       writeEntitySet(metadata, entityType, entitySet, options == null ? null : options.getExpand(),
-           options == null ? null : options.getSelect(),
-           options == null ? false : options.onlyReferences(), json);
 -      writeEntitySet(entityType, entitySet,
 -          options == null ? null : options.getExpand(), options == null ? null : options.getSelect(),
json);
++      if(options == null) {
++        writeEntitySet(metadata, entityType, entitySet, null, null, false, json);
++      } else {
++        writeEntitySet(metadata, entityType, entitySet,
++            options.getExpand(), options.getSelect(), options.onlyReferences(), json);
++      }
        if (entitySet.getNext() != null) {
          json.writeStringField(Constants.JSON_NEXT_LINK, entitySet.getNext().toASCIIString());
        }
@@@ -227,63 -214,9 +230,65 @@@
          }
        }
      }
 -    writeProperties(entityType, entity.getProperties(), select, json);
 -    writeNavigationProperties(entityType, entity, expand, json);
 -    json.writeEndObject();
 +    if (onlyReference) {
 +      json.writeStringField(Constants.JSON_ID, entity.getId().toASCIIString());
 +    } else {
 +      EdmEntityType resolvedType = resolveEntityType(metadata, entityType, entity.getType());
 +      if (!resolvedType.equals(entityType)) {
 +        json.writeStringField(Constants.JSON_TYPE, "#"+entity.getType());
 +      }
 +      writeProperties(resolvedType, entity.getProperties(), select, json);
 +      writeNavigationProperties(metadata, resolvedType, entity, expand, json);
 +      json.writeEndObject();
 +    }
 +  }
 +
 +  protected EdmEntityType resolveEntityType(ServiceMetadata metadata, EdmEntityType baseType,
 +      String derivedTypeName) throws SerializerException {
-     if (baseType.getFullQualifiedName().getFullQualifiedNameAsString().equals(derivedTypeName))
{
++    if (derivedTypeName == null ||
++        baseType.getFullQualifiedName().getFullQualifiedNameAsString().equals(derivedTypeName))
{
 +      return baseType;
 +    }
 +    EdmEntityType derivedType = metadata.getEdm().getEntityType(new FullQualifiedName(derivedTypeName));
 +    if (derivedType == null) {
 +      throw new SerializerException("EntityType not found",
 +          SerializerException.MessageKeys.UNKNOWN_TYPE, derivedTypeName);
 +    }
 +    EdmEntityType type = derivedType.getBaseType();
 +    while (type != null) {
 +      if (type.getFullQualifiedName().getFullQualifiedNameAsString()
 +          .equals(baseType.getFullQualifiedName().getFullQualifiedNameAsString())) {
 +        return derivedType;
 +      }
 +      type = type.getBaseType();
 +    }
 +    throw new SerializerException("Wrong base type",
 +        SerializerException.MessageKeys.WRONG_BASE_TYPE, derivedTypeName, baseType
 +            .getFullQualifiedName().getFullQualifiedNameAsString());
 +  }
 +
 +  protected EdmComplexType resolveComplexType(ServiceMetadata metadata, EdmComplexType baseType,
 +      String derivedTypeName) throws SerializerException {
-     if (baseType.getFullQualifiedName().getFullQualifiedNameAsString().equals(derivedTypeName))
{
++    if (derivedTypeName == null ||
++        baseType.getFullQualifiedName().getFullQualifiedNameAsString().equals(derivedTypeName))
{
 +      return baseType;
 +    }
 +    EdmComplexType derivedType = metadata.getEdm().getComplexType(new FullQualifiedName(derivedTypeName));
 +    if (derivedType == null) {
 +      throw new SerializerException("Complex Type not found",
 +          SerializerException.MessageKeys.UNKNOWN_TYPE, derivedTypeName);
 +    }
 +    EdmComplexType type = derivedType.getBaseType();
 +    while (type != null) {
 +      if (type.getFullQualifiedName().getFullQualifiedNameAsString()
 +          .equals(baseType.getFullQualifiedName().getFullQualifiedNameAsString())) {
 +        return derivedType;
 +      }
 +      type = type.getBaseType();
 +    }
 +    throw new SerializerException("Wrong base type",
 +        SerializerException.MessageKeys.WRONG_BASE_TYPE, derivedTypeName, baseType
 +            .getFullQualifiedName().getFullQualifiedNameAsString());
    }
  
    protected void writeProperties(final EdmStructuredType type, final List<Property>
properties,

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3f79ced1/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3f79ced1/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java
----------------------------------------------------------------------
diff --cc lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java
index 45fd740,413ef34..9de7166
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java
@@@ -92,8 -92,8 +92,7 @@@ public class DataCreator 
      EntitySet entitySet = new EntitySetImpl();
  
      for (int i = 1; i <= 503; i++) {
--      entitySet.getEntities().add(new EntityImpl()
--          .addProperty(createPrimitive("PropertyInt16", i))
++      entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16",
i))
            .addProperty(createPrimitive("PropertyString", "Number:" + i)));
      }
  
@@@ -112,32 -112,32 +111,20 @@@
  
    @SuppressWarnings("unchecked")
    private Entity createETKeyNavEntity(int propertyInt16, String propertyString) {
--    return new EntityImpl()
--        .addProperty(createPrimitive("PropertyInt16", propertyInt16))
++    return new EntityImpl().addProperty(createPrimitive("PropertyInt16", propertyInt16))
          .addProperty(createPrimitive("PropertyString", propertyString))
--        .addProperty(createComplex("PropertyCompNav",
--            createPrimitive("PropertyInt16", 1)))
--        .addProperty(createKeyNavAllPrimComplexValue("PropertyCompAllPrim"))
--        .addProperty(createComplex("PropertyCompTwoPrim",
--            createPrimitive("PropertyInt16", 16),
--            createPrimitive("PropertyString", "Test123")))
--        .addProperty(createPrimitiveCollection("CollPropertyString",
--            "Employee1@company.example",
--            "Employee2@company.example",
--            "Employee3@company.example"))
--        .addProperty(createPrimitiveCollection("CollPropertyInt16", 1000, 2000, 30112))
--        .addProperty(createComplexCollection("CollPropertyComp",
--            Arrays.asList(
--                createPrimitive("PropertyInt16", 1),
--                createKeyNavAllPrimComplexValue("PropertyComp")),
--            Arrays.asList(
--                createPrimitive("PropertyInt16", 2),
--                createKeyNavAllPrimComplexValue("PropertyComp")),
--            Arrays.asList(
--                createPrimitive("PropertyInt16", 3),
--                createKeyNavAllPrimComplexValue("PropertyComp"))))
--        .addProperty(createComplex("PropertyCompCompNav",
--            createPrimitive("PropertyString", "1"),
++        .addProperty(createComplex("PropertyCompNav", createPrimitive("PropertyInt16", 1)))
++        .addProperty(createKeyNavAllPrimComplexValue("PropertyCompAllPrim")).addProperty(
++            createComplex("PropertyCompTwoPrim", createPrimitive("PropertyInt16", 16),
++                createPrimitive("PropertyString", "Test123"))).addProperty(
++            createPrimitiveCollection("CollPropertyString", "Employee1@company.example",
"Employee2@company.example",
++                "Employee3@company.example"))
++        .addProperty(createPrimitiveCollection("CollPropertyInt16", 1000, 2000, 30112)).addProperty(
++            createComplexCollection("CollPropertyComp",
++                Arrays.asList(createPrimitive("PropertyInt16", 1), createKeyNavAllPrimComplexValue("PropertyComp")),
++                Arrays.asList(createPrimitive("PropertyInt16", 2), createKeyNavAllPrimComplexValue("PropertyComp")),
++                Arrays.asList(createPrimitive("PropertyInt16", 3), createKeyNavAllPrimComplexValue("PropertyComp"))))
++        .addProperty(createComplex("PropertyCompCompNav", createPrimitive("PropertyString",
"1"),
              createComplex("PropertyCompNav", createPrimitive("PropertyInt16", 1))));
    }
  
@@@ -154,55 -154,56 +141,40 @@@
  
    @SuppressWarnings("unchecked")
    private Entity createESTwoKeyNavEntity(int propertyInt16, String propertyString) {
--    return new EntityImpl()
--        .addProperty(createPrimitive("PropertyInt16", propertyInt16))
--        .addProperty(createPrimitive("PropertyString", propertyString))
--        .addProperty(createComplex("PropertyComp",
--            createPrimitive("PropertyInt16", 11),
--            createComplex("PropertyComp",
--                createPrimitive("PropertyString", "StringValue"),
--                createPrimitive("PropertyBinary", new byte[] { 1, 35, 69, 103, -119, -85,
-51, -17 }),
--                createPrimitive("PropertyBoolean", true),
--                createPrimitive("PropertyByte", 255),
--                createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 7, 16, 23)),
--                createPrimitive("PropertyDecimal", 34),
--                createPrimitive("PropertySingle", 179000000000000000000D),
--                createPrimitive("PropertyDouble", -179000000000000000000D),
--                createPrimitive("PropertyDuration", 6),
--                createPrimitive("PropertyGuid", UUID.fromString("01234567-89ab-cdef-0123-456789abcdef")),
--                createPrimitive("PropertyInt16", Short.MAX_VALUE),
--                createPrimitive("PropertyInt32", Integer.MAX_VALUE),
--                createPrimitive("PropertyInt64", Long.MAX_VALUE),
--                createPrimitive("PropertySByte", Byte.MAX_VALUE),
--                createPrimitive("PropertyTimeOfDay", getTime(21, 5, 59)))))
--        .addProperty(createComplex("PropertyCompNav",
--            createPrimitive("PropertyInt16", 1),
--            createKeyNavAllPrimComplexValue("PropertyComp")))
++    return new EntityImpl().addProperty(createPrimitive("PropertyInt16", propertyInt16))
++        .addProperty(createPrimitive("PropertyString", propertyString)).addProperty(
++            createComplex("PropertyComp", createPrimitive("PropertyInt16", 11),
++                createComplex("PropertyComp", createPrimitive("PropertyString", "StringValue"),
++                    createPrimitive("PropertyBinary", new byte[] { 1, 35, 69, 103, -119,
-85, -51, -17 }),
++                    createPrimitive("PropertyBoolean", true), createPrimitive("PropertyByte",
255),
++                    createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 7, 16, 23)),
++                    createPrimitive("PropertyDecimal", 34), createPrimitive("PropertySingle",
179000000000000000000D),
++                    createPrimitive("PropertyDouble", -179000000000000000000D), createPrimitive("PropertyDuration",
6),
++                    createPrimitive("PropertyGuid", UUID.fromString("01234567-89ab-cdef-0123-456789abcdef")),
++                    createPrimitive("PropertyInt16", Short.MAX_VALUE),
++                    createPrimitive("PropertyInt32", Integer.MAX_VALUE),
++                    createPrimitive("PropertyInt64", Long.MAX_VALUE), createPrimitive("PropertySByte",
Byte.MAX_VALUE),
++                    createPrimitive("PropertyTimeOfDay", getTime(21, 5, 59))))).addProperty(
++            createComplex("PropertyCompNav", createPrimitive("PropertyInt16", 1),
++                createKeyNavAllPrimComplexValue("PropertyComp")))
          .addProperty(createComplexCollection("CollPropertyComp"))
--        .addProperty(createComplexCollection("CollPropertyCompNav",
--            Arrays.asList(createPrimitive("PropertyInt16", 1))))
--        .addProperty(createPrimitiveCollection("CollPropertyString", 1, 2))
-         .addProperty(createComplex("PropertyCompTwoPrim", createPrimitive("PropertyInt16",
11),
 -        .addProperty(createComplex("PropertyCompTwoPrim",
 -            createPrimitive("PropertyInt16", 11),
--            createPrimitive("PropertyString", "11")));
++        .addProperty(createComplexCollection("CollPropertyCompNav", Arrays.asList(createPrimitive("PropertyInt16",
1))))
++        .addProperty(createPrimitiveCollection("CollPropertyString", 1, 2)).addProperty(
++            createComplex("PropertyCompTwoPrim", createPrimitive("PropertyInt16", 11),
++                createPrimitive("PropertyString", "11")));
    }
  
    private Property createKeyNavAllPrimComplexValue(final String name) {
--    return createComplex(name,
--        createPrimitive("PropertyString", "First Resource - positive values"),
++    return createComplex(name, createPrimitive("PropertyString", "First Resource - positive
values"),
          createPrimitive("PropertyBinary", new byte[] { 1, 35, 69, 103, -119, -85, -51, -17
}),
--        createPrimitive("PropertyBoolean", true),
--        createPrimitive("PropertyByte", 255),
++        createPrimitive("PropertyBoolean", true), createPrimitive("PropertyByte", 255),
          createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 7, 16, 23)),
          createPrimitive("PropertyDateTimeOffset", getTimestamp(2012, 12, 3, 7, 16, 23, 0)),
--        createPrimitive("PropertyDecimal", 34),
--        createPrimitive("PropertySingle", 179000000000000000000D),
--        createPrimitive("PropertyDouble", -179000000000000000000D),
--        createPrimitive("PropertyDuration", 6),
++        createPrimitive("PropertyDecimal", 34), createPrimitive("PropertySingle", 179000000000000000000D),
++        createPrimitive("PropertyDouble", -179000000000000000000D), createPrimitive("PropertyDuration",
6),
          createPrimitive("PropertyGuid", UUID.fromString("01234567-89ab-cdef-0123-456789abcdef")),
--        createPrimitive("PropertyInt16", Short.MAX_VALUE),
--        createPrimitive("PropertyInt32", Integer.MAX_VALUE),
--        createPrimitive("PropertyInt64", Long.MAX_VALUE),
--        createPrimitive("PropertySByte", Byte.MAX_VALUE),
++        createPrimitive("PropertyInt16", Short.MAX_VALUE), createPrimitive("PropertyInt32",
Integer.MAX_VALUE),
++        createPrimitive("PropertyInt64", Long.MAX_VALUE), createPrimitive("PropertySByte",
Byte.MAX_VALUE),
          createPrimitive("PropertyTimeOfDay", getTime(21, 5, 59)));
    }
  
@@@ -210,25 -211,33 +182,23 @@@
    private EntitySet createESCompCollComp() {
      final EntitySet entitySet = new EntitySetImpl();
  
--    entitySet.getEntities().add(new EntityImpl()
--        .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
 -        .addProperty(createComplex("PropertyComp",
 -            createComplexCollection("CollPropertyComp",
 -                Arrays.asList(
 -                    createPrimitive("PropertyInt16", 555),
 -                    createPrimitive("PropertyString", "1 Test Complex in Complex Property")),
 -                Arrays.asList(
 -                    createPrimitive("PropertyInt16", 666),
 -                    createPrimitive("PropertyString", "2 Test Complex in Complex Property")),
 -                Arrays.asList(
 -                    createPrimitive("PropertyInt16", 777),
 -                    createPrimitive("PropertyString", "3 Test Complex in Complex Property"))))));
 -
 -    entitySet.getEntities().add(new EntityImpl()
 -        .addProperty(createPrimitive("PropertyInt16", 12345))
 -        .addProperty(createComplex("PropertyComp",
 -            createComplexCollection("CollPropertyComp",
 -                Arrays.asList(
 -                    createPrimitive("PropertyInt16", 888),
 -                    createPrimitive("PropertyString", "11 Test Complex in Complex Property")),
 -                Arrays.asList(
 -                    createPrimitive("PropertyInt16", 999),
 -                    createPrimitive("PropertyString", "12 Test Complex in Complex Property")),
 -                Arrays.asList(
 -                    createPrimitive("PropertyInt16", 0),
 -                    createPrimitive("PropertyString", "13 Test Complex in Complex Property"))))));
++    entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16",
Short.MAX_VALUE))
 +        .addProperty(createComplex("PropertyComp", createComplexCollection("CollPropertyComp",
Arrays
 +            .asList(createPrimitive("PropertyInt16", 555),
 +                createPrimitive("PropertyString", "1 Test Complex in Complex Property")),
Arrays
 +            .asList(createPrimitive("PropertyInt16", 666),
 +                createPrimitive("PropertyString", "2 Test Complex in Complex Property")),
Arrays
 +            .asList(createPrimitive("PropertyInt16", 777),
 +                createPrimitive("PropertyString", "3 Test Complex in Complex Property"))))));
 +
-     entitySet.getEntities().add(new EntityImpl()
-         .addProperty(createPrimitive("PropertyInt16", 12345))
-         .addProperty(createComplex("PropertyComp", createComplexCollection("CollPropertyComp",
Arrays
++    entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16",
12345)).addProperty(
++        createComplex("PropertyComp", createComplexCollection("CollPropertyComp", Arrays
 +            .asList(createPrimitive("PropertyInt16", 888),
 +                createPrimitive("PropertyString", "11 Test Complex in Complex Property")),
Arrays
 +            .asList(createPrimitive("PropertyInt16", 999),
 +                createPrimitive("PropertyString", "12 Test Complex in Complex Property")),
Arrays
 +            .asList(createPrimitive("PropertyInt16", 0),
 +                createPrimitive("PropertyString", "13 Test Complex in Complex Property"))))));
  
      return entitySet;
    }
@@@ -236,20 -245,20 +206,16 @@@
    private EntitySet createESTwoPrim() {
      EntitySet entitySet = new EntitySetImpl();
  
--    entitySet.getEntities().add(new EntityImpl()
--        .addProperty(createPrimitive("PropertyInt16", 32766))
++    entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16",
32766))
          .addProperty(createPrimitive("PropertyString", "Test String1")));
  
--    entitySet.getEntities().add(new EntityImpl()
--        .addProperty(createPrimitive("PropertyInt16", -365))
++    entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16",
-365))
          .addProperty(createPrimitive("PropertyString", "Test String2")));
  
--    entitySet.getEntities().add(new EntityImpl()
--        .addProperty(createPrimitive("PropertyInt16", -32766))
++    entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16",
-32766))
          .addProperty(createPrimitive("PropertyString", null)));
  
--    entitySet.getEntities().add(new EntityImpl()
--        .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
++    entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16",
Short.MAX_VALUE))
          .addProperty(createPrimitive("PropertyString", "Test String4")));
  
      return entitySet;
@@@ -289,16 -305,16 +255,11 @@@
          .addProperty(createPrimitive("PropertyGuid", UUID.fromString("76543201-23ab-cdef-0123-456789dddfff")))
          .addProperty(createPrimitive("PropertyTimeOfDay", getTime(23, 49, 14))));
  
--    entitySet.getEntities().add(new EntityImpl()
--        .addProperty(createPrimitive("PropertyInt16", 0))
--        .addProperty(createPrimitive("PropertyString", ""))
--        .addProperty(createPrimitive("PropertyBoolean", false))
--        .addProperty(createPrimitive("PropertyByte", 0))
--        .addProperty(createPrimitive("PropertySByte", 0))
--        .addProperty(createPrimitive("PropertyInt32", 0))
--        .addProperty(createPrimitive("PropertyInt64", 0))
--        .addProperty(createPrimitive("PropertySingle", 0))
--        .addProperty(createPrimitive("PropertyDouble", 0))
++    entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16",
0))
++        .addProperty(createPrimitive("PropertyString", "")).addProperty(createPrimitive("PropertyBoolean",
false))
++        .addProperty(createPrimitive("PropertyByte", 0)).addProperty(createPrimitive("PropertySByte",
0))
++        .addProperty(createPrimitive("PropertyInt32", 0)).addProperty(createPrimitive("PropertyInt64",
0))
++        .addProperty(createPrimitive("PropertySingle", 0)).addProperty(createPrimitive("PropertyDouble",
0))
          .addProperty(createPrimitive("PropertyDecimal", 0))
          .addProperty(createPrimitive("PropertyBinary", new byte[] {}))
          .addProperty(createPrimitive("PropertyDate", getDateTime(1970, 1, 1, 0, 0, 0)))
@@@ -315,24 -331,24 +276,17 @@@
  
      Entity entity = new EntityImpl();
      entity.addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE));
--    entity.addProperty(createComplex("PropertyComp",
--        createPrimitive("PropertyString", "First Resource - first"),
++    entity.addProperty(createComplex("PropertyComp", createPrimitive("PropertyString", "First
Resource - first"),
          createPrimitive("PropertyBinary",
              new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD,
(byte) 0xEF }),
--        createPrimitive("PropertyBoolean", true),
--        createPrimitive("PropertyByte", 255),
++        createPrimitive("PropertyBoolean", true), createPrimitive("PropertyByte", 255),
          createPrimitive("PropertyDate", getDateTime(2012, 10, 3, 0, 0, 0)),
          createPrimitive("PropertyDateTimeOffset", getTimestamp(2012, 10, 3, 7, 16, 23, 123456700)),
--        createPrimitive("PropertyDecimal", 34.27),
--        createPrimitive("PropertySingle", 1.79000000E+20),
--        createPrimitive("PropertyDouble", -1.7900000000000000E+19),
--        createPrimitive("PropertyDuration", 6),
--        createPrimitive("PropertyGuid", GUID),
--        createPrimitive("PropertyInt16", Short.MAX_VALUE),
--        createPrimitive("PropertyInt32", Integer.MAX_VALUE),
--        createPrimitive("PropertyInt64", Long.MAX_VALUE),
--        createPrimitive("PropertySByte", Byte.MAX_VALUE),
--        createPrimitive("PropertyTimeOfDay", getTime(1, 0, 1))));
++        createPrimitive("PropertyDecimal", 34.27), createPrimitive("PropertySingle", 1.79000000E+20),
++        createPrimitive("PropertyDouble", -1.7900000000000000E+19), createPrimitive("PropertyDuration",
6),
++        createPrimitive("PropertyGuid", GUID), createPrimitive("PropertyInt16", Short.MAX_VALUE),
++        createPrimitive("PropertyInt32", Integer.MAX_VALUE), createPrimitive("PropertyInt64",
Long.MAX_VALUE),
++        createPrimitive("PropertySByte", Byte.MAX_VALUE), createPrimitive("PropertyTimeOfDay",
getTime(1, 0, 1))));
      entitySet.getEntities().add(entity);
  
      entity = new EntityImpl();
@@@ -372,10 -401,10 +326,9 @@@
    private EntitySet createESCollAllPrim() {
      EntitySet entitySet = new EntitySetImpl();
  
--    entitySet.getEntities().add(new EntityImpl()
--        .addProperty(createPrimitive("PropertyInt16", 1))
--        .addProperty(createPrimitiveCollection("CollPropertyString",
--            "Employee1@company.example", "Employee2@company.example", "Employee3@company.example"))
++    entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16",
1)).addProperty(
++        createPrimitiveCollection("CollPropertyString", "Employee1@company.example", "Employee2@company.example",
++            "Employee3@company.example"))
          .addProperty(createPrimitiveCollection("CollPropertyBoolean", true, false, true))
          .addProperty(createPrimitiveCollection("CollPropertyByte", 50, 200, 249))
          .addProperty(createPrimitiveCollection("CollPropertySByte", -120, 120, 126))
@@@ -383,28 -412,28 +336,22 @@@
          .addProperty(createPrimitiveCollection("CollPropertyInt32", 23232323, 11223355,
10000001))
          .addProperty(createPrimitiveCollection("CollPropertyInt64", 929292929292L, 333333333333L,
444444444444L))
          .addProperty(createPrimitiveCollection("CollPropertySingle", 1.79000000E+03, 2.66000000E+04,
3.21000000E+03))
--        .addProperty(createPrimitiveCollection("CollPropertyDouble",
--            -1.7900000000000000E+04, -2.7800000000000000E+07, 3.2100000000000000E+03))
--        .addProperty(createPrimitiveCollection("CollPropertyDecimal", 12, -2, 1234))
--        .addProperty(createPrimitiveCollection("CollPropertyBinary",
--            new byte[] { (byte) 0xAB, (byte) 0xCD, (byte) 0xEF },
--            new byte[] { 0x01, 0x23, 0x45 },
--            new byte[] { 0x54, 0x67, (byte) 0x89 }))
--        .addProperty(createPrimitiveCollection("CollPropertyDate",
--            getDateTime(1958, 12, 3, 0, 0, 0),
--            getDateTime(1999, 8, 5, 0, 0, 0),
--            getDateTime(2013, 6, 25, 0, 0, 0)))
--        .addProperty(createPrimitiveCollection("CollPropertyDateTimeOffset",
--            getDateTime(2015, 8, 12, 3, 8, 34),
--            getDateTime(1970, 3, 28, 12, 11, 10),
--            getDateTime(1948, 2, 17, 9, 9, 9)))
--        .addProperty(createPrimitiveCollection("CollPropertyDuration", 13, 19680, 3600))
--        .addProperty(createPrimitiveCollection("CollPropertyGuid",
--            UUID.fromString("ffffff67-89ab-cdef-0123-456789aaaaaa"),
--            UUID.fromString("eeeeee67-89ab-cdef-0123-456789bbbbbb"),
--            UUID.fromString("cccccc67-89ab-cdef-0123-456789cccccc")))
--        .addProperty(createPrimitiveCollection("CollPropertyTimeOfDay",
--            getTime(4, 14, 13), getTime(23, 59, 59), getTime(1, 12, 33))));
++        .addProperty(createPrimitiveCollection("CollPropertyDouble", -1.7900000000000000E+04,
-2.7800000000000000E+07,
++            3.2100000000000000E+03)).addProperty(createPrimitiveCollection("CollPropertyDecimal",
12, -2, 1234))
++        .addProperty(
++            createPrimitiveCollection("CollPropertyBinary", new byte[] { (byte) 0xAB, (byte)
0xCD, (byte) 0xEF }, new
++                    byte[] { 0x01, 0x23, 0x45 },
++                new byte[] { 0x54, 0x67, (byte) 0x89 })).addProperty(
++            createPrimitiveCollection("CollPropertyDate", getDateTime(1958, 12, 3, 0, 0,
0),
++                getDateTime(1999, 8, 5, 0, 0, 0), getDateTime(2013, 6, 25, 0, 0, 0))).addProperty(
++            createPrimitiveCollection("CollPropertyDateTimeOffset", getDateTime(2015, 8,
12, 3, 8, 34),
++                getDateTime(1970, 3, 28, 12, 11, 10), getDateTime(1948, 2, 17, 9, 9, 9)))
++        .addProperty(createPrimitiveCollection("CollPropertyDuration", 13, 19680, 3600)).addProperty(
++            createPrimitiveCollection("CollPropertyGuid", UUID.fromString("ffffff67-89ab-cdef-0123-456789aaaaaa"),
++                UUID.fromString("eeeeee67-89ab-cdef-0123-456789bbbbbb"),
++                UUID.fromString("cccccc67-89ab-cdef-0123-456789cccccc"))).addProperty(
++            createPrimitiveCollection("CollPropertyTimeOfDay", getTime(4, 14, 13), getTime(23,
59, 59),
++                getTime(1, 12, 33))));
  
      Entity entity = new EntityImpl();
      entity.getProperties().addAll(entitySet.getEntities().get(0).getProperties());
@@@ -420,39 -449,40 +367,31 @@@
    }
  
    private EntitySet createESMixPrimCollComp() {
--    @SuppressWarnings("unchecked")
--    final Property complexCollection = createComplexCollection("CollPropertyComp",
++    @SuppressWarnings("unchecked") final Property complexCollection = createComplexCollection("CollPropertyComp",
          Arrays.asList(createPrimitive("PropertyInt16", 123), createPrimitive("PropertyString",
"TEST 1")),
          Arrays.asList(createPrimitive("PropertyInt16", 456), createPrimitive("PropertyString",
"TEST 2")),
          Arrays.asList(createPrimitive("PropertyInt16", 789), createPrimitive("PropertyString",
"TEST 3")));
  
      EntitySet entitySet = new EntitySetImpl();
  
--    entitySet.getEntities().add(new EntityImpl()
--        .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
--        .addProperty(createPrimitiveCollection("CollPropertyString",
--            "Employee1@company.example", "Employee2@company.example", "Employee3@company.example"))
--        .addProperty(createComplex("PropertyComp",
--            createPrimitive("PropertyInt16", 111),
--            createPrimitive("PropertyString", "TEST A")))
--        .addProperty(complexCollection));
--
--    entitySet.getEntities().add(new EntityImpl()
--        .addProperty(createPrimitive("PropertyInt16", 7))
 -        .addProperty(createPrimitiveCollection("CollPropertyString",
 -            "Employee1@company.example", "Employee2@company.example", "Employee3@company.example"))
 -        .addProperty(createComplex("PropertyComp",
 -            createPrimitive("PropertyInt16", 222),
 -            createPrimitive("PropertyString", "TEST B")))
 -        .addProperty(complexCollection));
 -
 -    entitySet.getEntities().add(new EntityImpl()
 -        .addProperty(createPrimitive("PropertyInt16", 0))
 -        .addProperty(createPrimitiveCollection("CollPropertyString",
 -            "Employee1@company.example", "Employee2@company.example", "Employee3@company.example"))
 -        .addProperty(createComplex("PropertyComp",
 -            createPrimitive("PropertyInt16", 333),
 -            createPrimitive("PropertyString", "TEST C")))
 -        .addProperty(complexCollection));
++    entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16",
Short.MAX_VALUE))
 +        .addProperty(
 +            createPrimitiveCollection("CollPropertyString", "Employee1@company.example",
"Employee2@company.example",
-                 "Employee3@company.example"))
-         .addProperty(createComplex("PropertyComp", createPrimitive("PropertyInt16", 222),
-             createPrimitive("PropertyString", "TEST B")))
-         .addProperty(complexCollection));
- 
-     entitySet.getEntities().add(new EntityImpl()
-         .addProperty(createPrimitive("PropertyInt16", 0))
-         .addProperty(createPrimitiveCollection("CollPropertyString", "Employee1@company.example",
-             "Employee2@company.example", "Employee3@company.example"))
-         .addProperty(createComplex("PropertyComp", createPrimitive("PropertyInt16", 333),
-             createPrimitive("PropertyString", "TEST C")))
-         .addProperty(complexCollection));
++                "Employee3@company.example")).addProperty(
++            createComplex("PropertyComp", createPrimitive("PropertyInt16", 111),
++                createPrimitive("PropertyString", "TEST A"))).addProperty(complexCollection));
++
++    entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16",
7)).addProperty(
++        createPrimitiveCollection("CollPropertyString", "Employee1@company.example", "Employee2@company.example",
++            "Employee3@company.example")).addProperty(
++        createComplex("PropertyComp", createPrimitive("PropertyInt16", 222),
++            createPrimitive("PropertyString", "TEST B"))).addProperty(complexCollection));
++
++    entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyInt16",
0)).addProperty(
++        createPrimitiveCollection("CollPropertyString", "Employee1@company.example", "Employee2@company.example",
++            "Employee3@company.example")).addProperty(
++        createComplex("PropertyComp", createPrimitive("PropertyInt16", 333),
++            createPrimitive("PropertyString", "TEST C"))).addProperty(complexCollection));
  
      return entitySet;
    }
@@@ -469,22 -501,23 +408,18 @@@
          .addProperty(createPrimitive("PropertyDecimal", 34))
          .addProperty(createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 0, 0, 0)))
          .addProperty(createPrimitive("PropertyDateTimeOffset", getDateTime(2012, 12, 3,
7, 16, 23)))
 -        .addProperty(createPrimitive("PropertyDuration", 6))
 -        .addProperty(createPrimitive("PropertyGuid", GUID))
 +        .addProperty(createPrimitive("PropertyDuration", 6)).addProperty(createPrimitive("PropertyGuid",
GUID))
          .addProperty(createPrimitive("PropertyTimeOfDay", getTime(2, 48, 21))));
  
--    entitySet.getEntities().add(new EntityImpl()
--        .addProperty(createPrimitive("PropertyString", "Second"))
--        .addProperty(createPrimitive("PropertyBoolean", true))
--        .addProperty(createPrimitive("PropertyByte", 254))
--        .addProperty(createPrimitive("PropertySByte", 124))
--        .addProperty(createPrimitive("PropertyInt16", 32764))
++    entitySet.getEntities().add(new EntityImpl().addProperty(createPrimitive("PropertyString",
"Second"))
++        .addProperty(createPrimitive("PropertyBoolean", true)).addProperty(createPrimitive("PropertyByte",
254))
++        .addProperty(createPrimitive("PropertySByte", 124)).addProperty(createPrimitive("PropertyInt16",
32764))
          .addProperty(createPrimitive("PropertyInt32", 2147483644))
          .addProperty(createPrimitive("PropertyInt64", 9223372036854775804L))
          .addProperty(createPrimitive("PropertyDecimal", 34))
          .addProperty(createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 0, 0, 0)))
          .addProperty(createPrimitive("PropertyDateTimeOffset", getDateTime(2012, 12, 3,
7, 16, 23)))
--        .addProperty(createPrimitive("PropertyDuration", 6))
--        .addProperty(createPrimitive("PropertyGuid", GUID))
++        .addProperty(createPrimitive("PropertyDuration", 6)).addProperty(createPrimitive("PropertyGuid",
GUID))
          .addProperty(createPrimitive("PropertyTimeOfDay", getTime(2, 48, 21))));
  
      return entitySet;
@@@ -496,8 -529,8 +431,7 @@@
      Entity entity = new EntityImpl();
      entity.addProperty(createPrimitive("PropertyInt16", 1));
      entity.addProperty(createComplex("PropertyComp",
--        createComplex("PropertyComp",
--            createPrimitive("PropertyInt16", 123),
++        createComplex("PropertyComp", createPrimitive("PropertyInt16", 123),
              createPrimitive("PropertyString", "String 1"))));
      entitySet.getEntities().add(entity);
  
@@@ -514,26 -548,26 +448,22 @@@
    private EntitySet createESMedia() {
      EntitySet entitySet = new EntitySetImpl();
  
--    Entity entity = new EntityImpl()
--        .addProperty(createPrimitive("PropertyInt16", 1))
++    Entity entity = new EntityImpl().addProperty(createPrimitive("PropertyInt16", 1))
          .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("darkturquoise")));
      entity.setMediaContentType("image/svg+xml");
      entitySet.getEntities().add(entity);
  
--    entity = new EntityImpl()
--        .addProperty(createPrimitive("PropertyInt16", 2))
++    entity = new EntityImpl().addProperty(createPrimitive("PropertyInt16", 2))
          .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("royalblue")));
      entity.setMediaContentType("image/svg+xml");
      entitySet.getEntities().add(entity);
  
--    entity = new EntityImpl()
--        .addProperty(createPrimitive("PropertyInt16", 3))
++    entity = new EntityImpl().addProperty(createPrimitive("PropertyInt16", 3))
          .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("crimson")));
      entity.setMediaContentType("image/svg+xml");
      entitySet.getEntities().add(entity);
  
--    entity = new EntityImpl()
--        .addProperty(createPrimitive("PropertyInt16", 4))
++    entity = new EntityImpl().addProperty(createPrimitive("PropertyInt16", 4))
          .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("black")));
      entity.setMediaContentType("image/svg+xml");
      entitySet.getEntities().add(entity);
@@@ -545,9 -579,9 +475,7 @@@
      return ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
          + "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 100
100\">\n"
          + "  <g stroke=\"darkmagenta\" stroke-width=\"16\" fill=\"" + color + "\">\n"
--        + "    <circle cx=\"50\" cy=\"50\" r=\"42\"/>\n"
--        + "  </g>\n"
--        + "</svg>\n").getBytes(Charset.forName("UTF-8"));
++        + "    <circle cx=\"50\" cy=\"50\" r=\"42\"/>\n" + "  </g>\n" + "</svg>\n").getBytes(Charset.forName("UTF-8"));
    }
  
    private void linkESTwoPrim(Map<String, EntitySet> data) {
@@@ -566,8 -601,8 +494,8 @@@
      setLinks(entitySet.getEntities().get(0), "NavPropertyETTwoPrimMany", targetEntities.get(1));
      setLink(entitySet.getEntities().get(0), "NavPropertyETTwoPrimOne", targetEntities.get(3));
  
--    setLinks(entitySet.getEntities().get(2), "NavPropertyETTwoPrimMany",
--        targetEntities.get(0), targetEntities.get(2), targetEntities.get(3));
++    setLinks(entitySet.getEntities().get(2), "NavPropertyETTwoPrimMany", targetEntities.get(0),
targetEntities.get(2),
++        targetEntities.get(3));
    }
  
    private void linkESKeyNav(Map<String, EntitySet> data) {
@@@ -613,12 -650,12 +541,9 @@@
      setLink(entitySet.getEntities().get(3), "NavPropertyETKeyNavOne", esKeyNavTargets.get(2));
  
      // NavPropertyETKeyNavMany
--    setLinks(entitySet.getEntities().get(0), "NavPropertyETKeyNavMany",
--        esKeyNavTargets.get(0), esKeyNavTargets.get(1));
--    setLinks(entitySet.getEntities().get(1), "NavPropertyETKeyNavMany",
--        esKeyNavTargets.get(0), esKeyNavTargets.get(1));
--    setLinks(entitySet.getEntities().get(2), "NavPropertyETKeyNavMany",
--        esKeyNavTargets.get(1), esKeyNavTargets.get(2));
++    setLinks(entitySet.getEntities().get(0), "NavPropertyETKeyNavMany", esKeyNavTargets.get(0),
esKeyNavTargets.get(1));
++    setLinks(entitySet.getEntities().get(1), "NavPropertyETKeyNavMany", esKeyNavTargets.get(0),
esKeyNavTargets.get(1));
++    setLinks(entitySet.getEntities().get(2), "NavPropertyETKeyNavMany", esKeyNavTargets.get(1),
esKeyNavTargets.get(2));
  
      // NavPropertyETTwoKeyNavOne
      setLink(entitySet.getEntities().get(0), "NavPropertyETTwoKeyNavOne", esTwoKeyNavTargets.get(0));
@@@ -626,8 -663,8 +551,8 @@@
      setLink(entitySet.getEntities().get(3), "NavPropertyETTwoKeyNavOne", esTwoKeyNavTargets.get(2));
  
      // NavPropertyETTwoKeyNavMany
--    setLinks(entitySet.getEntities().get(0), "NavPropertyETTwoKeyNavMany",
--        esTwoKeyNavTargets.get(0), esTwoKeyNavTargets.get(1));
++    setLinks(entitySet.getEntities().get(0), "NavPropertyETTwoKeyNavMany", esTwoKeyNavTargets.get(0),
++        esTwoKeyNavTargets.get(1));
      setLinks(entitySet.getEntities().get(1), "NavPropertyETTwoKeyNavMany", esTwoKeyNavTargets.get(0));
      setLinks(entitySet.getEntities().get(2), "NavPropertyETTwoKeyNavMany", esTwoKeyNavTargets.get(1));
    }
@@@ -640,6 -677,6 +565,10 @@@
      return new PropertyImpl(null, name, ValueType.COLLECTION_PRIMITIVE, Arrays.asList(values));
    }
  
++  protected static Property createComplex(final String name, String type, final Property...
properties) {
++    return createComplex(name, properties);
++  }
++
    protected static Property createComplex(final String name, final Property... properties)
{
      ComplexValue complexValue = new ComplexValueImpl();
      for (final Property property : properties) {
@@@ -648,6 -685,6 +577,11 @@@
      return new PropertyImpl(null, name, ValueType.COMPLEX, complexValue);
    }
  
++  protected static Property createComplexCollection(final String name, String type, final
List<Property>...
++      propertiesList) {
++    return createComplexCollection(name, propertiesList);
++  }
++
    protected static Property createComplexCollection(final String name, final List<Property>...
propertiesList) {
      List<ComplexValue> complexCollection = new ArrayList<ComplexValue>();
      for (final List<Property> properties : propertiesList) {


Mime
View raw message