You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ko...@apache.org on 2014/09/02 10:41:27 UTC
[1/4] git commit: [OLINGO-416] fix jsdoc error,
do not copy c# tmp filed to dist folder
Repository: olingo-odata4-js
Updated Branches:
refs/heads/master f57279e7f -> 29a0817e9
[OLINGO-416] fix jsdoc error, do not copy c# tmp filed to dist folder
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/fa7a8c18
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/tree/fa7a8c18
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/diff/fa7a8c18
Branch: refs/heads/master
Commit: fa7a8c180948b7df861490dd2eef6cfd82f200f5
Parents: f57279e
Author: Sven Kobler <sv...@sap.com>
Authored: Tue Sep 2 10:39:34 2014 +0200
Committer: Sven Kobler <sv...@sap.com>
Committed: Tue Sep 2 10:39:34 2014 +0200
----------------------------------------------------------------------
odatajs/Gruntfile.js | 2 +-
odatajs/grunt-config/release.js | 21 +++++++++++++++++----
2 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/fa7a8c18/odatajs/Gruntfile.js
----------------------------------------------------------------------
diff --git a/odatajs/Gruntfile.js b/odatajs/Gruntfile.js
index ffc5593..8c07d34 100644
--- a/odatajs/Gruntfile.js
+++ b/odatajs/Gruntfile.js
@@ -205,7 +205,7 @@ module.exports = function(grunt) {
// Create documentation in /build/doc
grunt.registerTask('doc', ['clearEnv', 'jsdoc:src']);
- grunt.registerTask('doc-test', [/*'npm-clean:doc-test',*/'jsdoc:test']);
+ grunt.registerTask('doc-test', ['clearEnv', 'jsdoc:test']);
// Build the odatajs library
grunt.registerTask('build', ['browserify:src', 'uglify:build', 'concat','copy:forDemo']);
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/fa7a8c18/odatajs/grunt-config/release.js
----------------------------------------------------------------------
diff --git a/odatajs/grunt-config/release.js b/odatajs/grunt-config/release.js
index fd4d2e3..f3a51ef 100644
--- a/odatajs/grunt-config/release.js
+++ b/odatajs/grunt-config/release.js
@@ -60,14 +60,28 @@ module.exports = function(grunt) {
files: [
{ dot: true, expand: true, cwd: '', src: ['**'], dest: './../dist/<%= filename %>/sources',
filter: function(srcPath) {
- //no node_modules
+ // no node_modules
if (srcPath === 'node_modules' || contains(srcPath, 'node_modules\\')) {
return false;
}
- if (srcPath === 'extern_modules' || contains(srcPath, 'extern_modules\\')) {
+ if (srcPath === 'extern-tools' || contains(srcPath, 'extern-tools\\')) {
return false;
}
+ // no c# files
+ if (srcPath === 'obj' || startsWith(srcPath, 'obj\\')) {
+ return false;
+ }
+
+ if (srcPath === 'bin' || startsWith(srcPath, 'bin\\')) {
+ return false;
+ }
+
+ if (srcPath === 'packages' || startsWith(srcPath, 'packages\\')) {
+ return false;
+ }
+
+ // no build retults
if (srcPath === 'build' || startsWith(srcPath, 'build\\')) {
return false;
}
@@ -118,9 +132,8 @@ module.exports = function(grunt) {
//tasks
grunt.registerTask('dist',[
'clean:release-dist',
-
'build',
- 'jsdoc:src',
+ 'doc',
'copy:release-lib','copy:release-doc','copy:release-sources',
'compress:release-lib','compress:release-doc','compress:release-sources']);
};
[2/4] [OLINGO-418] remove tests-tmp
Posted by ko...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/endpoints/FoodStoreDataServiceV4.svc
----------------------------------------------------------------------
diff --git a/odatajs/tests-tmp/endpoints/FoodStoreDataServiceV4.svc b/odatajs/tests-tmp/endpoints/FoodStoreDataServiceV4.svc
deleted file mode 100644
index ac1cfe7..0000000
--- a/odatajs/tests-tmp/endpoints/FoodStoreDataServiceV4.svc
+++ /dev/null
@@ -1,590 +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.
- */
--->
-
-<%@ ServiceHost Language="C#" Factory="Microsoft.OData.Service.DataServiceHostFactory, Microsoft.OData.Service, Version=6.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
- Service="DataJS.Tests.V4.FoodStoreDataService" %>
-
-namespace DataJS.Tests.V4
-{
- using System;
- using System.Collections.Generic;
- using Microsoft.OData.Service;
- using Microsoft.OData.Service.Providers;
- using System.Linq;
- using System.ServiceModel.Web;
- using System.Web;
- using System.IO;
- using Microsoft.Spatial;
-
- /// <summary>
- /// Provides a service similar to FoodStoreDataService, but uses V4 and WCF Data Services 6.0.0-beta1
- /// features.
- /// </summary>
- [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]
- public class FoodStoreDataService : DataService<FoodContainer>
- {
- // 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.UseVerboseErrors = true;
- // Set Foods page size to 5 for cache testing
- config.SetEntitySetPageSize("Foods", 5);
- // Make the Categories set paged to have a paged feed
- config.SetEntitySetPageSize("Categories", 1);
- }
-
- [WebInvoke]
- public string ResetData()
- {
- this.CurrentDataSource.ResetData();
- return "Data Reset";
- }
-
- [WebGet]
- public IQueryable<string> FoodsAvailable()
- {
- return this.CurrentDataSource.Foods.Select(food => food.Name);
- }
-
- [WebGet]
- public IQueryable<Package> PackagingTypes()
- {
- return this.CurrentDataSource.Foods.Select(food => food.Packaging);
- }
-
- [WebGet]
- public string UserNameAndPassword()
- {
- var request = WebOperationContext.Current.IncomingRequest;
- string authorization = request.Headers["Authorization"];
- if (String.IsNullOrEmpty(authorization))
- {
- WebOperationContext.Current.OutgoingResponse.Headers["WWW-Authenticate"] = "Basic realm=\"localhost\"";
- throw new DataServiceException(401, "Access denied in UserNameAndPassword");
- }
-
- return authorization;
- }
- }
-
- public class FoodContainer : ReflectionDataContext, IUpdatable, IDataServiceStreamProvider2
- {
- private static bool dataInitialized;
-
- public IQueryable<Category> Categories
- {
- get { return this.GetResourceSetEntities<Category>("Categories").AsQueryable(); }
- }
-
- public IQueryable<Food> Foods
- {
- get { return this.GetResourceSetEntities<Food>("Foods").AsQueryable(); }
- }
-
- public void ResetData()
- {
- this.ClearData();
-
- var builder = SpatialImplementation.CurrentImplementation.CreateBuilder();
- builder.GeometryPipeline.SetCoordinateSystem(CoordinateSystem.DefaultGeography);
- builder.GeometryPipeline.BeginGeometry(SpatialType.Collection);
- builder.GeometryPipeline.BeginFigure(new GeometryPosition(5.0, 5.0));
- builder.GeometryPipeline.EndFigure();
- builder.GeometryPipeline.EndGeometry();
-
- int i = 0;
- Category[] categories = new Category[]
- {
- new Category { CategoryID = i++, Name = "Baking Supplies" },
- new Category { CategoryID = i++, Name = "Condiments" },
- new Category { CategoryID = i++, Name = "Empty Category" }
- };
- Array.ForEach(categories, (category) => this.GetResourceSetEntities<Category>("Categories").Add(category));
-
- i = 0;
- Food[] foods = new Food[]
- {
- new Food()
- {
- FoodID = i++,
- Name = "flour",
- UnitPrice = .19999,
- ServingSize = 1,
- MeasurementUnit = "Cup",
- ProteinGrams = 3,
- FatGrams = 1,
- CarbohydrateGrams = 20,
- CaloriesPerServing = 140,
- IsAvailable = true,
- ExpirationDate = new DateTime(2010, 12, 25, 12, 0, 0),
- ItemGUID = new Guid("27272727272727272727272727272727"),
- Weight = 10f,
- AvailableUnits = 1,
-
- Packaging = new Package(){
- Type = null,
- Color = String.Empty,
- NumberPerPackage = int.MaxValue,
- RequiresRefridgeration = false,
- PackageDimensions = new Dimensions()
- {
- Length = Decimal.MaxValue,
- Height = Int16.MaxValue,
- Width = Int64.MaxValue,
- Volume = double.MaxValue,
- },
- ShipDate = new DateTime(2000, 12, 29)
- },
-
- CookedSize = new CookedDimensions()
- {
- Height = 1,
- Length = 2,
- Width = 3,
- Volume = 1 * 2 * 3
- },
-
- Category = categories[0],
-
- AlternativeNames = new List<string>() {"ground cereal", "ground grain"},
-
- Providers = new List<Provider> {
- new Provider() {
- Name= "Flour Provider",
- Aliases = new List<string>() {"fp1", "flour provider1"},
- Details = new ProviderDetails() {
- Telephone= "555-555-555",
- PreferredCode = 1001
- }
- },
- new Provider() {
- Name= "Ground Grains",
- Aliases = new List<string>()
- }
- },
-
- SpatialData = (GeometryCollection)builder.ConstructedGeometry
- },
-
- new Food()
- {
- FoodID = i++,
- Name = "sugar",
- UnitPrice = .2,
- ServingSize = 1,
- MeasurementUnit = "tsp",
- ProteinGrams = 0,
- FatGrams = 0,
- CarbohydrateGrams = 4,
- CaloriesPerServing = 16,
- IsAvailable = false,
- ExpirationDate = new DateTime(2011, 12, 28),
- ItemGUID = new Guid("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"),
- Weight = 0.1f,
- AvailableUnits = 0,
-
- Packaging = new Package(){
- Type = " ",
- Color = "BLUE",
- NumberPerPackage = int.MinValue,
- RequiresRefridgeration = true,
- PackageDimensions = new Dimensions(){
- Length = Decimal.MinValue,
- Height = Int16.MinValue,
- Width = Int64.MinValue,
- Volume = double.MinValue,
- },
- ShipDate = new DateTime(2000, 12, 29),
- },
-
- Category = categories[1],
- },
-
- new Food()
- {
- FoodID = i++,
- Name = "1 Chicken Egg",
- UnitPrice = 0.55,
- MeasurementUnit = null,
- ServingSize = 1,
- ProteinGrams = 6,
- FatGrams = 1,
- CarbohydrateGrams = 1,
- CaloriesPerServing = 70,
- IsAvailable = true,
- ExpirationDate = new DateTime(2000, 12, 29),
- ItemGUID = new Guid("00000000000000000000000000000000"),
- Weight = 0,
- AvailableUnits = -128,
-
- Packaging = new Package(){
- Type = "18 - Carton",
- Color = " brown ",
- NumberPerPackage = 0,
- RequiresRefridgeration = true,
- PackageDimensions = null,
- ShipDate = new DateTime(2000, 12, 29),
- },
-
- Category = null,
- },
-
- new Food()
- {
- FoodID = i++,
- Name = "Brown Sugar",
- UnitPrice = 1.6,
- ServingSize = 1,
- MeasurementUnit = "TSP.",
- ProteinGrams = 0,
- FatGrams = 0,
- CarbohydrateGrams = 5,
- CaloriesPerServing = 16,
- IsAvailable = true,
- ExpirationDate = new DateTime(2011, 12, 28),
- ItemGUID = new Guid("0123456789abcdef0123456789abcdef"),
- Weight = 4.5f,
- AvailableUnits = 127,
- Packaging = null,
- Category = categories[1],
- },
-
- new PreparedFood()
- {
- FoodID = i++,
- Name = "Cobb Salad",
- UnitPrice = 1.99,
- ServingSize = -1,
- MeasurementUnit = "cups",
- ProteinGrams = 6,
- FatGrams = 1,
- CarbohydrateGrams = 3,
- CaloriesPerServing = 5,
- IsAvailable = true,
- ExpirationDate = new DateTime(2000, 12, 29),
- ItemGUID = new Guid("0123456789abcdef0123456789abcdef"),
- Weight = 5.674f,
- AvailableUnits = 127,
- Packaging = null,
- Category = categories[1],
- Instructions = "1.) Open 2.) Eat",
- NumberOfIngredients = 4,
- },
-
- new PreparedFood()
- {
- FoodID = i++,
- Name = "Lasagna",
- UnitPrice = 0,
- ServingSize = 8,
- MeasurementUnit = " servings",
- ProteinGrams = 100,
- FatGrams = 4,
- CarbohydrateGrams = 27,
- CaloriesPerServing = 389,
- IsAvailable = true,
- ExpirationDate = new DateTime(1904, 2, 29),
- ItemGUID = new Guid("0123456789abcdef0123456789abcdef"),
- Weight = 0,
- AvailableUnits = 4,
- Packaging = new Package(){
- Type = "box",
- Color = " 1 ",
- NumberPerPackage = 1,
- RequiresRefridgeration = true,
- PackageDimensions = new Dimensions(){
- Length = 3,
- Height = 1,
- Width = 5,
- Volume = 1.5,
- },
- ShipDate = new DateTime(2000, 12, 29),
- },
- Category = categories[0],
- Instructions = "Bake in oven",
- NumberOfIngredients = 15,
- },
-
- new Food()
- {
- FoodID = i++,
- Name = "Chocolate"
- },
-
- new Food()
- {
- FoodID = i++,
- Name = "Pizza"
- },
-
- new Food()
- {
- FoodID = i++,
- Name = "Avocados"
- },
-
- new Food()
- {
- FoodID = i++,
- Name = "Quinoa"
- },
-
- new Food()
- {
- FoodID = i++,
- Name = "Oatmeal"
- },
-
- new Food()
- {
- FoodID = i++,
- Name = "Peanut Butter"
- },
-
- new Food()
- {
- FoodID = i++,
- Name = "Banana"
- },
-
- new Food()
- {
- FoodID = i++,
- Name = "Yam"
- },
-
- new Food()
- {
- FoodID = i++,
- Name = "Clam"
- },
-
- new Food()
- {
- FoodID = i++,
- Name = "Spam"
- }
- };
- Array.ForEach(foods, (food) => this.GetResourceSetEntities<Food>("Foods").Add(food));
-
- categories[0].Foods.Add(foods[0]);
- categories[1].Foods.Add(foods[2]);
- categories[1].Foods.Add(foods[3]);
- }
-
- protected override void EnsureDataIsInitialized()
- {
- if (!dataInitialized)
- {
- this.ResetData();
- dataInitialized = true;
- }
- }
-
- public Stream GetReadStream(object entity, ResourceProperty streamProperty, string etag, bool? checkETagForEquality, DataServiceOperationContext operationContext)
- {
- return new MemoryStream();
- }
-
- public Uri GetReadStreamUri(object entity, ResourceProperty streamProperty, DataServiceOperationContext operationContext)
- {
- if (streamProperty.Name == "Icon")
- {
- return null;
- }
- return new Uri(operationContext.AbsoluteServiceUri, streamProperty.Name);
- }
-
- public string GetStreamContentType(object entity, ResourceProperty streamProperty, DataServiceOperationContext operationContext)
- {
- if (streamProperty.Name == "Icon")
- {
- return "image/gif";
- }
- return "image/png";
- }
-
- public string GetStreamETag(object entity, ResourceProperty streamProperty, DataServiceOperationContext operationContext)
- {
- return "W/\"123456789\"";
- }
-
- public Stream GetWriteStream(object entity, ResourceProperty streamProperty, string etag, bool? checkETagForEquality, DataServiceOperationContext operationContext)
- {
- return new MemoryStream();
- }
-
- public void DeleteStream(object entity, DataServiceOperationContext operationContext)
- {
- // do nothing.
- }
-
- public Stream GetReadStream(object entity, string etag, bool? checkETagForEquality, DataServiceOperationContext operationContext)
- {
- throw new NotImplementedException();
- }
-
- public Uri GetReadStreamUri(object entity, DataServiceOperationContext operationContext)
- {
- throw new NotImplementedException();
- }
-
- public string GetStreamContentType(object entity, DataServiceOperationContext operationContext)
- {
- throw new NotImplementedException();
- }
-
- public string GetStreamETag(object entity, DataServiceOperationContext operationContext)
- {
- throw new NotImplementedException();
- }
-
- public Stream GetWriteStream(object entity, string etag, bool? checkETagForEquality, DataServiceOperationContext operationContext)
- {
- throw new NotImplementedException();
- }
-
- public string ResolveType(string entitySetName, DataServiceOperationContext operationContext)
- {
- throw new NotImplementedException();
- }
-
- public int StreamBufferSize
- {
- get { return 1024; }
- }
- }
-
- /// <summary>
- /// The Category class is a simple class with V1-compatible feed customizations.
- /// </summary>
- public class Category
- {
- public Category()
- {
- this.Foods = new List<Food>();
- }
-
- public int CategoryID { get; set; }
- public string Name { get; set; }
- public List<Food> Foods { get; set; }
- }
-
- /// <summary>
- /// The Food class has a mixture of V1-compatible and incompatible feed
- /// customizations (thus it's V2), and custom mappings.
- /// </summary>
- public class Food
- {
- private List<string> alternativeNames = new List<string>();
- private List<Provider> providers = new List<Provider>();
-
- // Primitive types
- public int FoodID { get; set; }
- public string Name { get; set; }
- public double UnitPrice { get; set; }
- public Decimal ServingSize { get; set; }
- public string MeasurementUnit { get; set; }
- public Byte ProteinGrams { get; set; }
- public Int16 FatGrams { get; set; }
- public Int32 CarbohydrateGrams { get; set; }
- public Int64 CaloriesPerServing { get; set; }
- public Boolean IsAvailable { get; set; }
- public DateTime ExpirationDate { get; set; }
- public Guid ItemGUID { get; set; }
- public Single Weight { get; set; }
- public sbyte AvailableUnits { get; set; }
-
- // Complex types
- public Package Packaging { get; set; }
- public CookedDimensions CookedSize { get; set; }
-
- // Navigation properties
- public Category Category { get; set; }
-
- // Collection properties
- public List<string> AlternativeNames
- {
- get { return alternativeNames; }
- set { alternativeNames = value; }
- }
-
- public List<Provider> Providers
- {
- get { return providers; }
- set { providers = value; }
- }
-
- public GeometryCollection SpatialData
- {
- get;
- set;
- }
-
- }
-
- public class Provider
- {
- public string Name { get; set; }
- public List<string> Aliases { get; set; }
- public ProviderDetails Details { get; set; }
- }
-
- public class ProviderDetails
- {
- public string Telephone { get; set; }
- public int PreferredCode { get; set; }
- }
-
- public class Package
- {
- public string Type { get; set; }
- public string Color { get; set; }
- public int NumberPerPackage { get; set; }
- public Boolean RequiresRefridgeration { get; set; }
- public DateTime ShipDate { get; set; }
- public Dimensions PackageDimensions { get; set; }
- }
-
- public class Dimensions
- {
- public Decimal Length { get; set; }
- public Int16 Height { get; set; }
- public Int64 Width { get; set; }
- public double Volume { get; set; }
- }
-
- public class CookedDimensions
- {
- public Decimal Length { get; set; }
- public Int16 Height { get; set; }
- public Int64 Width { get; set; }
- public double Volume { get; set; }
- }
-
- public class PreparedFood : Food
- {
- public string Instructions { get; set; }
- public float NumberOfIngredients { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/endpoints/LargeCollectionService.svc
----------------------------------------------------------------------
diff --git a/odatajs/tests-tmp/endpoints/LargeCollectionService.svc b/odatajs/tests-tmp/endpoints/LargeCollectionService.svc
deleted file mode 100644
index bfbd3ef..0000000
--- a/odatajs/tests-tmp/endpoints/LargeCollectionService.svc
+++ /dev/null
@@ -1,113 +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.
- */
--->
-
-<%@ ServiceHost Language="C#" Factory="Microsoft.OData.Service.DataServiceHostFactory, Microsoft.OData.Service, Version=6.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
- Service="DataJS.Tests.LargeCollectionService" %>
-
-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.Web;
-
- [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
- public class LargeCollectionService : DataService<LargeCollection>
- {
- // 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.UseVerboseErrors = true;
- }
-
- [WebInvoke]
- public void ResetData()
- {
- this.CurrentDataSource.ResetData();
- }
- }
-
- public class LargeCollection : ReflectionDataContext, IUpdatable
- {
- private static bool dataInitialized;
-
- public IQueryable<Customer> Customers
- {
- get { return this.GetResourceSetEntities<Customer>("Customers").AsQueryable(); }
- }
-
- public IQueryable<Supplier> Suppliers
- {
- get { return this.GetResourceSetEntities<Supplier>("Suppliers").AsQueryable(); }
- }
-
- public void ResetData()
- {
- this.ClearData();
-
- IList<Customer> customers = this.GetResourceSetEntities<Customer>("Customers");
- foreach (int i in Enumerable.Range(1, 2 * 1024 * 1024))
- {
- customers.Add(new Customer()
- {
- ID = i,
- Name = "Customer " + i
- });
- }
-
- IList<Supplier> suppliers = this.GetResourceSetEntities<Supplier>("Suppliers");
- foreach (int i in Enumerable.Range(1, 5000))
- {
- suppliers.Add(new Supplier()
- {
- ID = i,
- Name = "Supplier " + i
- });
- }
- }
-
- protected override void EnsureDataIsInitialized()
- {
- if (!dataInitialized)
- {
- this.ResetData();
- dataInitialized = true;
- }
- }
- }
-
- public class Customer
- {
- public int ID { get; set; }
- public string Name { get; set; }
- }
-
- public class Supplier
- {
- 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/web.config
----------------------------------------------------------------------
diff --git a/odatajs/tests-tmp/endpoints/web.config b/odatajs/tests-tmp/endpoints/web.config
deleted file mode 100644
index 116a567..0000000
--- a/odatajs/tests-tmp/endpoints/web.config
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version='1.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.
- */
--->
-<configuration>
- <system.web>
- <compilation debug='true'>
- <assemblies>
- <add assembly='System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089'/>
- <add assembly='System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089'/>
- <add assembly='System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35'/>
- <add assembly='System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089'/>
- <add assembly='System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089'/>
- <add assembly='System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089'/>
- <add assembly='System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35'/>
- <add assembly="Microsoft.OData.Core, Version=6.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
- <add assembly="Microsoft.OData.Service, Version=6.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
- <add assembly="Microsoft.OData.Client, Version=6.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
- </assemblies>
- </compilation>
- </system.web>
- <system.codedom>
- <compilers>
- <compiler language='c#;cs;csharp' extension='.cs' type='Microsoft.CSharp.CSharpCodeProvider,System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'>
- <providerOption name='CompilerVersion' value='v4.0' />
- </compiler>
- </compilers>
- </system.codedom>
-</configuration>
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/odata-json-tests-todo-analyse.js
----------------------------------------------------------------------
diff --git a/odatajs/tests-tmp/odata-json-tests-todo-analyse.js b/odatajs/tests-tmp/odata-json-tests-todo-analyse.js
deleted file mode 100644
index 702e015..0000000
--- a/odatajs/tests-tmp/odata-json-tests-todo-analyse.js
+++ /dev/null
@@ -1,828 +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.
- */
-
-// odata-tests.js
-
-(function (window, undefined) {
- djstest.addTest(function jsonParserTest() {
- var tests = [
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" }, expected: {} },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" },
- expected: {
- "@odata.context": "http://foo/OData.svc/$metadata",
- value: [
- {
- name: "Products",
- kind: "EntitySet",
- url: "Products"
- },
- {
- name: "ProductDetails",
- kind: "EntitySet",
- url: "ProductDetails"
- }
- ]
- }
- },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" },
- expected: {
- value: [
- {
- name: "Products",
- kind: "EntitySet",
- url: "http://foo/OData.svc/Products"
- },
- {
- name: "ProductDetails",
- kind: "EntitySet",
- url: "http://foo/OData.svc/ProductDetails"
- }
- ]
- }
- },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" }, expected: { "@odata.context": "http://foo/OData.svc/$metadata#Products(0)/Name", value: "Bread"} },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" },
- expected: {
- "@odata.context": "http://foo/OData.svc/$metadata#Products",
- value: [
- {
- "@odata.type": "#ODataDemo.Product",
- "@odata.id": "http://foo/OData.svc/Products(0)",
- "@odata.editLink": "Products(0)",
- "Categories@odata.navigationLink": "Products(0)/Categories",
- "Categories@odata.associationLink": "Products(0)/Categories/$ref",
- "Supplier@odata.navigationLink": "Products(0)/Supplier",
- "Supplier@odata.associationLink": "Products(0)/Supplier/$ref",
- "ProductDetail@odata.navigationLink": "Products(0)/ProductDetail",
- "ProductDetail@odata.associationLink": "Products(0)/ProductDetail/$ref",
- ID: 0,
- Name: "Bread",
- Description: "Whole grain bread",
- "ReleaseDate@odata.type": "#DateTimeOffset",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- "Rating@odata.type": "#Int16",
- Rating: 4,
- Price: 2.5
- }]
- }
- },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" },
- expected: {
- "@odata.context": "http://foo/OData.svc/$metadata#Products",
- value: [
- {
- ID: 0,
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 4,
- Price: 2.5
- }]
- }
- },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" },
- expected: {
- value: [
- {
- ID: 0,
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 4,
- Price: 2.5
- }]
- }
- },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" },
- expected: {
- "@odata.context": "http://foo/OData.svc/$metadata#Products/$entry",
- "@odata.type": "#ODataDemo.Product",
- "@odata.id": "http://foo/OData.svc/Products(0)",
- "@odata.editLink": "Products(0)",
- "Categories@odata.navigationLink": "Products(0)/Categories",
- "Categories@odata.associationLink": "Products(0)/Categories/$ref",
- "Supplier@odata.navigationLink": "Products(0)/Supplier",
- "Supplier@odata.associationLink": "Products(0)/Supplier/$ref",
- "ProductDetail@odata.navigationLink": "Products(0)/ProductDetail",
- "ProductDetail@odata.associationLink": "Products(0)/ProductDetail/$ref",
- ID: 0,
- Name: "Bread",
- Description: "Whole grain bread",
- "ReleaseDate@odata.type": "#DateTimeOffset",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- "Rating@odata.type": "#Int16",
- Rating: 4,
- Price: 2.5
- }
- },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" },
- expected: {
- "@odata.context": "http://foo/OData.svc/$metadata#Products/$entry",
- ID: 0,
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 4,
- Price: 2.5
- }
- },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" },
- expected: {
- ID: 0,
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 4,
- Price: 2.5
- }
- },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" },
- expected: {
- "@odata.context": "http://foo/$metadata#Customer(-10)/PrimaryContactInfo/AlternativeNames",
- "@odata.type": "#Collection(String)",
- value: [
- "グぁマせぺネソぁぼソひバたぴソ歹九ネボボяポソ畚クяせべ歹珱Я欲タハバミ裹ぼボをヲ歹んひ九ひ匚ぁa",
- "qckrnuruxcbhjfimnsykgfquffobcadpsaocixoeljhspxrhebkudppgndgcrlyvynqhbujrnvyxyymhnroemigogsqulvgallta",
- "btsnhqrjqryqzgxducl",
- "qbtlssjhunufmzdv",
- "ボんЯぜチべゼボボほa匚ミぼ九ぁひチ珱黑ミんぁタび暦クソソボゾんんあゼぞひタボタぜん弌ひべ匚",
- "vicqasfdkxsuyuzspjqunxpyfuhlxfhgfqnlcpdfivqnxqoothnfsbuykfguftgulgldnkkzufssbae",
- "九ソミせボぜゾボёaをぜЯまゾタぜタひ縷ダんaバたゼソ",
- "ぽマタぁぁ黑ソゼミゼ匚zソダマぁァゾぽミaタゾ弌ミゼタそzぺポせ裹バポハハヲぺチあマ匚ミ",
- "hssiißuamtctgqhglmusexyikhcsqctusonubxorssyizhyqpbtbdßjnelxqttkhdalabibuqhiubtßsptrmzelud",
- "gbjssllxzzxkmßppyyrhgmoeßizlcmsuqqnvjßudszevtfunflqzqcuubukypßqjcix"
- ]
- }
- }
- ];
-
- var i, len;
- for (i = 0, len = tests.length; i < len; i++) {
- var data = JSON.stringify(tests[i].expected);
- var actual = window.odatajs.oData.json.jsonParser(window.odatajs.oData.json.jsonHandler, data, tests[i].context);
- djstest.assertAreEqualDeep(actual, tests[i].expected, "test " + i + "didn't return the expected data");
- }
-
- djstest.done();
- });
-
- djstest.addTest(function jsonSerializerTest() {
- var tests = [
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" }, expected: { value: ""} },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" }, expected: { value: []} },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" },
- expected: {
- ID: 0,
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 4,
- Price: 2.5
- }
- },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" },
- expected: {
- value: [
- "グぁマせぺネソぁぼソひバたぴソ歹九ネボボяポソ畚クяせべ歹珱Я欲タハバミ裹ぼボをヲ歹んひ九ひ匚ぁa",
- "qckrnuruxcbhjfimnsykgfquffobcadpsaocixoeljhspxrhebkudppgndgcrlyvynqhbujrnvyxyymhnroemigogsqulvgallta",
- "btsnhqrjqryqzgxducl",
- "qbtlssjhunufmzdv",
- "ボんЯぜチべゼボボほa匚ミぼ九ぁひチ珱黑ミんぁタび暦クソソボゾんんあゼぞひタボタぜん弌ひべ匚",
- "vicqasfdkxsuyuzspjqunxpyfuhlxfhgfqnlcpdfivqnxqoothnfsbuykfguftgulgldnkkzufssbae",
- "九ソミせボぜゾボёaをぜЯまゾタぜタひ縷ダんaバたゼソ",
- "ぽマタぁぁ黑ソゼミゼ匚zソダマぁァゾぽミaタゾ弌ミゼタそzぺポせ裹バポハハヲぺチあマ匚ミ",
- "hssiißuamtctgqhglmusexyikhcsqctusonubxorssyizhyqpbtbdßjnelxqttkhdalabibuqhiubtßsptrmzelud",
- "gbjssllxzzxkmßppyyrhgmoeßizlcmsuqqnvjßudszevtfunflqzqcuubukypßqjcix"
- ]
- }
- },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" },
- expected: {
- "@odata.id": "Foods(4)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 0,
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 4,
- Price: 2.5
- },
- data: {
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(0)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag",
- ID: 0,
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 4,
- Price: 2.5
- }
- },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" },
- expected: {
- "@odata.id": "Foods(4)",
- value : [{
- "@odata.id": "Foods(4)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 0,
- ComplexInLayerOne:
- {
- "@odata.id": "Foods(4)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 1,
- ComplexInLayerTwo:
- {
- "@odata.id": "Foods(4)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 2,
- ComplexInLayerThreeList: [
- {
- "@odata.id": "Foods(4)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 3,
- Name: "BreadInLayer3",
- Description: "Whole grain bread inLayer3",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 7,
- Price: 5.5
- },
- {
- "@odata.id": "Foods(4)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 3,
- Name: "BreadInLayer3",
- Description: "Whole grain bread inLayer3",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 7,
- Price: 5.5
- }],
- Name: "BreadInLayer2",
- Description: "Whole grain bread inLayer2",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 6,
- Price: 4.5
- },
- Name: ["BreadInLayer1", "BreadInLayer12", "BreadInLayer13"],
- Description: "Whole grain bread inLayer1",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 5,
- Price: 3.5
- },
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 4,
- Price: 2.5
- },
- {
- "@odata.id": "Foods(4)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 0,
- ComplexInLayerOne:
- {
- "@odata.id": "Foods(4)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 1,
- ComplexInLayerTwo:
- {
- "@odata.id": "Foods(4)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 2,
- ComplexInLayerThreeList: [
- {
- "@odata.id": "Foods(4)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 3,
- Name: "BreadInLayer3",
- Description: "Whole grain bread inLayer3",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 7,
- Price: 5.5
- },
- {
- "@odata.id": "Foods(4)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 3,
- Name: "BreadInLayer3",
- Description: "Whole grain bread inLayer3",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 7,
- Price: 5.5
- }],
- Name: "BreadInLayer2",
- Description: "Whole grain bread inLayer2",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 6,
- Price: 4.5
- },
- Name: ["BreadInLayer1", "BreadInLayer12", "BreadInLayer13"],
- Description: "Whole grain bread inLayer1",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 5,
- Price: 3.5
- },
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 4,
- Price: 2.5
- }]
- },
- data: {
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.editLink": "Foods(0)",
- value : [{
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(0)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag",
- ID: 0,
- ComplexInLayerOne:
- {
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(0)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink/layer1",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink/layer1",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType/layer1",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag/layer1",
- ID: 1,
- ComplexInLayerTwo:
- {
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(0)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink/layer2",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink/layer2",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType/layer2",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag/layer2",
- ID: 2,
- ComplexInLayerThreeList: [
- {
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(0)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink/layer3",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink/layer3",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType/layer3",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag/layer3",
- ID: 3,
- Name: "BreadInLayer3",
- Description: "Whole grain bread inLayer3",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 7,
- Price: 5.5
- },
- {
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(0)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink/layer3",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink/layer3",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType/layer3",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag/layer3",
- ID: 3,
- Name: "BreadInLayer3",
- Description: "Whole grain bread inLayer3",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 7,
- Price: 5.5
- }],
- Name: "BreadInLayer2",
- Description: "Whole grain bread inLayer2",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 6,
- Price: 4.5
- },
- Name: ["BreadInLayer1", "BreadInLayer12", "BreadInLayer13"],
- Description: "Whole grain bread inLayer1",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 5,
- Price: 3.5
- },
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 4,
- Price: 2.5
- },
- {
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(0)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag",
- ID: 0,
- ComplexInLayerOne:
- {
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(0)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink/layer1",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink/layer1",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType/layer1",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag/layer1",
- ID: 1,
- ComplexInLayerTwo:
- {
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(0)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink/layer2",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink/layer2",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType/layer2",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag/layer2",
- ID: 2,
- ComplexInLayerThreeList: [
- {
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(0)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink/layer3",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink/layer3",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType/layer3",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag/layer3",
- ID: 3,
- Name: "BreadInLayer3",
- Description: "Whole grain bread inLayer3",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 7,
- Price: 5.5
- },
- {
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(0)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink/layer3",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink/layer3",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType/layer3",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag/layer3",
- ID: 3,
- Name: "BreadInLayer3",
- Description: "Whole grain bread inLayer3",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 7,
- Price: 5.5
- }],
- Name: "BreadInLayer2",
- Description: "Whole grain bread inLayer2",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 6,
- Price: 4.5
- },
- Name: ["BreadInLayer1", "BreadInLayer12", "BreadInLayer13"],
- Description: "Whole grain bread inLayer1",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 5,
- Price: 3.5
- },
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 4,
- Price: 2.5
- }]
- }
- },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" },
- expected: {
- "@odata.id": "Foods(4)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 0,
- ComplexInLayerOne:
- {
- "@odata.id": "Foods(4)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 1,
- ComplexInLayerTwo:
- {
- "@odata.id": "Foods(4)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 2,
- ComplexInLayerThree:
- {
- "@odata.id": "Foods(4)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 3,
- Name: "BreadInLayer3",
- Description: "Whole grain bread inLayer3",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 7,
- Price: 5.5
- },
- Name: "BreadInLayer2",
- Description: "Whole grain bread inLayer2",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 6,
- Price: 4.5
- },
- Name: "BreadInLayer1",
- Description: "Whole grain bread inLayer1",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 5,
- Price: 3.5
- },
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 4,
- Price: 2.5
- },
- data: {
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(0)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag",
- ID: 0,
- ComplexInLayerOne:
- {
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(0)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink/layer1",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink/layer1",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType/layer1",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag/layer1",
- ID: 1,
- ComplexInLayerTwo:
- {
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(0)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink/layer2",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink/layer2",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType/layer2",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag/layer2",
- ID: 2,
- ComplexInLayerThree:
- {
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(0)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink/layer3",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink/layer3",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType/layer3",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag/layer3",
- ID: 3,
- Name: "BreadInLayer3",
- Description: "Whole grain bread inLayer3",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 7,
- Price: 5.5
- },
- Name: "BreadInLayer2",
- Description: "Whole grain bread inLayer2",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 6,
- Price: 4.5
- },
- Name: "BreadInLayer1",
- Description: "Whole grain bread inLayer1",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 5,
- Price: 3.5
- },
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 4,
- Price: 2.5
- }
- },
- { context: { response: { requestUri: "http://base.org" }, dataServiceVersion: "4.0" },
- expected: {
- value: [{
- "@odata.id": "Foods(4)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 0,
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 4,
- Price: 2.5
- },
- {
- "@odata.id": "Foods(2)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- ID: 1,
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1999-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 6,
- Price: 3.5
- }]
- },
- data: {
- value: [{
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(4)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(0)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag",
- ID: 0,
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1992-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 4,
- Price: 2.5
- },
- {
- "@odata.context": "http://base.org/$metadata#Foods/$entity",
- "@odata.id": "Foods(2)",
- "@odata.etag": "W/MjAxMy0wNS0yN1QxMTo1OFo=",
- "@odata.editLink": "Foods(2)",
- "@odata.type": "#DataJS.Tests.V4.Food",
- "@odata.mediaEditLink": "http://base.org/$metadata#Foods/mediaEditLink2",
- "@odata.mediaReadLink": "http://base.org/$metadata#Foods/mediaReadLink2",
- "@odata.mediaContentType": "http://base.org/$metadata#Foods/mediaContentType2",
- "@odata.mediaEtag": "http://base.org/$metadata#Foods/mediaEtag2",
- ID: 1,
- Name: "Bread",
- Description: "Whole grain bread",
- ReleaseDate: "1999-01-01T00:00:00Z",
- DiscontinuedDate: null,
- Rating: 6,
- Price: 3.5
- }]
- }
- }
- ];
- var i, len;
- for (i = 0, len = tests.length; i < len; i++) {
- var data = tests[i].data ? tests[i].data : tests[i].expected;
- var actual = window.odatajs.oData.json.jsonSerializer(window.odatajs.oData.json.jsonHandler, data, tests[i].context);
- var expected = JSON.stringify(tests[i].expected);
- djstest.assertAreEqualDeep(actual, expected, "test " + i + "didn't return the expected data");
- }
- djstest.done();
- });
-
- djstest.addTest(function normalizeHeadersReadTest() {
- // Verifies that headers are normalized for reading.
- // See issue at http://datajs.codeplex.com/workitem/148
- MockHttpClient.clear();
-
- MockHttpClient.clear().addResponse("/foo", {
- statusCode: 200,
- body: { "@odata.context": "http://foo", value: [] },
- headers: { "unknown": "u", "Content-Encoding": "compress, gzip", "Content-Length": "8042",
- "Content-Type": "application/json", "OData-Version": "4.0", "Etag": "Vetag", "Location": "foo", "OData-EntityId": "entityId",
- "Preference-Applied": "prefered", "Retry-After": "retry"
- }
- });
-
- odatajs.oData.read("/foo", function (data, response) {
- // djstest.assertAreEqual(data.results.length, 2, "data.results.length has two entries");
- djstest.assertAreEqual(response.headers.unknown, "u", "u unmodified");
- djstest.assertAreEqual(response.headers["Content-Encoding"], "compress, gzip", "Content-Encoding available");
- djstest.assertAreEqual(response.headers["Content-Length"], "8042", "Content-Length available");
- djstest.assertAreEqual(response.headers["Content-Type"], "application/json", "Content-Type available");
- djstest.assertAreEqual(response.headers["ETag"], "Vetag", "Content-Type available");
- djstest.assertAreEqual(response.headers["Location"], "foo", "Content-Type available");
- djstest.assertAreEqual(response.headers["OData-EntityId"], "entityId", "OData-EntityId available");
- djstest.assertAreEqual(response.headers["Preference-Applied"], "prefered", "Preference-Applied available");
- djstest.assertAreEqual(response.headers["Retry-After"], "retry", "Retry available");
- djstest.assertAreEqual(response.headers["OData-Version"], "4.0", "OData-Version available");
- djstest.done();
- }, undefined, undefined, MockHttpClient);
- });
-
- djstest.addTest(function normalizeHeadersWriteTest() {
-
- // Verifies that headers are normalized for writing.
- // See issue at http://datajs.codeplex.com/workitem/148
-
- MockHttpClient.clear().addRequestVerifier("/foo", function (request) {
- djstest.assertAreEqual(request.headers.Accept, "application/json", "Accept available");
- djstest.assertAreEqual(request.headers["Content-Type"], "application/json", "json found");
- djstest.assertAreEqual(request.headers["Content-Encoding"], "compress, gzip", "Content-Encoding available");
- djstest.assertAreEqual(request.headers["Content-Length"], "8042", "Content-Length available");
- djstest.assertAreEqual(request.headers["OData-Version"], "4.0", "OData-Version available");
- djstest.assertAreEqual(request.headers["Accept-Charset"], "Accept-Charset", "Accept-Charset available");
- djstest.assertAreEqual(request.headers["If-Match"], "true", "If-Match available");
- djstest.assertAreEqual(request.headers["If-None-Match"], "false", "If-None-Match available");
- djstest.assertAreEqual(request.headers["OData-Isolation"], "isolation", "OData-Isolation available");
- djstest.assertAreEqual(request.headers["OData-MaxVersion"], "4.0", "OData-MaxVersion available");
- djstest.assertAreEqual(request.headers["Prefer"], "prefer", "prefer available");
- djstest.done();
- });
-
- var request = {
- method: "POST",
- requestUri: "/foo",
- data: { value: 123 },
- headers: { "Accept": "application/json", "Content-Encoding": "compress, gzip", "Content-Length": "8042", "content-type": "application/json", "OData-Version": "4.0",
- "accept-charset": "Accept-Charset", "if-match": "true", "if-none-match": "false", "odata-isolation": "isolation",
- "odata-maxversion": "4.0", "prefer": "prefer"
- }
- };
- odatajs.oData.request(request, function (data) { }, undefined, undefined, MockHttpClient);
-
- });
-
-
-})(window);
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/odata-qunit-tests-launcher.htm
----------------------------------------------------------------------
diff --git a/odatajs/tests-tmp/odata-qunit-tests-launcher.htm b/odatajs/tests-tmp/odata-qunit-tests-launcher.htm
deleted file mode 100644
index 4f8a390..0000000
--- a/odatajs/tests-tmp/odata-qunit-tests-launcher.htm
+++ /dev/null
@@ -1,61 +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.
- */
- -->
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
- <head>
- <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="pragma" content="no-cache" />
- <meta http-equiv="expires" content="-1" />
-
- <title>OData unit tests</title>
- <link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.10.0.css" type="text/css" />
-
- <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js" ></script>
- <script type="text/javascript" src="http://code.jquery.com/qunit/qunit-1.10.0.js"></script>
- <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js"></script>
- <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/rxjs/2.3.5/rx.all.js"></script>
-
-
- <script type="text/javascript" src="../build/odatajs-4.0.0-beta-01.js"></script>
-
- <script type="text/javascript" src="./common/logging.js"></script>
-
- <script type="text/javascript" src="./common/odataCacheVerifier.js"></script>
- <script type="text/javascript" src="./common/odataVerifyReader.js"></script>
-
-
- <script type="text/javascript" src="./common/mockHttpClient.js"></script>
-
-
-
- <script type="text/javascript" src="./common/djstest.js"></script>
- <script type="text/javascript" src="./common/djstest-browser.js"></script>
-
-
- <script type="text/javascript" src="./bn-odata-json-tests.js"></script>
- <script type="text/javascript" src="./a-odata-json-tests.js"></script>
- <script type="text/javascript" src="./b-cache-tests.js"></script>
- <body>
- <div id="qunit"></div>
- </body>
-
-</html>
\ No newline at end of file
[4/4] git commit: [OLINGO-418] remove tests-tmp
Posted by ko...@apache.org.
[OLINGO-418] remove tests-tmp
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/29a0817e
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/tree/29a0817e
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/diff/29a0817e
Branch: refs/heads/master
Commit: 29a0817e957938abcef3c24b68a57b29f14fe701
Parents: fa7a8c1
Author: Sven Kobler <sv...@sap.com>
Authored: Tue Sep 2 10:41:22 2014 +0200
Committer: Sven Kobler <sv...@sap.com>
Committed: Tue Sep 2 10:41:22 2014 +0200
----------------------------------------------------------------------
odatajs/readme.md | 20 -
odatajs/tests-tmp/b-cache-tests.js | 1191 ------------------
...cache-large-collection-functional-tests.html | 53 -
...s-cache-large-collection-functional-tests.js | 187 ---
odatajs/tests-tmp/bn-odata-json-tests.js | 211 ----
odatajs/tests-tmp/common/ODataVerifiyReader.svc | 114 --
odatajs/tests-tmp/common/djstest-browser.js | 142 ---
odatajs/tests-tmp/common/djstest.js | 412 ------
odatajs/tests-tmp/common/logging.js | 5 -
odatajs/tests-tmp/common/mockHttpClient.js | 138 --
odatajs/tests-tmp/common/node-test-setup.js | 30 -
.../tests-tmp/common/observableHttpClient.js | 84 --
odatajs/tests-tmp/common/odataCacheVerifier.js | 241 ----
odatajs/tests-tmp/common/odataVerifyReader.js | 203 ---
odatajs/tests-tmp/done.txt | 29 -
.../endpoints/BasicAuthDataService.svc | 124 --
.../tests-tmp/endpoints/CustomAnnotations.xml | 121 --
.../tests-tmp/endpoints/CustomDataService.svc | 85 --
odatajs/tests-tmp/endpoints/EpmDataService.svc | 336 -----
.../tests-tmp/endpoints/ErrorDataService.svc | 78 --
.../endpoints/FoodStoreDataServiceV4.svc | 590 ---------
.../endpoints/LargeCollectionService.svc | 113 --
odatajs/tests-tmp/endpoints/web.config | 46 -
.../tests-tmp/odata-json-tests-todo-analyse.js | 828 ------------
.../tests-tmp/odata-qunit-tests-launcher.htm | 61 -
25 files changed, 5442 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/readme.md
----------------------------------------------------------------------
diff --git a/odatajs/readme.md b/odatajs/readme.md
deleted file mode 100644
index bcd2560..0000000
--- a/odatajs/readme.md
+++ /dev/null
@@ -1,20 +0,0 @@
-Development
-===========
-
-Preparation
-1. npm install -g grunt-cli
-
-Installation
-1. git clone https://git-wip-us.apache.org/repos/asf/olingo-odata4-js
-1. cd datajs
-1. npm install
-
-Build datajs-x.x.x.js
-1. grunt build
-* Output is copied into the directory ...
-
-Run demo
-1. grunt run
-
-Run tests
-1. grunt test
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/b-cache-tests.js
----------------------------------------------------------------------
diff --git a/odatajs/tests-tmp/b-cache-tests.js b/odatajs/tests-tmp/b-cache-tests.js
deleted file mode 100644
index 5b41123..0000000
--- a/odatajs/tests-tmp/b-cache-tests.js
+++ /dev/null
@@ -1,1191 +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.
-*/
-
-(function (window, undefined) {
-
- module("cache-tests.js");
- var foodsFeed = "./endpoints/FoodStoreDataServiceV4.svc/Foods";
- var collectionSize = 16;
-
- var thenFailTest = function (err) {
- if (err && err.message) {
- djstest.fail(err.message);
- } else {
- djstest.fail("unexepected promise failure");
- }
-
- djstest.done();
- };
-
- djstest.addTest(function dataCacheCountTest() {
- var cache = odatajs.cache.createDataCache({ name: "cache", source: foodsFeed });
- cache.count().then(function (count) {
- djstest.assertAreEqual(count, collectionSize, "expected count for Foods");
- djstest.destroyCacheAndDone(cache);
- }, thenFailTest);
- });
-
- djstest.addTest(function dataCacheCountOnLocalTest() {
- var cache = odatajs.cache.createDataCache({ name: "cache", source: foodsFeed, pageSize: collectionSize + 10, mechanism: "memory" });
- cache.readRange(0, collectionSize + 10).then(function (data) {
- var expectedCount = data.value ? data.value.length : 0;
- cache.count().then(function (count) {
- djstest.assertAreEqual(count, expectedCount, "expected count for expectedCount");
- djstest.destroyCacheAndDone(cache);
- }, thenFailTest);
- }, thenFailTest);
- });
-
- djstest.addTest(function dataCacheCountAbortTest() {
- // Abort before completion.
- var cache = odatajs.cache.createDataCache({ name: "cache", source: foodsFeed });
- var item = cache.count().then(thenFailTest, function (err) {
- djstest.assertAreEqual(true, err.canceled, "err.aborted is true");
- djstest.destroyCacheAndDone(cache);
- }).cancel();
- });
-
- var createNewCache = function (options) {
-
- var thenSuccess = null;
-
- var resolved = false;
- var rejected = false;
-
- var args = null;
-
- this.then = function (success) {
- if (resolved) {
- success.apply(null, args);
- } else if (!rejected) {
- thenSuccess = success;
- }
- };
-
- var resolve = function (/*args*/) {
- resolved = true;
- args = arguments;
- if (thenSuccess) {
- thenSuccess.apply(null, arguments);
- }
- };
-
- var cache = odatajs.cache.createDataCache(options);
- cache.clear().then(function () {
- var newCache = odatajs.cache.createDataCache(options);
- resolve(newCache);
- }, function (err) {
- rejected = true;
- thenFailTest(err);
- });
-
- return this;
- };
-
- djstest.addTest(function dataCacheReadRangeSingleTest() {
- // Read a new range.
- var options = { name: "cache", source: foodsFeed, pageSize: 2 };
- createNewCache(options).
- then(function (cache) {
- cache.readRange(0, 1).
- then(function (data) {
- djstest.assertAreEqual(data.value.length, 1, "single item was read.");
- djstest.assertAreEqual(data.value[0].FoodID, 0, "food id is 0.");
- djstest.done();
- }, thenFailTest);
- }, thenFailTest);
- });
-
- djstest.addTest(function dataCacheReadRangeExactPageTest() {
- // Read exactly one page.
- var options = { name: "cache", source: foodsFeed, pageSize: 2 };
- createNewCache(options).
- then(function (cache) {
- cache.readRange(0, 2).
- then(function (data) {
- djstest.assertAreEqual(data.value.length, 2, "single item was read.");
- djstest.assertAreEqual(data.value[0].FoodID, 0, "first food id is 0.");
- djstest.assertAreEqual(data.value[1].FoodID, 1, "second food id is 1.");
- djstest.done();
- }, thenFailTest);
- }, thenFailTest);
- });
-
- djstest.addTest(function dataCacheReadRangeMultiplePageTest() {
- // Read multiple pages.
- var options = { name: "cache", source: foodsFeed, pageSize: 2 };
- createNewCache(options).
- then(function (cache) {
- cache.readRange(0, 3).
- then(function (data) {
- djstest.assertAreEqual(data.value.length, 3, "single item was read.");
- djstest.assertAreEqual(data.value[0].FoodID, 0, "first food id is 0.");
- djstest.assertAreEqual(data.value[1].FoodID, 1, "second food id is 1.");
- djstest.assertAreEqual(data.value[2].FoodID, 2, "third food id is 2.");
- djstest.done();
- }, thenFailTest);
- }, thenFailTest);
- });
-
- djstest.addTest(function dataCacheReadRangeSyncDelaysTest() {
- var options = { name: "cache", source: foodsFeed, pageSize: 2 };
- var counter = 0;
- createNewCache(options).
- then(function (cache) {
- cache.readRange(0, 1).
- then(function (data) {
- djstest.assertAreEqual(counter, 0, "counter is zero for first set of results");
- djstest.assertAreEqual(cache.stats.netReads, 1, "one request made to fulfill the readRange");
- counter++;
- cache.readRange(0, 1).
- then(function (data) {
- djstest.assertAreEqual(counter, 2, "counter is two because even sync results are delayed)");
- djstest.assertAreEqual(cache.stats.netReads, 1, "no additional requests since requested data is in cache");
- djstest.done();
- }, thenFailTest);
- djstest.assertAreEqual(counter, 1, "counter is one because readRange hasn't run (even if results are cached)");
- counter++;
- }, thenFailTest);
- }, thenFailTest);
- });
-
- djstest.addTest(function dataCacheReadRangesWithDestroyTest() {
- var options = { name: "cache", source: foodsFeed, pageSize: 2, prefetchSize: 0 };
- var counter = 0;
- createNewCache(options).then(function (cache) {
- cache.readRange(0, 1).then(function (data) {
- djstest.assertAreEqual(cache.stats.netReads, 1, "one request made to fulfill the readRange");
- cache.clear().then(function () {
- djstest.assertAreEqual(cache.stats.netReads, 0, "stats cleared in destroy");
- cache.readRange(0, 1).then(function (data) {
- djstest.assertAreEqual(cache.stats.netReads, 1, "request made after destroy to fulfill the readRange");
- djstest.done();
- }, thenFailTest);
- }, thenFailTest);
- }, thenFailTest);
- }, thenFailTest);
- });
-
- djstest.addTest(function dataCacheReadSimultaneousTest() {
- var options = { name: "cache", source: foodsFeed, pageSize: 2 };
- var counter = 0;
- var theCache;
- var checkDataAndCount = function (data) {
- djstest.assertAreEqual(data.value.length, 1, "Single item returned");
- djstest.assertAreEqual(data.value[0].FoodID, 0, "FoodId is set to zero for first item");
- djstest.assertAreEqual(theCache.stats.netReads, 1, "single theCache.stats.netReads");
- djstest.assert(theCache.stats.prefetches <= 1, "theCache.stats.prefetches <= 1 - no repetitions");
- counter++;
- if (counter === 3) {
- djstest.done();
- }
- };
-
- createNewCache(options).
- then(function (cache) {
- theCache = cache;
- cache.readRange(0, 1).then(checkDataAndCount, thenFailTest);
- cache.readRange(0, 1).then(checkDataAndCount, thenFailTest);
- cache.readRange(0, 1).then(checkDataAndCount, thenFailTest);
- }, thenFailTest);
- });
-
- djstest.addTest(function dataCacheMultipleClearTest() {
- var options = { name: "cache", source: foodsFeed, pageSize: 2 };
- var counter = 0;
- var checkCount = function (data) {
- djstest.assert(true, "clear then was called");
- counter++;
- if (counter === 3) {
- djstest.done();
- }
- };
-
- createNewCache(options).
- then(function (cache) {
- cache.readRange(0, 1).then(function () {
- cache.clear().then(checkCount, thenFailTest);
- cache.clear().then(checkCount, thenFailTest);
- cache.clear().then(checkCount, thenFailTest);
- }, thenFailTest);
- }, thenFailTest);
- });
-
- djstest.addTest(function dataCacheOnIdleIsFired() {
- var options = { name: "cache", source: foodsFeed, pageSize: 2, prefetchSize: 0 };
-
- createNewCache(options).
- then(function (cache) {
- var counter = 0;
- var clearSucceeded = false;
-
- var thenFailThisTest = function (err) {
- if (err && err.message) {
- djstest.fail(err.message);
- } else {
- djstest.fail("unexepected promise failure");
- }
- };
-
- cache.onidle = function () {
- counter++;
- djstest.assertAreEqual(counter, 1, "onidle was called 1 times");
- djstest.assert(clearSucceeded, "onidle was called after destroy");
- djstest.done();
- };
-
- cache.readRange(0, 1).then(null, thenFailThisTest);
- cache.readRange(0, 1).then(null, thenFailThisTest);
- cache.readRange(3, 4).then(function () {
- cache.readRange(5, 6).then(function () {
- cache.clear().then(function () {
- clearSucceeded = true;
- }, thenFailThisTest);
- }, thenFailThisTest);
- }, thenFailThisTest);
- }, thenFailTest);
- });
-
- djstest.addTest(function dataCacheOnIdleFiresOnErrorTest() {
-
- var errorResponse = false;
- var httpClient = {
- request: function (request, success, error) {
- var response = { statusCode: 200, headers: { "Content-Type": "application/json", "OData-Version": "4.0" }, body: JSON.stringify({ d: [1, 2] }) };
- if (!errorResponse) {
- errorResponse = true;
- setTimeout(function () {
- success(response);
- }, 0);
- } else {
- response.statusCode = 500;
- response.body = "bad response";
- setTimeout(function () {
- error({ message: "HTTP request failed", request: request, response: response });
- }, 0);
- }
- }
- };
-
- var options = { name: "cache", source: foodsFeed, pageSize: 2, prefetchSize: 0, httpClient: httpClient };
-
- createNewCache(options).
- then(function (cache) {
- var counter = 0;
- var errorHandlerCalled = false;
-
- var thenFailThisTest = function (err) {
- if (err && err.message) {
- if (errorResponse) {
- djstest.assertAreEqual(err.message, "HTTP request failed", "Error is the expected one");
- errorHandlerCalled = true;
- } else {
- djstest.fail(err.message);
- }
- } else {
- djstest.fail("unexepected promise failure");
- }
- };
-
- cache.onidle = function () {
- counter++;
- djstest.assertAreEqual(counter, 1, "onidle was called");
- djstest.assert(errorHandlerCalled, "error handler was called before onidle");
- cache.onidle = null;
- cache.clear().then(function () {
- djstest.done();
- }, thenFailTest);
- };
- cache.readRange(0, 2).then(function () {
- cache.readRange(2, 4).then(function () {
- djstest.fail("unexpected readRange success");
- }, thenFailThisTest);
- }, thenFailThisTest);
- }, thenFailTest);
- });
-
-
- djstest.addTest(function dataCacheOdataSourceNormalizedURITest() {
- var requestsMade = 0;
- var httpClient = {
- request: function (request, success, error) {
- var response = { statusCode: 200, headers: { "Content-Type": "application/json", "OData-Version": "4.0" }, body: JSON.stringify({ value: [1, 2] }) };
- if (requestsMade === 0) {
- djstest.pass("Cache made first request for data from the source");
- requestsMade++;
- } else {
- // In memory storage will make a second request from the new cache since two caches with the same name will coexist
- if (window.mozIndexedDB || window.localStorage || requestsMade > 1) {
- djstest.fail("Unexpected request to the source");
- } else {
- djstest.pass("In memory cache requested the data from the source");
- }
- }
- setTimeout(function () {
- success(response);
- }, 0);
- }
- };
-
- var options = { name: "cache", source: "http://exampleuri.com/my service.svc", pageSize: 2, prefetchSize: 0, httpClient: httpClient };
-
- createNewCache(options).
- then(function (cache) {
- cache.readRange(0, 2).then(function () {
- options.source = "HtTp://ExampleURI.cOm/my%20service.svc";
- var newCache = odatajs.cache.createDataCache(options);
- newCache.readRange(0, 2).then(function (data) {
- djstest.assertAreEqualDeep(data.value, [1, 2], "Got the expected data from the new cache instance");
- newCache.clear().then(function () {
- djstest.done();
- }, thenFailTest);
- }, thenFailTest);
- }, thenFailTest);
- }, thenFailTest);
- });
-
-
- djstest.addTest(function dataCachePrefetchAllTest() {
- var options = { name: "cache", source: foodsFeed, pageSize: 2, prefetchSize: -1 };
- var counter = 0;
- var theCache;
-
- var callback = function () {
- counter++;
- if (counter === 2) {
- djstest.assertAreEqual(1, theCache.stats.netReads, "single page to satisfy read (" + theCache.stats.netReads + ")");
- djstest.assert(theCache.stats.prefetches > 1, "theCache.stats.prefetches(" + theCache.stats.prefetches + ") > 1 - multiple prefetches");
- djstest.done();
- }
- };
-
- var checkDataAndCount = function (data) {
- djstest.assertAreEqual(data.value.length, 1, "Single item returned");
- djstest.assertAreEqual(data.value[0].FoodID, 0, "FoodId is set to zero for first item");
- djstest.assertAreEqual(1, theCache.stats.netReads, "single theCache.stats.netReads");
- djstest.assert(theCache.stats.prefetches <= 1, "theCache.stats.prefetches <= 1 - no repetitions");
- callback();
- };
-
- createNewCache(options).
- then(function (cache) {
- theCache = cache;
- cache.readRange(0, 1).then(checkDataAndCount, thenFailTest);
- cache.onidle = function () {
- djstest.log("onidle fired");
- callback();
- };
- }, thenFailTest);
- });
-
- djstest.addTest(function dataCacheReadRangeTakeMoreThanCollectionCountTest() {
- // Read multiple pages.
- var options = { name: "cache", source: foodsFeed, pageSize: 2 };
- createNewCache(options).
- then(function (cache) {
- cache.count().then(function (count) {
- cache.readRange(0, count + 1).
- then(function (data) {
- djstest.assertAreEqual(data.value.length, count, "all items in the collection were read.");
- cache.readRange(2, count + 1).
- then(function (data) {
- djstest.assertAreEqual(data.value.length, count - 2, "all requested in the collection were read.");
- djstest.assertAreEqual(data.value[0].FoodID, 2, "first read food id is 2.");
- djstest.done();
- }, thenFailTest);
- }, thenFailTest);
- }, thenFailTest);
- }, thenFailTest);
- });
-
- djstest.addTest(function dataCacheReadRangeSkipMoreThanCollectionCountTest() {
- // Read multiple pages.
- var options = { name: "cache", source: foodsFeed, pageSize: 2 };
- createNewCache(options).
- then(function (cache) {
- cache.count().then(function (count) {
- cache.readRange(count + 1, 5).
- then(function (data) {
- djstest.assertAreEqual(data.value.length, 0, "no items were read.");
- djstest.done();
- }, thenFailTest);
- }, thenFailTest);
- }, thenFailTest);
- });
-
- djstest.addTest(function dataCacheReadRangeTakeMoreThanPrefetchSizeTest() {
- // Read multiple pages.
- var options = { name: "cache", source: foodsFeed, pageSize: 2, prefetchSize: 1 };
- createNewCache(options).
- then(function (cache) {
- cache.readRange(0, 4).
- then(function (data) {
- djstest.assertAreEqual(data.value.length, 4, "all requested in the collection were read.");
- djstest.assertAreEqual(data.value[0].FoodID, 0, "first food id is 0.");
- djstest.assertAreEqual(data.value[1].FoodID, 1, "second food id is 1.");
- djstest.assertAreEqual(data.value[2].FoodID, 2, "third food id is 2.");
- djstest.assertAreEqual(data.value[3].FoodID, 3, "third food id is 3.");
- djstest.done();
- }, thenFailTest);
- }, thenFailTest);
- });
-
- djstest.addTest(function dataCacheRangeInvalidIndexAndCount() {
- var options = { name: "cache", source: foodsFeed, pageSize: 2, prefetchSize: 1 };
- var counter = 0;
-
- var thenFailSuccess = function () {
- djstest.fail("Call to success was unexpected");
- counter++;
- if (counter === tests.length) {
- djstest.done();
- }
- };
-
- var thenFailError = function () {
- djstest.fail("Call to error was unexpected");
- counter++;
- if (counter === tests.length) {
- djstest.done();
- }
- };
-
- var invalidValues = [-5, -1, null, undefined, NaN, Infinity, "5", "this is not a number"];
- var tests = [];
- $.each(invalidValues, function (_, value) {
- tests.push({ i: value, c: 0 });
- tests.push({ i: 0, c: value });
- tests.push({ i: value, c: value });
- });
-
- createNewCache(options).
- then(function (cache) {
- var i, len;
- for (i = 0, len = tests.length; i < len; i++) {
- var test = tests[i];
- try {
- cache.readRange(test.i, test.c).then(thenFailSuccess, thenFailTest);
- } catch (err) {
- djstest.pass("Expected exception was thrown: " + err.message);
- counter++;
- }
- }
- if (counter === tests.length) {
- djstest.done();
- }
- });
- });
-
-
- djstest.addTest(function cacheOptionsForCountTest() {
- var httpClient = {
- request: function (r, success, error) {
- window.setTimeout(function () {
- success({ data: "10" });
- }, 1);
- return null;
- }
- };
- var cache = odatajs.cache.createDataCache({
- name: "mem", mechanism: "memory", source: "http://www.example.org/service/",
- httpClient: httpClient
- });
- cache.count().then(function (count) {
- djstest.assertAreEqual(count, 10, "count value");
- djstest.done();
- }, djstest.failAndDoneCallback("failed to get count"));
- });
-
- djstest.addTest(function dataCacheDestoryStopsThePrefetcherTest() {
- var oldHttpClientRequest = window.odatajs.oData.net.defaultHttpClient.request;
- var prefetchCount = 0;
- var theCache;
-
- window.odatajs.oData.net.defaultHttpClient.request = function (request, success, error) {
- prefetchCount++;
- djstest.assert(prefetchCount <= 3, "Expected prefetch request");
- if (prefetchCount === 3) {
- theCache.clear().then(function () {
- djstest.assertAreEqual(prefetchCount, 3, "cache.clear() stopped the prefetcher");
- djstest.done();
- window.odatajs.oData.net.defaultHttpClient.request = oldHttpClientRequest;
- }, thenFailTest);
- return {
- abort: function () { }
- };
- }
- return oldHttpClientRequest(request, success, error);
- };
-
- try {
- var options = { name: "cache", source: foodsFeed, pageSize: 1, prefetchSize: -1 };
- createNewCache(options).then(function (cache) {
- theCache = cache;
- cache.readRange(0, 0).then(null, thenFailTest);
- });
- } catch (e) {
- window.odatajs.oData.net.defaultHttpClient.request = oldHttpClientRequest;
- djstest.fail("Exception thrown, prefetchSize: " + tests[count] + " error: " + e.message);
- djstest.done();
- }
- });
-
- djstest.addTest(function dataCacheFilterTest() {
- var options = { name: "cache", source: foodsFeed, pageSize: 3, prefetchSize: -1 };
- var counter = 0;
-
- var singleItemPredicate = function (data) {
- return data.FoodID === 2;
- };
-
- var multipleItemPredicate = function (data) {
- return data.FoodID % 2 === 1;
- };
-
- var noItemPredicate = function (data) {
- return data.Name === "something i would never eat";
- };
-
- var allItemPredicate = function (data) {
- return data.FoodID >= 0;
- };
-
- var doneAfterAllTests = function () {
- counter++;
- if (counter === tests.length) {
- djstest.done();
- }
- };
-
- var last = collectionSize - 1;
- var tests = [
- { index: 0, count: -5, predicate: singleItemPredicate }, // Single match in entire collection
- {index: 2, count: 1, predicate: singleItemPredicate }, // Single match, single count
- {index: 3, count: 1, predicate: singleItemPredicate }, // Single match skipped, i.e. no matches
- {index: 0, count: -1, predicate: multipleItemPredicate }, // Multiple matches in entire collection
- {index: 0, count: 5, predicate: multipleItemPredicate }, // Multiple matches, take partial
- {index: 3, count: 5, predicate: multipleItemPredicate }, // Multiple matches, skip/take partial
- {index: 7, count: 10, predicate: multipleItemPredicate }, // Multiple matches, skip partial, take past end of collection
- {index: 13, count: 4, predicate: allItemPredicate }, // All items match, skip/take partial
- {index: 0, count: 20, predicate: noItemPredicate }, // No matches
- {index: 0, count: 0, predicate: allItemPredicate }, // Zero count
- {index: -5, count: 1, predicate: allItemPredicate }, // Negative index
- {index: last + 1, count: 1, predicate: allItemPredicate }, // Index past end of collection
-
- {index: last, count: -5, predicate: singleItemPredicate, backwards: true }, // Single match in entire collection
- {index: 2, count: 1, predicate: singleItemPredicate, backwards: true }, // Single match, single count
- {index: 1, count: 1, predicate: singleItemPredicate, backwards: true }, // Single match skipped, i.e. no matches
- {index: last, count: -1, predicate: multipleItemPredicate, backwards: true }, // Multiple matches in entire collection
- {index: last, count: 6, predicate: multipleItemPredicate, backwards: true }, // Multiple matches, take partial
- {index: last - 3, count: 5, predicate: multipleItemPredicate, backwards: true }, // Multiple matches, skip/take partial
- {index: 13, count: 10, predicate: multipleItemPredicate, backwards: true }, // Multiple matches, skip partial, take past end of collection
- {index: 4, count: 13, predicate: allItemPredicate, backwards: true }, // All items match, skip/take partial
- {index: last, count: 20, predicate: noItemPredicate, backwards: true }, // No matches
- {index: 0, count: 0, predicate: allItemPredicate, backwards: true }, // Zero count
- {index: -5, count: 1, predicate: allItemPredicate, backwards: true }, // Negative index
- {index: last + 1, count: 1, predicate: allItemPredicate, backwards: true }, // Index past end of collection
-
- {index: "foo", count: 1, predicate: singleItemPredicate, exception: { message: "'index' must be a valid number.", index: NaN} },
- { index: 0, count: "foo", predicate: multipleItemPredicate, exception: { message: "'count' must be a valid number.", count: NaN} }
- ];
-
- var testDescription = function(test) {
- return "filter [" + test.index + ", " + test.count + " " + (test.backwards ? "back" : "forward") + "] for predicate " + test.predicate;
- };
-
- var filterErrorCallback = function (err) {
- if (err && err.message) {
- djstest.fail(err.message);
- } else {
- djstest.fail("unexpected promise failure");
- }
- doneAfterAllTests();
- };
-
- var removeSafariExceptionProperties = function (err) {
- /** Removes Safari-specific properties from an exception object
- * @param {Exception} err -The exception object to operate on
- * @returns {Exception} The original exception object with the Safari-specific properties removed
- */
- var safariProperties = ["line", "expressionBeginOffset", "expressionEndOffset", "sourceId", "sourceURL"];
-
- var result = {};
- $.each(err, function (property, value) {
- if ($.inArray(property, safariProperties) === -1) {
- result[property] = value;
- }
- });
-
- return result;
- };
-
- ODataVerifyReader.readJsonAcrossServerPages(foodsFeed, function (expectData) {
- $.each(tests, function (_, test) {
- createNewCache(options).then(function (cache) {
- try {
- var expectedResults = {};
- if (test.backwards) {
- cache.filterBack(test.index, test.count, test.predicate).then(function (results) {
- expectedResults = CacheVerifier.getExpectedFilterResults(expectData, test.index, test.count, test.predicate, test.backwards);
- djstest.assertAreEqualDeep(results, expectedResults, "results for " + testDescription(test));
- doneAfterAllTests();
- }, filterErrorCallback);
- } else {
- cache.filterForward(test.index, test.count, test.predicate).then(function (results) {
- expectedResults = CacheVerifier.getExpectedFilterResults(expectData, test.index, test.count, test.predicate, test.backwards);
- djstest.assertAreEqualDeep(results, expectedResults, "results for " + testDescription(test));
- doneAfterAllTests();
- }, filterErrorCallback);
- }
-
- if (test.exception) {
- djstest.fail("expected exception for " + testDescription(test));
- doneAfterAllTests();
- }
- } catch (err) {
- if (test.exception) {
- djstest.assertAreEqualDeep(removeSafariExceptionProperties(err), test.exception, "exception for " + testDescription(test));
- } else {
- djstest.fail("unexpected exception for " + testDescription(test) + ": " + djstest.toString(err));
- }
- doneAfterAllTests();
- }
- }, thenFailTest);
- });
- });
- });
-
- djstest.addTest(function createDataCacheTest() {
- var cache;
-
- // Verify the defaults.
- cache = odatajs.cache.createDataCache({ name: "name", source: "src" });
-
- djstest.assertAreEqual(cache.onidle, undefined, "onidle is undefined");
-
- // Verify specific values.
- cache = odatajs.cache.createDataCache({ name: "name", source: "src", cacheSize: 1, pageSize: 2, prefetchSize: 3, idle: 123 });
-
- djstest.assertAreEqual(cache.onidle, 123, "onidle is as specified");
-
- // Verify 0 pageSize
- djstest.expectException(function () {
- odatajs.cache.createDataCache({ name: "name", source: "src", cacheSize: 1, pageSize: 0, prefetchSize: 3, idle: 123 });
- }, "zero pageSize");
-
- // Verify negative pageSize
- djstest.expectException(function () {
- odatajs.cache.createDataCache({ name: "name", source: "src", cacheSize: 1, pageSize: -2, prefetchSize: 3, idle: 123 });
- }, "negative pageSize");
-
- // Verify NaN pageSize
- djstest.expectException(function () {
- cache = odatajs.cache.createDataCache({ name: "name", source: "src", cacheSize: 1, pageSize: "2", prefetchSize: 3, idle: 123 });
- }, "NaN pageSize");
-
- // Verify NaN cacheSize
- djstest.expectException(function () {
- cache = odatajs.cache.createDataCache({ name: "name", source: "src", cacheSize: "1", pageSize: 2, prefetchSize: 3, idle: 123 });
- }, "NaN cacheSize");
-
- // Verify NaN prefetchSize
- djstest.expectException(function () {
- cache = odatajs.cache.createDataCache({ name: "name", source: "src", cacheSize: 1, pageSize: 2, prefetchSize: "3", idle: 123 });
- }, "NaN prefetchSize");
-
- // Verify undefined name
- djstest.expectException(function () {
- odatajs.cache.createDataCache({ source: "src", cacheSize: 1, pageSize: 1, prefetchSize: 3, idle: 123 });
- }, "undefined name");
-
- // Verify null name
- djstest.expectException(function () {
- odatajs.cache.createDataCache({ name: null, source: "src", cacheSize: 1, pageSize: 1, prefetchSize: 3, idle: 123 });
- }, "null name");
-
- // Verify undefined source
- djstest.expectException(function () {
- odatajs.cache.createDataCache({ name: "name", cacheSize: 1, pageSize: 1, prefetchSize: 3, idle: 123 });
- }, "undefined source");
-
- djstest.done();
- });
-
- djstest.addTest(function createDataCacheWithSourceTest() {
- var cacheSource = {
- count: function (success) {
- djstest.pass("cacheSource.count was called");
- success(0);
- },
-
- read: function (index, count, success, error) {
- djstest.assertAreEqual(index, 0, "index is the expected one");
- djstest.assertAreEqual(count, 10, "test is the expected one");
- djstest.assert(success, "success is defined");
- djstest.assert(error, "error is defined");
- djstest.pass("cacheSource.read was called");
-
- setTimeout(function () {
- success([]);
- }, 0);
- }
- };
-
- var cache = odatajs.cache.createDataCache({ name: "name", source: cacheSource, mechanism: "memory", pageSize: 10 });
- cache.count().then(function () {
- cache.readRange(0, 5).then(function () {
- djstest.done();
- }, thenFailTest);
- }, thenFailTest);
- });
-
- djstest.addTest(function cacheInitializationFailTest() {
- // Tests various failure modes for cache initialization.
- var failures = ["read-settings", "write-settings", "v2"];
- var failureIndex = 0;
-
- var originalStore = odatajs.store.createStore;
- var restoreStore = function () {
- odatajs.store.createStore = originalStore;
- };
-
- var storeError = { message: "cacheInitializationFailTest error" };
- odatajs.store.createStore = function (name, mechanism) {
- return {
- addOrUpdate: function (key, value, successCallback, errorCallback) {
- if (failures[failureIndex] === "write-settings") {
- window.setTimeout(function () { errorCallback(storeError); }, 2);
- } else {
- djstest.fail("Error unaccounted for in addOrUpdate for " + failures[failureIndex]);
- window.setTimeout(function () { errorCallback(storeError); }, 2);
- }
- },
- read: function (key, successCallback, errorCallback) {
- if (failures[failureIndex] === "read-settings") {
- window.setTimeout(function () { errorCallback(storeError); }, 2);
- } else if (failures[failureIndex] === "v2") {
- window.setTimeout(function () {
- successCallback("K", { version: "2.0" });
- }, 2);
- } else if (failures[failureIndex] === "write-settings") {
- window.setTimeout(function () { successCallback(null, null); }, 2);
- } else {
- djstest.fail("Error unaccounted for read in " + failures[failureIndex]);
- window.setTimeout(function () { errorCallback(storeError); }, 2);
- }
- }
- };
- };
-
- var nextFailure = function () {
- djstest.log("Failure mode: " + failures[failureIndex]);
- var cache = odatajs.cache.createDataCache({ name: "name", source: "foo", mechanism: "memory", pageSize: 10 });
- try {
- // The first readRange should succeed, because the data cache isn't really initialized at this time.
- cache.readRange(1, 2).then(djstest.failAndDoneCallback("No function should succeed"), function (err) {
- djstest.expectException(function () {
- cache.readRange(1, 2);
- }, "readRange after store is invalidated");
-
- djstest.expectException(function () {
- cache.count();
- }, "count after store is invalidated");
-
- djstest.expectException(function () {
- cache.clear();
- }, "clear after store is invalidated");
-
- djstest.expectException(function () {
- cache.filterForward(1, 2);
- }, "filterForward after store is invalidated");
-
- djstest.expectException(function () {
- cache.filterBack(1, 2);
- }, "filterBack after store is invalidated");
-
- djstest.expectException(function () {
- cache.toObservable();
- }, "toObservable after store is invalidated");
-
- failureIndex++;
- if (failureIndex === failures.length) {
- restoreStore();
- djstest.done();
- } else {
- nextFailure();
- }
- });
- } catch (outerError) {
- djstest.fail("Unexpected failure for first .readRange: " + window.JSON.stringify(outerError));
- restoreStore();
- djstest.done();
- }
- };
-
- nextFailure();
- });
-
- djstest.addTest(function createDataCacheWithSourceCallsErrorTest() {
- var cacheSource = {
- count: function () {
- djstest.fail("cacheSource.count was called");
- },
-
- read: function (index, count, success, error) {
- setTimeout(function () {
- error({ message: "source error" });
- }, 0);
- }
- };
-
- var cache = odatajs.cache.createDataCache({ name: "name", source: cacheSource, mechanism: "memory", pageSize: 10 });
- cache.readRange(0, 5).then(function () {
- djstest.fail("unexpected call to then success");
- djstest.done();
- }, function (err) {
- djstest.assertAreEqual(err.message, "source error", "got the expected error");
- djstest.done();
- });
- });
-
- djstest.addTest(function toObservableMissingTest() {
- createNewCache({ name: "cache", source: "http://temp.org" }).then(function (cache) {
- var hiddenRx = window.Rx;
- try {
- window.Rx = null;
- var error = null;
- try {
- cache.toObservable();
- } catch (err) {
- error = err;
- }
-
- djstest.assert(error !== null, "error !== null");
- } finally {
- window.Rx = hiddenRx;
- }
-
- djstest.assert(error !== null, "error !== null");
- djstest.destroyCacheAndDone(cache);
- });
- });
-
- djstest.addTest(function toObservableSinglePageTest() {
- createNewCache({ name: "cache", source: foodsFeed }).then(function (cache) {
- var lastId = -1;
- cache.toObservable().subscribe(function (item) {
- djstest.assert(lastId < item.FoodID, "lastId < item.FoodID");
- lastId = item.FoodID;
- }, thenFailTest, function () {
- djstest.assert(lastId !== -1, "lastId !== -1");
- djstest.done();
- });
- });
- });
-
- djstest.addTest(function toObservableCaseSinglePageTest() {
- createNewCache({ name: "cache", source: foodsFeed }).then(function (cache) {
- var lastId = -1;
- cache.toObservable().subscribe(function (item) {
- djstest.assert(lastId < item.FoodID, "lastId < item.FoodID");
- lastId = item.FoodID;
- }, thenFailTest, function () {
- djstest.assert(lastId !== -1, "lastId !== -1");
- djstest.done();
- });
- });
- });
-
- djstest.addTest(function toObservableMultiplePageTest() {
- createNewCache({ name: "cache", source: foodsFeed, pageSize: 2 }).then(function (cache) {
- var lastId = -1;
- var callCount = 0;
- cache.toObservable().subscribe(function (item) {
- djstest.assert(lastId < item.FoodID, "lastId < item.FoodID");
- lastId = item.FoodID;
- callCount += 1;
- }, thenFailTest, function () {
- djstest.assert(lastId !== -1, "lastId !== -1");
- djstest.assert(callCount > 1, "callCount > 1");
- djstest.done();
- });
- });
- });
-
- djstest.addTest(function toObservableEarlyDisposeTest() {
- createNewCache({ name: "cache", source: foodsFeed, pageSize: 2 }).then(function (cache) {
- var lastId = -1;
- var callCount = 0;
- var complete = false;
- var observer = cache.toObservable().subscribe(function (item) {
- djstest.assert(complete === false, "complete === false");
- djstest.assert(lastId < item.FoodID, "lastId < item.FoodID");
- lastId = item.FoodID;
- callCount += 1;
- complete = true;
- observer.Dispose();
- djstest.done();
- }, thenFailTest);
- });
- });
-
- djstest.addTest(function toObservableFailureTest() {
- createNewCache({ name: "cache", source: foodsFeed, pageSize: 2 }).then(function (cache) {
- var lastId = -1;
- var complete = false;
- window.MockHttpClient.clear().addResponse("*", { statusCode: 500, body: "server error" });
- window.MockHttpClient.async = true;
- var savedClient = window.odatajs.oData.net.defaultHttpClient;
- window.odatajs.oData.net.defaultHttpClient = window.MockHttpClient;
- cache.toObservable().subscribe(function (item) {
- window.odatajs.oData.net.defaultHttpClient = savedClient;
- djstest.fail("Unexpected call to OnNext");
- }, function (err) {
- djstest.assert(complete === false, "complete === false");
- djstest.assert(err, "err defined");
- window.odatajs.oData.net.defaultHttpClient = savedClient;
- complete = true;
- djstest.done();
- }, function (complete) {
- djstest.fail("Unexpected call to complete. Error handler should be called.");
- window.odatajs.oData.net.defaultHttpClient = savedClient;
- complete = true;
- djstest.done();
- });
- });
- });
-
- // DATAJS INTERNAL START
-
- djstest.addTest(function createDeferredTest() {
- // Verify basic use of deferred object.
- var deferred = odatajs.deferred.createDeferred();
- deferred.then(function (val1, val2) {
- djstest.assertAreEqual(val1, 1, "val1 is as specified");
- djstest.assertAreEqual(val2, 2, "val2 is as specified");
- djstest.done();
- });
- deferred.resolve(1, 2);
- });
-
- djstest.addTest(function deferredThenTest() {
- // Verify then registration and chaining.
- var deferred = odatajs.deferred.createDeferred();
- deferred.then(function (val1, val2) {
- djstest.assertAreEqual(val1, 1, "val1 is as specified");
- djstest.assertAreEqual(val2, 2, "val2 is as specified");
- return "foo";
- }).then(function (foo) {
- // See Compatibility Note B in DjsDeferred remarks.
- djstest.assert(foo !== "foo", "argument for chained 'then' is *not* result of previous call");
- djstest.assert(foo === 1, "argument for chained 'then' is same as for previous call");
-
- var other = odatajs.deferred.createDeferred();
- other.then(null, function (err, msg) {
- djstest.assertAreEqual("error", err, "err is as specified");
- djstest.assertAreEqual("message", msg, "msg is as specified");
-
- }).then(null, function (err, msg) {
- djstest.log("chained errors are called");
-
- djstest.assertAreEqual("error", err, "err is as specified");
- djstest.assertAreEqual("message", msg, "msg is as specified");
-
- var multiple = odatajs.deferred.createDeferred();
- var count = 0;
-
- // See Compatibility Note A in DjsDeferred remarks.
- multiple.then(function () {
- djstest.assertAreEqual(count, 0, "first base registration fires as #0");
- count++;
- }).then(function () {
- djstest.assertAreEqual(count, 1, "first chained registration fires as #1");
- count++;
- });
-
- multiple.then(function () {
- djstest.assertAreEqual(count, 2, "second base registration fires as #2");
- count++;
- }).then(function () {
- djstest.assertAreEqual(count, 3, "second chained registration fires as #3");
- djstest.done();
- });
-
- multiple.resolve();
- });
- other.reject("error", "message");
- });
-
- deferred.resolve(1, 2);
- });
-
- djstest.addTest(function deferredResolveTest() {
- // Resolve with no arguments.
- var deferred = odatajs.deferred.createDeferred();
- deferred.then(function (arg) {
- djstest.assertAreEqual(arg, undefined, "resolve with no args shows up as undefined");
-
- // Resolve with no callbacks.
- var other = odatajs.deferred.createDeferred();
- other.resolve();
- djstest.done();
- });
-
- deferred.resolve();
- });
-
- djstest.addTest(function deferredRejectTest() {
- // Resolve with no arguments.
- var deferred = odatajs.deferred.createDeferred();
- deferred.then(null, function (arg) {
- djstest.assertAreEqual(arg, undefined, "reject with no args shows up as undefined");
-
- // Resolve with no callbacks.
- var other = odatajs.deferred.createDeferred();
- other.reject();
- djstest.done();
- });
-
- deferred.reject();
- });
-
- djstest.addTest(function estimateSizeTest() {
- var tests = [
- { i: null, e: 8 },
- { i: undefined, e: 8 },
- { i: 0, e: 8 },
- { i: "abc", e: 6 },
- { i: [1, 2, 3], e: 30 },
- { i: { a1: null, a2: undefined, a3: 5, a4: "ab", a5: { b1: 5, b2: 6} }, e: 72 },
- { i: {}, e: 0 }
- ];
-
- var i, len;
- for (i = 0, len = tests.length; i < len; i++) {
- var test = tests[i];
- djstest.assertAreEqual(odatajs.cache.estimateSize(test.i), test.e);
- }
- djstest.done();
- });
-
- djstest.addTest(function cacheOptionsTunnelTest() {
- var mockClient = window.MockHttpClient;
- var doneCalled = false;
-
- mockClient.clear().setAsync(true).addRequestVerifier("*", function (theRequest) {
- if (!doneCalled) {
- doneCalled = true;
- djstest.assertAreEqual(theRequest.user, "the-user", "theRequest.user");
- djstest.assertAreEqual(theRequest.password, "the-password", "theRequest.password");
- djstest.assertAreEqual(theRequest.enableJsonpCallback, false, "theRequest.enableJsonpCallback");
- djstest.assertAreEqual(theRequest.callbackParameterName, "p", "callbackParameterName");
- djstest.done();
- }
- });
-
- var cache = odatajs.cache.createDataCache({
- name: "cacheOptionsTunnel",
- source: "http://foo-bar/",
- user: "the-user",
- password: "the-password",
- enableJsonpCallback: false,
- callbackParameterName: "p",
- httpClient: mockClient
- });
-
- cache.readRange(0, 10).then(function (arr) {
- djstest.fail("unexpected callback into readRange in test cacheOptionsTunnelTest");
- if (!doneCalled) {
- doneCalled = true;
- djstest.done();
- }
- });
- });
-
- djstest.addTest(function dataCacheHandlesFullStoreTest() {
-
- var TestStore = function (name) {
- var that = new window.odatajs.store.MemoryStore(name);
- that.addOrUpdate = function (key, value, success, error) {
- if (key === "__settings") {
- window.setTimeout(function () {
- success(key, value);
- }, 0);
- } else {
- window.setTimeout(function () {
- error({ name: "QUOTA_EXCEEDED_ERR" });
- }, 0);
- }
- };
- return that;
- };
-
- TestStore.create = function (name) {
- return new TestStore(name);
- };
-
- TestStore.isSupported = function () {
- return true;
- };
-
- var cacheSource = {
- identifier: "testSource",
- count: function (success) {
- djstest.fail("cacheSource.count was called");
- success(5);
- },
- read: function (index, count, success, error) {
- djstest.assertAreEqual(index, 0, "index is the expected one");
- djstest.assertAreEqual(count, 5, "test is the expected one");
-
- setTimeout(function () {
- success({ value: [1, 2, 3, 4, 5] });
- }, 0);
- }
- };
-
- var originalCreateStore = window.odatajs.store.createStore;
-
- window.odatajs.store.createStore = function (name, mechanism) {
- return TestStore(name);
- };
-
- try {
- var cache = odatajs.cache.createDataCache({
- name: "cache",
- pageSize: 5,
- prefetchSize: 0,
- source: cacheSource,
- mechanism: "teststore"
- });
- } finally {
- window.odatajs.store.createStore = originalCreateStore;
- }
-
- cache.readRange(0, 5).then(function (data) {
- djstest.assertAreEqual(data.value.length, 5, "5 items were read.");
- cache.readRange(0, 5).then(function (data) {
- djstest.assertAreEqual(data.value.length, 5, "5 items were read.");
- djstest.done();
- }, thenFailTest);
- }, thenFailTest);
- });
-
- // DATAJS INTERNAL END
-})(this);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/b-datajs-cache-large-collection-functional-tests.html
----------------------------------------------------------------------
diff --git a/odatajs/tests-tmp/b-datajs-cache-large-collection-functional-tests.html b/odatajs/tests-tmp/b-datajs-cache-large-collection-functional-tests.html
deleted file mode 100644
index a3820cb..0000000
--- a/odatajs/tests-tmp/b-datajs-cache-large-collection-functional-tests.html
+++ /dev/null
@@ -1,53 +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.
- */
- -->
-<html>
-<head>
- <title>datajs.cache and datajs.store full local store tests</title>
- <meta http-equiv="cache-control" content="no-cache"/>
- <meta http-equiv="pragma" content="no-cache"/>
- <meta http-equiv="expires" content="-1"/>
-
- <link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.10.0.css" type="text/css" />
- <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js"></script>
- <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
- <script type="text/javascript" src="http://code.jquery.com/qunit/qunit-1.10.0.js"></script>
- <!--<script type="text/javascript" src="common/TestSynchronizerClient.js"></script>-->
- <!--<script type="text/javascript">
- window.TestSynchronizer.init(QUnit);
- </script>-->
- <script type="text/javascript" src="../build/odatajs-4.0.0-beta-01.js"></script>
- <!--<script type="text/javascript" src="common/common.js"></script>-->
-
- <script type="text/javascript" src="common/djstest.js"></script>
- <script type="text/javascript" src="common/djstest-browser.js"></script>
- <script type="text/javascript" src="common/cacheVerifier.js"></script>
- <script type="text/javascript" src="common/observableHttpClient.js"></script>
- <!--<script type="text/javascript" src="common/ODataReadOracle.js"></script>-->
-
- <script type="text/javascript" src="b-datajs-cache-large-collection-functional-tests.js"></script>
-</head>
-<body>
- <h1 id="qunit-header">datajs.cache and datajs.store full local store tests</h1>
- <h2 id="qunit-banner"></h2>
- <h2 id="qunit-userAgent"></h2>
- <ol id="qunit-tests"></ol>
-</body>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/b-datajs-cache-large-collection-functional-tests.js
----------------------------------------------------------------------
diff --git a/odatajs/tests-tmp/b-datajs-cache-large-collection-functional-tests.js b/odatajs/tests-tmp/b-datajs-cache-large-collection-functional-tests.js
deleted file mode 100644
index d09ae51..0000000
--- a/odatajs/tests-tmp/b-datajs-cache-large-collection-functional-tests.js
+++ /dev/null
@@ -1,187 +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.
- */
-
-(function (window, undefined) {
- window.odatajs.oData.defaultHandler.accept = "application/json;q=0.9, */*;q=0.1";
- var largeCollectionFeed = "./endpoints/LargeCollectionService.svc/Customers";
- var itemsInCollection = 2 * 1024 * 1024;
-
- var cleanDomStorage = function (done) {
- /* Cleans all the data saved in the browser's DOM Storage. Needs to be called asynchronously in the
- * setup and teardown methods to be consistent with indexedDb's cleanup method.
- * @param {Function} done - Function to be called after DOM storage is cleared.
- */
- if (window.localStorage) {
- window.localStorage.clear();
- }
- done();
- };
-
- var cleanIndexedDb = function (done) {
- /** Cleans all the data saved in the browser's IndexedDb Storage.
- * @param {Function} done - Function to be called after DOM storage is cleared.
- */
- var caches = this.caches;
-
- djstest.cleanStoreOnIndexedDb(caches, done);
- };
-
- var makeUnexpectedErrorHandler = function () {
- return function (err) {
- djstest.assert(false, "Unexpected call to error handler with error: " + djstest.toString(err));
- };
- };
-
- var storageMechanisms = {
- indexeddb: { cleanup: cleanIndexedDb },
- dom: { cleanup: cleanDomStorage }
- };
-
- var cleanupAllStorage = function(done) {
- /** Cleans up all available storage mechanisms in the browser.
- * @param {Function} done - Function to be called by each cleanup function after storage is cleared.
- */
- var that = this;
- var storeCleanup = [];
-
- $.each(CacheVerifier.mechanisms, function(_, mechanism) {
- if (CacheVerifier.isMechanismAvailable(mechanism)) {
- storeCleanup.push(function(done) {
- if (storageMechanisms[mechanism]) {
- storageMechanisms[mechanism].cleanup.call(that, done);
- } else {
- done();
- }
- });
- }
- });
-
- djstest.asyncDo(storeCleanup, done);
- };
-
-
- module("Functional", {
- setup: function () {
- this.observableHttpClient = new ObservableHttpClient();
- window.odatajs.oData.net.defaultHttpClient = this.observableHttpClient;
- this.caches = [];
- var that = this;
-
- djstest.wait(function (done) {
- cleanupAllStorage.call(that, done);
- });
- },
-
- teardown: function () {
- window.odatajs.oData.net.defaultHttpClient = this.observableHttpClient.provider;
- var clearActions = [];
- var that = this;
-
- $.each(this.caches, function (_, cacheObject) {
- cacheObject.cache.onidle = undefined;
-
- clearActions.push(function (done) {
- cacheObject.cache.clear().then(function () {
- done();
- },
- function (err) {
- djstest.assert(false, "Unexpected call to error handler while attempting to clear with error: " + djstest.toString(err));
- });
- });
- });
-
- djstest.wait(function (done) {
- djstest.asyncDo(clearActions, function () {
- cleanupAllStorage.call(that, function () {
- that.caches = [];
- done();
- });
- });
- });
- }
- });
-
- $.each(["dom", "indexeddb"], function (_, mechanism) {
- if (CacheVerifier.isMechanismAvailable(mechanism)) {
- $.each([-1, 10 * 1024 * 1024, 1024 * 10248], function (_, cacheSize) {
- var prefetchParameters = { mechanism: mechanism, feed: largeCollectionFeed, skip: 0, take: 5, pageSize: 1024, prefetchSize: -1, cacheSize: cacheSize };
- djstest.addTest(function (params) {
-
- djstest.assertsExpected(3);
- var options = { name: "cache" + new Date().valueOf(), source: params.feed, pageSize: params.pageSize, prefetchSize: params.prefetchSize,
- mechanism: params.mechanism, cacheSize: params.cacheSize
- };
-
- var cache = odatajs.cache.createDataCache(options);
- this.caches.push({ name: options.name,
- cache: cache
- });
-
- cache.onidle = function () {
- djstest.assert(true, "onidle Called");
- djstest.done();
- };
-
- var cacheOracle = new CacheVerifier(params.feed, params.pageSize, itemsInCollection);
- var session = this.observableHttpClient.newSession();
-
- cache.readRange(params.skip, params.take).then(function (data) {
- var expectedRangeUrl = params.feed + "?$skip=" + params.skip + "&$top=" + params.take;
- cacheOracle.verifyRequests(session.requests, session.responses, params.skip, params.take, "largeCollection requests with prefetch", false, true);
- window.ODataReadOracle.readJsonAcrossServerPages(expectedRangeUrl, function (expectedData) {
- djstest.assertAreEqualDeep(data, expectedData, "Verify response data");
- });
- }, function (err) {
- makeUnexpectedErrorHandler(err)();
- });
- }, "readRange and prefetch all to fill store on " + prefetchParameters.mechanism + " with cacheSize=" + prefetchParameters.cacheSize, prefetchParameters, 600000);
-
- $.each([500, 1024 * 10 /*Test reduced from 100 to 10 to work around slow running script error in IE8 and Safari (bug 2200)*/], function (_, pageSize) {
- var largeReadParameters = { mechanism: mechanism, feed: largeCollectionFeed, skip: 0, take: 1024, pageSize: pageSize, prefetchSize: 0, cacheSize: cacheSize };
- djstest.addTest(function (params) {
-
- djstest.assertsExpected(2);
- var options = { name: "cache" + new Date().valueOf(), source: params.feed, pageSize: params.pageSize, prefetchSize: params.prefetchSize,
- mechanism: params.mechanism, cacheSize: params.cacheSize
- };
-
- var cache = odatajs.cache.createDataCache(options);
- this.caches.push({ name: options.name, cache: cache });
-
- var cacheOracle = new CacheVerifier(params.feed, params.pageSize, itemsInCollection);
- var session = this.observableHttpClient.newSession();
-
- cache.readRange(params.skip, params.take).then(function (data) {
- var expectedRangeUrl = params.feed + "?$skip=" + params.skip + "&$top=" + params.take;
- cacheOracle.verifyRequests(session.requests, session.responses, params.skip, params.take, "largeCollection requests without prefetch", false, false);
- window.ODataReadOracle.readJsonAcrossServerPages(expectedRangeUrl, function (expectedData) {
- djstest.assertAreEqualDeep(data, expectedData, "Verify response data");
- djstest.done();
- });
- }, function (err) {
- makeUnexpectedErrorHandler(err)();
- djstest.done();
- });
- }, "readRange of skip=" + largeReadParameters.skip + " take=" + largeReadParameters.take + " cacheSize=" + largeReadParameters.cacheSize + " and pageSize=" + largeReadParameters.pageSize +
- " to fill store on " + largeReadParameters.mechanism, largeReadParameters, 600000);
- });
- });
- }
- });
-})(window);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/bn-odata-json-tests.js
----------------------------------------------------------------------
diff --git a/odatajs/tests-tmp/bn-odata-json-tests.js b/odatajs/tests-tmp/bn-odata-json-tests.js
deleted file mode 100644
index 3e306a5..0000000
--- a/odatajs/tests-tmp/bn-odata-json-tests.js
+++ /dev/null
@@ -1,211 +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.
- */
-
-// odata-tests.js
-
-(function (window, undefined) {
- QUnit.module("odata-json-tests.js");
-
- djstest.addTest(function isArrayTest() {
- djstest.assert(window.odatajs.utils.isArray([]));
- djstest.assert(window.odatajs.utils.isArray([1, 2]));
- djstest.assert(!window.odatajs.utils.isArray({}));
- djstest.assert(!window.odatajs.utils.isArray("1,2,3,4"));
- djstest.assert(!window.odatajs.utils.isArray());
- djstest.assert(!window.odatajs.utils.isArray(null));
- djstest.done();
- });
-
- var verifyReadJsonLightDataMetadataFull = function (input, expected, message, model) {
- var response = {
- headers: {
- "Content-Type": "application/json;odata.metadata=full",
- DataServiceVersion: "4.0"
- },
- body: JSON.stringify(input)
- };
-
- window.odatajs.oData.json.jsonHandler.read(response, { metadata: model });
- djstest.assertAreEqualDeep(response.data, expected, message);
- };
-
-
- var verifyReadJsonLightDataMetadataMinimal= function (input, expected, message, model) {
- var response = {
- headers: {
- "Content-Type": "application/json;odata.metadata=minimal",
- DataServiceVersion: "4.0"
- },
- body: JSON.stringify(input)
- };
-
- window.odatajs.oData.json.jsonHandler.read(response, { metadata: model });
- djstest.assertAreEqualDeep(response.data, expected, message);
- };
-
-
- function createPointValue(geoKind) {
- return {
- edmType : geoKind+'Point', value : {
- type: "Point",
- coordinates: [1.0, 2.0],
- crs: {
- type: "Point",
- properties: {
- name: "EPSG:4326"
- }
- }
- }
- };
- }
-
- function createLineStringValue(geoKind) {
- return {
- edmType : geoKind+'LineString', value : {
- "type": "LineString",
- "coordinates": [ [100.0, 0.0], [101.0, 1.0] ],
- crs: {
- type: "LineString",
- properties: {
- name: "EPSG:4326"
- }
- }
- }
- };
- }
-
- function createPolygonValue(geoKind) {
- return {
- edmType : geoKind+'Polygon', value : {
- "type": "Polygon",
- "coordinates": [
- [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ],
- [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ]
- ],
- crs: {
- type: "Polygon",
- properties: {
- name: "EPSG:4326"
- }
- }
- }
- };
- }
-
- function createMultiPointValue(geoKind) {
- return {
- edmType : geoKind+'MultiPoint', value : {
- "type": "MultiPoint",
- "coordinates": [ [100.0, 0.0], [101.0, 1.0] ],
- crs: {
- type: "MultiPoint",
- properties: {
- name: "EPSG:4326"
- }
- }
- }
- };
- }
-
- function createMultiLineStringValue(geoKind) {
- return {
- edmType : geoKind+'MultiLineString', value : {
- "type": "MultiLineString",
- "coordinates": [
- [ [100.0, 0.0], [101.0, 1.0] ],
- [ [102.0, 2.0], [103.0, 3.0] ]
- ],
- crs: {
- type: "MultiLineString",
- properties: {
- name: "EPSG:4326"
- }
- }
- }
- };
- }
- function createMultiPolygonStringValue(geoKind) {
- return {
- edmType : geoKind+'MultiPolygon', value : {
- "type": "MultiPolygon",
- "coordinates": [
- [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],
- [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
- [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]
- ],
- crs: {
- type: "MultiPolygon",
- properties: {
- name: "EPSG:4326"
- }
- }
- }
- };
- }
-
- function createWorkload(geoKind) {
- return [
- createPointValue(geoKind),
- createLineStringValue(geoKind),
- createPolygonValue(geoKind),
- createMultiPointValue(geoKind),
- createMultiLineStringValue(geoKind),
- createMultiPolygonStringValue(geoKind)
- ];
- }
-
- function checkGeoKind(geoKind, full) {
- var workload = createWorkload(geoKind);
- for ( var i = 0; i < workload.length; i++) {
- var item = workload[i];
- var input = {
- "@odata.context": "http://someUri#Edm."+item.edmType,
- "value@odata.type" : item.edmType,
- value: item.value
- };
-
- var expected = {
- "@odata.context": "http://someUri#Edm."+item.edmType,
- "value@odata.type" : item.edmType,
- value: item.value
- };
- if (full) {
- verifyReadJsonLightDataMetadataFull(input, expected, item.edmType + " was read properly.", {});
- } else {
- verifyReadJsonLightDataMetadataMinimal(input, expected, item.edmType + " was read properly.", {});
- }
- }
-
- djstest.done();
- }
-
- djstest.addTest(function jsonReadGeometryFull() {
- checkGeoKind('Geometry',true);
- });
- djstest.addTest(function jsonReadGeometryMinimal() {
- checkGeoKind('Geometry',false);
- });
- djstest.addTest(function jsonReadGeographyFull() {
- checkGeoKind('Geography',true);
- });
- djstest.addTest(function jsonReadGeographyMinimal() {
- checkGeoKind('Geography',false);
- });
-
-})(window);
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/common/ODataVerifiyReader.svc
----------------------------------------------------------------------
diff --git a/odatajs/tests-tmp/common/ODataVerifiyReader.svc b/odatajs/tests-tmp/common/ODataVerifiyReader.svc
deleted file mode 100644
index 101cf36..0000000
--- a/odatajs/tests-tmp/common/ODataVerifiyReader.svc
+++ /dev/null
@@ -1,114 +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.
-*/
-
-<%@ ServiceHost Language="C#" Debug="true" Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory"
- Service="DataJS.Tests.ODataVerifyReader" %>
-
-//uncomment this line to debug JSON serialization.
-//#define DEBUG_SERIALIZATION
-
-namespace DataJS.Tests
-{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Net;
- using System.Runtime.Serialization;
- using System.ServiceModel;
- using System.ServiceModel.Activation;
- using System.ServiceModel.Syndication;
- using System.ServiceModel.Web;
- using System.Xml;
- using System.Xml.Linq;
- using Microsoft.Spatial;
- using Microsoft.OData.Core;
- using System.Web.Script.Serialization;
-
- /// <summary>
- /// Oracle for the OData.read library function
- /// </summary>
- [ServiceContract]
- [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
- [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
- public class ODataVerifyReader
- {
- const string jsonlightMediaType = "application/json";
-
- /// <summary>
- /// Reads a URI that will return a metadata object
- /// </summary>
- /// <param name="url">The URL to send the request to</param>
- /// <returns>Stream of metadata in json light format</returns>
- [OperationContract]
- [WebGet]
- public Stream ReadMetadata(string url)
- {
- WebResponse response = WebRequest.Create(ResolveUri(url, UriKind.Absolute)).GetResponse();
- Dictionary<string, object> jsonObject = CsdlReader.ReadCsdl(new StreamReader(response.GetResponseStream()));
- return ReaderUtils.ConvertDictionarytoJsonlightStream(jsonObject);
- }
-
- /// <summary>
- /// Reads a URI that will get the Json response and return the stream
- /// </summary>
- /// <param name="url">URL of the entry</param>
- /// <param name="user">The username for basic authentication</param>
- /// <param name="password">The password for basic authentication</param>
- /// <returns>Stream of the Json response expected to be returned by OData.read</returns>
- [OperationContract]
- [WebGet(ResponseFormat = WebMessageFormat.Json)]
- public Stream ReadJson(string url, string mimeType, string user, string password)
- {
- if (mimeType == null)
- {
- mimeType = jsonlightMediaType + ";odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8";
- }
-
- HttpWebRequest request = (HttpWebRequest)ReaderUtils.CreateRequest(ResolveUri(url, UriKind.Absolute), user, password);
- request.Accept = mimeType;
- WebResponse response = request.GetResponse();
-
- return response.GetResponseStream();
- }
-
- /// <summary>
- /// Resolves the given url string to a URI
- /// </summary>
- /// <param name="url">The given URL string</param>
- /// <param name="urlKind">URI kind to resolve to</param>
- /// <returns>The resolved URI</returns>
- private static string ResolveUri(string url, UriKind uriKind)
- {
- Uri resolvedUri = new Uri(url, UriKind.RelativeOrAbsolute);
- if (!resolvedUri.IsAbsoluteUri)
- {
- // If the given URI is relative, then base it on the Referer URI
- Uri baseUri = new Uri(WebOperationContext.Current.IncomingRequest.Headers["Referer"]);
- resolvedUri = new Uri(baseUri, resolvedUri);
- if (uriKind == UriKind.Relative)
- {
- resolvedUri = baseUri.MakeRelativeUri(resolvedUri);
- }
- }
-
- return resolvedUri.ToString();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/29a0817e/odatajs/tests-tmp/common/djstest-browser.js
----------------------------------------------------------------------
diff --git a/odatajs/tests-tmp/common/djstest-browser.js b/odatajs/tests-tmp/common/djstest-browser.js
deleted file mode 100644
index 14e5401..0000000
--- a/odatajs/tests-tmp/common/djstest-browser.js
+++ /dev/null
@@ -1,142 +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 || {};
-
- // Initialize indexedDB if the window object is available
- djstest.indexedDB = window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.indexedDB;
-
- /** Cleans all the test data saved in the IndexedDb database.
- * @param {Array} storeNames - Array of store objects with a property that is the name of the store
- * @param {Function} done - Callback function
- */
- djstest.cleanStoreOnIndexedDb = function (storeObjects, done) {
- var IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || {};
-
- function deleteObjectStores(db) {
- for ( var i = 0 ; i < db.objectStoreNames.length ; i ++) {
- db.deleteObjectStore(db.objectStoreNames[i]);
- }
- }
- var job;
-
- if (djstest.indexedDB) {
- job = new djstest.Job();
- for ( var i = 0 ; i < storeObjects.length ; i ++) {
- storeObject = storeObjects[i];
- job.queue((function (storeObject) {
- return function (success, fail) {
- var dbname = "_datajs_" + storeObject.name;
- var request = djstest.indexedDB.open(dbname);
- request.onsuccess = function (event) {
- var db = request.result;
-
- if ("setVersion" in db) {
- var versionRequest = db.setVersion("0.1");
- versionRequest.onsuccess = function (event) {
- var transaction = versionRequest.transaction;
- transaction.oncomplete = function () {
- db.close();
- success();
- };
- deleteObjectStores(db);
- };
- versionRequest.onerror = function (e) {
- djstest.fail("Error on cleanup - code: " + e.code + " name: " + e.name + "message: " + message);
- fail();
- };
- return;
- }
-
- // new api cleanup
- db.close();
- var deleteRequest = djstest.indexedDB.deleteDatabase(dbname);
- deleteRequest.onsuccess = function (event) {
- djstest.log("djstest indexeddb cleanup - deleted database " + dbname);
- success();
- };
- deleteRequest.onerror = function (e) {
- djstest.fail("djstest indexeddb cleanup - error deleting database " + dbname);
- fail();
- };
- djstest.log("djstest indexeddb cleanup - requested deletion of database " + dbname);
- };
-
- request.onerror = function (e) {
- djstest.fail(e.code + ": " + e.message);
- };
- };
- })(storeObject));
- }
- }
-
- if (job) {
- job.run(function (succeeded) {
- if (!succeeded) {
- djstest.fail("cleanup job failed");
- }
- done();
- });
- }
- else {
- done();
- }
- };
-
-
- // Disable caching to ensure that every test-related AJAX request is actually being sent,
- // and set up a default error handler
- if (typeof window !== undefined) {
- $.ajaxSetup({
- cache: false,
- error: function (jqXHR, textStatus, errorThrown) {
- // Work around bug in IE-Mobile on Windows Phone 7
- if (jqXHR.status !== 1223) {
- var err = {
- status: jqXHR.status,
- statusText: jqXHR.statusText,
- responseText: jqXHR.responseText
- };
- djstest.fail("AJAX request failed with: " + djstest.toString(err));
- }
- djstest.done();
- }
- });
- }
- return djstest;
-}
[3/4] [OLINGO-418] remove tests-tmp
Posted by ko...@apache.org.
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>
- * @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</remarks>
- */
- 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<BasicAuthDataSource>
- {
- 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<Customer> Customers
- {
- get { return this.GetResourceSetEntities<Customer>("Customers").AsQueryable(); }
- }
-
- public void ResetData()
- {
- this.ClearData();
-
- IList<Customer> customers = this.GetResourceSetEntities<Customer>("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 @@
-<!--/*
- * 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.
-*/
--->
-<?xml version="1.0" encoding="utf-8"?>
-<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" Version="1.0">
- <edmx:DataServices m:DataServiceVersion="2.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
- <Schema xmlns="http://schemas.microsoft.com/ado/2007/05/edm" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:mcns="http://MyCustomNamespace.com"
- Namespace="DataJS.Tests">
- <EntityType Name="MappedEntry" mcns:MyCustomAnnotation="My custom attribute.">
- <Key mcns:MyCustomAnnotation="//">
- <PropertyRef Name="ID" mcns:MyCustomAnnotation=" "/>
- </Key>
- <Property Name="ID" Nullable="false" Type="Edm.Int32"/>
- <Property Name="UnmappedField" Nullable="true" Type="Edm.String"/>
- <Property Name="Author" Nullable="false" Type="DataJS.Tests.Author" m:FC_KeepInContent_5="false" m:FC_SourcePath_5="Contributor/Name" m:FC_ContentKind_5="text" m:FC_TargetPath_5="SyndicationContributorName" m:FC_KeepInContent_4="false" m:FC_SourcePath_4="Contributor/Email" m:FC_ContentKind_4="text" m:FC_TargetPath_4="SyndicationContributorEmail" m:FC_KeepInContent_3="false" m:FC_SourcePath_3="Uri" m:FC_ContentKind_3="text" m:FC_TargetPath_3="SyndicationAuthorUri" m:FC_KeepInContent_2="false" m:FC_SourcePath_2="Name" m:FC_ContentKind_2="text" m:FC_TargetPath_2="SyndicationAuthorName" m:FC_KeepInContent_1="false" m:FC_SourcePath_1="Email" m:FC_ContentKind_1="text" m:FC_TargetPath_1="SyndicationAuthorEmail" m:FC_KeepInContent="false" m:FC_SourcePath="Contributor/Uri" m:FC_ContentKind="text" m:FC_TargetPath="SyndicationContributorUri"/>
- <Property Name="Published" Nullable="true" Type="Edm.String" m:FC_KeepInContent="false" m:FC_ContentKind="text" m:FC_TargetPath="SyndicationPublished"/>
- <Property Name="Rights" Nullable="true" Type="Edm.String" m:FC_KeepInContent="false" m:FC_ContentKind="text" m:FC_TargetPath="SyndicationRights"/>
- <Property Name="Summary" Nullable="true" Type="Edm.String" m:FC_KeepInContent="false" m:FC_ContentKind="xhtml" m:FC_TargetPath="SyndicationSummary"/>
- <Property Name="Title" Nullable="true" Type="Edm.String" m:FC_KeepInContent="false" m:FC_ContentKind="html" m:FC_TargetPath="SyndicationTitle"/>
- <Property Name="Updated" Nullable="true" Type="Edm.String" m:FC_KeepInContent="false" m:FC_ContentKind="text" m:FC_TargetPath="SyndicationUpdated"/>
- <Property Name="CustomElement" Nullable="true" Type="Edm.String" m:FC_KeepInContent="false" m:FC_TargetPath="customElement" m:FC_NsPrefix="pr" m:FC_NsUri="http://www.example.org/dummy"/>
- <Property Name="CustomAttribute" Nullable="true" Type="Edm.String" m:FC_KeepInContent="false" m:FC_TargetPath="customElement/@customAttribute" m:FC_NsPrefix="pr" m:FC_NsUri="http://www.example.org/dummy"/>
- <Property Name="NestedElement1" Nullable="true" Type="Edm.String" m:FC_KeepInContent="false" m:FC_TargetPath="commonElement/nestedElement1" m:FC_NsPrefix="pr" m:FC_NsUri="http://www.example.com/dummy"/>
- <Property Name="NestedElement2" Nullable="true" Type="Edm.String" m:FC_KeepInContent="false" m:FC_TargetPath="commonElement/nestedElement2" m:FC_NsPrefix="pr" m:FC_NsUri="http://www.example.com/dummy"/>
- <Property Name="CommonAttribute1" Nullable="true" Type="Edm.String" m:FC_KeepInContent="false" m:FC_TargetPath="commonElement/@commonAttribute1" m:FC_NsPrefix="pr" m:FC_NsUri="http://www.example.com/dummy"/>
- <Property Name="CommonAttribute2" Nullable="true" Type="Edm.String" m:FC_KeepInContent="false" m:FC_TargetPath="commonElement/@commonAttribute2" m:FC_NsPrefix="pr" m:FC_NsUri="http://www.example.com/dummy"/>
- <Property Name="Location" Nullable="false" Type="DataJS.Tests.Location" m:FC_KeepInContent_1="false" m:FC_SourcePath_1="Long" m:FC_TargetPath_1="long" m:FC_KeepInContent="false" m:FC_SourcePath="Lat" m:FC_TargetPath="lat" m:FC_NsPrefix="geo" m:FC_NsUri="http://www.georss.org/georss" m:FC_NsPrefix_1="geo" m:FC_NsUri_1="http://www.georss.org/georss"/>
- </EntityType>
- <ComplexType Name="Author" mcns:MyCustomAnnotation="">
- <Property Name="Email" Nullable="true" Type="Edm.String" mcns:MyCustomAnnotation=""/>
- <Property Name="Name" Nullable="true" Type="Edm.String"/>
- <Property Name="Uri" Nullable="true" Type="Edm.String"/>
- <Property Name="Contributor" Nullable="false" Type="DataJS.Tests.Contributor"/>
- </ComplexType>
- <ComplexType Name="Contributor">
- <Property Name="Email" Nullable="true" Type="Edm.String" mcns:MyCustomAnnotation=" "/>
- <Property Name="Name" Nullable="true" Type="Edm.String"/>
- <Property Name="Uri" Nullable="true" Type="Edm.String" mcns:MyCustomAnnotation="true"/>
- </ComplexType>
- <ComplexType Name="Location">
- <Property Name="Lat" Nullable="false" Type="Edm.Single" mcns:MyCustomAnnotation="27"/>
- <Property Name="Long" Nullable="false" Type="Edm.Single"/>
- </ComplexType>
- <EntityType Name="ReplicatedEntry">
- <Key>
- <PropertyRef Name="ID"/>
- </Key>
- <Property Name="ID" Nullable="false" Type="Edm.Int32"/>
- <Property Name="UnmappedField" Nullable="true" Type="Edm.String"/>
- <Property Name="Author" Nullable="false" Type="DataJS.Tests.Author2" m:FC_KeepInContent_5="true" m:FC_SourcePath_5="Contributor/Uri" m:FC_ContentKind_5="text" m:FC_TargetPath_5="SyndicationContributorUri" m:FC_KeepInContent_4="true" m:FC_SourcePath_4="Contributor/Name" m:FC_ContentKind_4="text" m:FC_TargetPath_4="SyndicationContributorName" m:FC_KeepInContent_3="true" m:FC_SourcePath_3="Contributor/Email" m:FC_ContentKind_3="text" m:FC_TargetPath_3="SyndicationContributorEmail" m:FC_KeepInContent_2="true" m:FC_SourcePath_2="Uri" m:FC_ContentKind_2="text" m:FC_TargetPath_2="SyndicationAuthorUri" m:FC_KeepInContent_1="true" m:FC_SourcePath_1="Name" m:FC_ContentKind_1="text" m:FC_TargetPath_1="SyndicationAuthorName" m:FC_KeepInContent="true" m:FC_SourcePath="Email" m:FC_ContentKind="text" m:FC_TargetPath="SyndicationAuthorEmail" mcns:MyCustomAnnotation="b>100/b>"/>
- <Property Name="Published" Nullable="true" Type="Edm.String" m:FC_KeepInContent="true" m:FC_ContentKind="text" m:FC_TargetPath="SyndicationPublished" mcns:MyCustomAnnotation=" . "/>
- <Property Name="Rights" Nullable="true" Type="Edm.String" m:FC_KeepInContent="true" m:FC_ContentKind="text" m:FC_TargetPath="SyndicationRights"/>
- <Property Name="Summary" Nullable="true" Type="Edm.String" m:FC_KeepInContent="true" m:FC_ContentKind="xhtml" m:FC_TargetPath="SyndicationSummary" mcns:MyCustomAnnotation="/Property"/>
- <Property Name="Title" Nullable="true" Type="Edm.String" m:FC_KeepInContent="true" m:FC_ContentKind="html" m:FC_TargetPath="SyndicationTitle"/>
- <Property Name="Updated" Nullable="true" Type="Edm.String" m:FC_KeepInContent="true" m:FC_ContentKind="text" m:FC_TargetPath="SyndicationUpdated"/>
- <Property Name="CustomElement" Nullable="true" Type="Edm.String" m:FC_KeepInContent="true" m:FC_TargetPath="customElement" m:FC_NsPrefix="pr" m:FC_NsUri="http://www.example.org/dummy"/>
- <Property Name="CustomAttribute" Nullable="true" Type="Edm.String" m:FC_KeepInContent="true" m:FC_TargetPath="customElement/@customAttribute" m:FC_NsPrefix="pr" m:FC_NsUri="http://www.example.org/dummy"/>
- <Property Name="NestedElement1" Nullable="true" Type="Edm.String" m:FC_KeepInContent="true" m:FC_TargetPath="commonElement/nestedElement1" m:FC_NsPrefix="pr" m:FC_NsUri="http://www.example.com/dummy"/>
- <Property Name="NestedElement2" Nullable="true" Type="Edm.String" m:FC_KeepInContent="true" m:FC_TargetPath="commonElement/nestedElement2" m:FC_NsPrefix="pr" m:FC_NsUri="http://www.example.com/dummy"/>
- <Property Name="CommonAttribute1" Nullable="true" Type="Edm.String" m:FC_KeepInContent="true" m:FC_TargetPath="commonElement/@commonAttribute1" m:FC_NsPrefix="pr" m:FC_NsUri="http://www.example.com/dummy"/>
- <Property Name="CommonAttribute2" Nullable="true" Type="Edm.String" m:FC_KeepInContent="true" m:FC_TargetPath="commonElement/@commonAttribute2" m:FC_NsPrefix="pr" m:FC_NsUri="http://www.example.com/dummy"/>
- <Property Name="Location" Nullable="false" Type="DataJS.Tests.Location2" m:FC_KeepInContent_1="true" m:FC_SourcePath_1="Long" m:FC_TargetPath_1="long" m:FC_KeepInContent="true" m:FC_SourcePath="Lat" m:FC_TargetPath="lat" m:FC_NsPrefix="geo" m:FC_NsUri="http://www.georss.org/georss" m:FC_NsPrefix_1="geo" m:FC_NsUri_1="http://www.georss.org/georss"/>
- </EntityType>
- <ComplexType Name="Author2">
- <Property Name="Email" Nullable="true" Type="Edm.String"/>
- <Property Name="Name" Nullable="true" Type="Edm.String"/>
- <Property Name="Uri" Nullable="true" Type="Edm.String"/>
- <Property Name="Contributor" Nullable="false" Type="DataJS.Tests.Contributor2"/>
- </ComplexType>
- <ComplexType Name="Contributor2">
- <Property Name="Email" Nullable="true" Type="Edm.String"/>
- <Property Name="Name" Nullable="true" Type="Edm.String"/>
- <Property Name="Uri" Nullable="true" Type="Edm.String"/>
- </ComplexType>
- <ComplexType Name="Location2">
- <Property Name="Lat" Nullable="false" Type="Edm.Single"/>
- <Property Name="Long" Nullable="false" Type="Edm.Single"/>
- </ComplexType>
- <EntityType Name="DerivedEntry" m:FC_KeepInContent="false" m:FC_SourcePath="MappedInDerivedField" m:FC_TargetPath="mappedField/@mappedInDerived" m:FC_NsPrefix="pre" m:FC_NsUri="http://www.example.com/dummy" BaseType="DataJS.Tests.BaseEntry">
- <Property Name="UnmappedConcreteField" Nullable="true" Type="Edm.String"/>
- <Property Name="MappedConcreteField" Nullable="true" Type="Edm.String" m:FC_KeepInContent="false" m:FC_TargetPath="mappedField/@mappedConcrete" m:FC_NsPrefix="pre" m:FC_NsUri="http://www.example.com/dummy"/>
- </EntityType>
- <EntityType Name="BaseEntry">
- <Key>
- <PropertyRef Name="ID"/>
- </Key>
- <Property Name="ID" Nullable="false" Type="Edm.Int32"/>
- <Property Name="UnmappedField" Nullable="true" Type="Edm.String"/>
- <Property Name="MappedInDerivedField" Nullable="true" Type="Edm.String" mcns:MyCustomAnnotation="false"/>
- <Property Name="MappedField" Nullable="true" Type="Edm.String" m:FC_KeepInContent="false" m:FC_TargetPath="mappedField" m:FC_NsPrefix="pre" m:FC_NsUri="http://www.example.com/dummy"/>
- </EntityType>
- <EntityContainer Name="EpmDataSource" m:IsDefaultEntityContainer="true" mcns:MyCustomAnnotation="0">
- <EntitySet Name="MappedEntries" EntityType="DataJS.Tests.MappedEntry"/>
- <EntitySet Name="ReplicatedEntries" EntityType="DataJS.Tests.ReplicatedEntry"/>
- <EntitySet Name="HierarchicalEntries" EntityType="DataJS.Tests.BaseEntry"/>
- <FunctionImport Name="ResetData" m:HttpMethod="POST" mcns:MyCustomAnnotation="null"/>
- </EntityContainer>
- <mcns:EmptyElement></mcns:EmptyElement>
- <mcns:ParentCustomElement mcns:MyCustomAnnotation="annotation" mcns:MySecondCustomAnnotation="annotation 2">
- <mcns:CustomChildElement1>Custom metadata 1.</mcns:CustomChildElement1>
- <mcns:CustomChildElement2>Custom metadata 2.</mcns:CustomChildElement2>
- </mcns:ParentCustomElement>
- </Schema>
- </edmx:DataServices>
-</edmx:Edmx>
\ 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 @@
-<!--
-/*
- * 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.
- */
--->
-
-<%@ 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;
-
- /// <summary>
- /// Custom data service that does not use OData
- /// </summary>
- [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<string, object> result = new Dictionary<string, object>();
- List<Dictionary<string, string>> value = new List<Dictionary<string, string>>();
- foreach (Item d in selectData)
- {
- Dictionary<string, string> item = new Dictionary<string, string>();
- 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 @@
-<!--
-/*
- * 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.
- */
--->
-
-<%@ 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;
-
- /// <summary>
- /// A data service that uses EPM
- /// </summary>
- [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]
- public class EpmDataService : DataService<EpmDataSource>
- {
- // 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<MappedEntry> MappedEntries
- {
- get { return this.GetResourceSetEntities<MappedEntry>("MappedEntries").AsQueryable(); }
- }
-
- public IQueryable<ReplicatedEntry> ReplicatedEntries
- {
- get { return this.GetResourceSetEntities<ReplicatedEntry>("ReplicatedEntries").AsQueryable(); }
- }
-
- public IQueryable<BaseEntry> HierarchicalEntries
- {
- get { return this.GetResourceSetEntities<BaseEntry>("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 = "<xmlElement xmlns=\"http://www.example.org/dummy\" attr=\"value0\">Summary0</xmlElement>",
- Title = "Title<b>0</b>",
- 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 = "Title<i>1</i>",
- 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<MappedEntry>("MappedEntries").Add(item));
-
- Array.ForEach(mappedEntries, (item) => this.GetResourceSetEntities<ReplicatedEntry>("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<BaseEntry>("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 @@
-<!--
-/*
- * 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.
- */
--->
-
-<%@ 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;
-
- /// <summary>
- /// A data service that contains in-stream errors
- /// </summary>
- public class ErrorDataService : DataService<ErrorDataSource>
- {
- // 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<ErrorType> Entities
- {
- get
- {
- ErrorType[] entities = new ErrorType[]
- {
- new ErrorType(() => 0),
- new ErrorType(() => { throw new ApplicationException(); })
- };
-
- return entities.AsQueryable();
- }
- }
- }
-
- public class ErrorType
- {
- Func<int> generateID;
-
- public ErrorType(Func<int> generateID)
- {
- this.generateID = generateID;
- }
-
- public int ID
- {
- get { return this.generateID(); }
- }
- }
-}
\ No newline at end of file