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 2015/02/23 11:11:14 UTC

[07/41] olingo-odata4-js git commit: [OLINGO-541] Move the odatajs branch one directory up

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/tests/odata-fuzz.html
----------------------------------------------------------------------
diff --git a/tests/odata-fuzz.html b/tests/odata-fuzz.html
new file mode 100644
index 0000000..270e153
--- /dev/null
+++ b/tests/odata-fuzz.html
@@ -0,0 +1,557 @@
+<!--
+/*
+ * 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.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+    <title>OData Fuzzing Tests</title>
+    <meta http-equiv="cache-control" content="no-cache" />
+    <meta http-equiv="pragma" content="no-cache" />
+    <meta http-equiv="expires" content="-1" />
+    <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.js"></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">
+
+        var testCsdl = '' +
+        '<?xml version="1.0" encoding="utf-8" standalone="yes"?>\r\n' +
+        '<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">\r\n' +
+        '  <edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="2.0">\r\n' +
+        '    <Schema Namespace="TestCatalog.Model" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">\r\n' +
+        '      <EntityType Name="Genre">\r\n' +
+        '        <Key><PropertyRef Name="Name" /></Key>\r\n' +
+        '        <Property Name="Name" Type="Edm.String" Nullable="false" MaxLength="50" Unicode="false" FixedLength="false" m:FC_TargetPath="SyndicationTitle" />\r\n' +
+        '        <NavigationProperty Name="Titles" Relationship="TestCatalog.Model.TitleGenres" FromRole="Genres" ToRole="Titles" />\r\n' +
+        '      </EntityType>\r\n' +
+        '      <EntityType Name="Language">\r\n' +
+        '        <Key><PropertyRef Name="Name" /></Key>\r\n' +
+        '        <Property Name="Name" Type="Edm.String" Nullable="false" MaxLength="80" Unicode="false" FixedLength="false" m:FC_TargetPath="SyndicationTitle" />\r\n' +
+        '        <NavigationProperty Name="Titles" Relationship="TestCatalog.Model.TitleLanguages" FromRole="Language" ToRole="Titles" />\r\n' +
+        '      </EntityType>\r\n' +
+        '      <EntityType Name="Person">\r\n' +
+        '        <Key><PropertyRef Name="Id" /></Key>\r\n' +
+        '        <Property Name="Id" Type="Edm.Int32" Nullable="false" />\r\n' +
+        '        <Property Name="Name" Type="Edm.String" Nullable="false" MaxLength="80" Unicode="true" FixedLength="false" m:FC_TargetPath="SyndicationTitle" />\r\n' +
+        '        <NavigationProperty Name="Awards" Relationship="TestCatalog.Model.FK_TitleAward_Person" FromRole="People" ToRole="TitleAwards" />\r\n' +
+        '        <NavigationProperty Name="TitlesActedIn" Relationship="TestCatalog.Model.TitleActors" FromRole="People" ToRole="Titles" />\r\n' +
+        '        <NavigationProperty Name="TitlesDirected" Relationship="TestCatalog.Model.TitleDirectors" FromRole="People" ToRole="Titles" />\r\n' +
+        '      </EntityType>\r\n' +
+        '      <EntityType Name="TitleAudioFormat">\r\n' +
+        '        <Key><PropertyRef Name="TitleId" /><PropertyRef Name="DeliveryFormat" /><PropertyRef Name="Language" /><PropertyRef Name="Format" /></Key>\r\n' +
+        '        <Property Name="TitleId" Type="Edm.String" Nullable="false" MaxLength="30" FixedLength="false" />\r\n' +
+        '        <Property Name="DeliveryFormat" Type="Edm.String" Nullable="false" MaxLength="10" Unicode="false" FixedLength="false" />\r\n' +
+        '        <Property Name="Language" Type="Edm.String" Nullable="false" MaxLength="30" Unicode="false" FixedLength="false" />\r\n' +
+        '        <Property Name="Format" Type="Edm.String" Nullable="false" MaxLength="30" Unicode="false" FixedLength="false" />\r\n' +
+        '        <NavigationProperty Name="Title" Relationship="TestCatalog.Model.FK_TitleAudioFormat_Title" FromRole="TitleAudioFormats" ToRole="Titles" />\r\n' +
+        '      </EntityType>\r\n' +
+        '      <EntityType Name="TitleAward">\r\n' +
+        '        <Key><PropertyRef Name="Id" /></Key>\r\n' +
+        '        <Property Name="Id" Type="Edm.Guid" Nullable="false" />\r\n' +
+        '        <Property Name="Type" Type="Edm.String" Nullable="false" MaxLength="30" Unicode="false" FixedLength="false" />\r\n' +
+        '        <Property Name="Category" Type="Edm.String" Nullable="false" MaxLength="60" Unicode="false" FixedLength="false" />\r\n' +
+        '        <Property Name="Year" Type="Edm.Int32" Nullable="true" />\r\n' +
+        '        <Property Name="Won" Type="Edm.Boolean" Nullable="false" />\r\n' +
+        '        <NavigationProperty Name="Title" Relationship="TestCatalog.Model.FK_TitleAward_Title" FromRole="TitleAwards" ToRole="Titles" />\r\n' +
+        '        <NavigationProperty Name="Person" Relationship="TestCatalog.Model.FK_TitleAward_Person" FromRole="TitleAwards" ToRole="People" />\r\n' +
+        '      </EntityType>\r\n' +
+        '      <EntityType Name="Title" m:HasStream="true">\r\n' +
+        '        <Key><PropertyRef Name="Id" /></Key>\r\n' +
+        '        <Property Name="Id" Type="Edm.String" Nullable="false" MaxLength="30" FixedLength="false" />\r\n' +
+        '        <Property Name="Synopsis" Type="Edm.String" Nullable="true" MaxLength="Max" Unicode="false" FixedLength="false" m:FC_TargetPath="SyndicationSummary" m:FC_ContentKind="html" />\r\n' +
+        '        <Property Name="ShortSynopsis" Type="Edm.String" Nullable="true" MaxLength="Max" Unicode="false" FixedLength="false" />\r\n' +
+        '        <Property Name="AverageRating" Type="Edm.Double" Nullable="true" />\r\n' +
+        '        <Property Name="ReleaseYear" Type="Edm.Int32" Nullable="true" />\r\n' +
+        '        <Property Name="Url" Type="Edm.String" Nullable="true" MaxLength="200" Unicode="false" FixedLength="false" />\r\n' +
+        '        <Property Name="Runtime" Type="Edm.Int32" Nullable="true" />\r\n' +
+        '        <Property Name="Rating" Type="Edm.String" Nullable="true" MaxLength="10" Unicode="false" FixedLength="false" />\r\n' +
+        '        <Property Name="DateModified" Type="Edm.DateTime" Nullable="false" ConcurrencyMode="Fixed" m:FC_TargetPath="SyndicationUpdated" m:FC_KeepInContent="false" />\r\n' +
+        '        <Property Name="Type" Type="Edm.String" Nullable="false" MaxLength="8" Unicode="false" FixedLength="false" />\r\n' +
+        '        <Property Name="BoxArt" Type="TestCatalog.Model.BoxArt" Nullable="false" />\r\n' +
+        '        <Property Name="ShortName" Type="Edm.String" Nullable="false" MaxLength="200" Unicode="false" FixedLength="false" />\r\n' +
+        '        <Property Name="Name" Type="Edm.String" Nullable="false" MaxLength="200" Unicode="false" FixedLength="false" m:FC_TargetPath="SyndicationTitle" />\r\n' +
+        '        <Property Name="Instant" Type="TestCatalog.Model.InstantAvailability" Nullable="false" />\r\n' +
+        '        <Property Name="Dvd" Type="TestCatalog.Model.DeliveryFormatAvailability" Nullable="false" />\r\n' +
+        '        <Property Name="BluRay" Type="TestCatalog.Model.DeliveryFormatAvailability" Nullable="false" />\r\n' +
+        '        <Property Name="TinyUrl" Type="Edm.String" Nullable="false" MaxLength="30" />\r\n' +
+        '        <Property Name="WebsiteUrl" Type="Edm.String" Nullable="true" MaxLength="200" />\r\n' +
+        '        <Property Name="TestApiId" Type="Edm.String" Nullable="false" MaxLength="200" />\r\n' +
+        '        <NavigationProperty Name="AudioFormats" Relationship="TestCatalog.Model.FK_TitleAudioFormat_Title" FromRole="Titles" ToRole="TitleAudioFormats" />\r\n' +
+        '        <NavigationProperty Name="Awards" Relationship="TestCatalog.Model.FK_TitleAward_Title" FromRole="Titles" ToRole="TitleAwards" />\r\n' +
+        '        <NavigationProperty Name="Disc" Relationship="TestCatalog.Model.FK_Title_Disc" FromRole="Titles1" ToRole="Titles" />\r\n' +
+        '        <NavigationProperty Name="Movie" Relationship="TestCatalog.Model.FK_Title_Movie" FromRole="Titles1" ToRole="Titles" />\r\n' +
+        '        <NavigationProperty Name="Season" Relationship="TestCatalog.Model.FK_Title_Season" FromRole="Titles1" ToRole="Titles" />\r\n' +
+        '        <NavigationProperty Name="Series" Relationship="TestCatalog.Model.FK_Title_Series" FromRole="Titles1" ToRole="Titles" />\r\n' +
+        '        <NavigationProperty Name="ScreenFormats" Relationship="TestCatalog.Model.FK_TitleScreenFormat_Title" FromRole="Titles" ToRole="TitleScreenFormats" />\r\n' +
+        '        <NavigationProperty Name="Cast" Relationship="TestCatalog.Model.TitleActors" FromRole="Titles" ToRole="People" />\r\n' +
+        '        <NavigationProperty Name="Languages" Relationship="TestCatalog.Model.TitleLanguages" FromRole="Titles" ToRole="Language" />\r\n' +
+        '        <NavigationProperty Name="Directors" Relationship="TestCatalog.Model.TitleDirectors" FromRole="Titles" ToRole="People" />\r\n' +
+        '        <NavigationProperty Name="Genres" Relationship="TestCatalog.Model.TitleGenres" FromRole="Titles" ToRole="Genres" />\r\n' +
+        '      </EntityType>\r\n' +
+        '      <ComplexType Name="BoxArt">\r\n' +
+        '        <Property Name="SmallUrl" Type="Edm.String" Nullable="true" MaxLength="80" Unicode="false" FixedLength="false" />\r\n' +
+        '        <Property Name="MediumUrl" Type="Edm.String" Nullable="true" MaxLength="80" Unicode="false" FixedLength="false" />\r\n' +
+        '        <Property Name="LargeUrl" Type="Edm.String" Nullable="true" MaxLength="80" Unicode="false" FixedLength="false" />\r\n' +
+        '        <Property Name="HighDefinitionUrl" Type="Edm.String" Nullable="true" MaxLength="80" Unicode="false" FixedLength="false" />\r\n' +
+        '      </ComplexType>\r\n' +
+        '      <ComplexType Name="InstantAvailability">\r\n' +
+        '        <Property Name="Available" Type="Edm.Boolean" Nullable="false" />\r\n' +
+        '        <Property Name="AvailableFrom" Type="Edm.DateTime" Nullable="true" />\r\n' +
+        '        <Property Name="AvailableTo" Type="Edm.DateTime" Nullable="true" />\r\n' +
+        '        <Property Name="HighDefinitionAvailable" Type="Edm.Boolean" Nullable="false" />\r\n' +
+        '        <Property Name="Runtime" Type="Edm.Int32" Nullable="true" />\r\n' +
+        '        <Property Name="Rating" Type="Edm.String" Nullable="true" MaxLength="10" Unicode="false" FixedLength="false" />\r\n' +
+        '      </ComplexType>\r\n' +
+        '      <ComplexType Name="DeliveryFormatAvailability">\r\n' +
+        '        <Property Name="Available" Type="Edm.Boolean" Nullable="false" />\r\n' +
+        '        <Property Name="AvailableFrom" Type="Edm.DateTime" Nullable="true" />\r\n' +
+        '        <Property Name="AvailableTo" Type="Edm.DateTime" Nullable="true" />\r\n' +
+        '        <Property Name="Runtime" Type="Edm.Int32" Nullable="true" />\r\n' +
+        '        <Property Name="Rating" Type="Edm.String" Nullable="true" MaxLength="10" Unicode="false" FixedLength="false" />\r\n' +
+        '      </ComplexType>\r\n' +
+        '      <EntityType Name="TitleScreenFormat">\r\n' +
+        '        <Key><PropertyRef Name="TitleId" /><PropertyRef Name="DeliveryFormat" /><PropertyRef Name="Format" /></Key>\r\n' +
+        '        <Property Name="TitleId" Type="Edm.String" Nullable="false" MaxLength="30" FixedLength="false" />\r\n' +
+        '        <Property Name="DeliveryFormat" Type="Edm.String" Nullable="false" MaxLength="10" Unicode="false" FixedLength="false" />\r\n' +
+        '        <Property Name="Format" Type="Edm.String" Nullable="false" MaxLength="30" Unicode="false" FixedLength="false" />\r\n' +
+        '        <NavigationProperty Name="Title" Relationship="TestCatalog.Model.FK_TitleScreenFormat_Title" FromRole="TitleScreenFormats" ToRole="Titles" />\r\n' +
+        '      </EntityType>\r\n' +
+        '      <Association Name="FK_TitleAudioFormat_Title">\r\n' +
+        '        <End Role="Titles" Type="TestCatalog.Model.Title" Multiplicity="1" />\r\n' +
+        '        <End Role="TitleAudioFormats" Type="TestCatalog.Model.TitleAudioFormat" Multiplicity="*" />\r\n' +
+        '        <ReferentialConstraint>\r\n' +
+        '          <Principal Role="Titles"><PropertyRef Name="Id" /></Principal>\r\n' +
+        '          <Dependent Role="TitleAudioFormats"><PropertyRef Name="TitleId" /></Dependent>\r\n' +
+        '        </ReferentialConstraint>\r\n' +
+        '      </Association>\r\n' +
+        '      <Association Name="FK_TitleAward_Title">\r\n' +
+        '        <End Role="Titles" Type="TestCatalog.Model.Title" Multiplicity="1" />\r\n' +
+        '        <End Role="TitleAwards" Type="TestCatalog.Model.TitleAward" Multiplicity="*" />\r\n' +
+        '      </Association>\r\n' +
+        '      <Association Name="FK_TitleAward_Person">\r\n' +
+        '        <End Role="People" Type="TestCatalog.Model.Person" Multiplicity="0..1" />\r\n' +
+        '        <End Role="TitleAwards" Type="TestCatalog.Model.TitleAward" Multiplicity="*" />\r\n' +
+        '      </Association>\r\n' +
+        '      <Association Name="FK_Title_Disc">\r\n' +
+        '        <End Role="Titles" Type="TestCatalog.Model.Title" Multiplicity="0..1" />\r\n' +
+        '        <End Role="Titles1" Type="TestCatalog.Model.Title" Multiplicity="*" />\r\n' +
+        '      </Association>\r\n' +
+        '      <Association Name="FK_Title_Movie">\r\n' +
+        '        <End Role="Titles" Type="TestCatalog.Model.Title" Multiplicity="0..1" />\r\n' +
+        '        <End Role="Titles1" Type="TestCatalog.Model.Title" Multiplicity="*" />\r\n' +
+        '      </Association>\r\n' +
+        '      <Association Name="FK_Title_Season">\r\n' +
+        '        <End Role="Titles" Type="TestCatalog.Model.Title" Multiplicity="0..1" />\r\n' +
+        '        <End Role="Titles1" Type="TestCatalog.Model.Title" Multiplicity="*" />\r\n' +
+        '      </Association>\r\n' +
+        '      <Association Name="FK_Title_Series">\r\n' +
+        '        <End Role="Titles" Type="TestCatalog.Model.Title" Multiplicity="0..1" />\r\n' +
+        '        <End Role="Titles1" Type="TestCatalog.Model.Title" Multiplicity="*" />\r\n' +
+        '      </Association>\r\n' +
+        '      <Association Name="FK_TitleScreenFormat_Title">\r\n' +
+        '        <End Role="Titles" Type="TestCatalog.Model.Title" Multiplicity="1" />\r\n' +
+        '        <End Role="TitleScreenFormats" Type="TestCatalog.Model.TitleScreenFormat" Multiplicity="*" />\r\n' +
+        '        <ReferentialConstraint>\r\n' +
+        '          <Principal Role="Titles"><PropertyRef Name="Id" /></Principal>\r\n' +
+        '          <Dependent Role="TitleScreenFormats"><PropertyRef Name="TitleId" /></Dependent>\r\n' +
+        '        </ReferentialConstraint>\r\n' +
+        '      </Association>\r\n' +
+        '      <Association Name="TitleActors">\r\n' +
+        '        <End Role="Titles" Type="TestCatalog.Model.Title" Multiplicity="*" />\r\n' +
+        '        <End Role="People" Type="TestCatalog.Model.Person" Multiplicity="*" />\r\n' +
+        '      </Association>\r\n' +
+        '      <Association Name="TitleLanguages">\r\n' +
+        '        <End Role="Titles" Type="TestCatalog.Model.Title" Multiplicity="*" />\r\n' +
+        '        <End Role="Language" Type="TestCatalog.Model.Language" Multiplicity="*" />\r\n' +
+        '      </Association>\r\n' +
+        '      <Association Name="TitleDirectors">\r\n' +
+        '        <End Role="Titles" Type="TestCatalog.Model.Title" Multiplicity="*" />\r\n' +
+        '        <End Role="People" Type="TestCatalog.Model.Person" Multiplicity="*" />\r\n' +
+        '      </Association>\r\n' +
+        '      <Association Name="TitleGenres">\r\n' +
+        '        <End Role="Titles" Type="TestCatalog.Model.Title" Multiplicity="*" />\r\n' +
+        '        <End Role="Genres" Type="TestCatalog.Model.Genre" Multiplicity="*" />\r\n' +
+        '      </Association>\r\n' +
+        '    </Schema>\r\n' +
+        '    <Schema Namespace="Test.Catalog" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">\r\n' +
+        '      <EntityContainer Name="TestCatalog" m:IsDefaultEntityContainer="true">\r\n' +
+        '        <FunctionImport Name="Movies" EntitySet="Titles" ReturnType="Collection(TestCatalog.Model.Title)" m:HttpMethod="GET" />\r\n' +
+        '        <FunctionImport Name="Series" EntitySet="Titles" ReturnType="Collection(TestCatalog.Model.Title)" m:HttpMethod="GET" />\r\n' +
+        '        <FunctionImport Name="Seasons" EntitySet="Titles" ReturnType="Collection(TestCatalog.Model.Title)" m:HttpMethod="GET" />\r\n' +
+        '        <FunctionImport Name="Discs" EntitySet="Titles" ReturnType="Collection(TestCatalog.Model.Title)" m:HttpMethod="GET" />\r\n' +
+        '        <FunctionImport Name="Episodes" EntitySet="Titles" ReturnType="Collection(TestCatalog.Model.Title)" m:HttpMethod="GET" />\r\n' +
+        '        <EntitySet Name="Genres" EntityType="TestCatalog.Model.Genre" />\r\n' +
+        '        <EntitySet Name="Languages" EntityType="TestCatalog.Model.Language" />\r\n' +
+        '        <EntitySet Name="People" EntityType="TestCatalog.Model.Person" />\r\n' +
+        '        <EntitySet Name="TitleAudioFormats" EntityType="TestCatalog.Model.TitleAudioFormat" />\r\n' +
+        '        <EntitySet Name="TitleAwards" EntityType="TestCatalog.Model.TitleAward" />\r\n' +
+        '        <EntitySet Name="Titles" EntityType="TestCatalog.Model.Title" />\r\n' +
+        '        <EntitySet Name="TitleScreenFormats" EntityType="TestCatalog.Model.TitleScreenFormat" />\r\n' +
+        '        <AssociationSet Name="FK_TitleAudioFormat_Title" Association="TestCatalog.Model.FK_TitleAudioFormat_Title">\r\n' +
+        '          <End Role="Titles" EntitySet="Titles" />\r\n' +
+        '          <End Role="TitleAudioFormats" EntitySet="TitleAudioFormats" />\r\n' +
+        '        </AssociationSet>\r\n' +
+        '        <AssociationSet Name="FK_TitleAward_Title" Association="TestCatalog.Model.FK_TitleAward_Title">\r\n' +
+        '          <End Role="Titles" EntitySet="Titles" />\r\n' +
+        '          <End Role="TitleAwards" EntitySet="TitleAwards" />\r\n' +
+        '        </AssociationSet>\r\n' +
+        '        <AssociationSet Name="FK_TitleAward_Person" Association="TestCatalog.Model.FK_TitleAward_Person">\r\n' +
+        '          <End Role="People" EntitySet="People" />\r\n' +
+        '          <End Role="TitleAwards" EntitySet="TitleAwards" />\r\n' +
+        '        </AssociationSet>\r\n' +
+        '        <AssociationSet Name="FK_Title_Disc" Association="TestCatalog.Model.FK_Title_Disc">\r\n' +
+        '          <End Role="Titles" EntitySet="Titles" />\r\n' +
+        '          <End Role="Titles1" EntitySet="Titles" />\r\n' +
+        '        </AssociationSet>\r\n' +
+        '        <AssociationSet Name="FK_Title_Movie" Association="TestCatalog.Model.FK_Title_Movie">\r\n' +
+        '          <End Role="Titles" EntitySet="Titles" />\r\n' +
+        '          <End Role="Titles1" EntitySet="Titles" />\r\n' +
+        '        </AssociationSet>\r\n' +
+        '        <AssociationSet Name="FK_Title_Season" Association="TestCatalog.Model.FK_Title_Season">\r\n' +
+        '          <End Role="Titles" EntitySet="Titles" />\r\n' +
+        '          <End Role="Titles1" EntitySet="Titles" />\r\n' +
+        '        </AssociationSet>\r\n' +
+        '        <AssociationSet Name="FK_Title_Series" Association="TestCatalog.Model.FK_Title_Series">\r\n' +
+        '          <End Role="Titles" EntitySet="Titles" />\r\n' +
+        '          <End Role="Titles1" EntitySet="Titles" />\r\n' +
+        '        </AssociationSet>\r\n' +
+        '        <AssociationSet Name="FK_TitleScreenFormat_Title" Association="TestCatalog.Model.FK_TitleScreenFormat_Title">\r\n' +
+        '          <End Role="Titles" EntitySet="Titles" />\r\n' +
+        '          <End Role="TitleScreenFormats" EntitySet="TitleScreenFormats" />\r\n' +
+        '        </AssociationSet>\r\n' +
+        '        <AssociationSet Name="TitleActors" Association="TestCatalog.Model.TitleActors">\r\n' +
+        '          <End Role="Titles" EntitySet="Titles" />\r\n' +
+        '          <End Role="People" EntitySet="People" />\r\n' +
+        '        </AssociationSet>\r\n' +
+        '        <AssociationSet Name="TitleLanguages" Association="TestCatalog.Model.TitleLanguages">\r\n' +
+        '          <End Role="Titles" EntitySet="Titles" />\r\n' +
+        '          <End Role="Language" EntitySet="Languages" />\r\n' +
+        '        </AssociationSet>\r\n' +
+        '        <AssociationSet Name="TitleDirectors" Association="TestCatalog.Model.TitleDirectors">\r\n' +
+        '          <End Role="Titles" EntitySet="Titles" />\r\n' +
+        '          <End Role="People" EntitySet="People" />\r\n' +
+        '        </AssociationSet>\r\n' +
+        '        <AssociationSet Name="TitleGenres" Association="TestCatalog.Model.TitleGenres">\r\n' +
+        '          <End Role="Titles" EntitySet="Titles" />\r\n' +
+        '          <End Role="Genres" EntitySet="Genres" />\r\n' +
+        '        </AssociationSet>\r\n' +
+        '      </EntityContainer>\r\n' +
+        '    </Schema>\r\n' +
+        '  </edmx:DataServices>\r\n' +
+        '</edmx:Edmx>\r\n' +
+        '';
+
+
+        var iterationsRemaining = 0;
+        var iterationsPerRun = 100000;
+        var failureCount = 0;
+        var canary = false;
+
+        function canaryFn() {
+            canary = true;
+        }
+
+        var buildSumAndNormalize = function (table) {
+            // Sum all weights.
+            var total = 0;
+            for (var i = 0; i < table.length; i++) {
+                total += table[i].w;
+            }
+
+            // Record a normalized weight (nw) and the step-ladder threshold.
+            var last = 0;
+            for (var i = 0; i < table.length; i++) {
+                table[i].nw = (table[i].w / total);
+
+                last += table[i].nw;
+                table[i].sl = last;
+            }
+
+            table.total = total;
+        };
+
+        var randomFromWeighted = function (table) {
+            if (table.total === undefined) {
+                buildSumAndNormalize(table);
+            }
+
+            var number = Math.random();
+            for (var i = 0; i < table.length; i++) {
+                if (number < table[i].sl) {
+                    return table[i].v;
+                }
+            }
+
+            return table[table.length - 1].v;
+        };
+
+        // Create a table with relative weight w and value v for text generation.
+        var fuzzingTextTable = [
+            { w: 3, v: "canary=true" },
+            { w: 2, v: "canary=true;" },
+            { w: 3, v: "canary=1" },
+            { w: 1, v: "window.canary=1" },
+            { w: 2, v: "canary=[]" },
+            { w: 2, v: "canary={}" },
+            { w: 1, v: "canaryFn" },
+            { w: 2, v: "canaryFn()" }
+        ];
+
+        var fuzzingTextOpTable = [
+            { w: 1, v: "replace" },
+            { w: 3, v: "insert" }
+        ];
+
+        var fuzzText = function (text) {
+            /** Fuzzes the specified string.
+             * @param {String} text - Text to fuzz.
+             * @returns {String} The fuzzes text.
+
+            var location = Math.round(Math.random() * text.length - 1);
+            var content = randomFromWeighted(fuzzingTextTable);
+            var op = randomFromWeighted(fuzzingTextOpTable);
+            if (op === "replace") {
+                text = text.substr(0, location) + content + text.substr(location + content.length);
+            } else if (op === "insert") {
+                text = text.substr(0, location) + content + text.substr(location);
+            }
+
+            return text;
+        };
+
+        var rarely = function (rare, common) {
+            if (Math.random() < 0.1) {
+                return rare;
+            } else {
+                return common;
+            }
+        };
+
+        var gibberish = function () {
+            var len = Math.random() * 100;
+            var result = "";
+            for (var i = 0; i < len; i++) {
+                result += String.fromCharCode(Math.round(Math.random() * 65000));
+            }
+
+            return result;
+        }
+
+        var generateResponse = function (suggestedContentType, body) {
+            var url = rarely(null, "http://foo/bar");
+            var statusCode = rarely((Math.random() * 1000).toString().substr(0, 3), 200);
+            var statusText = rarely(gibberish(), "OK");
+            var headers = [];
+            headers["Content-Length"] = rarely(Math.random() * 200, undefined);
+            headers["Content-Type"] = rarely("foo bar baz", suggestedContentType);
+
+            var response = { requestUri: url, statusCode: statusCode, statusText: statusText, headers: headers, body: body };
+            return response;
+        };
+
+        var generateRandom = function () {
+            var body = gibberish();
+            return generateResponse("application/octet-stream", body);
+        };
+
+        var generateServiceDoc = function() {
+            var body = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>\r\n' +
+                        '<service xml:base="http://services.odata.org/OData/OData.svc/"  xmlns:atom="http://www.w3.org/2005/Atom" ' +
+                        ' xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app">' +
+                        '<workspace><atom:title>Default</atom:title> <collection href="Products"><atom:title>Products</atom:title></collection>' +
+                        '<collection href="Categories"><atom:title>Categories</atom:title> </collection><collection href="Suppliers"><atom:title>Suppliers</atom:title> </collection></workspace></service>';
+            body = fuzzText(body);
+            return generateResponse("application/atomsvc+xml", body);
+        };
+
+        var generateMetadata = function () {
+            var body = testCsdl;
+            body = fuzzText(body);
+            return generateResponse("application/xml", body);
+        };
+
+        var generateError = function () {
+            var body = testCsdl;
+            body = fuzzText(body);
+            return generateResponse("application/xml", body);
+        };
+
+        var generatePlainText = function () {
+            var body = gibberish();
+            return generateResponse("plain/text", body);
+        };
+
+        var generateBatch = function () {
+            var body = gibberish();
+            return generateResponse("multipart/mixed; boundary=batch(123)", body);
+        };
+
+        var generateXml = function () {
+            // TODO: consider doing something about an XHTML section here
+            var body = '' +
+                '<?xml version="1.0" encoding="utf-8" standalone="yes"?>\r\n' +
+                '<feed xml:base=http://services.odata.org/OData/OData.svc/' +
+                '     xmlns:d=http://schemas.microsoft.com/ado/2007/08/dataservices' +
+                '     xmlns:m=http://schemas.microsoft.com/ado/2007/08/dataservices/metadata' +
+                '     xmlns="http://www.w3.org/2005/Atom">' +
+                '  <title type="text">Categories</title>' +
+                '  <id>http://services.odata.org/OData/OData.svc/Categories</id>' +
+                '  <updated>2010-03-10T08:38:14Z</updated>' +
+                '  <link rel="self" title="Categories" href="Categories" />' +
+                '  <entry>' +
+                '    <id>http://services.odata.org/OData/OData.svc/Categories(0)</id>' +
+                '    <title type="text">Food</title>' +
+                '    <updated>2010-03-10T08:38:14Z</updated>' +
+                '    <author><name /></author>' +
+                '    <link rel="edit" title="Category" href="Categories(0)" />' +
+                '    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Products"' +
+                '            type="application/atom+xml;type=feed"' +
+                '            title="Products" href="Categories(0)/Products" />' +
+                '    <category term="ODataDemo.Category"' +
+                '            scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />' +
+                '    <content type="application/xml">' +
+                '      <m:properties>' +
+                '        <d:ID m:type="Edm.Int32">0</d:ID>' +
+                '        <d:Name>Food</d:Name>' +
+                '        <d:AverageRating m:type="Edm.Double">3.6</d:AverageRating>' +
+                '        <d:AvailableFrom m:type="Edm.DateTime">1999-03-23T00:00:00</d:AvailableFrom>' +
+                '        <d:Name>Food</d:Name>' +
+                '      </m:properties>' +
+                '    </content>' +
+                '  </entry>' +
+                '  <!-- <entry> elements representing additional Categories go here -->' +
+                '</feed>';
+            return generateResponse("application/atom+xml", body);
+        };
+
+        var generateJson = function () {
+            var body =  '{ "d" : { ' +
+                        '"results": [ ' +
+                        '{ ' +
+                        '"__metadata": {  ' +
+                        '"uri": "http://services.odata.org/OData/OData.svc/Categories(0)",  ' +
+                        '"type": "DataServiceProviderDemo.Category" ' +
+                        '}, ' +
+                        '"ID": 0, ' +
+                        '"Name": "Food", ' +
+                        '"SomeDate": "Date(123)", ' +
+                        '"Products": { ' +
+                        '"__deferred": { ' +
+                        '"uri": "http://services.odata.org/OData/OData.svc/Categories(0)/Products" ' +
+                        '} } } ], ' +
+                        '"__count": "3", ' +
+                        '"__next": "http://services.odata.org/OData/OData.svc$skiptoken=12" ' +
+                        '} } ' +
+                        '';
+            return generateResponse("application/json", body);
+        };
+
+        // Create a table with relative weight w and value v for response generation.
+        var formatTable = [
+            { w:  1, v: generateRandom },
+            { w:  2, v: generateError },
+            { w:  5, v: generatePlainText },
+            { w:  5, v: generateServiceDoc },
+            { w: 10, v: generateBatch },
+            { w: 10, v: generateMetadata },
+            { w: 40, v: generateXml },
+            { w: 80, v: generateJson }
+        ];
+
+        var fakeHttpClient = {
+            request: function (request, success, error) {
+                /** Performs a network request.
+                 * @param {Function} success - Success callback with the response object.
+                 * @param {Function} error - Error callback with an error object.
+                 * @returns {Object} Object with an 'abort' method for the operation.
+
+                var shouldError = rarely(true, false);
+                var format = randomFromWeighted(formatTable);
+                var response = format();
+
+                window.setTimeout(function () {
+                    if (shouldError) {
+                        error(response);
+                    } else {
+                        success(response);
+                    }
+                }, 1);
+
+                return {};
+            }
+        };
+
+        var startTimeMs = 0;
+
+        function startTest() {
+            failureCount = 0;
+            startTimeMs = new Date().getTime();
+            iterationsRemaining = iterationsPerRun;
+            nextIteration();
+        }
+
+        function readCallback() {
+            // Success or failure don't actually matter.
+            if (canary === true) {
+                canary = false;
+                failureCount++;
+            }
+
+            iterationsRemaining--;
+            nextIteration();
+        }
+
+        function nextIteration() {
+            if (iterationsRemaining === 0) {
+                $("#fuzz-status").text("Tests complete. Failures: #" + failureCount);
+                return;
+            }
+
+            if (iterationsRemaining % 50 === 0) {
+                var text = "Running tests (pending=" + iterationsRemaining + " of " + iterationsPerRun;
+                if (iterationsRemaining !== iterationsPerRun) {
+                    var currentTimeMs = new Date().getTime();
+                    var averageTestTimeMs = (iterationsPerRun - iterationsRemaining) / (currentTimeMs - startTimeMs);
+                    var remainingTimeMs = iterationsRemaining * averageTestTimeMs;
+                    text += ", ETA: " + remainingTimeMs + "ms, avg " + averageTestTimeMs + "ms";
+                }
+
+                text += "). Failures: #" + failureCount;
+                $("#fuzz-status").text(text);
+            }
+
+            OData.read("url", readCallback, readCallback, undefined, fakeHttpClient);
+        }
+
+        $(document).ready(function () {
+            $("#start-button").click(startTest);
+        });
+    </script>
+
+</head>
+<body>
+<h1>OData Fuzzing Tests</h1>
+<p>
+This page fuzzes the OData parsers in the datajs library.
+</p>
+<button id='start-button'>Start</button>
+<p id='fuzz-status'>&nbsp;</p>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/503b4417/tests/odata-handler-tests.js
----------------------------------------------------------------------
diff --git a/tests/odata-handler-tests.js b/tests/odata-handler-tests.js
new file mode 100644
index 0000000..aa824c7
--- /dev/null
+++ b/tests/odata-handler-tests.js
@@ -0,0 +1,364 @@
+/*
+ * 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-handler-tests.js
+
+(function (window, undefined) {
+
+    var dataServiceVersion = "4.0";
+    var endpoint = "./endpoints/FoodStoreDataServiceV4.svc";
+    var mimeType = "application/json;odata.metadata=minimal";
+    var headers = {
+                "Content-Type": mimeType,
+                Accept: mimeType,
+                "OData-Version": "4.0"
+            };
+    var unexpectedErrorHandler = function (err) {
+        djstest.assert(false, "Unexpected call to error handler with error: " + djstest.toString(err));
+        djstest.done();
+    };
+
+    djstest.addTest(function createUpdateDeleteTest() {
+        // This is a simple create-update-delete cycle as a high-level test.
+
+        var serviceUri = "./endpoints/FoodStoreDataServiceV4.svc/";
+        var baseUri = serviceUri + "Categories";
+        var testItem;
+        var handledData = { CategoryID: 1001, Name: "Name #1001" };
+        var uri;
+
+        var itemCreatedCallback = function (data, response) {
+            djstest.assert(response.headers["Location"], "location URL in the headers");
+            djstest.assert(data.Name, "Name #1001");
+            
+            uri = response.headers["Location"];
+            testItem = handledData;
+            testItem.Name = "Updated name";
+            
+            odatajs.oData.request({
+                method: "PUT",
+                data: testItem,
+                requestUri: uri,
+            }, itemUpdatedCallback);
+        };
+
+        var itemUpdatedCallback = function (data, response) {
+            djstest.assertAreEqual(response.statusCode, 204, "Expecting no content on update");
+            odatajs.oData.request({
+                method: "DELETE",
+                requestUri: uri
+            }, itemDeletedCallback);
+        };
+
+        var itemDeletedCallback = function (data, response) {
+            djstest.done();
+        };
+
+        $.post(serviceUri + "ResetData", function () {
+            odatajs.oData.request({
+                requestUri: baseUri,
+                method: "POST",
+                data: { CategoryID: 1001, Name: "Name #1001" }
+            }, itemCreatedCallback);
+        });
+    });
+
+    djstest.addTest(function errorHandlerTest() {
+        djstest.assertsExpected(1);
+        odatajs.oData.read("./endpoints/FoodStoreDataServiceV4.svc/Categories?$reserved-misused=true",
+            function (data) {
+                djstest.fail("expected an error callback");
+                djstest.done();
+            },
+            function (err) {
+                djstest.assert(err.response.body, "err.response.body is assigned");
+                djstest.done();
+            });
+    });
+
+    djstest.addTest(function textHandlerParseTest() {
+        djstest.assertsExpected(1);
+        MockHttpClient.clear().addResponse("textHandlerParseTest", {
+            statusCode: 200,
+            body: " text ",
+            headers: { "Content-Type": "text/plain" }
+        });
+        odatajs.oData.read("textHandlerParseTest", function (data) {
+            djstest.assertAreEqual(data, " text ", "data matches");
+            djstest.done();
+        }, function (err) {
+            djstest.fail("expected success");
+            djstest.done();
+        }, undefined, MockHttpClient);
+    });
+
+    djstest.addTest(function textHandlerParseEmptyTest() {
+        djstest.assertsExpected(1);
+        MockHttpClient.clear().addResponse("textHandlerParseTest", {
+            statusCode: 200,
+            body: "",
+            headers: { "Content-Type": "text/plain" }
+        });
+        odatajs.oData.read("textHandlerParseTest", function (data) {
+            djstest.assertAreEqual(data, "", "data matches");
+            djstest.done();
+        }, function (err) {
+            djstest.fail("expected success");
+            djstest.done();
+        }, undefined, MockHttpClient);
+    });
+
+    djstest.addTest(function textHandlerSerializeTest() {
+        djstest.assertsExpected(1);
+        MockHttpClient.clear().addRequestVerifier("uri", function (request) {
+            djstest.assertAreEqual(request.body, "text", "text in request");
+        }).addResponse("uri", { statusCode: 200, body: "", headers: { "Content-Type": "text/plain"} });
+        odatajs.oData.request({ requestUri: "uri", method: "POST", data: "text", headers: { "Content-Type": "text/plain"} }, function (data) {
+            djstest.done();
+        }, function (err) {
+            djstest.fail("expected success");
+            djstest.done();
+        }, undefined, MockHttpClient);
+    });
+
+    djstest.addTest(function textHandlerSerializeBlankTest() {
+        djstest.assertsExpected(1);
+        MockHttpClient.clear().addRequestVerifier("uri", function (request) {
+            djstest.assertAreEqual(request.body, "", "text in request");
+        }).addResponse("uri", { statusCode: 200, body: "", headers: { "Content-Type": "text/plain"} });
+        odatajs.oData.request({ requestUri: "uri", method: "POST", data: "", headers: { "Content-Type": "text/plain"} }, function (data) {
+            djstest.done();
+        }, function (err) {
+            djstest.fail("expected success");
+            djstest.done();
+        }, undefined, MockHttpClient);
+    });
+
+    // DATAJS INTERNAL START
+    djstest.addTest(function handlerReadTest() {
+        var tests = [
+            {
+                response: { headers: { "Content-Type": "application/json", "OData-Version": "4.0" }, body: "response 0" },
+                shouldHit: true,
+                context: { contentType: window.odatajs.oData.handler.contentType("application/json"), dataServiceVersion: "4.0" }
+            },
+            {
+                response: { headers: { "Content-Type": "application/json" }, body: "response 1" },
+                shouldHit: true,
+                context: { contentType: window.odatajs.oData.handler.contentType("application/json"), dataServiceVersion: "" }
+            },
+            {
+                response: { headers: { "Content-Type": "otherMediaType" }, body: "response 2" },
+                shouldHit: false,
+                context: { contentType: window.odatajs.oData.handler.contentType("otherMediaType"), dataServiceVersion: "" }
+            },
+            {
+                response: { headers: { "Content-Type": "application/json", "OData-Version": "4.0" }, body: "response 3" },
+                shouldHit: true,
+                context: { contentType: window.odatajs.oData.handler.contentType("application/json"), dataServiceVersion: "4.0" }
+            },
+            {
+                response: { body: "response 4" },
+                shouldHit: false,
+                context: { contentType: window.odatajs.oData.handler.contentType("application/json"), dataServiceVersion: "" }
+            },
+            {
+                response: null,
+                shouldHit: false,
+                context: {}
+            },
+            {
+                response: undefined,
+                shouldHit: false,
+                context: {}
+            }
+        ];
+
+        var i;
+        var test;
+        var testRead = function (handler, body, context) {
+            djstest.assert(test.shouldHit, "method should be hit on item #" + i);
+            djstest.assertAreEqual(handler, testHandler, "handler matches target on item #" + i);
+            djstest.assertAreEqualDeep(context, test.context, "context matches target on item #" + i);
+            djstest.assertAreEqual(body, test.response.body, "body matches target on item #" + i);
+            return body;
+        };
+
+        var testHandler = window.odatajs.oData.handler.handler(testRead, null, "application/json", "4.0");
+
+        var len, expectedAssertCount = 0;
+        for (i = 0, len = tests.length; i < len; i++) {
+            test = tests[i];
+            test.context.handler = testHandler;
+            test.context.response = test.response;
+            if (test.shouldHit) {
+                expectedAssertCount += 4;
+            }
+
+            testHandler.read(test.response, {});
+        }
+
+        djstest.assertsExpected(expectedAssertCount);
+        djstest.done();
+    });
+
+    djstest.addTest(function handlerWriteTest() {
+        var tests = [
+            {
+                request: { headers: { "Content-Type": "application/json", "OData-Version": "4.0" }, data: "request 0" },
+                shouldHit: true,
+                context: { contentType: window.odatajs.oData.handler.contentType("application/json"), dataServiceVersion: "4.0" }
+            },
+            {
+                request: { headers: { "Content-Type": "application/json" }, data: "request 1" },
+                shouldHit: true,
+                context: { contentType: window.odatajs.oData.handler.contentType("application/json"), dataServiceVersion: undefined }
+            },
+            {
+                request: { headers: { "Content-Type": "otherMediaType" }, data: "request 2" },
+                shouldHit: false,
+                context: { contentType: window.odatajs.oData.handler.contentType("otherMediaType"), dataServiceVersion: undefined }
+            },
+            {
+                request: { headers: {}, data: "request 3" },
+                shouldHit: true,
+                context: { contentType: null, dataServiceVersion: undefined }
+            },
+            {
+                request: { headers: { "Content-Type": "application/json", "OData-Version": "4.0" }, data: "request 4" },
+                shouldHit: true,
+                context: { contentType: window.odatajs.oData.handler.contentType("application/json"), dataServiceVersion: "4.0" }
+            },
+            {
+                request: null,
+                shouldHit: false,
+                context: {}
+            },
+            {
+                request: undefined,
+                shouldHit: false,
+                context: {}
+            }
+        ];
+
+        var test;
+        var testWrite = function (handler, data, context) {
+            djstest.assert(test.shouldHit, "method should be hit");
+            djstest.assertAreEqual(handler, testHandler, "handler matches target");
+            djstest.assertAreEqualDeep(context, test.context, "context matches target");
+            djstest.assertAreEqual(data, test.request.data, "body matches target");
+            return data;
+        };
+
+        var testHandler = window.odatajs.oData.handler.handler(null, testWrite, "application/json", "4.0");
+
+        var i, len, expectedAssertCount = 0;
+        for (i = 0, len = tests.length; i < len; i++) {
+            test = tests[i];
+            test.context.handler = testHandler;
+            test.context.request = test.request;
+            if (test.shouldHit) {
+                expectedAssertCount += 4;
+            }
+            testHandler.write(test.request);
+        }
+
+        djstest.assertsExpected(expectedAssertCount);
+        djstest.done();
+    });
+
+    djstest.addTest(function handlerWriteUpdatesRequestContentTypeTest() {
+        var testWrite = function (handler, data, context) {
+            context.contentType = window.odatajs.oData.handler.contentType("my new content type");
+            return data;
+        };
+
+        var testHandler = window.odatajs.oData.handler.handler(null, testWrite, "application/json", "4.0");
+
+        var tests = [
+            { request: { headers: { "Content-Type": "application/json" }, data: "request 0" }, expected: "application/json" },
+            { request: { headers: {}, data: "request 1" }, expected: "my new content type" }
+        ];
+
+        var i, len;
+        for (i = 0, len = tests.length; i < len; i++) {
+            testHandler.write(tests[i].request);
+            djstest.assertAreEqual(tests[i].request.headers["Content-Type"], tests[i].expected, "request content type is the expected");
+        }
+        djstest.done();
+    });
+
+    djstest.addTest(function contentTypeTest() {
+        var tests = [
+            { contentType: "application/json;param1=value1;param2=value2", expected: { mediaType: "application/json", properties: { param1: "value1", param2: "value2"}} },
+            { contentType: "application/json; param1=value1; param2=value2", expected: { mediaType: "application/json", properties: { param1: "value1", param2: "value2"}} },
+            { contentType: "application/json;param1=value1; param2=value2", expected: { mediaType: "application/json", properties: { param1: "value1", param2: "value2"}} },
+            { contentType: "application/json; param1=value1;param2=value2", expected: { mediaType: "application/json", properties: { param1: "value1", param2: "value2"}} },
+            { contentType: "application/json", expected: { mediaType: "application/json", properties: {}} },
+            { contentType: ";param1=value1;param2=value2", expected: { mediaType: "", properties: { param1: "value1", param2: "value2"}} }
+        ];
+
+        var i, len, cTypeString;
+        for (i = 0, len = tests.length; i < len; i++) {
+            var actual = window.odatajs.oData.handler.contentType(tests[i].contentType);
+            djstest.assertAreEqual(actual.mediaType, tests[i].expected.mediaType, "Content type media type is parsed correctly");
+            djstest.assertAreEqualDeep(actual.properties, tests[i].expected.properties, "Content type properties are parsed correctly");
+        }
+
+        djstest.assert(! window.odatajs.oData.handler.contentType(undefined), "contentType returns undefined for undefined input");
+        djstest.assert(! window.odatajs.oData.handler.contentType(null), "contentType returns undefined for null input");
+
+        djstest.done();
+    });
+
+    djstest.addTest(function contentTypeToStringTest() {
+        var tests = [
+            { contentType: { mediaType: "application/json", properties: { param1: "value1", param2: "value2"} }, expected: "application/json;param1=value1;param2=value2" },
+            { contentType: { mediaType: "application/json", properties: {} }, expected: "application/json" },
+            { contentType: { mediaType: "", properties: { param1: "value1", param2: "value2"} }, expected: ";param1=value1;param2=value2" }
+        ];
+
+        var i, len, cTypeString;
+        for (i = 0, len = tests.length; i < len; i++) {
+            cTypeString = window.odatajs.oData.handler.contentTypeToString(tests[i].contentType);
+            djstest.assertAreEqual(cTypeString, tests[i].expected, "contentTypeToString returns the correct contentType string");
+        }
+
+        djstest.done();
+    });
+    
+    djstest.addTest(function readServiceDocumentTest(headers) {
+        odatajs.oData.request({
+            requestUri: endpoint,
+            method: "GET",
+            headers: headers
+        }, function (data, response) {
+            djstest.assertAreEqual(data.value[0].name, "Categories", "Verify .name");
+            djstest.assertAreEqual(data.value[0].kind, "EntitySet", "Verify .kind");
+            djstest.assertAreEqual(data.value[0].url, "Categories", "Verify .url");
+
+            djstest.assertAreEqual(data.value[1].name, "Foods", "Verify .name");
+            djstest.assertAreEqual(data.value[1].kind, "EntitySet", "Verify .kind");
+            djstest.assertAreEqual(data.value[1].url, "Foods", "Verify .url");
+            djstest.done();
+        }, unexpectedErrorHandler);
+     });
+          
+    // DATAJS INTERNAL END
+})(this);
\ No newline at end of file