You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2013/09/20 15:33:35 UTC
[13/59] [abbrv] Cleanup of core
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreatorImplTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreatorImplTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreatorImplTest.java
index b2ef4a0..5c97db2 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreatorImplTest.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreatorImplTest.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.uri;
@@ -54,7 +54,7 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
@Test
public void allNull() throws Exception {
- //{"all":true,"properties":[],"links":[]}
+ // {"all":true,"properties":[],"links":[]}
String expected = "{\"all\":true,\"properties\":[],\"links\":[]}";
String actual = getExpandSelectTree(null, null).toJsonString();
assertEquals(expected, actual);
@@ -62,10 +62,10 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
@Test
public void oneProperty() throws Exception {
- //{"all":false,"properties":["Age"],"links":[]}
+ // {"all":false,"properties":["Age"],"links":[]}
String expected = "{\"all\":false,\"properties\":[\"Age\"],\"links\":[]}";
- //$select=Age
+ // $select=Age
String actual = getExpandSelectTree("Age", null).toJsonString();
assertEquals(expected, actual);
}
@@ -82,10 +82,10 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
@Test
public void onlyPropertyAndExpandLink() throws Exception {
- //{"all":false,"properties":["Age"],"links":[]}
+ // {"all":false,"properties":["Age"],"links":[]}
String expected = "{\"all\":false,\"properties\":[\"Age\"],\"links\":[]}";
- //$select=Age&$expand=ne_Room
+ // $select=Age&$expand=ne_Room
String actual = getExpandSelectTree("Age", "ne_Room").toJsonString();
assertEquals(expected, actual);
@@ -93,79 +93,86 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
@Test
public void starAndExpandLink() throws Exception {
- //{"all":true,"properties":[],"links":[]}
+ // {"all":true,"properties":[],"links":[]}
String expected = "{\"all\":true,\"properties\":[],\"links\":[]}";
- //$select=*&$expand=ne_Room
+ // $select=*&$expand=ne_Room
String actual = getExpandSelectTree("*", "ne_Room").toJsonString();
assertEquals(expected, actual);
- //$select=*,EmployeeId&$expand=ne_Room
+ // $select=*,EmployeeId&$expand=ne_Room
actual = getExpandSelectTree("*,EmployeeId", "ne_Room").toJsonString();
assertEquals(expected, actual);
- //$select=EmployeeId,*&$expand=ne_Room
+ // $select=EmployeeId,*&$expand=ne_Room
actual = getExpandSelectTree("EmployeeId,*", "ne_Room").toJsonString();
assertEquals(expected, actual);
}
@Test
public void oneSelectLink() throws Exception {
- //{"all":false,"properties":[],"links":[{"ne_Room":null}]}
+ // {"all":false,"properties":[],"links":[{"ne_Room":null}]}
String expected = "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Room\":null}]}";
- //$select=ne_Room
+ // $select=ne_Room
String actual = getExpandSelectTree("ne_Room", null).toJsonString();
assertEquals(expected, actual);
}
@Test
public void starAndNavPropInSelectAndExpand() throws Exception {
- //{"all":false,"properties":[],"links":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[]}}]}
- String expected = "{\"all\":true,\"properties\":[],\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[]}}]}";
+ // {"all":false,"properties":[],"links":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[]}}]}
+ String expected =
+ "{\"all\":true,\"properties\":[],\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[]}}]}";
- //$select=ne_Room,* $expand=ne_Room
+ // $select=ne_Room,* $expand=ne_Room
String actual = getExpandSelectTree("ne_Room,*", "ne_Room").toJsonString();
assertEquals(expected, actual);
- //$select=*,ne_Room $expand=ne_Room
+ // $select=*,ne_Room $expand=ne_Room
actual = getExpandSelectTree("*,ne_Room", "ne_Room").toJsonString();
assertEquals(expected, actual);
- //$select=*,ne_Room,ne_Manager $expand=ne_Room
+ // $select=*,ne_Room,ne_Manager $expand=ne_Room
actual = getExpandSelectTree("*,ne_Room,ne_Manager", "ne_Room").toJsonString();
assertEquals(expected, actual);
- //$select=ne_Room,*,ne_Manager $expand=ne_Room
+ // $select=ne_Room,*,ne_Manager $expand=ne_Room
actual = getExpandSelectTree("ne_Room,*,ne_Manager", "ne_Room").toJsonString();
assertEquals(expected, actual);
- //$select=ne_Room,ne_Manager,* $expand=ne_Room
+ // $select=ne_Room,ne_Manager,* $expand=ne_Room
actual = getExpandSelectTree("ne_Room,ne_Manager,*", "ne_Room").toJsonString();
assertEquals(expected, actual);
}
@Test
public void sameLinkInSelectAndExpand() throws Exception {
- //{"all":false,"properties":[],"links":[{"ne_Room":{"all":true,"properties":[],"links":[]}}]}
- String expected = "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[]}}]}";
+ // {"all":false,"properties":[],"links":[{"ne_Room":{"all":true,"properties":[],"links":[]}}]}
+ String expected =
+ "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[]}}]}";
- //$select=ne_Room&$expand=ne_Room
+ // $select=ne_Room&$expand=ne_Room
String actual = getExpandSelectTree("ne_Room", "ne_Room").toJsonString();
assertEquals(expected, actual);
- //$select=ne_Room/*&$expand=ne_Room
+ // $select=ne_Room/*&$expand=ne_Room
actual = getExpandSelectTree("ne_Room/*", "ne_Room").toJsonString();
assertEquals(expected, actual);
}
@Test
public void deepLinkInSelectAndExpand() throws Exception {
- //{"all":false,"properties":[],"links":[{"ne_Room":{"all":false,"properties":[],"links":[{"nr_Employees":{"all":true,"properties":[],"links":[]}}]}}]}
- String expected = "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Room\":{\"all\":false,\"properties\":[],\"links\":[{\"nr_Employees\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
+ // {"all":false,"properties":[],"links":[{"ne_Room":{"all":false,"properties":[],
+ //"links":[{"nr_Employees":{"all":true,"properties":[],"links":[]}}]}}]}
+ String expected =
+ "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Room\":{\"all\":false," +
+ "\"properties\":[],\"links\":[{\"nr_Employees\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
- //$select=ne_Room/nr_Employees&$expand=ne_Room,ne_Manager,ne_Room/nr_Employees,ne_Room/nr_Building
- String actual = getExpandSelectTree("ne_Room/nr_Employees", "ne_Room,ne_Manager,ne_Room/nr_Employees,ne_Room/nr_Building").toJsonString();
+ // $select=ne_Room/nr_Employees&$expand=ne_Room,ne_Manager,ne_Room/nr_Employees,ne_Room/nr_Building
+ String actual =
+ getExpandSelectTree("ne_Room/nr_Employees", "ne_Room,ne_Manager,ne_Room/nr_Employees,ne_Room/nr_Building")
+ .toJsonString();
assertEquals(expected, actual);
}
@@ -175,22 +182,26 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
+ "{\"ne_Team\":{\"all\":false,\"properties\":[],\"links\":["
+ "{\"nt_Employees\":{\"all\":false,\"properties\":[],\"links\":["
+ "{\"ne_Manager\":{\"all\":false,\"properties\":[\"EmployeeId\"],\"links\":[]}}]}}]}}]}",
- getExpandSelectTree("ne_Team/nt_Employees/ne_Manager/EmployeeId", "ne_Team/nt_Employees/ne_Manager").toJsonString());
+ getExpandSelectTree("ne_Team/nt_Employees/ne_Manager/EmployeeId", "ne_Team/nt_Employees/ne_Manager")
+ .toJsonString());
}
@Test
public void expandOneLink() throws Exception {
- //{"all":true,"properties":[],"links":[{"ne_Room":{"all":true,"properties":[],"links":[]}}]}
- String expected = "{\"all\":true,\"properties\":[],\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[]}}]}";
+ // {"all":true,"properties":[],"links":[{"ne_Room":{"all":true,"properties":[],"links":[]}}]}
+ String expected =
+ "{\"all\":true,\"properties\":[],\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[]}}]}";
- //$expand=ne_Room
+ // $expand=ne_Room
String actual = getExpandSelectTree(null, "ne_Room").toJsonString();
assertEquals(expected, actual);
}
@Test
public void complexSelectExpand() throws Exception {
- //{"all":false,"properties":["Age"],"links":[{"ne_Room":{"all":false,"properties":["Seats"],"links":[]}},{"ne_Team":null},{"ne_Manager":{"all":true,"properties":[],"links":[{"ne_Team":{"all":true,"properties":[],"links":[{"nt_Employees":{"all":true,"properties":[],"links":[]}}]}}]}}]}
+ // {"all":false,"properties":["Age"],"links":[{"ne_Room":{"all":false,"properties":["Seats"],
+ //"links":[]}},{"ne_Team":null},{"ne_Manager":{"all":true,"properties":[],"links":[{"ne_Team":{"all":true,
+ //"properties":[],"links":[{"nt_Employees":{"all":true,"properties":[],"links":[]}}]}}]}}]}
String select = "Age,ne_Room/Seats,ne_Team/Name,ne_Manager/*,ne_Manager/ne_Team,ne_Team";
String expand = "ne_Room/nr_Building,ne_Manager/ne_Team/nt_Employees,ne_Manager/ne_Room";
@@ -212,7 +223,9 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
assertNull(links.get(navPropertyName));
} else if ("ne_Manager".equals(navPropertyName)) {
ExpandSelectTreeNodeImpl managerNode = (ExpandSelectTreeNodeImpl) links.get(navPropertyName);
- String expected = "{\"all\":true,\"properties\":[],\"links\":[{\"ne_Team\":{\"all\":true,\"properties\":[],\"links\":[{\"nt_Employees\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
+ String expected =
+ "{\"all\":true,\"properties\":[],\"links\":[{\"ne_Team\":{\"all\":true,\"properties\":[]," +
+ "\"links\":[{\"nt_Employees\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
String actualString = managerNode.toJsonString();
assertEquals(expected, actualString);
} else {
@@ -223,100 +236,104 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
@Test
public void twoProperties() throws Exception {
- //{"all":false,"properties":["Age","EmployeeId"],"links":[]}
+ // {"all":false,"properties":["Age","EmployeeId"],"links":[]}
String expected = "{\"all\":false,\"properties\":[\"Age\",\"EmployeeId\"],\"links\":[]}";
- //$select=Age,EmployeeId
+ // $select=Age,EmployeeId
String actual = getExpandSelectTree("Age,EmployeeId", null).toJsonString();
assertEquals(expected, actual);
}
@Test
public void sameProperties() throws Exception {
- //{"all":false,"properties":["EmployeeId","Age"],"links":[]}
+ // {"all":false,"properties":["EmployeeId","Age"],"links":[]}
String expected = "{\"all\":false,\"properties\":[\"EmployeeId\",\"Age\"],\"links\":[]}";
- //$select=EmployeeId,Age,EmployeeId
+ // $select=EmployeeId,Age,EmployeeId
String actual = getExpandSelectTree("EmployeeId,Age,EmployeeId", null).toJsonString();
assertEquals(expected, actual);
}
@Test
public void propertiesAndStar() throws Exception {
- //{"all":true,"properties":[],"links":[]}
+ // {"all":true,"properties":[],"links":[]}
String expected = "{\"all\":true,\"properties\":[],\"links\":[]}";
- //$select=Age,EmployeeId,*
+ // $select=Age,EmployeeId,*
String actual = getExpandSelectTree("Age,EmployeeId,*", null).toJsonString();
assertEquals(expected, actual);
- //$select=*,Age,EmployeeId
+ // $select=*,Age,EmployeeId
actual = getExpandSelectTree("*,Age,EmployeeId", null).toJsonString();
assertEquals(expected, actual);
}
@Test
public void multiSelectLinkWithoutExpand() throws Exception {
- //{"all":false,"properties":[],"links":[{"ne_Manager":null}]}
+ // {"all":false,"properties":[],"links":[{"ne_Manager":null}]}
String expected = "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":null}]}";
- //$select=ne_Manager
+ // $select=ne_Manager
String actual = getExpandSelectTree("ne_Manager", null).toJsonString();
assertEquals(expected, actual);
- //$select=ne_Manager/ne_Manager
+ // $select=ne_Manager/ne_Manager
actual = getExpandSelectTree("ne_Manager/ne_Manager", null).toJsonString();
assertEquals(expected, actual);
- //$select=ne_Manager/ne_Manager,ne_Manager
+ // $select=ne_Manager/ne_Manager,ne_Manager
actual = getExpandSelectTree("ne_Manager/ne_Manager,ne_Manager", null).toJsonString();
assertEquals(expected, actual);
- //$select=ne_Manager/ne_Manager/ne_Manager/ne_Manager,ne_Manager
+ // $select=ne_Manager/ne_Manager/ne_Manager/ne_Manager,ne_Manager
actual = getExpandSelectTree("ne_Manager/ne_Manager/ne_Manager/ne_Manager,ne_Manager", null).toJsonString();
assertEquals(expected, actual);
- //$select=ne_Manager,ne_Manager/ne_Manager/ne_Manager/ne_Manager
+ // $select=ne_Manager,ne_Manager/ne_Manager/ne_Manager/ne_Manager
actual = getExpandSelectTree("ne_Manager,ne_Manager/ne_Manager/ne_Manager/ne_Manager", null).toJsonString();
assertEquals(expected, actual);
}
@Test
public void sameSelectLinks() throws Exception {
- //{"all":false,"properties":[],"links":[{"ne_Manager":null}]}
+ // {"all":false,"properties":[],"links":[{"ne_Manager":null}]}
String expected = "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":null}]}";
- //$select=ne_Manager,ne_Manager
+ // $select=ne_Manager,ne_Manager
String actual = getExpandSelectTree("ne_Manager,ne_Manager", null).toJsonString();
assertEquals(expected, actual);
}
@Test
public void sameExpandLinks() throws Exception {
- //{"all":true,"properties":[],"links":[{"ne_Manager":{"all":true,"properties":[],"links":[]}}]}
- String expected = "{\"all\":true,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[],\"links\":[]}}]}";
+ // {"all":true,"properties":[],"links":[{"ne_Manager":{"all":true,"properties":[],"links":[]}}]}
+ String expected =
+ "{\"all\":true,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[],\"links\":[]}}]}";
- //$expand=ne_Manager,ne_Manager
+ // $expand=ne_Manager,ne_Manager
String actual = getExpandSelectTree(null, "ne_Manager,ne_Manager").toJsonString();
assertEquals(expected, actual);
}
@Test
public void multiExpandLinkWithoutSelect() throws Exception {
- //{"all":true,"properties":[],"links":[{"ne_Manager":{"all":true,"properties":[],"links":[{"ne_Manager":{"all":true,"properties":[],"links":[]}}]}}]}
- String expected = "{\"all\":true,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
+ // {"all":true,"properties":[],"links":[{"ne_Manager":{"all":true,"properties":[],
+ //"links":[{"ne_Manager":{"all":true,"properties":[],"links":[]}}]}}]}
+ String expected =
+ "{\"all\":true,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[]," +
+ "\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
- //$expand=ne_Manager/ne_Manager,ne_Manager
+ // $expand=ne_Manager/ne_Manager,ne_Manager
String actual = getExpandSelectTree(null, "ne_Manager/ne_Manager,ne_Manager").toJsonString();
assertEquals(expected, actual);
}
@Test
public void twoSelectLinks() throws Exception {
- //One of the two is expected but the order of links is not defined
+ // One of the two is expected but the order of links is not defined
String expected = "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":null},{\"ne_Room\":null}]}";
String expected2 = "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Room\":null},{\"ne_Manager\":null}]}";
- //$select=ne_Manager,ne_Room
+ // $select=ne_Manager,ne_Room
String actual = getExpandSelectTree("ne_Manager,ne_Room", null).toJsonString();
if (!expected.equals(actual) && !expected2.equals(actual)) {
@@ -326,22 +343,26 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
@Test
public void oneSelectDeepExpand() throws Exception {
- //{"all":false,"properties":[],"links":[{"ne_Manager":{"all":true,"properties":[],"links":[{"ne_Room":{"all":true,"properties":[],"links":[{"nr_Building":{"all":true,"properties":[],"links":[]}}]}}]}}]}
- String expected = "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[],\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}}]}";
-
- //$select=ne_Manager $expand=ne_Manager/ne_Room/nr_Building
+ // {"all":false,"properties":[],"links":[{"ne_Manager":{"all":true,"properties":[],"links":[{
+ //"ne_Room":{"all":true,"properties":[],"links":[{"nr_Building":{"all":true,"properties":[],"links":[]}}]}}]}}]}
+ String expected =
+ "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[]," +
+ "\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true," +
+ "\"properties\":[],\"links\":[]}}]}}]}}]}";
+
+ // $select=ne_Manager $expand=ne_Manager/ne_Room/nr_Building
String actual = getExpandSelectTree("ne_Manager", "ne_Manager/ne_Room/nr_Building").toJsonString();
assertEquals(expected, actual);
- //$select=ne_Manager,ne_Manager/EmployeeId $expand=ne_Manager/ne_Room/nr_Building
+ // $select=ne_Manager,ne_Manager/EmployeeId $expand=ne_Manager/ne_Room/nr_Building
actual = getExpandSelectTree("ne_Manager,ne_Manager/EmployeeId", "ne_Manager/ne_Room/nr_Building").toJsonString();
assertEquals(expected, actual);
- //$select=ne_Manager/EmployeeId,ne_Manager $expand=ne_Manager/ne_Room/nr_Building
+ // $select=ne_Manager/EmployeeId,ne_Manager $expand=ne_Manager/ne_Room/nr_Building
actual = getExpandSelectTree("ne_Manager/EmployeeId,ne_Manager", "ne_Manager/ne_Room/nr_Building").toJsonString();
assertEquals(expected, actual);
- //$select=ne_Manager,ne_Manager $expand=ne_Manager/ne_Room/nr_Building
+ // $select=ne_Manager,ne_Manager $expand=ne_Manager/ne_Room/nr_Building
actual = getExpandSelectTree("ne_Manager,ne_Manager", "ne_Manager/ne_Room/nr_Building").toJsonString();
assertEquals(expected, actual);
}
@@ -349,14 +370,16 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
@Test
public void starAtEndWithExpand() throws Exception {
- //{"all":false,"properties":["EmployeeId"],"links":[{"ne_Room":{"all":true,"properties":[],"links":[]}}]}
- String expected = "{\"all\":false,\"properties\":[\"EmployeeId\"],\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[]}}]}";
+ // {"all":false,"properties":["EmployeeId"],"links":[{"ne_Room":{"all":true,"properties":[],"links":[]}}]}
+ String expected =
+ "{\"all\":false,\"properties\":[\"EmployeeId\"],\"links\":[{\"ne_Room\":{\"all\":true," +
+ "\"properties\":[],\"links\":[]}}]}";
- //$select=EmployeeId,ne_Room/* $expand=ne_Room/nr_Building
+ // $select=EmployeeId,ne_Room/* $expand=ne_Room/nr_Building
String actual = getExpandSelectTree("EmployeeId,ne_Room/*", "ne_Room/nr_Building").toJsonString();
assertEquals(expected, actual);
- //$select=EmployeeId,ne_Room/Id $expand=ne_Room/nr_Building/nb_Rooms
+ // $select=EmployeeId,ne_Room/Id $expand=ne_Room/nr_Building/nb_Rooms
actual = getExpandSelectTree("EmployeeId,ne_Room/*", "ne_Room/nr_Building/nb_Rooms").toJsonString();
assertEquals(expected, actual);
}
@@ -364,14 +387,16 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
@Test
public void propertyAtEndWithExpand() throws Exception {
- //{"all":false,"properties":["EmployeeId"],"links":[{"ne_Room":{"all":true,"properties":[],"links":[]}}]}
- String expected = "{\"all\":false,\"properties\":[\"EmployeeId\"],\"links\":[{\"ne_Room\":{\"all\":false,\"properties\":[\"Id\"],\"links\":[]}}]}";
+ // {"all":false,"properties":["EmployeeId"],"links":[{"ne_Room":{"all":true,"properties":[],"links":[]}}]}
+ String expected =
+ "{\"all\":false,\"properties\":[\"EmployeeId\"],\"links\":[{\"ne_Room\":{\"all\":false," +
+ "\"properties\":[\"Id\"],\"links\":[]}}]}";
- //$select=EmployeeId,ne_Room/* $expand=ne_Room/nr_Building
+ // $select=EmployeeId,ne_Room/* $expand=ne_Room/nr_Building
String actual = getExpandSelectTree("EmployeeId,ne_Room/Id", "ne_Room/nr_Building").toJsonString();
assertEquals(expected, actual);
- //$select=EmployeeId,ne_Room/Id $expand=ne_Room/nr_Building/nb_Rooms
+ // $select=EmployeeId,ne_Room/Id $expand=ne_Room/nr_Building/nb_Rooms
actual = getExpandSelectTree("EmployeeId,ne_Room/Id", "ne_Room/nr_Building/nb_Rooms").toJsonString();
assertEquals(expected, actual);
}
@@ -379,14 +404,15 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
@Test
public void starTest() throws Exception {
- //{"all":false,"properties":["EmployeeId"],"links":[{"ne_Room":{"all":true,"properties":[],"links":[]}}]}
- String expected = "{\"all\":true,\"properties\":[],\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[]}}]}";
+ // {"all":false,"properties":["EmployeeId"],"links":[{"ne_Room":{"all":true,"properties":[],"links":[]}}]}
+ String expected =
+ "{\"all\":true,\"properties\":[],\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[]}}]}";
- //$select=EmployeeId,ne_Room/* $expand=ne_Room/nr_Building
+ // $select=EmployeeId,ne_Room/* $expand=ne_Room/nr_Building
String actual = getExpandSelectTree("*,ne_Room/*", "ne_Room/nr_Building").toJsonString();
assertEquals(expected, actual);
- //$select=EmployeeId,ne_Room/Id $expand=ne_Room/nr_Building/nb_Rooms
+ // $select=EmployeeId,ne_Room/Id $expand=ne_Room/nr_Building/nb_Rooms
actual = getExpandSelectTree("ne_Room/*,*", "ne_Room/nr_Building").toJsonString();
assertEquals(expected, actual);
}
@@ -394,45 +420,67 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
@Test
public void twoExpandsTwoSelects() throws Exception {
- //{"all":false,"properties":[],"links":[{"ne_Manager":{"all":false,"properties":["EmployeeId"],"links":[{"ne_Room":{"all":true,"properties":[],"links":[{"nr_Building":{"all":true,"properties":[],"links":[]}}]}}]}}]}
- String expected = "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":false,\"properties\":[\"EmployeeId\"],\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}}]}";
+ // {"all":false,"properties":[],"links":[{"ne_Manager":{"all":false,"properties":["EmployeeId"],
+ //"links":[{"ne_Room":{"all":true,"properties":[],"links":[{"nr_Building":{"all":true,"properties":[],
+ //"links":[]}}]}}]}}]}
+ String expected =
+ "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":false,\"properties\":[\"EmployeeId\"]," +
+ "\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true," +
+ "\"properties\":[],\"links\":[]}}]}}]}}]}";
- //$select=ne_Manager/EmployeeId,ne_Manager/ne_Room $expand=ne_Manager/ne_Room/nr_Building
- String actual = getExpandSelectTree("ne_Manager/ne_Room,ne_Manager/EmployeeId", "ne_Manager/ne_Room/nr_Building").toJsonString();
+ // $select=ne_Manager/EmployeeId,ne_Manager/ne_Room $expand=ne_Manager/ne_Room/nr_Building
+ String actual =
+ getExpandSelectTree("ne_Manager/ne_Room,ne_Manager/EmployeeId", "ne_Manager/ne_Room/nr_Building")
+ .toJsonString();
assertEquals(expected, actual);
- //$select=EmployeeId,ne_Room/Id $expand=ne_Room/nr_Building/nb_Rooms
- actual = getExpandSelectTree("ne_Manager/EmployeeId,ne_Manager/ne_Room", "ne_Manager/ne_Room/nr_Building").toJsonString();
+ // $select=EmployeeId,ne_Room/Id $expand=ne_Room/nr_Building/nb_Rooms
+ actual =
+ getExpandSelectTree("ne_Manager/EmployeeId,ne_Manager/ne_Room", "ne_Manager/ne_Room/nr_Building")
+ .toJsonString();
assertEquals(expected, actual);
}
@Test
public void twoExpandsTest() throws Exception {
- //{"all":false,"properties":[],"links":[{"ne_Manager":{"all":true,"properties":[],"links":[{"ne_Room":{"all":true,"properties":[],"links":[{"nr_Building":{"all":true,"properties":[],"links":[]}}]}},{"ne_Team":{"all":true,"properties":[],"links":[]}}]}}]}
- String expected1 = "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[],\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true,\"properties\":[],\"links\":[]}}]}},{\"ne_Team\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
- String expected2 = "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[],\"links\":[{\"ne_Team\":{\"all\":true,\"properties\":[],\"links\":[]}},{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}}]}";
-
- //$select=ne_Manager $expand=ne_Manager/ne_Room/nr_Building,ne_Manager/ne_Team
- String actual = getExpandSelectTree("ne_Manager", "ne_Manager/ne_Room/nr_Building,ne_Manager/ne_Team").toJsonString();
+ // {"all":false,"properties":[],"links":[{"ne_Manager":{"all":true,"properties":[],
+ //"links":[{"ne_Room":{"all":true,"properties":[],"links":[{"nr_Building":{"all":true,"properties":[],
+ //"links":[]}}]}},{"ne_Team":{"all":true,"properties":[],"links":[]}}]}}]}
+ String expected1 =
+ "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[]," +
+ "\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true," +
+ "\"properties\":[],\"links\":[]}}]}},{\"ne_Team\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
+ String expected2 =
+ "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[]," +
+ "\"links\":[{\"ne_Team\":{\"all\":true,\"properties\":[],\"links\":[]}},{\"ne_Room\":{\"all\":true," +
+ "\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}}]}";
+
+ // $select=ne_Manager $expand=ne_Manager/ne_Room/nr_Building,ne_Manager/ne_Team
+ String actual =
+ getExpandSelectTree("ne_Manager", "ne_Manager/ne_Room/nr_Building,ne_Manager/ne_Team").toJsonString();
if (!expected1.equals(actual) && !expected2.equals(actual)) {
fail("Either " + expected1 + " or " + expected2 + " expected but was: " + actual);
}
- //$select=ne_Manager $expand=ne_Manager/ne_Team,ne_Manager/ne_Room/nr_Building
+ // $select=ne_Manager $expand=ne_Manager/ne_Team,ne_Manager/ne_Room/nr_Building
actual = getExpandSelectTree("ne_Manager", "ne_Manager/ne_Team,ne_Manager/ne_Room/nr_Building").toJsonString();
if (!expected1.equals(actual) && !expected2.equals(actual)) {
fail("Either " + expected1 + " or " + expected2 + " expected but was: " + actual);
}
- //$select=ne_Manager,ne_Manager/ne_Team/Id $expand=ne_Manager/ne_Team,ne_Manager/ne_Room/nr_Building
- actual = getExpandSelectTree("ne_Manager,ne_Manager/ne_Team/Id", "ne_Manager/ne_Team,ne_Manager/ne_Room/nr_Building").toJsonString();
+ // $select=ne_Manager,ne_Manager/ne_Team/Id $expand=ne_Manager/ne_Team,ne_Manager/ne_Room/nr_Building
+ actual =
+ getExpandSelectTree("ne_Manager,ne_Manager/ne_Team/Id", "ne_Manager/ne_Team,ne_Manager/ne_Room/nr_Building")
+ .toJsonString();
if (!expected1.equals(actual) && !expected2.equals(actual)) {
fail("Either " + expected1 + " or " + expected2 + " expected but was: " + actual);
}
- //$select=ne_Manager/ne_Team/Id,ne_Manager $expand=ne_Manager/ne_Team,ne_Manager/ne_Room/nr_Building
- actual = getExpandSelectTree("ne_Manager/ne_Team/Id,ne_Manager", "ne_Manager/ne_Team,ne_Manager/ne_Room/nr_Building").toJsonString();
+ // $select=ne_Manager/ne_Team/Id,ne_Manager $expand=ne_Manager/ne_Team,ne_Manager/ne_Room/nr_Building
+ actual =
+ getExpandSelectTree("ne_Manager/ne_Team/Id,ne_Manager", "ne_Manager/ne_Team,ne_Manager/ne_Room/nr_Building")
+ .toJsonString();
if (!expected1.equals(actual) && !expected2.equals(actual)) {
fail("Either " + expected1 + " or " + expected2 + " expected but was: " + actual);
}
@@ -441,16 +489,25 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
@Test
public void oneExpandsFourSelects() throws Exception {
- //{"all":false,"properties":[],"links":[{"ne_Manager":{"all":true,"properties":[],"links":[{"ne_Room":{"all":true,"properties":[],"links":[{"nr_Building":{"all":true,"properties":[],"links":[]}}]}}]}}]}
- String expected = "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[],\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}}]}";
+ // {"all":false,"properties":[],"links":[{"ne_Manager":{"all":true,"properties":[],"links":[{"ne_Room":
+ //{"all":true,"properties":[],"links":[{"nr_Building":{"all":true,"properties":[],"links":[]}}]}}]}}]}
+ String expected =
+ "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[],\"links\":" +
+ "[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true,\"properties\":" +
+ "[],\"links\":[]}}]}}]}}]}";
- //$select=ne_Manager/EmployeeId,ne_Manager/ne_Room/Id,ne_Manager/ne_Room/nr_Building/Id,ne_Manager $expand=ne_Manager/ne_Room/nr_Building
- String actual = getExpandSelectTree("ne_Manager/EmployeeId,ne_Manager/ne_Room/Id,ne_Manager/ne_Room/nr_Building/Id,ne_Manager", "ne_Manager/ne_Room/nr_Building").toJsonString();
+ // $select=ne_Manager/EmployeeId,ne_Manager/ne_Room/Id,ne_Manager/ne_Room/nr_Building/Id,ne_Manager
+ // $expand=ne_Manager/ne_Room/nr_Building
+ String actual =
+ getExpandSelectTree("ne_Manager/EmployeeId,ne_Manager/ne_Room/Id,ne_Manager/ne_Room/nr_Building/Id,ne_Manager",
+ "ne_Manager/ne_Room/nr_Building").toJsonString();
assertEquals(expected, actual);
}
- private ExpandSelectTreeNodeImpl getExpandSelectTree(final String selectString, final String expandString) throws Exception {
- final List<PathSegment> pathSegments = MockFacade.getPathSegmentsAsODataPathSegmentMock(Arrays.asList("Employees('1')"));
+ private ExpandSelectTreeNodeImpl getExpandSelectTree(final String selectString, final String expandString)
+ throws Exception {
+ final List<PathSegment> pathSegments =
+ MockFacade.getPathSegmentsAsODataPathSegmentMock(Arrays.asList("Employees('1')"));
Map<String, String> queryParameters = new HashMap<String, String>();
if (selectString != null) {
@@ -462,7 +519,8 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
final UriInfo uriInfo = UriParser.parse(edm, pathSegments, queryParameters);
- ExpandSelectTreeCreator expandSelectTreeCreator = new ExpandSelectTreeCreator(uriInfo.getSelect(), uriInfo.getExpand());
+ ExpandSelectTreeCreator expandSelectTreeCreator =
+ new ExpandSelectTreeCreator(uriInfo.getSelect(), uriInfo.getExpand());
ExpandSelectTreeNode expandSelectTree = expandSelectTreeCreator.create();
assertNotNull(expandSelectTree);
return (ExpandSelectTreeNodeImpl) expandSelectTree;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/QueryOptionsEnumTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/QueryOptionsEnumTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/QueryOptionsEnumTest.java
index 8790880..9e7f0a6 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/QueryOptionsEnumTest.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/QueryOptionsEnumTest.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.uri;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/UriInfoTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/UriInfoTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/UriInfoTest.java
index 54a3ec2..97fe846 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/UriInfoTest.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/UriInfoTest.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.uri;
@@ -56,11 +56,11 @@ public class UriInfoTest extends BaseTest {
}
/**
- * Parse the URI part after an OData service root, given as string.
- * Query parameters can be included.
- * @param uri the URI part
- * @return a {@link UriInfoImpl} instance containing the parsed information
- */
+ * Parse the URI part after an OData service root, given as string.
+ * Query parameters can be included.
+ * @param uri the URI part
+ * @return a {@link UriInfoImpl} instance containing the parsed information
+ */
private UriInfoImpl parse(final String uri) throws UriSyntaxException, UriNotMatchingException, EdmException {
final String[] path = uri.split("\\?", -1);
if (path.length > 2) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/UriParserFacadeTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/UriParserFacadeTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/UriParserFacadeTest.java
index 242c3d9..e608d9b 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/UriParserFacadeTest.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/UriParserFacadeTest.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.uri;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/UriParserTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/UriParserTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/UriParserTest.java
index 9ec3c51..b914347 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/UriParserTest.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/UriParserTest.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.uri;
@@ -54,7 +54,7 @@ import org.junit.Test;
/**
* Tests for OData URI parsing.
- *
+ *
*/
public class UriParserTest extends BaseTest {
@@ -66,11 +66,11 @@ public class UriParserTest extends BaseTest {
}
/**
- * Parse the URI part after an OData service root, given as string.
- * Query parameters can be included.
- * @param uri the URI part
- * @return a {@link UriInfoImpl} instance containing the parsed information
- */
+ * Parse the URI part after an OData service root, given as string.
+ * Query parameters can be included.
+ * @param uri the URI part
+ * @return a {@link UriInfoImpl} instance containing the parsed information
+ */
private UriInfoImpl parse(final String uri) throws UriSyntaxException, UriNotMatchingException, EdmException {
final String[] path = uri.split("\\?", -1);
if (path.length > 2) {
@@ -135,7 +135,9 @@ public class UriParserTest extends BaseTest {
result = parse("");
assertEquals(UriType.URI0, result.getUriType());
- result = (UriInfoImpl) new UriParserImpl(edm).parse(Collections.<PathSegment> emptyList(), Collections.<String, String> emptyMap());
+ result =
+ (UriInfoImpl) new UriParserImpl(edm).parse(Collections.<PathSegment> emptyList(), Collections
+ .<String, String> emptyMap());
assertEquals(UriType.URI0, result.getUriType());
}
@@ -599,7 +601,8 @@ public class UriParserTest extends BaseTest {
UriInfoImpl result = parse("EmployeeSearch?q='Hugo'¬aparameter=2");
assertEquals("EmployeeSearch", result.getFunctionImport().getName());
assertEquals(1, result.getFunctionImportParameters().size());
- assertEquals(EdmSimpleTypeKind.String.getEdmSimpleTypeInstance(), result.getFunctionImportParameters().get("q").getType());
+ assertEquals(EdmSimpleTypeKind.String.getEdmSimpleTypeInstance(), result.getFunctionImportParameters().get("q")
+ .getType());
assertEquals("Hugo", result.getFunctionImportParameters().get("q").getLiteral());
}
@@ -773,8 +776,10 @@ public class UriParserTest extends BaseTest {
@Test
public void parseInCompatibleSystemQueryOptions() throws Exception {
parseWrongUri("$metadata?$top=1", UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION);
- parseWrongUri("Employees('1')?$format=json&$inlinecount=allpages&$skiptoken=abc&$skip=2&$top=1", UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION);
- parseWrongUri("/Employees('1')/Location/Country/$value?$format=json", UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION);
+ parseWrongUri("Employees('1')?$format=json&$inlinecount=allpages&$skiptoken=abc&$skip=2&$top=1",
+ UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION);
+ parseWrongUri("/Employees('1')/Location/Country/$value?$format=json",
+ UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION);
parseWrongUri("/Employees('1')/Location/Country/$value?$skip=2", UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION);
parseWrongUri("/Employees('1')/EmployeeName/$value?$format=json", UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION);
parseWrongUri("/Employees('1')/EmployeeName/$value?$skip=2", UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION);
@@ -813,7 +818,8 @@ public class UriParserTest extends BaseTest {
assertEquals(UriType.URI1, result.getUriType());
assertEquals(1, result.getSelect().size());
assertEquals(1, result.getSelect().get(0).getNavigationPropertySegments().size());
- assertEquals("Managers", result.getSelect().get(0).getNavigationPropertySegments().get(0).getTargetEntitySet().getName());
+ assertEquals("Managers", result.getSelect().get(0).getNavigationPropertySegments().get(0).getTargetEntitySet()
+ .getName());
assertNull(result.getSelect().get(0).getProperty());
result = parse("Teams?$select=nt_Employees/ne_Manager/*");
@@ -839,7 +845,8 @@ public class UriParserTest extends BaseTest {
assertEquals("EmployeeName", result.getSelect().get(1).getProperty().getName());
assertEquals("Location", result.getSelect().get(2).getProperty().getName());
assertEquals(1, result.getSelect().get(0).getNavigationPropertySegments().size());
- assertEquals("Managers", result.getSelect().get(0).getNavigationPropertySegments().get(0).getTargetEntitySet().getName());
+ assertEquals("Managers", result.getSelect().get(0).getNavigationPropertySegments().get(0).getTargetEntitySet()
+ .getName());
result = parse("Managers('1')?$select=nm_Employees/EmployeeName,nm_Employees/Location");
assertEquals("Managers", result.getTargetEntitySet().getName());
@@ -848,7 +855,8 @@ public class UriParserTest extends BaseTest {
assertEquals("EmployeeName", result.getSelect().get(0).getProperty().getName());
assertEquals("Location", result.getSelect().get(1).getProperty().getName());
assertEquals(1, result.getSelect().get(0).getNavigationPropertySegments().size());
- assertEquals("Employees", result.getSelect().get(0).getNavigationPropertySegments().get(0).getTargetEntitySet().getName());
+ assertEquals("Employees", result.getSelect().get(0).getNavigationPropertySegments().get(0).getTargetEntitySet()
+ .getName());
}
@Test
@@ -876,7 +884,8 @@ public class UriParserTest extends BaseTest {
assertEquals(1, result.getExpand().size());
assertEquals(1, result.getExpand().get(0).size());
assertEquals("Employees", result.getExpand().get(0).get(0).getTargetEntitySet().getName());
- assertEquals(result.getTargetEntitySet().getEntityType().getProperty("nm_Employees"), result.getExpand().get(0).get(0).getNavigationProperty());
+ assertEquals(result.getTargetEntitySet().getEntityType().getProperty("nm_Employees"), result.getExpand().get(0)
+ .get(0).getNavigationProperty());
}
@Test
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImplTool.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImplTool.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImplTool.java
index 203344b..87f42ed 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImplTool.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImplTool.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.uri.expression;
@@ -37,33 +37,38 @@ public class FilterParserImplTool extends FilterParserImpl {
public void addTestfunctions() {
Map<String, InfoMethod> lAvailableMethods = new HashMap<String, InfoMethod>(availableMethods);
ParameterSetCombination combination = null;
- //create type helpers
+ // create type helpers
- //TESTING
+ // TESTING
combination = new ParameterSetCombination.PSCflex();
- lAvailableMethods.put("testingMINMAX1", new InfoMethod(MethodOperator.CONCAT, "testingMINMAX1", -1, -1, combination));
+ lAvailableMethods.put("testingMINMAX1",
+ new InfoMethod(MethodOperator.CONCAT, "testingMINMAX1", -1, -1, combination));
- //TESTING
+ // TESTING
combination = new ParameterSetCombination.PSCflex();
- lAvailableMethods.put("testingMINMAX2", new InfoMethod(MethodOperator.CONCAT, "testingMINMAX2", 0, -1, combination));
+ lAvailableMethods
+ .put("testingMINMAX2", new InfoMethod(MethodOperator.CONCAT, "testingMINMAX2", 0, -1, combination));
- //TESTING
+ // TESTING
combination = new ParameterSetCombination.PSCflex();
- lAvailableMethods.put("testingMINMAX3", new InfoMethod(MethodOperator.CONCAT, "testingMINMAX3", 2, -1, combination));
+ lAvailableMethods
+ .put("testingMINMAX3", new InfoMethod(MethodOperator.CONCAT, "testingMINMAX3", 2, -1, combination));
- //TESTING
+ // TESTING
combination = new ParameterSetCombination.PSCflex();
- lAvailableMethods.put("testingMINMAX4", new InfoMethod(MethodOperator.CONCAT, "testingMINMAX4", -1, 0, combination));
+ lAvailableMethods
+ .put("testingMINMAX4", new InfoMethod(MethodOperator.CONCAT, "testingMINMAX4", -1, 0, combination));
- //TESTING
+ // TESTING
combination = new ParameterSetCombination.PSCflex();
- lAvailableMethods.put("testingMINMAX5", new InfoMethod(MethodOperator.CONCAT, "testingMINMAX5", -1, 2, combination));
+ lAvailableMethods
+ .put("testingMINMAX5", new InfoMethod(MethodOperator.CONCAT, "testingMINMAX5", -1, 2, combination));
- //TESTING
+ // TESTING
combination = new ParameterSetCombination.PSCflex();
lAvailableMethods.put("testingMINMAX6", new InfoMethod(MethodOperator.CONCAT, "testingMINMAX6", 1, 2, combination));
- //TESTING
+ // TESTING
combination = new ParameterSetCombination.PSCflex();
lAvailableMethods.put("testingMINMAX7", new InfoMethod(MethodOperator.CONCAT, "testingMINMAX7", 1, 1, combination));
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/FilterToJsonTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/FilterToJsonTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/FilterToJsonTest.java
index 7274a6c..17e62e9 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/FilterToJsonTest.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/FilterToJsonTest.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.uri.expression;
@@ -183,7 +183,8 @@ public class FilterToJsonTest {
checkProperty(path, null, "PostalCode");
}
- private void checkUnary(final StringMap<Object> unary, final UnaryOperator expectedOperator, final String expectedType) {
+ private void
+ checkUnary(final StringMap<Object> unary, final UnaryOperator expectedOperator, final String expectedType) {
assertEquals(ExpressionKind.UNARY.toString(), unary.get(NODETYPE));
assertEquals(expectedOperator.toString(), unary.get(OPERATOR));
assertEquals(expectedType, unary.get(TYPE));
@@ -197,7 +198,8 @@ public class FilterToJsonTest {
assertNotNull(member.get(PATH));
}
- private void checkMethod(final StringMap<Object> method, final MethodOperator expectedOperator, final String expectedType) {
+ private void checkMethod(final StringMap<Object> method, final MethodOperator expectedOperator,
+ final String expectedType) {
assertEquals(ExpressionKind.METHOD.toString(), method.get(NODETYPE));
assertEquals(expectedOperator.toString(), method.get(OPERATOR));
assertEquals(expectedType, method.get(TYPE));
@@ -216,7 +218,8 @@ public class FilterToJsonTest {
assertEquals(expectedValue, literal.get(VALUE));
}
- private void checkBinary(final StringMap<Object> binary, final String expectedOperator, final String expectedType) throws Exception {
+ private void checkBinary(final StringMap<Object> binary, final String expectedOperator, final String expectedType)
+ throws Exception {
assertEquals(ExpressionKind.BINARY.toString(), binary.get(NODETYPE));
assertEquals(expectedOperator, binary.get(OPERATOR));
assertEquals(expectedType, binary.get(TYPE));
@@ -224,7 +227,8 @@ public class FilterToJsonTest {
assertNotNull(binary.get(RIGHT));
}
- private static String toJson(final FilterExpression expression) throws ExceptionVisitExpression, ODataApplicationException {
+ private static String toJson(final FilterExpression expression) throws ExceptionVisitExpression,
+ ODataApplicationException {
return (String) expression.accept(new JsonVisitor());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/ParserTool.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/ParserTool.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/ParserTool.java
index 86c9e2e..1c7d08b 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/ParserTool.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/ParserTool.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.uri.expression;
@@ -72,7 +72,8 @@ public class ParserTool {
ParserTool.log.debug(out);
}
- public ParserTool(final String expression, final boolean isOrder, final boolean addTestfunctions, final boolean allowOnlyBinary) {
+ public ParserTool(final String expression, final boolean isOrder, final boolean addTestfunctions,
+ final boolean allowOnlyBinary) {
dout("ParserTool - Testing: " + expression);
this.expression = expression;
@@ -96,7 +97,8 @@ public class ParserTool {
curNode = tree;
}
- public ParserTool(final String expression, final boolean isOrder, final boolean addTestfunctions, final boolean allowOnlyBinary, final EdmEntityType resourceEntityType) {
+ public ParserTool(final String expression, final boolean isOrder, final boolean addTestfunctions,
+ final boolean allowOnlyBinary, final EdmEntityType resourceEntityType) {
dout("ParserTool - Testing: " + expression);
this.expression = expression;
@@ -140,7 +142,7 @@ public class ParserTool {
* Verifies that the thrown exception is of {@paramref expected}
*
* @param expected
- * Expected Exception class
+ * Expected Exception class
* @return ParserTool
*/
public ParserTool aExType(final Class<? extends Exception> expected) {
@@ -159,11 +161,10 @@ public class ParserTool {
}
/**
- * Verifies that the message text of the thrown exception serialized is
- * {@paramref messageText}
+ * Verifies that the message text of the thrown exception serialized is {@paramref messageText}
*
* @param messageText
- * Expected message text
+ * Expected message text
* @return this
*/
public ParserTool aExMsgText(final String messageText) {
@@ -384,7 +385,9 @@ public class ParserTool {
String info = "GetExpr(" + expression + ")-->";
if ((curNode.getKind() != ExpressionKind.ORDER) && (curNode.getKind() != ExpressionKind.FILTER)) {
- String out = info + "Expected: " + ExpressionKind.ORDER + " or " + ExpressionKind.FILTER + " Actual: " + curNode.getKind().toString();
+ String out =
+ info + "Expected: " + ExpressionKind.ORDER + " or " + ExpressionKind.FILTER + " Actual: "
+ + curNode.getKind().toString();
dout(" " + out);
fail(out);
}
@@ -411,7 +414,8 @@ public class ParserTool {
PropertyExpressionImpl propertyExpression = (PropertyExpressionImpl) curNode;
try {
- dout(" " + info + "Expected: Property'" + string.getName() + "' Actual: " + propertyExpression.getEdmProperty().getName());
+ dout(" " + info + "Expected: Property'" + string.getName() + "' Actual: "
+ + propertyExpression.getEdmProperty().getName());
} catch (EdmException e) {
fail("Error in aEdmProperty:" + e.getLocalizedMessage());
}
@@ -457,7 +461,9 @@ public class ParserTool {
case METHOD:
case PROPERTY:
String info = "param(" + expression + ")-->";
- info = " " + info + "Expected: " + ExpressionKind.BINARY.toString() + " or " + ExpressionKind.MEMBER.toString() + " Actual: " + curNode.getKind();
+ info =
+ " " + info + "Expected: " + ExpressionKind.BINARY.toString() + " or " + ExpressionKind.MEMBER.toString()
+ + " Actual: " + curNode.getKind();
dout(info);
fail(info);
break;
@@ -482,7 +488,9 @@ public class ParserTool {
case METHOD:
case PROPERTY:
String info = "param(" + expression + ")-->";
- info = " " + info + "Expected: " + ExpressionKind.BINARY.toString() + " or " + ExpressionKind.MEMBER.toString() + " Actual: " + curNode.getKind();
+ info =
+ " " + info + "Expected: " + ExpressionKind.BINARY.toString() + " or " + ExpressionKind.MEMBER.toString()
+ + " Actual: " + curNode.getKind();
dout(info);
fail(info);
break;
@@ -527,7 +535,8 @@ public class ParserTool {
MethodExpressionImpl methodExpressionImpl = (MethodExpressionImpl) curNode;
if (i >= methodExpressionImpl.getParameterCount()) {
String info = "param(" + expression + ")-->";
- info = " " + info + "Too wrong index! Expected max: " + methodExpressionImpl.getParameterCount() + " Actual: " + i;
+ info =
+ " " + info + "Too wrong index! Expected max: " + methodExpressionImpl.getParameterCount() + " Actual: " + i;
dout(info);
fail(info);
}