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 2014/08/13 09:56:11 UTC
git commit: [OLINGO-393] JS - support add/delete links via $ref
Repository: olingo-odata4-js
Updated Branches:
refs/heads/master c5b93e9de -> 4e1a3baf6
[OLINGO-393] JS - support add/delete links via $ref
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/commit/4e1a3baf
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/tree/4e1a3baf
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/diff/4e1a3baf
Branch: refs/heads/master
Commit: 4e1a3baf65b32a5072dffbb03f81c8478c5f5112
Parents: c5b93e9
Author: challenh <ch...@microsoft.com>
Authored: Wed Aug 13 15:54:29 2014 +0800
Committer: challenh <ch...@microsoft.com>
Committed: Wed Aug 13 15:54:29 2014 +0800
----------------------------------------------------------------------
datajs/tests/odata-links-functional-tests.js | 35 +++++++++++++++++++----
datajs/tests/odata-qunit-tests.htm | 1 +
2 files changed, 31 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/4e1a3baf/datajs/tests/odata-links-functional-tests.js
----------------------------------------------------------------------
diff --git a/datajs/tests/odata-links-functional-tests.js b/datajs/tests/odata-links-functional-tests.js
index 8f15470..e14616c 100644
--- a/datajs/tests/odata-links-functional-tests.js
+++ b/datajs/tests/odata-links-functional-tests.js
@@ -195,7 +195,7 @@
);
}, "Testing valid read of " + readLinksEntry + " with " + mimeType, { linksEntry: readLinksEntry, mimeType: mimeType });
- djstest.addTest(function addLinksEntityTest(mimeType) {
+ djstest.addTest(function updateLinksEntityTest(mimeType) {
var request = {
requestUri: foodsFeed + "(1)/Category/$ref",
@@ -218,9 +218,9 @@
});
}, unexpectedErrorHandler);
- }, "Add new links entity (mimeType = " + mimeType + " service = " + service + ")", mimeType);
+ }, "Update links entity (mimeType = " + mimeType + " service = " + service + ")", mimeType);
- djstest.addTest(function addLinksFeedTest(mimeType) {
+ djstest.addTest(function addDeleteLinksFeedTest(mimeType) {
var request = {
requestUri: categoriesFeed + "(2)/Foods/$ref",
@@ -229,6 +229,29 @@
data: newFoodLinks
};
+ var deleteAndVerify = function (){
+
+ // delete by id
+ var deletionRequest = {
+ requestUri: categoriesFeed + "(2)/Foods/$ref?$id=" + newFoodLinks["@odata.id"],
+ method: "DELETE",
+ headers: djstest.clone(headers),
+ data: null
+ };
+
+ OData.request(deletionRequest, function (data, response) {
+ var httpOperation = deletionRequest.method + " " + deletionRequest.requestUri;
+ djstest.assertAreEqual(response.statusCode, httpStatusCode.noContent, "Verify response code: " + httpOperation);
+
+ OData.read(request.requestUri, function (data, response) {
+ var httpOperation = "Read " + request.requestUri;
+ djstest.assertAreEqual(0, response.data.value.length, "Verify links against the request: " + httpOperation);
+ djstest.done();
+ },unexpectedErrorHandler);
+ }, unexpectedErrorHandler);
+ };
+
+ // add
OData.request(request, function (data, response) {
var httpOperation = request.method + " " + request.requestUri;
@@ -237,11 +260,13 @@
OData.read(request.requestUri, function (data, response) {
ODataReadOracle.readLinksFeed(request.requestUri, function (actualData) {
djstest.assertAreEqualDeep(actualData, response.data, "Verify updated links entry against the request: " + httpOperation);
- djstest.done();
+ deleteAndVerify();
});
});
}, unexpectedErrorHandler);
- }, "Update entity (mimeType = " + mimeType + " service = " + service + ")", mimeType);
+
+ }, "Add & Delete entity (mimeType = " + mimeType + " service = " + service + ")", mimeType);
+
});
});
})(this);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/4e1a3baf/datajs/tests/odata-qunit-tests.htm
----------------------------------------------------------------------
diff --git a/datajs/tests/odata-qunit-tests.htm b/datajs/tests/odata-qunit-tests.htm
index 427d360..7934ae6 100644
--- a/datajs/tests/odata-qunit-tests.htm
+++ b/datajs/tests/odata-qunit-tests.htm
@@ -56,6 +56,7 @@
<!-- <script type="text/javascript" src="odata-tests.js"></script>-->
<script type="text/javascript" src="odata-json-tests.js"></script>
<!-- <script type="text/javascript" src="odata-json-light-tests.js"></script>-->
+ <script type="text/javascript" src="odata-links-functional-tests.js"></script>
<script type="text/javascript" src="odata-metadata-tests.js"></script>
<script type="text/javascript" src="odata-xml-tests.js"></script>
<script type="text/javascript" src="odata-handler-tests.js"></script>