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/10/08 16:36:36 UTC
[2/3] Enhance Media Resource Handling
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducerTest.java
index b10c68e..0ce9980 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducerTest.java
@@ -23,14 +23,17 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.TimeZone;
import org.apache.olingo.odata2.api.ODataCallback;
import org.apache.olingo.odata2.api.edm.EdmEntitySet;
@@ -54,6 +57,7 @@ import org.junit.Test;
import org.mockito.Mockito;
import com.google.gson.Gson;
+import com.google.gson.internal.StringMap;
/**
*
@@ -71,12 +75,7 @@ public class JsonEntryEntityProducerTest extends BaseTest {
teamData.put("isScrumTeam", true);
final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, teamData, DEFAULT_PROPERTIES);
- assertNotNull(response);
- assertNotNull(response.getEntity());
- assertNull("EntitypProvider must not set content header", response.getContentHeader());
-
- final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
- assertNotNull(json);
+ final String json = verifyResponse(response);
assertEquals("{\"d\":{\"__metadata\":{\"id\":\"" + BASE_URI + "Teams('1')\","
+ "\"uri\":\"" + BASE_URI + "Teams('1')\",\"type\":\"RefScenario.Team\"},"
+ "\"Id\":\"1\",\"Name\":null,\"isScrumTeam\":true,"
@@ -111,12 +110,7 @@ public class JsonEntryEntityProducerTest extends BaseTest {
final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, buildingData,
EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node).build());
- assertNotNull(response);
- assertNotNull(response.getEntity());
- assertNull("EntitypProvider must not set content header", response.getContentHeader());
-
- final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
- assertNotNull(json);
+ final String json = verifyResponse(response);
assertEquals("{\"d\":{\"__metadata\":{\"id\":\"" + BASE_URI + "Buildings('1')\","
+ "\"uri\":\"" + BASE_URI + "Buildings('1')\",\"type\":\"RefScenario.Building\"},"
+ "\"nb_Rooms\":{\"__deferred\":{\"uri\":\"" + BASE_URI + "Buildings('1')/nb_Rooms\"}}}}",
@@ -130,15 +124,12 @@ public class JsonEntryEntityProducerTest extends BaseTest {
photoData.put("Id", 1);
photoData.put("Type", "image/png");
photoData.put("BinaryData", new byte[] { -1, 0, 1, 2 });
- photoData.put("getType", "image/png");
- final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, photoData, DEFAULT_PROPERTIES);
- assertNotNull(response);
- assertNotNull(response.getEntity());
- assertNull("EntitypProvider must not set content header", response.getContentHeader());
+ EntityProviderWriteProperties writeProperties =
+ EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).mediaResourceTypeKey("Type").build();
- final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
- assertNotNull(json);
+ final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, photoData, writeProperties);
+ final String json = verifyResponse(response);
assertEquals("{\"d\":{\"__metadata\":{"
+ "\"id\":\"" + BASE_URI + "Container2.Photos(Id=1,Type='image%2Fpng')\","
+ "\"uri\":\"" + BASE_URI + "Container2.Photos(Id=1,Type='image%2Fpng')\","
@@ -162,14 +153,13 @@ public class JsonEntryEntityProducerTest extends BaseTest {
ExpandSelectTreeNode node = Mockito.mock(ExpandSelectTreeNode.class);
Mockito.when(node.getProperties()).thenReturn(Arrays.asList(property));
- final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, employeeData,
- EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node).build());
- assertNotNull(response);
- assertNotNull(response.getEntity());
- assertNull("EntitypProvider must not set content header", response.getContentHeader());
+ EntityProviderWriteProperties writeProperties =
+ EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).mediaResourceTypeKey("getImageType")
+ .serviceRoot(URI.create(BASE_URI)).expandSelectTree(node).build();
- final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
- assertNotNull(json);
+ final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, employeeData,
+ writeProperties);
+ final String json = verifyResponse(response);
assertEquals("{\"d\":{\"__metadata\":{"
+ "\"id\":\"" + BASE_URI + "Employees('1')\","
+ "\"uri\":\"" + BASE_URI + "Employees('1')\","
@@ -303,12 +293,7 @@ public class JsonEntryEntityProducerTest extends BaseTest {
new JsonEntityProvider().writeEntry(entitySet, roomData,
EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1)
.callbacks(callbacks).build());
- assertNotNull(response);
- assertNotNull(response.getEntity());
- assertNull("EntitypProvider must not set content header", response.getContentHeader());
-
- final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
- assertNotNull(json);
+ final String json = verifyResponse(response);
assertEquals("{\"d\":{\"__metadata\":{\"id\":\"" + BASE_URI + "Rooms('1')\","
+ "\"uri\":\"" + BASE_URI + "Rooms('1')\",\"type\":\"RefScenario.Room\",\"etag\":\"W/\\\"1\\\"\"},"
+ "\"nr_Building\":{\"__metadata\":{\"id\":\"" + BASE_URI + "Buildings('1')\","
@@ -333,12 +318,7 @@ public class JsonEntryEntityProducerTest extends BaseTest {
final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, roomData,
EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1).build());
- assertNotNull(response);
- assertNotNull(response.getEntity());
- assertNull("EntitypProvider must not set content header", response.getContentHeader());
-
- final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
- assertNotNull(json);
+ final String json = verifyResponse(response);
assertEquals("{\"d\":{\"__metadata\":{\"id\":\"" + BASE_URI + "Rooms('1')\","
+ "\"uri\":\"" + BASE_URI + "Rooms('1')\",\"type\":\"RefScenario.Room\",\"etag\":\"W/\\\"1\\\"\"},"
+ "\"nr_Building\":{\"__deferred\":{\"uri\":\"" + BASE_URI + "Rooms('1')/nr_Building\"}}}}",
@@ -402,12 +382,7 @@ public class JsonEntryEntityProducerTest extends BaseTest {
new JsonEntityProvider().writeEntry(entitySet, buildingData,
EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1)
.callbacks(callbacks).build());
- assertNotNull(response);
- assertNotNull(response.getEntity());
- assertNull("EntitypProvider must not set content header", response.getContentHeader());
-
- final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
- assertNotNull(json);
+ final String json = verifyResponse(response);
assertEquals("{\"d\":{\"__metadata\":{\"id\":\"" + BASE_URI + "Buildings('1')\","
+ "\"uri\":\"" + BASE_URI + "Buildings('1')\",\"type\":\"RefScenario.Building\"},"
+ "\"nb_Rooms\":{\"results\":[{\"__metadata\":{\"id\":\"" + BASE_URI + "Rooms('1')\","
@@ -526,12 +501,7 @@ public class JsonEntryEntityProducerTest extends BaseTest {
final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, buildingData,
EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1).build());
- assertNotNull(response);
- assertNotNull(response.getEntity());
- assertNull("EntitypProvider must not set content header", response.getContentHeader());
-
- final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
- assertNotNull(json);
+ final String json = verifyResponse(response);
assertEquals("{\"d\":{\"__metadata\":{\"id\":\"" + BASE_URI + "Buildings('1')\","
+ "\"uri\":\"" + BASE_URI + "Buildings('1')\",\"type\":\"RefScenario.Building\"},"
+ "\"nb_Rooms\":{\"__deferred\":{\"uri\":\"" + BASE_URI + "Buildings('1')/nb_Rooms\"}}}}",
@@ -556,6 +526,173 @@ public class JsonEntryEntityProducerTest extends BaseTest {
new JsonEntityProvider().writeEntry(entitySet, buildingData,
EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1).callbacks(callbacks)
.build());
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void serializeWithCustomSrcAttributeOnEmployee() throws Exception {
+ Map<String, Object> employeeData = new HashMap<String, Object>();
+
+ Calendar date = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ date.clear();
+ date.set(1999, 0, 1);
+
+ employeeData.put("EmployeeId", "1");
+ employeeData.put("ImmageUrl", null);
+ employeeData.put("ManagerId", "1");
+ employeeData.put("Age", new Integer(52));
+ employeeData.put("RoomId", "1");
+ employeeData.put("EntryDate", date);
+ employeeData.put("TeamId", "42");
+ employeeData.put("EmployeeName", "Walter Winter");
+
+ Map<String, Object> locationData = new HashMap<String, Object>();
+ Map<String, Object> cityData = new HashMap<String, Object>();
+ cityData.put("PostalCode", "33470");
+ cityData.put("CityName", "Duckburg");
+ locationData.put("City", cityData);
+ locationData.put("Country", "Calisota");
+
+ employeeData.put("Location", locationData);
+
+ String mediaResourceSourceKey = "~src";
+ employeeData.put(mediaResourceSourceKey, "http://localhost:8080/images/image1");
+ EntityProviderWriteProperties localProperties =
+ EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).mediaResourceSourceKey(mediaResourceSourceKey
+ ).build();
+ ODataResponse response =
+ new JsonEntityProvider().writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet(
+ "Employees"),
+ employeeData,
+ localProperties);
+ String jsonString = verifyResponse(response);
+ Gson gson = new Gson();
+ StringMap<Object> jsonMap = gson.fromJson(jsonString, StringMap.class);
+ jsonMap = (StringMap<Object>) jsonMap.get("d");
+ jsonMap = (StringMap<Object>) jsonMap.get("__metadata");
+
+ assertEquals("http://localhost:8080/images/image1", jsonMap.get("media_src"));
+ assertEquals("application/octet-stream", jsonMap.get("content_type"));
+ assertEquals("http://host:80/service/Employees('1')/$value", jsonMap.get("edit_media"));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void serializeWithCustomSrcAndTypeAttributeOnEmployee() throws Exception {
+ Map<String, Object> employeeData = new HashMap<String, Object>();
+
+ Calendar date = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ date.clear();
+ date.set(1999, 0, 1);
+
+ employeeData.put("EmployeeId", "1");
+ employeeData.put("ImmageUrl", null);
+ employeeData.put("ManagerId", "1");
+ employeeData.put("Age", new Integer(52));
+ employeeData.put("RoomId", "1");
+ employeeData.put("EntryDate", date);
+ employeeData.put("TeamId", "42");
+ employeeData.put("EmployeeName", "Walter Winter");
+
+ Map<String, Object> locationData = new HashMap<String, Object>();
+ Map<String, Object> cityData = new HashMap<String, Object>();
+ cityData.put("PostalCode", "33470");
+ cityData.put("CityName", "Duckburg");
+ locationData.put("City", cityData);
+ locationData.put("Country", "Calisota");
+
+ employeeData.put("Location", locationData);
+ String mediaResourceSourceKey = "~src";
+ employeeData.put(mediaResourceSourceKey, "http://localhost:8080/images/image1");
+ String mediaResourceTypeKey = "~type";
+ employeeData.put(mediaResourceTypeKey, "image/jpeg");
+ EntityProviderWriteProperties localProperties =
+ EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).mediaResourceSourceKey(mediaResourceSourceKey
+ ).mediaResourceTypeKey(mediaResourceTypeKey).build();
+ ODataResponse response =
+ new JsonEntityProvider().writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet(
+ "Employees"),
+ employeeData,
+ localProperties);
+ String jsonString = verifyResponse(response);
+
+ Gson gson = new Gson();
+ StringMap<Object> jsonMap = gson.fromJson(jsonString, StringMap.class);
+ jsonMap = (StringMap<Object>) jsonMap.get("d");
+ jsonMap = (StringMap<Object>) jsonMap.get("__metadata");
+
+ assertEquals("http://localhost:8080/images/image1", jsonMap.get("media_src"));
+ assertEquals("image/jpeg", jsonMap.get("content_type"));
+ assertEquals("http://host:80/service/Employees('1')/$value", jsonMap.get("edit_media"));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void serializeWithCustomSrcAttributeOnRoom() throws Exception {
+ Map<String, Object> roomData = new HashMap<String, Object>();
+ roomData.put("Id", "1");
+ roomData.put("Name", "Neu Schwanstein");
+ roomData.put("Seats", new Integer(20));
+ roomData.put("Version", new Integer(3));
+
+ String mediaResourceSourceKey = "~src";
+ roomData.put(mediaResourceSourceKey, "http://localhost:8080/images/image1");
+ EntityProviderWriteProperties localProperties =
+ EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).mediaResourceSourceKey(mediaResourceSourceKey
+ ).build();
+ ODataResponse response =
+ new JsonEntityProvider().writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"),
+ roomData,
+ localProperties);
+ String jsonString = verifyResponse(response);
+ Gson gson = new Gson();
+ StringMap<Object> jsonMap = gson.fromJson(jsonString, StringMap.class);
+ jsonMap = (StringMap<Object>) jsonMap.get("d");
+ jsonMap = (StringMap<Object>) jsonMap.get("__metadata");
+
+ assertNull(jsonMap.get("media_src"));
+ assertNull(jsonMap.get("content_type"));
+ assertNull(jsonMap.get("edit_media"));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void serializeWithCustomSrcAndTypeAttributeOnRoom() throws Exception {
+ Map<String, Object> roomData = new HashMap<String, Object>();
+ roomData.put("Id", "1");
+ roomData.put("Name", "Neu Schwanstein");
+ roomData.put("Seats", new Integer(20));
+ roomData.put("Version", new Integer(3));
+
+ String mediaResourceSourceKey = "~src";
+ roomData.put(mediaResourceSourceKey, "http://localhost:8080/images/image1");
+ String mediaResourceTypeKey = "~type";
+ roomData.put(mediaResourceTypeKey, "image/jpeg");
+ EntityProviderWriteProperties localProperties =
+ EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).mediaResourceSourceKey(mediaResourceSourceKey
+ ).mediaResourceTypeKey(mediaResourceTypeKey).build();
+ ODataResponse response =
+ new JsonEntityProvider().writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"),
+ roomData,
+ localProperties);
+ String jsonString = verifyResponse(response);
+ Gson gson = new Gson();
+ StringMap<Object> jsonMap = gson.fromJson(jsonString, StringMap.class);
+ jsonMap = (StringMap<Object>) jsonMap.get("d");
+ jsonMap = (StringMap<Object>) jsonMap.get("__metadata");
+
+ assertNull(jsonMap.get("media_src"));
+ assertNull(jsonMap.get("content_type"));
+ assertNull(jsonMap.get("edit_media"));
+ }
+ private String verifyResponse(final ODataResponse response) throws IOException {
+ assertNotNull(response);
+ assertNotNull(response.getEntity());
+ assertNull("EntitypProvider must not set content header", response.getContentHeader());
+
+ final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
+ assertNotNull(json);
+ return json;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFunctionImportTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFunctionImportTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFunctionImportTest.java
index 001e7f1..97314fd 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFunctionImportTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFunctionImportTest.java
@@ -131,7 +131,7 @@ public class JsonFunctionImportTest extends BaseTest {
MockFacade.getMockEdm().getDefaultEntityContainer().getFunctionImport("OldestEmployee");
final String uri = "http://host:80/service/";
final EntityProviderWriteProperties properties =
- EntityProviderWriteProperties.serviceRoot(URI.create(uri)).build();
+ EntityProviderWriteProperties.serviceRoot(URI.create(uri)).mediaResourceTypeKey("getImageType").build();
Map<String, Object> employeeData = new HashMap<String, Object>();
employeeData.put("EmployeeId", "1");
employeeData.put("getImageType", "image/jpeg");
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/MessageServiceTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/MessageServiceTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/MessageServiceTest.java
index 553857f..6c0f7ab 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/MessageServiceTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/MessageServiceTest.java
@@ -42,7 +42,7 @@ public class MessageServiceTest extends BaseTest {
assertEquals(
"MessageService could not be created because of exception 'IllegalArgumentException with message " +
- "'Parameter locale MUST NOT be NULL.'.",
+ "'Parameter locale MUST NOT be NULL.'.",
ms.getText());
}
@@ -71,7 +71,7 @@ public class MessageServiceTest extends BaseTest {
assertEquals(
"Missing replacement for place holder in value 'First was [%1$s] and second was [%2$s]!' " +
- "for following arguments '[first]'!",
+ "for following arguments '[first]'!",
ms.getText());
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/ODataMessageTextVerifierTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/ODataMessageTextVerifierTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/ODataMessageTextVerifierTest.java
index 28d5c97..9c63ef2 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/ODataMessageTextVerifierTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/ODataMessageTextVerifierTest.java
@@ -48,14 +48,14 @@ public class ODataMessageTextVerifierTest extends BaseTest {
assertEquals(
"Error",
"Error-->Messagetext for key:\"org.apache.olingo.odata2.testutil.mock.SampleClassForInvalidMessageReferences." +
- "DOES_NOT_EXIST\" missing",
+ "DOES_NOT_EXIST\" missing",
ec.get(0).getMessage());
assertNotNull("!!!Error in testtool", ec.get(1));
assertEquals(
"Error",
"Error-->Messagetext for key:\"org.apache.olingo.odata2.testutil.mock.SampleClassForInvalidMessageReferences." +
- "EXITS_BUT_EMPTY\" empty",
+ "EXITS_BUT_EMPTY\" empty",
ec.get(1).getMessage());
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreatorImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreatorImplTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreatorImplTest.java
index 5c97db2..0e6c50e 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreatorImplTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreatorImplTest.java
@@ -164,10 +164,10 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
@Test
public void deepLinkInSelectAndExpand() throws Exception {
// {"all":false,"properties":[],"links":[{"ne_Room":{"all":false,"properties":[],
- //"links":[{"nr_Employees":{"all":true,"properties":[],"links":[]}}]}}]}
+ // "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\":[]}}]}}]}";
+ "\"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 =
@@ -200,8 +200,8 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
@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":[]}}]}}]}}]}
+ // "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";
@@ -225,7 +225,7 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
ExpandSelectTreeNodeImpl managerNode = (ExpandSelectTreeNodeImpl) links.get(navPropertyName);
String expected =
"{\"all\":true,\"properties\":[],\"links\":[{\"ne_Team\":{\"all\":true,\"properties\":[]," +
- "\"links\":[{\"nt_Employees\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
+ "\"links\":[{\"nt_Employees\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
String actualString = managerNode.toJsonString();
assertEquals(expected, actualString);
} else {
@@ -317,10 +317,10 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
@Test
public void multiExpandLinkWithoutSelect() throws Exception {
// {"all":true,"properties":[],"links":[{"ne_Manager":{"all":true,"properties":[],
- //"links":[{"ne_Manager":{"all":true,"properties":[],"links":[]}}]}}]}
+ // "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\":[]}}]}}]}";
+ "\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
// $expand=ne_Manager/ne_Manager,ne_Manager
String actual = getExpandSelectTree(null, "ne_Manager/ne_Manager,ne_Manager").toJsonString();
@@ -344,11 +344,11 @@ 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":[]}}]}}]}}]}
+ // "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\":[]}}]}}]}}]}";
+ "\"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();
@@ -373,7 +373,7 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
// {"all":false,"properties":["EmployeeId"],"links":[{"ne_Room":{"all":true,"properties":[],"links":[]}}]}
String expected =
"{\"all\":false,\"properties\":[\"EmployeeId\"],\"links\":[{\"ne_Room\":{\"all\":true," +
- "\"properties\":[],\"links\":[]}}]}";
+ "\"properties\":[],\"links\":[]}}]}";
// $select=EmployeeId,ne_Room/* $expand=ne_Room/nr_Building
String actual = getExpandSelectTree("EmployeeId,ne_Room/*", "ne_Room/nr_Building").toJsonString();
@@ -390,7 +390,7 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
// {"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\":[]}}]}";
+ "\"properties\":[\"Id\"],\"links\":[]}}]}";
// $select=EmployeeId,ne_Room/* $expand=ne_Room/nr_Building
String actual = getExpandSelectTree("EmployeeId,ne_Room/Id", "ne_Room/nr_Building").toJsonString();
@@ -421,12 +421,12 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
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":[]}}]}}]}}]}
+ // "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\":[]}}]}}]}}]}";
+ "\"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 =
@@ -445,16 +445,16 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
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":[]}}]}}]}
+ // "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\":[]}}]}}]}";
+ "\"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\":[]}}]}}]}}]}";
+ "\"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 =
@@ -490,11 +490,11 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
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":[]}}]}}]}}]}
+ // {"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\":[]}}]}}]}}]}";
+ "[{\"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
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestAbapCompatibility.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestAbapCompatibility.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestAbapCompatibility.java
index 7fdab60..4952a32 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestAbapCompatibility.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestAbapCompatibility.java
@@ -392,7 +392,7 @@ public class TestAbapCompatibility extends TestBase {
GetPTF("concat('125')")
.aExMsgText(
"No applicable method found for \"concat\" at position 1 in \"concat('125')\" with the " +
- "specified arguments. Method \"concat\" requires 2 or more arguments.");
+ "specified arguments. Method \"concat\" requires 2 or more arguments.");
// lcl_helper=>veri_expression_ex(
// iv_expression = `indexof('a','b','c')`
@@ -401,7 +401,7 @@ public class TestAbapCompatibility extends TestBase {
GetPTF("indexof('a','b','c')")
.aExMsgText(
"No applicable method found for \"indexof\" at position 1 in \"indexof('a','b','c')\" with " +
- "the specified arguments. Method \"indexof\" requires exact 2 argument(s).");
+ "the specified arguments. Method \"indexof\" requires exact 2 argument(s).");
// lcl_helper=>veri_expression_ex(
// iv_expression = `replace('aBa','B','CCC')`
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestParserExceptions.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestParserExceptions.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestParserExceptions.java
index 933bbb1..7cde803 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestParserExceptions.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestParserExceptions.java
@@ -94,19 +94,19 @@ public class TestParserExceptions extends TestBase {
GetPTF(edmEtAllTypes, "'text' eq NotAProperty")
.aExMsgText(
"No property \"NotAProperty\" exists in type \"TecRefScenario.EtAllTypes\" at" +
- " position 11 in \"'text' eq NotAProperty\".");
+ " position 11 in \"'text' eq NotAProperty\".");
// CASE 3
GetPTF(edmEtAllTypes, "Complex/NotAProperty")
.aExMsgText(
"No property \"NotAProperty\" exists in type \"TecRefScenario.CtAllTypes\" at" +
- " position 9 in \"Complex/NotAProperty\".");
+ " position 9 in \"Complex/NotAProperty\".");
// CASE 4
GetPTF(edmEtAllTypes, "'text' eq Complex/NotAProperty")
.aExMsgText(
"No property \"NotAProperty\" exists in type \"TecRefScenario.CtAllTypes\" at " +
- "position 19 in \"'text' eq Complex/NotAProperty\".");
+ "position 19 in \"'text' eq Complex/NotAProperty\".");
// CASE 5
GetPTF(edmEtAllTypes, "String/NotAProperty").aExMsgText(
@@ -146,7 +146,7 @@ public class TestParserExceptions extends TestBase {
.aExType(ExpressionParserException.class)
.aExMsgText(
"No applicable method found for \"startswith\" at position 1 in \"startswith()\" with the specified " +
- "arguments. Method \"startswith\" requires exact 2 argument(s).");
+ "arguments. Method \"startswith\" requires exact 2 argument(s).");
// CASE 13
// http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=startswith('A')
@@ -156,7 +156,7 @@ public class TestParserExceptions extends TestBase {
.aExType(ExpressionParserException.class)
.aExMsgText(
"No applicable method found for \"startswith\" at position 1 in \"startswith('A')\" with the specified " +
- "arguments. Method \"startswith\" requires exact 2 argument(s).");
+ "arguments. Method \"startswith\" requires exact 2 argument(s).");
// CASE 14
// http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=startswith('A','B')
@@ -171,18 +171,18 @@ public class TestParserExceptions extends TestBase {
.aExType(ExpressionParserException.class)
.aExMsgText(
"No applicable method found for \"startswith\" at position 1 in \"startswith('A','B','C')\" with the" +
- " specified arguments. Method \"startswith\" requires exact 2 argument(s).");
+ " specified arguments. Method \"startswith\" requires exact 2 argument(s).");
// CASE 16
GetPTF("concat()")
.aExMsgText(
"No applicable method found for \"concat\" at position 1 in \"concat()\" with the specified arguments." +
- " Method \"concat\" requires 2 or more arguments.");
+ " Method \"concat\" requires 2 or more arguments.");
// CASE 17
GetPTF("concat('A')")
.aExMsgText(
"No applicable method found for \"concat\" at position 1 in \"concat('A')\" with the specified " +
- "arguments. Method \"concat\" requires 2 or more arguments.");
+ "arguments. Method \"concat\" requires 2 or more arguments.");
// CASE 18
GetPTF("concat('A','B')").aSerialized("{concat('A','B')}");
// CASE 19
@@ -192,7 +192,7 @@ public class TestParserExceptions extends TestBase {
GetPTF("'A' and concat('A')")
.aExMsgText(
"No applicable method found for \"concat\" at position 9 in \"'A' and concat('A')\" with the specified " +
- "arguments. Method \"concat\" requires 2 or more arguments.");
+ "arguments. Method \"concat\" requires 2 or more arguments.");
// CASE 1
// http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=concat(
@@ -239,12 +239,12 @@ public class TestParserExceptions extends TestBase {
.aExType(ExpressionParserException.class)
.aExMsgText(
"No applicable method found for \"concat\" at position 1 in \"testingMINMAX3()\" with the specified " +
- "arguments. Method \"concat\" requires 2 or more arguments.");
+ "arguments. Method \"concat\" requires 2 or more arguments.");
GetPTF("testingMINMAX3('A')")
.aExType(ExpressionParserException.class)
.aExMsgText(
"No applicable method found for \"concat\" at position 1 in \"testingMINMAX3('A')\" with the specified " +
- "arguments. Method \"concat\" requires 2 or more arguments.");
+ "arguments. Method \"concat\" requires 2 or more arguments.");
GetPTF("testingMINMAX3('A','B')").aSerialized("{concat('A','B')}");
GetPTF("testingMINMAX3('A','B','C')").aSerialized("{concat('A','B','C')}");
@@ -255,17 +255,17 @@ public class TestParserExceptions extends TestBase {
.aExType(ExpressionParserException.class)
.aExMsgText(
"No applicable method found for \"concat\" at position 1 in \"testingMINMAX4('A')\" with the specified " +
- "arguments. Method \"concat\" requires maximal 0 arguments.");
+ "arguments. Method \"concat\" requires maximal 0 arguments.");
GetPTF("testingMINMAX4('A','B')")
.aExType(ExpressionParserException.class)
.aExMsgText(
"No applicable method found for \"concat\" at position 1 in \"testingMINMAX4('A','B')\" with the " +
- "specified arguments. Method \"concat\" requires maximal 0 arguments.");
+ "specified arguments. Method \"concat\" requires maximal 0 arguments.");
GetPTF("testingMINMAX4('A','B','C')")
.aExType(ExpressionParserException.class)
.aExMsgText(
"No applicable method found for \"concat\" at position 1 in \"testingMINMAX4('A','B','C')\" with the " +
- "specified arguments. Method \"concat\" requires maximal 0 arguments.");
+ "specified arguments. Method \"concat\" requires maximal 0 arguments.");
// CASE 9
// min =-1, max = 2,
@@ -276,7 +276,7 @@ public class TestParserExceptions extends TestBase {
.aExType(ExpressionParserException.class)
.aExMsgText(
"No applicable method found for \"concat\" at position 1 in \"testingMINMAX5('A','B','C')\" with the " +
- "specified arguments. Method \"concat\" requires maximal 2 arguments.");
+ "specified arguments. Method \"concat\" requires maximal 2 arguments.");
// CASE 10
// min =1, max = 2,
@@ -284,14 +284,14 @@ public class TestParserExceptions extends TestBase {
.aExType(ExpressionParserException.class)
.aExMsgText(
"No applicable method found for \"concat\" at position 1 in \"testingMINMAX6()\" with the specified " +
- "arguments. Method \"concat\" requires between 1 and 2 arguments.");
+ "arguments. Method \"concat\" requires between 1 and 2 arguments.");
GetPTF("testingMINMAX6('A')").aSerialized("{concat('A')}");
GetPTF("testingMINMAX6('A','B')").aSerialized("{concat('A','B')}");
GetPTF("testingMINMAX6('A','B','C')")
.aExType(ExpressionParserException.class)
.aExMsgText(
"No applicable method found for \"concat\" at position 1 in \"testingMINMAX6('A','B','C')\" with the " +
- "specified arguments. Method \"concat\" requires between 1 and 2 arguments.");
+ "specified arguments. Method \"concat\" requires between 1 and 2 arguments.");
// CASE 11
// min =1, max = 2,
@@ -299,18 +299,18 @@ public class TestParserExceptions extends TestBase {
.aExType(ExpressionParserException.class)
.aExMsgText(
"No applicable method found for \"concat\" at position 1 in \"testingMINMAX7()\" with the specified " +
- "arguments. Method \"concat\" requires exact 1 argument(s).");
+ "arguments. Method \"concat\" requires exact 1 argument(s).");
GetPTF("testingMINMAX7('A')").aSerialized("{concat('A')}");
GetPTF("testingMINMAX7('A','B')")
.aExType(ExpressionParserException.class)
.aExMsgText(
"No applicable method found for \"concat\" at position 1 in \"testingMINMAX7('A','B')\" with the " +
- "specified arguments. Method \"concat\" requires exact 1 argument(s).");
+ "specified arguments. Method \"concat\" requires exact 1 argument(s).");
GetPTF("testingMINMAX7('A','B','C')")
.aExType(ExpressionParserException.class)
.aExMsgText(
"No applicable method found for \"concat\" at position 1 in \"testingMINMAX7('A','B','C')\" with " +
- "the specified arguments. Method \"concat\" requires exact 1 argument(s).");
+ "the specified arguments. Method \"concat\" requires exact 1 argument(s).");
// CASE 12
// http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=concat('a' 'b')
@@ -342,7 +342,7 @@ public class TestParserExceptions extends TestBase {
.aExKey(ExpressionParserException.INVALID_TYPES_FOR_BINARY_OPERATOR)
.aExMsgText(
"Operator \"add\" incompatible with operand types \"System.Uint7\" and \"Edm.String\" at " +
- "position 5 in \"123 add 'abc'\".");
+ "position 5 in \"123 add 'abc'\".");
}
@Test
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/VisitorTool.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/VisitorTool.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/VisitorTool.java
index c2b3ced..66af755 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/VisitorTool.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/VisitorTool.java
@@ -112,7 +112,7 @@ public class VisitorTool implements ExpressionVisitor {
}
@Override
- public Object visitOrder(final OrderExpression orderExpression, final Object filterResult,
+ public Object visitOrder(final OrderExpression orderExpression, final Object filterResult,
final SortOrder sortOrder) {
return "{o(" + filterResult + ", " + sortOrder.toString() + ")}";
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/AcceptHeaderTypeTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/AcceptHeaderTypeTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/AcceptHeaderTypeTest.java
index 33b2e82..ac77a6b 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/AcceptHeaderTypeTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/AcceptHeaderTypeTest.java
@@ -163,7 +163,7 @@ public class AcceptHeaderTypeTest extends AbstractBasicTest {
@Test
public void illegalLwsInAcceptHeaderParameter() throws Exception {
- testGetRequest("Employees('1')", "application/xml; param=\talskdf;", HttpStatusCodes.BAD_REQUEST,
+ testGetRequest("Employees('1')", "application/xml; param=\talskdf;", HttpStatusCodes.BAD_REQUEST,
"application/xml");
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/BasicBatchTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/BasicBatchTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/BasicBatchTest.java
index 761a3b5..f11d93a 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/BasicBatchTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/BasicBatchTest.java
@@ -68,7 +68,7 @@ public class BasicBatchTest extends AbstractBasicTest {
private static final String LF = "\n";
private static final String REG_EX_BOUNDARY =
"(([a-zA-Z0-9_\\-\\.'\\+]{1,70})|\"([a-zA-Z0-9_\\-\\.'\\+\\s\\(\\),/:=\\?]" +
- "{1,69}[a-zA-Z0-9_\\-\\.'\\+\\(\\),/:=\\?])\")";
+ "{1,69}[a-zA-Z0-9_\\-\\.'\\+\\(\\),/:=\\?])\")";
private static final String REG_EX = "multipart/mixed;\\s*boundary=" + REG_EX_BOUNDARY + "\\s*";
private static final String REQUEST_PAYLOAD =
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/ServiceResolutionTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/ServiceResolutionTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/ServiceResolutionTest.java
index f357602..f378715 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/ServiceResolutionTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/ServiceResolutionTest.java
@@ -254,8 +254,8 @@ public class ServiceResolutionTest extends BaseTest {
}
@Test
- public void testBaseUriWithEncoding() throws ClientProtocolException, IOException, ODataException,
- URISyntaxException {
+ public void testBaseUriWithEncoding() throws ClientProtocolException, IOException, ODataException,
+ URISyntaxException {
server.setPathSplit(3);
startServer();
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MapProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MapProcessor.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MapProcessor.java
index ded1086..26c7f58 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MapProcessor.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MapProcessor.java
@@ -61,7 +61,7 @@ public class MapProcessor extends ODataSingleProcessor {
}
@Override
- public ODataResponse readEntitySet(final GetEntitySetUriInfo uriInfo, final String contentType)
+ public ODataResponse readEntitySet(final GetEntitySetUriInfo uriInfo, final String contentType)
throws ODataException {
final EntityProviderWriteProperties properties =
EntityProviderWriteProperties.serviceRoot(getContext().getPathInfo().getServiceRoot()).build();
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java
index e802b06..2404a25 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java
@@ -157,7 +157,7 @@ public class AbstractRefTest extends AbstractFitTest {
assertNotNull(getBody(response));
}
- protected void deleteUri(final String uri, final HttpStatusCodes expectedStatusCode)
+ protected void deleteUri(final String uri, final HttpStatusCodes expectedStatusCode)
throws Exception, AssertionError {
final HttpResponse response = callUri(ODataHttpMethod.DELETE, uri, null, null, null, null, expectedStatusCode);
if (expectedStatusCode != HttpStatusCodes.NO_CONTENT) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonReadOnlyTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonReadOnlyTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonReadOnlyTest.java
index e2bc613..55d9379 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonReadOnlyTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonReadOnlyTest.java
@@ -115,7 +115,7 @@ public class EntryJsonReadOnlyTest extends AbstractRefTest {
public void entryWithTwoLevelInline() throws Exception {
HttpResponse response =
callUri("Employees('5')?$expand=ne_Room/nr_Building&$select=Age,ne_Room/Seats," +
- "ne_Room/nr_Building/Name&$format=json");
+ "ne_Room/nr_Building/Name&$format=json");
checkMediaType(response, HttpContentType.APPLICATION_JSON);
assertEquals("{\"d\":{\"__metadata\":{"
+ "\"id\":\"" + getEndpoint() + "Employees('5')\","
@@ -135,7 +135,7 @@ public class EntryJsonReadOnlyTest extends AbstractRefTest {
response =
callUri("Employees('1')?$expand=ne_Room/nr_Building&$select=EntryDate,ne_Manager,ne_Room/*," +
- "ne_Room/nr_Building/Name&$format=json");
+ "ne_Room/nr_Building/Name&$format=json");
checkMediaType(response, HttpContentType.APPLICATION_JSON);
assertEquals("{\"d\":{\"__metadata\":{"
+ "\"id\":\"" + getEndpoint() + "Employees('1')\","
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java
index 3bb834c..50a9b47 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java
@@ -71,7 +71,7 @@ public class EntryXmlReadOnlyTest extends AbstractRefXmlTest {
assertXpathEvaluatesTo(
EMPLOYEE_1_NAME,
"/atom:entry/atom:link[@href=\"Rooms('1')/nr_Employees\"]" +
- "/m:inline/atom:feed/atom:entry/m:properties/d:EmployeeName",
+ "/m:inline/atom:feed/atom:entry/m:properties/d:EmployeeName",
getBody(response));
response = callUri("Container2.Photos(Id=1,Type='image%2Fpng')");
@@ -137,13 +137,13 @@ public class EntryXmlReadOnlyTest extends AbstractRefXmlTest {
assertXpathEvaluatesTo(
EMPLOYEE_5_NAME,
"/atom:entry/atom:link[@href=\"Rooms('3')/nr_Employees\"]" +
- "/m:inline/atom:feed/atom:entry/m:properties/d:EmployeeName",
+ "/m:inline/atom:feed/atom:entry/m:properties/d:EmployeeName",
body);
assertXpathEvaluatesTo(
EMPLOYEE_3_NAME,
"/atom:entry/atom:link[@href=\"Rooms('3')/nr_Employees\"]" +
- "/m:inline/atom:feed/atom:entry/atom:link[@href=\"Employees('5')/ne_Manager\"]" +
- "/m:inline/atom:entry/m:properties/d:EmployeeName",
+ "/m:inline/atom:feed/atom:entry/atom:link[@href=\"Employees('5')/ne_Manager\"]" +
+ "/m:inline/atom:entry/m:properties/d:EmployeeName",
body);
notFound("Employees('3')?$expand=noNavProp");
@@ -173,7 +173,7 @@ public class EntryXmlReadOnlyTest extends AbstractRefXmlTest {
assertEquals(entry, getBody(callUri("Employees('6')?$select=*,ne_Room")));
checkUri("Container2.Photos(Id=4,Type='foo')?$select=%D0%A1%D0%BE%D0%B4%D0%B5%D1%80%D0%B6" +
- "%D0%B0%D0%BD%D0%B8%D0%B5,Id");
+ "%D0%B0%D0%BD%D0%B8%D0%B5,Id");
response = callUri("Employees('6')?$expand=ne_Room&$select=ne_Room/Version");
checkMediaType(response, HttpContentType.APPLICATION_ATOM_XML_UTF8 + ";type=entry");
@@ -181,12 +181,12 @@ public class EntryXmlReadOnlyTest extends AbstractRefXmlTest {
assertXpathEvaluatesTo(
"2",
"/atom:entry/atom:link[@href=\"Employees('6')/ne_Room\"]/m:inline/atom:entry/atom:content" +
- "[@type=\"application/xml\"]/m:properties/d:Version",
+ "[@type=\"application/xml\"]/m:properties/d:Version",
body);
assertXpathNotExists("/atom:entry/m:properties/d:Location", body);
assertXpathNotExists(
"/atom:entry/atom:link[@href=\"Employees('6')/ne_Room\"]/m:inline/atom:entry/atom:content" +
- "[@type=\"application/xml\"]/m:properties/d:Seats",
+ "[@type=\"application/xml\"]/m:properties/d:Seats",
body);
response = callUri("Rooms('3')?$expand=nr_Employees/ne_Team&$select=nr_Employees/ne_Team/Name");
@@ -195,14 +195,14 @@ public class EntryXmlReadOnlyTest extends AbstractRefXmlTest {
assertXpathEvaluatesTo(
"Team 2",
"/atom:entry/atom:link[@href=\"Rooms('3')/nr_Employees\"]/m:inline/atom:feed/atom:entry" +
- "/atom:link[@href=\"Employees('5')/ne_Team\"]/m:inline/atom:entry/atom:content/m:properties/d:Name",
+ "/atom:link[@href=\"Employees('5')/ne_Team\"]/m:inline/atom:entry/atom:content/m:properties/d:Name",
body);
assertXpathNotExists("/atom:entry/atom:content/m:properties", body);
assertXpathNotExists(
"/atom:entry/atom:link[@href=\"Rooms('3')/nr_Employees\"]/m:inline/atom:feed/atom:entry/m:properties", body);
assertXpathNotExists(
"/atom:entry/atom:link[@href=\"Rooms('3')/nr_Employees\"]/m:inline/atom:feed/atom:entry" +
- "/atom:link[@href=\"Employees('5')/ne_Team\"]/m:inline/atom:entry/atom:content/m:properties/d:Id",
+ "/atom:link[@href=\"Employees('5')/ne_Team\"]/m:inline/atom:entry/atom:content/m:properties/d:Id",
body);
notFound("Teams('3')?$select=noProp");
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedJsonReadOnlyTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedJsonReadOnlyTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedJsonReadOnlyTest.java
index 1d78e42..0658210 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedJsonReadOnlyTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedJsonReadOnlyTest.java
@@ -123,7 +123,7 @@ public class FeedJsonReadOnlyTest extends AbstractRefTest {
public void feedWithTwoLevelInline() throws Exception {
final HttpResponse response =
callUri("Employees()?$expand=ne_Room/nr_Building&$select=Age,ne_Room/Seats,ne_Room/nr_Building/Name&" +
- "$top=2&$format=json");
+ "$top=2&$format=json");
checkMediaType(response, HttpContentType.APPLICATION_JSON);
assertEquals("{\"d\":{\"results\":[{\"__metadata\":{"
+ "\"id\":\"" + getEndpoint() + "Employees('1')\","
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedXmlReadOnlyTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedXmlReadOnlyTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedXmlReadOnlyTest.java
index 93a30ca..ca1cb84 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedXmlReadOnlyTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedXmlReadOnlyTest.java
@@ -174,7 +174,7 @@ public class FeedXmlReadOnlyTest extends AbstractRefXmlTest {
response =
callUri("Employees?$filter=indexof(ImageUrl,EmployeeId)%20mod%20(Age%20sub%2028)%20eq%20month" +
- "(EntryDate)%20mul%203%20div%2027%20sub%201");
+ "(EntryDate)%20mul%203%20div%2027%20sub%201");
checkMediaType(response, HttpContentType.APPLICATION_ATOM_XML_UTF8 + ";type=feed");
body = getBody(response);
assertXpathEvaluatesTo("1", "count(/atom:feed/atom:entry)", body);
@@ -210,7 +210,7 @@ public class FeedXmlReadOnlyTest extends AbstractRefXmlTest {
checkUri("Employees('1')/ne_Room/nr_Employees('1')?$filter=EmployeeId%20eq%20'1'");
checkUri("Container2.Photos(Id=4,Type='foo')?$filter=%D0%A1%D0%BE%D0%B4%D0%B5%D1%80%D0%B6%D0%B0%D0%BD%" +
- "D0%B8%D0%B5%20eq%20'%D0%9F%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82'");
+ "D0%B8%D0%B5%20eq%20'%D0%9F%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82'");
notFound("Employees('4')?$filter=Age%20eq%2099");
notFound("Rooms('1')/nr_Employees('1')?$filter=Age%20eq%2099");
@@ -249,12 +249,12 @@ public class FeedXmlReadOnlyTest extends AbstractRefXmlTest {
public void nextLinkQueryOptions() throws Exception {
final HttpResponse response =
callUri("Rooms?$format=atom&$filter=true&$inlinecount=none&$orderby=Name&$skiptoken=1&$skip=0&$top=200" +
- "&$expand=nr_Building&$select=Seats");
+ "&$expand=nr_Building&$select=Seats");
checkMediaType(response, HttpContentType.APPLICATION_ATOM_XML_UTF8 + ";type=feed");
final String body = getBody(response);
assertXpathEvaluatesTo(
"Rooms?$format=atom&$filter=true&$inlinecount=none&$orderby=Name&$top=200&$expand=nr_Building" +
- "&$select=Seats&$skiptoken=97",
+ "&$select=Seats&$skiptoken=97",
"/atom:feed/atom:link[@rel='next']/@href", body);
}