Return-Path: X-Original-To: apmail-olingo-commits-archive@minotaur.apache.org Delivered-To: apmail-olingo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 015C911697 for ; Tue, 2 Sep 2014 08:41:28 +0000 (UTC) Received: (qmail 15268 invoked by uid 500); 2 Sep 2014 08:41:27 -0000 Delivered-To: apmail-olingo-commits-archive@olingo.apache.org Received: (qmail 15216 invoked by uid 500); 2 Sep 2014 08:41:27 -0000 Mailing-List: contact commits-help@olingo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@olingo.apache.org Delivered-To: mailing list commits@olingo.apache.org Received: (qmail 15188 invoked by uid 99); 2 Sep 2014 08:41:27 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Sep 2014 08:41:27 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 934639AEB83; Tue, 2 Sep 2014 08:41:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: koblers@apache.org To: commits@olingo.apache.org Date: Tue, 02 Sep 2014 08:41:29 -0000 Message-Id: <35e945a3cacd4fc4b93e09e0aaab7772@git.apache.org> In-Reply-To: <4227bd0c5c43403e91358cf025fc0119@git.apache.org> References: <4227bd0c5c43403e91358cf025fc0119@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/4] [OLINGO-418] remove tests-tmp http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/common/djstest.js ---------------------------------------------------------------------- diff --git a/odatajs/tests-tmp/common/djstest.js b/odatajs/tests-tmp/common/djstest.js deleted file mode 100644 index 104c4cf..0000000 --- a/odatajs/tests-tmp/common/djstest.js +++ /dev/null @@ -1,412 +0,0 @@ -/* - * 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 - * - * 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. - */ - - -// Because this code contains a init function to be useable directly inside the browser as well as in nodejs -// we define the @namespace djstest here instead of the a @module name djstest - -/** Create namespace djstest in window.djstest when this file is loaded as java script by the browser - * @namespace djstest - */ - -if (typeof window !== 'undefined') { - //expose to browsers window object - window.djstest = window.djstest || {}; - init(window.djstest); -} else { - //expose in commonjs style - module.exports = init(); -} - - -function init (parent) { - djstest = parent || {}; - - /** Constructs a Job object that allows for enqueuing and synchronizing the execution of functions. - * @class Job - * @constructor - * @returns {Object} Job object - */ - djstest.Job = function () { - - var currentTask = -1; - var tasks = []; - - var failedTasks = 0; - - /** Adds a function to the job queue regardless if the queue is already executing or not. - * @method djstest.Job#queue - * @param {Function} fn - Function to execute. - */ - this.queue = function (fn) { - - tasks.push(fn); - }; - - /** Adds a function to the front of the job queue regardless if the queue is already executing or not. - * @method djstest.Job#queueNext - * @param {Function} fn - Function to execute. - */ - this.queueNext = function (fn) { - - if (currentTask < 0) { - tasks.unshift(fn); - } else { - tasks.splice(currentTask + 1, 0, fn); - } - }; - - /** Starts the execution of this job. - * @method djstest.Job#run - * @param {Function} done - Callback invoked when the job has finished executing all of its enqueued tasks. - */ - this.run = function (done) { - /// This method does nothing if called on a unit of work that is already executing. - if (currentTask >= 0) { - return; - } - - if (tasks.length === 0) { - done(true); - return; - } - - /** - * @method djstest.Job~makeTaskDoneCallBack - */ - function makeTaskDoneCallBack(failed) { - return function () { - // Track the failed task and continue the execution of the job. - if (failed) { - failedTasks++; - } - currentTask++; - if (currentTask === tasks.length) { - done(failedTasks === 0); - } else { - runNextTask(); - } - }; - } - - /** Executes the next function in the queue. - * @method djstest.Job~runNextTask - */ - function runNextTask() { - defer(function () { - try { - tasks[currentTask](makeTaskDoneCallBack(false), makeTaskDoneCallBack(true)); - } catch (e) { - makeTaskDoneCallBack(true)(); - } - }); - } - - currentTask = 0; - runNextTask(); - }; - }; - - /** Defers the execution of an arbitrary function that takes no parameters. - * @memberof djstest - * @inner - * @param {Function} fn - Function to schedule for later execution. - */ - function defer(fn) { - setTimeout(fn, 0); - } - - /** Exposes date values for Date objects to facilitate debugging - * @memberof djstest - * @inner - * @param {Object} data - The object to operate on - */ - function exposeDateValues(data) { - - if (typeof data === "object") { - if (data instanceof Date) { - data.__date__ = data.toUTCString(); - } - else { - for (var prop in data) { - exposeDateValues(data[prop]); - } - } - } - - return data; - } - - /** Determines the name of a function. - * @memberof djstest - * @inner - * @param {String} text - Function text. - * @returns {String} The name of the function from text if found; the original text otherwise. - */ - function extractFunctionName(text) { - - var index = text.indexOf("function "); - if (index < 0) { - return text; - } - - var nameStart = index + "function ".length; - var parensIndex = text.indexOf("(", nameStart); - if (parensIndex < 0) { - return text; - } - - var result = text.substr(nameStart, parensIndex - nameStart); - if (result.indexOf("test") === 0) { - result = result.substr("test".length); - } - - return result; - } - - /** Removes metadata annotations from the specified object. - * @memberof djstest - * @inner - * @param data - Object to remove metadata from; possibly null. - */ - function removeMetadata(data) { - - if (typeof data === "object" && data !== null) { - delete data.__metadata; - for (var prop in data) { - removeMetadata(data[prop]); - } - } - } - - /** Add the unit test cases - * @param disable - Indicate whether this test case should be disabled - */ - djstest.addFullTest = function (disable, fn, name, arg, timeout) { - - if (disable !== true) { - djstest.addTest(fn, name, arg, timeout); - } - }; - - /** Add the unit test cases - * @param disable - Indicate whether this test case should be disabled - */ - djstest.addTest = function (fn, name, arg, timeout) { - if (!name) { - name = extractFunctionName(fn.toString()); - } - - test(name, function () { - if (!timeout) { - timeout = 20000; - } - - QUnit.config.testTimeout = timeout; - QUnit.stop(); - fn.call(this, arg); - }); - }; - - /** Asserts that a condition is true. - * @param {Boolean} test - Condition to test. - * @param {String} message - Text message for condition being tested. - */ - djstest.assert = function (test, message) { - - QUnit.ok(test, message); - }; - - /** Asserts that the values of the expected and actualobjects are equal. - * @memberof djstest - * @inner - */ - djstest.assertAreEqual = function (actual, expected, message) { - QUnit.equal(actual, expected, message); - }; - - /** Asserts that the actual and expected objects are the same. - */ - djstest.assertAreEqualDeep = function (actual, expected, message) { - QUnit.deepEqual(exposeDateValues(actual), exposeDateValues(expected), message); - }; - - /** Asserts that the actual and expected objects are the same but removes the metadata bevore - */ - djstest.assertWithoutMetadata = function (actual, expected, message) { - removeMetadata(actual); - removeMetadata(expected); - djstest.assertAreEqualDeep(actual, expected, message); - }; - - /** Calls each async action in asyncActions, passing each action a function which keeps a count and - * calls the passed done function when all async actions complete - * @param {Array} asyncActions -Array of asynchronous actions to be executed, - * each taking a single parameter - the callback function to call when the action is done. - * @param {Function} done - Function to be executed in the last async action to complete. - */ - djstest.asyncDo = function (asyncActions, done) { - - var count = 0; - var doneOne = function () { - count++; - if (count >= asyncActions.length) { - done(); - } - }; - - if (asyncActions.length > 0) { - for ( var i = 0; i < asyncActions.length; i++) { - asyncActions[i](doneOne); - } - } else { - done(); - } - }; - - /** Makes a deep copy of an object. - */ - djstest.clone = function (object) { - if ( object === undefined ) { - return undefined; - } else if (object === null) { - return null; - } else if (typeof(object) !== 'object') { - return object; - } else { - var ret = {}; - for(var key in object) { - if(object.hasOwnProperty(key)) { - ret[key] = this.clone(object[key]); - } - } - return ret; - } - throw("Error cloning an object"); - }; - - /** Destroys the cache and then completes the test - * @param cache - The cache to destroy - */ - djstest.destroyCacheAndDone = function (cache) { - - cache.clear().then(function () { - djstest.done(); - }, function (err) { - djstest.fail("Failed to destroy cache: " + djstest.toString(err)); - djstest.done(); - }); - }; - - /** Indicates that the currently running test has finished. - */ - djstest.done = function () { - - QUnit.start(); - }; - - /** Test passes if and only if an exception is thrown. - */ - djstest.expectException = function (testFunction, message) { - - try { - testFunction(); - djstest.fail("Expected exception but function succeeded: " + " " + message); - } - catch (e) { - // Swallow exception. - djstest.pass("Thrown exception expected"); - } - }; - - /** Indicates the expected number of asserts, fails test if number is not met. - * @param {Number} asserts - Number of asserts expected in test. - */ - djstest.assertsExpected = function (asserts) { - - expect(asserts); - }; - /** Marks the current test as failed. - * @param {String} message - Failure message. - */ - djstest.fail = function (message) { - - QUnit.ok(false, message); - }; - - /** Returns a function that when invoked will fail this test and be done with it. - * @param {String} message - Failure message. - * @param {Function} [cleanupCallback] - - * @returns {Function} A new function. - */ - djstest.failAndDoneCallback = function (message, cleanupCallback) { - - return function (err) { - message = "" + message + (err) ? JSON.stringify(err) : ""; - djstest.fail(message); - if (cleanupCallback) { - try { - cleanupCallback(); - } catch (e) { - djstest.fail("error during cleanupCallback: " + JSON.stringify(e)); - } - } - - djstest.done(); - }; - }; - - /** Logs a test message. - * @param {String} message - Test message. - */ - djstest.log = function (message) { - - var context = { result: true, actual: true, expected: true, message: message }; - QUnit.ok(true, message); - - }; - - /** Marks the current test as failed. - * @param {String} message - Failure message. - */ - djstest.pass = function (message) { - QUnit.ok(true, message); - }; - - /** Dumps the object as a string - * @param {Object} obj - Object to dump - */ - djstest.toString = function (obj) { - return QUnit.jsDump.parse(obj); - }; - - /** Executes the function, pausing test execution until the callback is called - * @param {Function} fn - Function to execute; takes one parameter which is the callback - * This function is typically used in asynchronous setup/teardown methods - */ - djstest.wait = function (fn) { - QUnit.stop(); - fn(function () { - QUnit.start(); - }); - }; - - return djstest; -} - http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/common/logging.js ---------------------------------------------------------------------- diff --git a/odatajs/tests-tmp/common/logging.js b/odatajs/tests-tmp/common/logging.js deleted file mode 100644 index 9297527..0000000 --- a/odatajs/tests-tmp/common/logging.js +++ /dev/null @@ -1,5 +0,0 @@ -QUnit.log( function (context) { - if (window.console && window.console.log && context.message) { - window.console.log(context.result + ' :: ' + context.message ); - } -}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/common/mockHttpClient.js ---------------------------------------------------------------------- diff --git a/odatajs/tests-tmp/common/mockHttpClient.js b/odatajs/tests-tmp/common/mockHttpClient.js deleted file mode 100644 index 2ec97e7..0000000 --- a/odatajs/tests-tmp/common/mockHttpClient.js +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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 - * - * 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. - */ - -//mockHttpClient.js -//this object allows for associating a uri with a requestVerfier and mock responses that will be sent back to the client of the httpStack. -//It can be used to replace OData's httpClient for testing purposes. -// -//RequestVerifiers -// -// A request verifier is a function associated to a particular URI that will be executed by the mockHttpClient when it receives a request with the matching URI. -// the callback receives as its only parameter the request object passed to the mockHttpClient. -// -// To register a request verifier, simply do -// -// MockHttpClient.addRequestVerifier("http://someUri", function(request) { -// djstest.assertAreEqual(request.requestUri,"http://someUri"); -// } -// -//Responses -// Mock responses can be associated with a particular URI. When the MockHttpClient receives a request with a URI mapped to a response, then it will, -// depending on the response status code invoke either the success or the error callbacks. -// -// To register a response, -// -// MockHttpClient.addResponse("http://someUri", {status: 200, body:"some body"}); -// -//Exceptions -// MockHttpClient will throw an exception if it receives a request to a URI that is not mapped to either a request verifier or a response. -// - - -if (typeof window !== 'undefined') { - //in browser call init() directly window as context - window.MockHttpClient = window.MockHttpClient || {}; - init(window.MockHttpClient); -} else { - //expose function init to be called with a custom context - module.exports = init(); -} - - -function init(parent, undefined) { - httpClient = parent || {}; - - var responses = {}; - var requestVerifiers = {}; - - httpClient.addRequestVerifier = function (uri, verifier) { - requestVerifiers[uri] = verifier; - return this; - }; - - httpClient.addResponse = function (uri, response) { - responses[uri] = response; - return this; - }; - - httpClient.async = false; - - httpClient.clear = function () { - /** Clears all registered responses and verifiers. - * @returns this client - */ - responses = {}; - requestVerifiers = {}; - this.async = false; - return this; - }; - - httpClient.request = function (request, success, error) { - var uri = request.requestUri; - var verifier = requestVerifiers[uri]; - var response = responses[uri]; - - if (verifier === undefined) { - verifier = requestVerifiers["*"]; - } - - if (response === undefined) { - response = responses["*"]; - } - - if (!verifier && !response) { - throw { message: "neither verifier or response defined for uri: " + uri }; - } - - if (verifier) { - verifier(request); - } - - if (response) { - response.requestUri = uri; - if (response.statusCode >= 200 && response.statusCode <= 299) { - if (this.async) { - setTimeout(function () { - success(response); - }); - } else { - success(response); - } - } else { - if (this.async) { - setTimeout(function () { - error({ message: "failed test response", request: request, response: response }); - }); - } - else { - error({ message: "failed test response", request: request, response: response }); - } - } - } - }; - - httpClient.setAsync = function (value) { - this.async = value; - return this; - }; - - return httpClient; -} - - http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/common/node-test-setup.js ---------------------------------------------------------------------- diff --git a/odatajs/tests-tmp/common/node-test-setup.js b/odatajs/tests-tmp/common/node-test-setup.js deleted file mode 100644 index c08c439..0000000 --- a/odatajs/tests-tmp/common/node-test-setup.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 - * - * 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. -*/ -//Creates the global objects - -//tools - -var window = {}; -window.djstest = require("./djstest.js"); -window.mockHttpClient = require("./mockHttpClient.js"); -window.odatajs = require('./../../src/index.js'); - -global.window = window; -console.log(global.window.odatajs.node+'asdfasdfasdfasdf'); - http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/common/observableHttpClient.js ---------------------------------------------------------------------- diff --git a/odatajs/tests-tmp/common/observableHttpClient.js b/odatajs/tests-tmp/common/observableHttpClient.js deleted file mode 100644 index 9be75f8..0000000 --- a/odatajs/tests-tmp/common/observableHttpClient.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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 - * - * 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. - */ - -// ObservableHttpClient.js -// This object extends OData's default httpClient by supporting request and response recording sessions, and firing a custom -// JQuery event for each request/response. -// -// The events fired by this object are: -// request: Before a request is made -// success: Before the primary success handler is called -// -// To bind to an event, JQuery event attachers can be used on the object, e.g. -// $(observableHttpClient).bind("request", function (request) { ... }); -// -// To begin a new recording session, use: -// var session = observableHttpClient.newSession(); -// -// Requests and responses are then recorded in session.requests and session.responses. Session can be ended by session.end(). -// Multiple simultaneous sessions are supported. - -(function (window, undefined) { - - var ObservableHttpClient = function (provider) { - this.provider = provider ? provider : window.odatajs.oData.net.defaultHttpClient; - }; - - ObservableHttpClient.prototype.newSession = function () { - return new Session(this); - }; - - ObservableHttpClient.prototype.request = function (request, success, error) { - var that = this; - - $(this).triggerHandler("request", request); - return this.provider.request(request, function (response) { - $(that).triggerHandler("success", response); - success(response); - }, error); - }; - - - var Session = function (client) { - var that = this; - - this.client = client; - this.clear(); - - this.requestHandler = function (event, request) { that.requests.push(request); }; - $(client).bind("request", this.requestHandler); - - this.successHandler = function (event, response) { that.responses.push(response); }; - $(client).bind("success", this.successHandler); - }; - - Session.prototype.clear = function () { - this.requests = []; - this.responses = []; - } - - Session.prototype.end = function () { - $(this.client).unbind("request", this.requestHandler); - $(this.client).unbind("success", this.successHandler); - }; - - window.ObservableHttpClient = ObservableHttpClient; - window.Session = Session; - -})(this); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/common/odataCacheVerifier.js ---------------------------------------------------------------------- diff --git a/odatajs/tests-tmp/common/odataCacheVerifier.js b/odatajs/tests-tmp/common/odataCacheVerifier.js deleted file mode 100644 index 54e4659..0000000 --- a/odatajs/tests-tmp/common/odataCacheVerifier.js +++ /dev/null @@ -1,241 +0,0 @@ -/* - * 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 - * - * 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. - */ - -// CacheVerifier.js -// This object verifies the operation of the cache. -// Internally it maintains a simple model of the cache implemented using a lookup array of the expected cached pages. - -(function (window, undefined) { - - var CacheVerifier = function (baseUri, pageSize, total, cacheSize) { - /** Creates a new CacheVerifier - * @param {String} baseUri - The base URI of the collection - * @param {Integer} pageSize - The page size used in the cache - * @param {Integer} total - The total number of items in the collection - * @param {Integer} cacheSize - Cache size in bytes - */ - this.baseUri = baseUri; - this.pageSize = pageSize; - this.total = total; - this.cacheSize = (cacheSize !== undefined) ? cacheSize : 1024 * 1024; - this.actualSize = 0; - this.actualCount = 0; - this.cachedPages = []; - this.exactPageCount = (total % pageSize === 0); - this.maxPage = Math.floor(total / pageSize); - this.overflowed = this.cacheSize === 0; - }; - - CacheVerifier.mechanisms = { - memory: "memory", - indexeddb: "indexeddb", - dom: "dom", - best: "best" - }; - - CacheVerifier.isMechanismAvailable = function (mechanism) { - /** Determines if the specified local storage mechanism is available - * @param mechanism - The name of the mechanism - * @returns Whether the mechanism is available - */ - switch (mechanism) { - case CacheVerifier.mechanisms.indexeddb: - if (window.msIndexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.indexedDB) { - return true; - } - else { - return false; - } - break; - case CacheVerifier.mechanisms.dom: - if (window.localStorage) { - return true; - } - else { - return false; - } - break; - case CacheVerifier.mechanisms.memory: - case CacheVerifier.mechanisms.best: - case undefined: - return true; - default: - return false; - } - }; - - CacheVerifier.prototype.clear = function () { - /** Clears the cache in the oracle - */ - this.cachedPages = []; - this.actualSize = 0; - this.actualCount = 0; - this.overflowed = this.cacheSize === 0; - }; - - CacheVerifier.prototype.verifyRequests = function (requests, responses, index, count, description, backwards, isPrefetch) { - /** Verifies the HTTP requests for a single data request, and updates the oracle with cached pages - * @param {Array} requests - The sequence of request objects (from OData.defaultHttpClient) - * @param {Array} responses - The sequence of response objects (from OData.defaultHttpClient) - * @param {Integer} index - The starting index of the read - * @param {Integer} count - The count of items in the read - * @param {String} description - The description of the requests being verified - * @param {Boolean} backwards - Whether or not filterBack is being verified - * @param {Boolean} isPrefetch - Whether the requests being verified come from the prefetcher - */ - var that = this; - - index = (index < 0 ? 0 : index); - var pageIndex = function (index) { - /** Returns the page index that the given item index belongs to - * @param {Integer} index - The item index - * @returns The page index - */ - return Math.floor(index / that.pageSize); - }; - - var estimateSize = function (obj) { - /** Estimates the size of an object in bytes. - * @param {Object} obj - Object to determine the size of. - * @returns {Number} Estimated size of the object in bytes. - */ - - var size = 0; - var type = typeof obj; - - if (type === "object" && obj) { - for (var name in obj) { - size += name.length * 2 + estimateSize(obj[name]); - } - } else if (type === "string") { - size = obj.length * 2; - } else { - size = 8; - } - return size; - }; - - var expectedUris = []; - var responseIndex = 0; - if (count >= 0) { - var minPage = pageIndex(index); - var maxPage = Math.min(pageIndex(index + count - 1), pageIndex(this.total)); - - // In the case that the index is outside the range of the collection the minPage will be greater than the maxPage - maxPage = Math.max(minPage, maxPage); - - if (!(isPrefetch && !this.exactPageCount && minPage > this.maxPage)) { - for (var page = minPage; page <= maxPage && this.actualCount <= this.total && !(isPrefetch && this.overflowed); page++) { - if (!this.cachedPages[page]) { - - expectedUris.push(that.baseUri + "?$skip=" + page * this.pageSize + "&$top=" + (this.pageSize)); - - var actualPageSize = 0; - var actualPageCount = 0; - if (responses[responseIndex] && responses[responseIndex].data) { - actualPageSize += estimateSize(responses[responseIndex].data); - actualPageCount += responses[responseIndex].data.value.length; - // Handle server paging skipToken requests - while (responses[responseIndex].data["@odata.nextLink"]) { - var nextLink = responses[responseIndex].data["@odata.nextLink"]; - if (nextLink) { - var index = that.baseUri.indexOf(".svc/", 0); - if (index != -1) { - nextLink = that.baseUri.substring(0, index + 5) + nextLink; - } - } - - expectedUris.push(nextLink); - responseIndex++; - actualPageSize += estimateSize(responses[responseIndex].data); - actualPageCount += responses[responseIndex].data.value.length; - } - - actualPageSize += 24; // 24 byte overhead for the pages (i)ndex, and (c)ount fields - } - - responseIndex++; - - this.overflowed = this.cacheSize >= 0 && this.actualSize + actualPageSize > this.cacheSize; - if (!this.overflowed) { - this.cachedPages[page] = true; - this.actualSize += actualPageSize; - this.actualCount += actualPageCount; - } - } - } - } - } - - if (backwards) { - expectedUris.reverse(); - } - - var actualUris = $.map(requests, function (r) { return r.requestUri; }); - djstest.assertAreEqualDeep(actualUris, expectedUris, description); - }; - - CacheVerifier.getExpectedFilterResults = function (data, filterIndex, filterCount, predicate, backwards) { - /** Verifies the cache filter returns the correct data - * @param {Array} collection - Array of items in the collection - * @param {Integer} filterIndex - The index value - * @param {Integer} filterCount - The count value - * @param {Function} predicate - Predicate to be applied in filter, takes an item - * @param {Boolean} backwards - Whether or not filterBackwards is being verified - */ - if (!data || !data.value) { - return data; - } - - var value = []; - if (filterCount !== 0) { - // Convert [item0, item1, ...] into [{ index: 0, item: item0 }, { index: 1, item: item1 }, ...] - var indexedCollection = $.map(data.value, function (item, index) { - return { index: index, item: item }; - }); - - var grepPredicate = function (element, index) { - return predicate(element.item); - }; - - var index = filterIndex < 0 ? 0 : filterIndex; - var count = filterCount < 0 ? indexedCollection.length : filterCount; - - value = backwards ? - // Slice up to 'index', filter, then slice 'count' number of items from the end - $.grep(indexedCollection.slice(0, index + 1), grepPredicate).slice(-count) : - // Slice from 'index' to the end, filter, then slice 'count' number of items from the beginning - $.grep(indexedCollection.slice(index), grepPredicate).slice(0, count); - } - - var expectedResults = {}; - for (var property in data) { - if (property == "value") { - expectedResults[property] = value; - } else { - expectedResults[property] = data[property]; - } - } - - return expectedResults; - }; - - window.CacheVerifier = CacheVerifier; - -})(this); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/common/odataVerifyReader.js ---------------------------------------------------------------------- diff --git a/odatajs/tests-tmp/common/odataVerifyReader.js b/odatajs/tests-tmp/common/odataVerifyReader.js deleted file mode 100644 index 14bf54e..0000000 --- a/odatajs/tests-tmp/common/odataVerifyReader.js +++ /dev/null @@ -1,203 +0,0 @@ -/* - * 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 - * - * 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. - */ - - -// Client for the odata.read oracle service - -(function (window, undefined) { - var jsonMime = "application/json"; - var universalMime = "*/*"; - - function readFeed(url, success, mimeType, recognizeDates) { - /** Calls the ReadFeed endpoint with the specified URL - * @param {String} url - The URL to read the feed from - * @param {Function} success - The success callback function - * @param {String} mimeType - The MIME media type in the Accept header - */ - var readMethod = getReadMethod(mimeType); - oracleRequest("GET", readMethod, typeof url === "string" ? { url: url} : url, mimeType, recognizeDates, function (data) { - success(data); - }); - } - - function readEntry(url, success, mimeType, recognizeDates) { - /** Calls the ReadEntry endpoint with the specified URL - * @param {String} url - The URL to read the entry from - * @param {Function} success - The success callback function - * @param {String} mimeType - The MIME media type in the Accept header - */ - var readMethod = getReadMethod(mimeType); - oracleRequest("GET", readMethod, typeof url === "string" ? { url: url} : url, mimeType, recognizeDates, success); - } - - function readLinksEntry(url, success) { - /** Calls the ReadMetadata endpoint with the specified URL - * @param {String} url - The URL to read the metadata from - * @param {Function} success - The success callback function - */ - readJson( - url, - success - ); - } - - function readLinksFeed(url, success) { - /** Calls the ReadMetadata endpoint with the specified URL - * @param {String} url - The URL to read the metadata from - * @param {Function} success - The success callback function - */ - readJson( - url, - function (data) { - success(data); - } - ); - } - - function readMetadata(url, success) { - /** Calls the ReadMetadata endpoint with the specified URL - * @param {String} url - The URL to read the metadata from - * @param {Function} success - The success callback function - */ - oracleRequest("GET", "ReadMetadata", typeof url === "string" ? { url: url} : url, null, null, success); - } - - function readServiceDocument (url, success, mimeType) { - /** Calls the ReadServiceDocument endpoint with the specified URL - * @param {String} url - The URL to the service - * @param {Function} success - The success callback function - * @param {String} mimeType - The MIME type being tested - */ - var readMethod = getReadMethod(mimeType); - oracleRequest("GET", readMethod, typeof url === "string" ? { url: url} : url, mimeType, null, success); - } - - function readJson(url, success) { - $.ajax({ - url: url, - accepts: null, - dataType: "json", - beforeSend: function (xhr) { - xhr.setRequestHeader("Accept", jsonMime); - xhr.setRequestHeader("OData-MaxVersion", "4.0"); - }, - success: function (data) { - success(data); - } - }); - } - - function readJsonAcrossServerPages(url, success) { - var data = {}; - var readPage = function (url) { - readJson(url, function (feedData) { - var nextLink = feedData["@odata.nextLink"]; - if (nextLink) { - var index = url.indexOf(".svc/", 0); - if (index != -1) { - nextLink = url.substring(0, index + 5) + nextLink; - } - } - - if (data.value && feedData.value) { - data.value = data.value.concat(feedData.value); - } - else { - for (var property in feedData) { - if (property != "@odata.nextLink") { - data[property] = feedData[property]; - } - } - } - - if (nextLink) { - readPage(nextLink); - } - else { - success(data); - } - }); - }; - - readPage(url); - } - - function getReadMethod(mimeType) { - switch (mimeType) { - case jsonMime: - case universalMime: - /* falls through */ - default: - return "ReadJson"; - } - return undefined; - } - - function oracleRequest(method, endpoint, data, mimeType, recognizeDates, success) { - /** Requests a JSON object from the oracle service, removing WCF-specific artifacts - * @param {String} method - The HTTP method (GET or POST) - * @param {String} endpoint - The oracle endpoint - * @param {Object} data - The data to send with the request - * @param {Function} reviver - The reviver function to run on each deserialized object - * @param {Function} success - Success callback - */ - var url = "./common/ODataVerifiyReader.svc/" + endpoint; - if (mimeType) { - data.mimeType = mimeType; - } - - $.ajax({ - type: method, - url: url, - data: data, - dataType: "text", - success: function (data) { - var json = JSON.parse(data); - success(json); - } - }); - } - - function removeProperty(data, property) { - /** Removes the specified property recursively from the given object - * @param {Object} data - The object to operate on - * @param {String} property - The name of the property to remove - */ - if (typeof data === "object" && data !== null) { - if (data[property]) { - delete data[property]; - } - - for (var prop in data) { - removeProperty(data[prop], property); - } - } - } - - window.ODataVerifyReader = { - readFeed: readFeed, - readEntry: readEntry, - readLinksEntry: readLinksEntry, - readLinksFeed: readLinksFeed, - readJson: readJson, - readJsonAcrossServerPages: readJsonAcrossServerPages, - readMetadata: readMetadata, - readServiceDocument: readServiceDocument - }; -})(this); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/done.txt ---------------------------------------------------------------------- diff --git a/odatajs/tests-tmp/done.txt b/odatajs/tests-tmp/done.txt deleted file mode 100644 index 85ca39b..0000000 --- a/odatajs/tests-tmp/done.txt +++ /dev/null @@ -1,29 +0,0 @@ -This tests-tmp folder will repleace the tests folder. -The plan is to -- select test case per testcase, -- verify it, and -- copy it to the tmp-tests -- once each tests is checkt and copied the folder tests will be deleted and replaced by tmp-tests - -DONE - -TestSynchronizerClient.js - -> removed - -> Moved from custom c# logging service to jenkins - -ODataReadOracle.js - -> removed - -> TODO check dependencies - -rx.js - -> removed - -> TODO check dependencies - -odata-json-test.js - -> copied and splittet - - -ODataReadOracle.js -> odataVerifyReader.js -ODataReadOracle.svc -> odataVerifyReader.svc - -ODataReadOracle -> odataVerifyReader http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/endpoints/BasicAuthDataService.svc ---------------------------------------------------------------------- diff --git a/odatajs/tests-tmp/endpoints/BasicAuthDataService.svc b/odatajs/tests-tmp/endpoints/BasicAuthDataService.svc deleted file mode 100644 index e059314..0000000 --- a/odatajs/tests-tmp/endpoints/BasicAuthDataService.svc +++ /dev/null @@ -1,124 +0,0 @@ -<%@ ServiceHost Language="C#" Factory="Microsoft.OData.Service.DataServiceHostFactory, Microsoft.OData.Service, Version=6.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" - Service="DataJS.Tests.BasicAuthDataService" %> -/* - * 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 - * - * 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. - */ -namespace DataJS.Tests -{ - using System; - using System.Collections.Generic; - using Microsoft.OData.Service; - using System.Linq; - using System.ServiceModel; - using System.ServiceModel.Web; - using System.Text; - using System.Web; - - [ServiceBehavior(IncludeExceptionDetailInFaults = true)] - public class BasicAuthDataService : DataService - { - const string Username = "djsUser"; - const string Password = "djsPassword"; - - // This method is called only once to initialize service-wide policies. - public static void InitializeService(DataServiceConfiguration config) - { - config.SetEntitySetAccessRule("*", EntitySetRights.All); - config.SetServiceOperationAccessRule("*", ServiceOperationRights.All); - config.DataServiceBehavior.MaxProtocolVersion = Microsoft.OData.Client.ODataProtocolVersion.V4; - config.UseVerboseErrors = true; - } - - public BasicAuthDataService() - : base() - { - this.ProcessingPipeline.ProcessingRequest += OnRequest; - } - - [WebInvoke] - public void ResetData() - { - this.CurrentDataSource.ResetData(); - } - - private static void UnauthorizedRequest(DataServiceOperationContext context) - { - context.ResponseHeaders["WWW-Authenticate"] = "Basic realm=\"DataJS.Tests\""; - throw new DataServiceException(401, "401 Unauthorized"); - } - - private void OnRequest(object sender, DataServiceProcessingPipelineEventArgs e) - { - string authHeader = e.OperationContext.RequestHeaders["Authorization"]; - - // Validate the Authorization header - if (authHeader == null || !authHeader.StartsWith("Basic")) - { - UnauthorizedRequest(e.OperationContext); - } - - // Decode the username and password from the header - string base64Credentials = authHeader.Substring(6); - string[] credentials = Encoding.ASCII.GetString(Convert.FromBase64String(base64Credentials)).Split(':'); - if (credentials.Length != 2 || !(credentials[0].Equals(Username) && credentials[1].Equals(Password))) - { - UnauthorizedRequest(e.OperationContext); - } - } - } - - public class BasicAuthDataSource : ReflectionDataContext, IUpdatable - { - private static bool dataInitialized; - - public IQueryable Customers - { - get { return this.GetResourceSetEntities("Customers").AsQueryable(); } - } - - public void ResetData() - { - this.ClearData(); - - IList customers = this.GetResourceSetEntities("Customers"); - foreach (int i in Enumerable.Range(1, 16)) - { - customers.Add(new Customer() - { - ID = i, - Name = "Customer " + i - }); - } - } - - protected override void EnsureDataIsInitialized() - { - if (!dataInitialized) - { - this.ResetData(); - dataInitialized = true; - } - } - } - - public class Customer - { - public int ID { get; set; } - public string Name { get; set; } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/endpoints/CustomAnnotations.xml ---------------------------------------------------------------------- diff --git a/odatajs/tests-tmp/endpoints/CustomAnnotations.xml b/odatajs/tests-tmp/endpoints/CustomAnnotations.xml deleted file mode 100644 index ebf4e26..0000000 --- a/odatajs/tests-tmp/endpoints/CustomAnnotations.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Custom metadata 1. - Custom metadata 2. - - - - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/endpoints/CustomDataService.svc ---------------------------------------------------------------------- diff --git a/odatajs/tests-tmp/endpoints/CustomDataService.svc b/odatajs/tests-tmp/endpoints/CustomDataService.svc deleted file mode 100644 index 67fcfd0..0000000 --- a/odatajs/tests-tmp/endpoints/CustomDataService.svc +++ /dev/null @@ -1,85 +0,0 @@ - - -<%@ ServiceHost Language="C#" Debug="true" Factory="System.ServiceModel.Activation.WebServiceHostFactory" - Service="DataJS.Tests.CustomDataService" %> - - -using System.Collections; -using System.IO; - -namespace DataJS.Tests -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.ServiceModel; - using System.ServiceModel.Activation; - using System.ServiceModel.Web; - - /// - /// Custom data service that does not use OData - /// - [ServiceContract] - [ServiceBehavior(IncludeExceptionDetailInFaults = true)] - [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] - public class CustomDataService - { - static readonly Item[] data = Enumerable.Range(0, 16).Select(i => new Item - { - ID = i, - Name = "Item " + i - }).ToArray(); - - // This uses the same URI template as OData so that the CacheOracle can be reused - [OperationContract] - [WebGet(UriTemplate = "ReadRange?$skip={skip}&$top={top}")] - public Stream ReadRange(int skip, int top) - { - IEnumerable selectData = data.Skip(skip).Take(top); - Dictionary result = new Dictionary(); - List> value = new List>(); - foreach (Item d in selectData) - { - Dictionary item = new Dictionary(); - item.Add("ID", d.ID.ToString()); - item.Add("Name", d.Name); - value.Add(item); - } - - result.Add("value", value); - return ReaderUtils.ConvertDictionarytoJsonlightStream(result); - } - - [OperationContract] - [WebGet(ResponseFormat = WebMessageFormat.Json)] - public int Count() - { - return data.Count(); - } - } - - public class Item - { - public int ID { get; set; } - public string Name { get; set; } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/endpoints/EpmDataService.svc ---------------------------------------------------------------------- diff --git a/odatajs/tests-tmp/endpoints/EpmDataService.svc b/odatajs/tests-tmp/endpoints/EpmDataService.svc deleted file mode 100644 index 316c9ae..0000000 --- a/odatajs/tests-tmp/endpoints/EpmDataService.svc +++ /dev/null @@ -1,336 +0,0 @@ - - -<%@ ServiceHost Language="C#" Factory="Microsoft.OData.Service.DataServiceHostFactory, Microsoft.OData.Service, Version=6.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" - Service="DataJS.Tests.EpmDataService" %> - - -namespace DataJS.Tests -{ - using System; - using System.Collections.Generic; - using Microsoft.OData.Service; - using System.Linq; - using System.ServiceModel.Web; - - /// - /// A data service that uses EPM - /// - [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)] - public class EpmDataService : DataService - { - // This method is called only once to initialize service-wide policies. - public static void InitializeService(DataServiceConfiguration config) - { - config.SetEntitySetAccessRule("*", EntitySetRights.All); - config.SetServiceOperationAccessRule("*", ServiceOperationRights.All); - config.DataServiceBehavior.MaxProtocolVersion = Microsoft.OData.Client.ODataProtocolVersion.V4; - config.UseVerboseErrors = true; - - } - - [WebInvoke] - public void ResetData() - { - this.CurrentDataSource.ResetData(); - } - } - - public class EpmDataSource : ReflectionDataContext, IUpdatable - { - private static bool dataInitialized; - - public IQueryable MappedEntries - { - get { return this.GetResourceSetEntities("MappedEntries").AsQueryable(); } - } - - public IQueryable ReplicatedEntries - { - get { return this.GetResourceSetEntities("ReplicatedEntries").AsQueryable(); } - } - - public IQueryable HierarchicalEntries - { - get { return this.GetResourceSetEntities("HierarchicalEntries").AsQueryable(); } - } - - public void ResetData() - { - this.ClearData(); - - MappedEntry[] mappedEntries = new MappedEntry[] - { - new MappedEntry - { - ID = 0, - UnmappedField = "Unmapped0", - Author = new Author - { - Email = "AuthorEmail0", - Name = "AuthorName0", - Uri = "http://www.example.com/AuthorUri", - Contributor = new Contributor - { - Email = "ContributorEmail0", - Name = "ContributorName0", - Uri = "http://www.example.com/ContributorUri", - }, - }, - Published = "2000-01-01T00:00:00-08:00", - Rights = "Rights0", - Summary = "Summary0", - Title = "Title0", - Updated = "2000-01-01T00:00:00-08:00", - CustomElement = "CustomElement0", - CustomAttribute = "CustomAttribute0", - NestedElement1 = "NestedElement1_0", - NestedElement2 = "NestedElement2_0", - CommonAttribute1 = "CommonAttribute1_0", - CommonAttribute2 = "CommonAttribute2_0", - Location = new Location - { - Lat = 3.14f, - Long = 2.72f - } - }, - - new MappedEntry - { - ID = 1, - UnmappedField = null, - Author = new Author - { - Email = null, - Name = string.Empty, - Uri = "http://www.example.com/AuthorUri1", - Contributor = new Contributor - { - Email = null, - Name = string.Empty, - Uri = "http://www.example.com/ContributorUri1", - }, - }, - Published = "2000-01-01T00:00:00-08:00", - Rights = null, - Summary = "", - Title = "Title1", - Updated = "2111-01-01T00:00:00-08:00", - CustomElement = null, - NestedElement1 = string.Empty, - NestedElement2 = "NestedElement2_1", - CustomAttribute = null, - CommonAttribute1 = string.Empty, - CommonAttribute2 = "CommonAttribute2_1", - Location = new Location - { - Lat = float.MaxValue, - Long = float.MinValue - } - }, - - new MappedEntry - { - ID = 2, - UnmappedField = "Unmapped2", - Author = new Author - { - Email = "AuthorEmail2", - Name = "AuthorName2", - Uri = "http://www.example.com/AuthorUri2", - Contributor = null - }, - Published = "2000-01-01T00:00:00-08:00", - Rights = "Rights2", - Summary = "Summary2", - Title = "Title2", - Updated = "2000-01-01T00:00:00-08:00", - CustomElement = "CustomElement2", - CustomAttribute = "CustomAttribute2", - NestedElement1 = "NestedElement1_2", - NestedElement2 = "NestedElement2_2", - CommonAttribute1 = "CommonAttribute1_2", - CommonAttribute2 = "CommonAttribute2_2", - Location = null - }, - }; - Array.ForEach(mappedEntries, (item) => this.GetResourceSetEntities("MappedEntries").Add(item)); - - Array.ForEach(mappedEntries, (item) => this.GetResourceSetEntities("ReplicatedEntries").Add(new ReplicatedEntry - { - ID = item.ID, - UnmappedField = item.UnmappedField, - Author = item.Author == null ? null : new Author2 - { - Email = item.Author.Email, - Name = item.Author.Name, - Uri = item.Author.Uri, - Contributor = item.Author.Contributor == null ? null : new Contributor2 - { - Name = item.Author.Contributor.Name, - Email = item.Author.Contributor.Email, - Uri = item.Author.Contributor.Uri - }, - }, - Published = item.Published, - Rights = item.Rights, - Summary = item.Summary, - Title = item.Title, - Updated = item.Updated, - CustomElement = item.CustomElement, - CustomAttribute = item.CustomAttribute, - NestedElement1 = item.NestedElement1, - NestedElement2 = item.NestedElement2, - CommonAttribute1 = item.CommonAttribute1, - CommonAttribute2 = item.CommonAttribute2, - Location = item.Location == null ? null : new Location2 - { - Lat = item.Location.Lat, - Long = item.Location.Long - } - })); - - BaseEntry[] hierarchicalEntries = new BaseEntry[] - { - new BaseEntry - { - ID = 0, - MappedField = "MappedField0", - MappedInDerivedField = "MappedInDerivedField0", - UnmappedField = "UnmappedField0" - }, - new DerivedEntry - { - ID = 1, - MappedField = "MappedField1", - MappedInDerivedField = "MappedInDerivedField1", - UnmappedField = "UnmappedField1", - MappedConcreteField = "MappedConcreteField1", - UnmappedConcreteField = "UnmappedConcreteField1" - }, - }; - Array.ForEach(hierarchicalEntries, (item) => this.GetResourceSetEntities("HierarchicalEntries").Add(item)); - } - - protected override void EnsureDataIsInitialized() - { - if (!dataInitialized) - { - this.ResetData(); - dataInitialized = true; - } - } - } - - public class Author - { - public string Email { get; set; } - public string Name { get; set; } - public string Uri { get; set; } - public Contributor Contributor { get; set; } - } - - public class Contributor - { - public string Email { get; set; } - public string Name { get; set; } - public string Uri { get; set; } - } - - public class Location - { - public float Lat { get; set; } - public float Long { get; set; } - } - - public class Author2 - { - public string Email { get; set; } - public string Name { get; set; } - public string Uri { get; set; } - public Contributor2 Contributor { get; set; } - } - - public class Contributor2 - { - public string Email { get; set; } - public string Name { get; set; } - public string Uri { get; set; } - } - - public class Location2 - { - public float Lat { get; set; } - public float Long { get; set; } - } - - public class MappedEntry - { - public int ID { get; set; } - public string UnmappedField { get; set; } - public Author Author { get; set; } - public string Published { get; set; } - public string Rights { get; set; } - public string Summary { get; set; } - public string Title { get; set; } - public string Updated { get; set; } - public string CustomElement { get; set; } - public string CustomAttribute { get; set; } - public string NestedElement1 { get; set; } - public string NestedElement2 { get; set; } - public string CommonAttribute1 { get; set; } - public string CommonAttribute2 { get; set; } - public Location Location { get; set; } - } - - public class ReplicatedEntry - { - public int ID { get; set; } - public string UnmappedField { get; set; } - public Author2 Author { get; set; } - public string Published { get; set; } - public string Rights { get; set; } - public string Summary { get; set; } - public string Title { get; set; } - public string Updated { get; set; } - public string CustomElement { get; set; } - public string CustomAttribute { get; set; } - public string NestedElement1 { get; set; } - public string NestedElement2 { get; set; } - public string CommonAttribute1 { get; set; } - public string CommonAttribute2 { get; set; } - public Location2 Location { get; set; } - } - - public class BaseEntry - { - public int ID { get; set; } - public string UnmappedField { get; set; } - public string MappedInDerivedField { get; set; } - public string MappedField { get; set; } - } - - public class DerivedEntry : BaseEntry - { - public string UnmappedConcreteField { get; set; } - public string MappedConcreteField { get; set; } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/endpoints/ErrorDataService.svc ---------------------------------------------------------------------- diff --git a/odatajs/tests-tmp/endpoints/ErrorDataService.svc b/odatajs/tests-tmp/endpoints/ErrorDataService.svc deleted file mode 100644 index 052a2df..0000000 --- a/odatajs/tests-tmp/endpoints/ErrorDataService.svc +++ /dev/null @@ -1,78 +0,0 @@ - - -<%@ ServiceHost Language="C#" Factory="Microsoft.OData.Service.DataServiceHostFactory, Microsoft.OData.Service, Version=6.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" - Service="DataJS.Tests.ErrorDataService" %> - - - -namespace DataJS.Tests -{ - using System; - using System.Collections.Generic; - using Microsoft.OData.Service; - using System.Linq; - - /// - /// A data service that contains in-stream errors - /// - public class ErrorDataService : DataService - { - // This method is called only once to initialize service-wide policies. - public static void InitializeService(DataServiceConfiguration config) - { - config.SetEntitySetAccessRule("*", EntitySetRights.All); - config.DataServiceBehavior.MaxProtocolVersion = Microsoft.OData.Client.ODataProtocolVersion.V4; - } - } - - public class ErrorDataSource - { - public IQueryable Entities - { - get - { - ErrorType[] entities = new ErrorType[] - { - new ErrorType(() => 0), - new ErrorType(() => { throw new ApplicationException(); }) - }; - - return entities.AsQueryable(); - } - } - } - - public class ErrorType - { - Func generateID; - - public ErrorType(Func generateID) - { - this.generateID = generateID; - } - - public int ID - { - get { return this.generateID(); } - } - } -} \ No newline at end of file