Skip to content

Commit

Permalink
TEIID-4430, TEIID-4399 : Upgrading the Olingo library to latest 4.3 and
Browse files Browse the repository at this point in the history
allowing the  construct in Teiid to > 1 (#799)


# Conflicts:
#	pom.xml
  • Loading branch information
rareddy authored and shawkins committed Jul 15, 2017
1 parent 57d6192 commit b44c567
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public SerializerResult complexCollection(final ServiceMetadata metadata,
}
else {
json.writeFieldName(type.getName());
writeEntity(metadata, type.getEdmEntityType(), type.getEntity(), null, null, null, false, json);
writeEntity(metadata, type.getEdmEntityType(), type.getEntity(), null, null, null, null, false, null, json);
}
}
json.writeEndObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,9 @@ private void processExpandOption(ExpandOption option, DocumentNode node, Query o
if (ei.getLevelsOption() != null) {
if (ei.getLevelsOption().isMax()) {
levels = MAX_EXPAND_LEVEL - expandLevel + 1;

//OLINGO-1009
levels = 1;
} else {
levels = ei.getLevelsOption().getValue();
checkExpandLevel(expandLevel + levels - 1);

//OLINGO-1009
if (levels > 1) {
throw new TeiidNotImplementedException(
ODataPlugin.Event.TEIID16061, ODataPlugin.Util.gs(ODataPlugin.Event.TEIID16061));
}
}
}

Expand Down
86 changes: 75 additions & 11 deletions olingo/src/test/java/org/teiid/olingo/TestODataIntegration.java
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,8 @@ public UpdateExecution createUpdateExecution(
+ "\"decimalval\":-20.4,"
+ "\"timeval\":\"00:00:00\","
+ "\"dateval\":\"1970-01-01\","
+ "\"timestampval\":\"1970-01-01T00:00:00Z\","
+ "\"clobval\":null}", response.getContentAsString());
+ "\"timestampval\":\"1970-01-01T00:00:00Z\""
+ "}", response.getContentAsString());

response = http.newRequest(baseURL + "/northwind/m/PostTable(4)/clobval")
.method("POST")
Expand Down Expand Up @@ -1775,16 +1775,79 @@ public void testExpandComplex() throws Exception {
.send();
assertEquals(400, response.getStatus());

response = http.newRequest(baseURL + "/northwind/m/x?$expand=*($levels=1)")
response = http.newRequest(baseURL + "/northwind/m/x?$expand=*($levels=3)")
.method("GET")
.send();
assertEquals(200, response.getStatus());
assertEquals("{\"@odata.context\":\"$metadata#x\",\"value\":["
+ "{\"a\":\"a\",\"b\":\"b\",\"y_FKX\":"
+ "[{\"a\":\"y\",\"b\":\"a\"},{\"a\":\"y1\",\"b\":\"a\"}],"
+ "\"z_FKX\":{\"a\":\"a\",\"b\":\"y\"}}"
+ "]}",
response.getContentAsString());
String expected = "{" +
"\"@odata.context\":\"$metadata#x\"," +
"\"value\":[" +
"{" +
"\"a\":\"a\"," +
"\"b\":\"b\"," +
"\"y_FKX\":[" +
"{" +
"\"a\":\"y\"," +
"\"b\":\"a\"," +
"\"FKX\":[" +
"{" +
"\"@odata.id\":\""+baseURL+"/northwind/m/x('a')\"" +
"}" +
"]," +
"\"z_FKY\":[" +
"{" +
"\"a\":\"a\"," +
"\"b\":\"y\"," +
"\"FKX\":{" +
"\"@odata.id\":\""+baseURL+"/northwind/m/x('a')\"" +
"}," +
"\"FKY\":[" +
"{" +
"\"@odata.id\":\""+baseURL+"/northwind/m/y('y')\"" +
"}" +
"]" +
"}" +
"]" +
"}," +
"{" +
"\"a\":\"y1\"," +
"\"b\":\"a\"," +
"\"FKX\":[" +
"{" +
"\"@odata.id\":\""+baseURL+"/northwind/m/x('a')\"" +
"}" +
"]," +
"\"z_FKY\":[" +
"]" +
"}" +
"]," +
"\"z_FKX\":{" +
"\"a\":\"a\"," +
"\"b\":\"y\"," +
"\"FKX\":{" +
"\"@odata.id\":\""+baseURL+"/northwind/m/x('a')\"" +
"}," +
"\"FKY\":[" +
"{" +
"\"a\":\"y\"," +
"\"b\":\"a\"," +
"\"FKX\":[" +
"{" +
"\"@odata.id\":\""+baseURL+"/northwind/m/x('a')\"" +
"}" +
"]," +
"\"z_FKY\":[" +
"{" +
"\"@odata.id\":\""+baseURL+"/northwind/m/z('a')\"" +
"}" +
"]" +
"}" +
"]" +
"}" +
"}" +
"]" +
"}";
assertEquals(expected, response.getContentAsString());

//invalid it's not a self relationship
response = http.newRequest(baseURL + "/northwind/m/x?$expand=y_FKX($levels=1)")
Expand Down Expand Up @@ -2021,8 +2084,9 @@ public void testStreamProperties() throws Exception {
.send();
assertEquals(200, response.getStatus());
String string = response.getContentAsString();
assertTrue(string.contains("odata4/loopy/vm1/LobTable(1)/e2"));
assertTrue(string.contains("odata4/loopy/vm1/LobTable(2)/e2"));
// stream properties are computed, not shown in the payload.
assertFalse(string.contains("odata4/loopy/vm1/LobTable(1)/e2"));
assertFalse(string.contains("odata4/loopy/vm1/LobTable(2)/e2"));
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<version.de.flapdoodle.embed.mongo>1.46.0</version.de.flapdoodle.embed.mongo>

<version.org.eclipse.persistence>2.5.0</version.org.eclipse.persistence>
<version.org.apache.olingo>4.2.0-teiid-8</version.org.apache.olingo>
<version.org.apache.olingo>4.3.0</version.org.apache.olingo>
<version.org.eclipse.jetty>9.2.7.v20150116</version.org.eclipse.jetty>
<version.commons-codec>1.9</version.commons-codec>
<version.com.fasterxml.jackson.core>2.5.4</version.com.fasterxml.jackson.core>
Expand Down

0 comments on commit b44c567

Please sign in to comment.