You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by bi...@apache.org on 2014/07/21 12:02:12 UTC

[3/4] Remove the "Atom" related dev and test codes

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/014949ce/datajs/tests/code/atomreader.cs
----------------------------------------------------------------------
diff --git a/datajs/tests/code/atomreader.cs b/datajs/tests/code/atomreader.cs
deleted file mode 100644
index 789a51d..0000000
--- a/datajs/tests/code/atomreader.cs
+++ /dev/null
@@ -1,815 +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.
- */
-
-/// <summary>
-/// Class used to parse the Content section of the feed to return the properties data and metadata
-/// </summary>
-
-namespace DataJS.Tests
-{
-    using System;
-    using System.Collections.Generic;
-    using System.IO;
-    using System.Linq;
-    using System.ServiceModel.Syndication;
-    using Microsoft.Spatial;
-    using System.Xml;
-    using System.Xml.Linq;
-
-    public static class AtomReader
-    {
-        const string atomXmlNs = "http://www.w3.org/2005/Atom";
-        const string gmlXmlNs = "http://www.opengis.net/gml";
-        const string odataRelatedPrefix = "http://schemas.microsoft.com/ado/2007/08/dataservices/related";
-        const string odataRelatedLinksPrefix = "http://schemas.microsoft.com/ado/2007/08/dataservices/relatedlinks";
-        const string odataXmlNs = "http://schemas.microsoft.com/ado/2007/08/dataservices";
-        const string odataMetaXmlNs = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";
-        const string odataEditMediaPrefix = "http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media";
-        const string odataMediaResourcePrefix = "http://schemas.microsoft.com/ado/2007/08/dataservices/mediaresource";
-
-        const string hrefAttribute = "href";
-        const string titleElement = "title";
-        const string workspaceElement = "workspace";
-        const string workspacesProperty = "workspaces";
-        const string collectionElement = "collection";
-        const string collectionsProperty = "collections";
-        const string extensionsProperty = "extensions";
-        static string baseUri = string.Empty;
-
-        /// <summary>
-        /// Creates a service document object
-        /// </summary>
-        /// <param name="container">The XML container</param>
-        /// <param name="uri">Uri to append to the href value</param>
-        /// <returns>The service document JsonObject</returns>
-        public static JsonObject ReadServiceDocument(TextReader payload, string baseUri)
-        {
-            JsonObject jsonObject = new JsonObject();
-            XElement container = XElement.Load(payload);
-
-            if (container != null && container.HasElements)
-            {
-                jsonObject["workspaces"] =
-                    container
-                        .Elements()
-                            .Where(element => element.Name.LocalName.Equals(workspaceElement))
-                            .Select(element => ReadWorkspaceObject(element, baseUri))
-                            .ToArray();
-
-                jsonObject["extensions"] =
-                    container
-                        .Elements()
-                            .Where(element => !element.Name.LocalName.Equals(workspaceElement))
-                            .Select(element => ReadExtensionElement(element))
-                            .ToArray();
-            }
-
-            return jsonObject;
-        }
-
-        public static JsonObject ReadEntry(TextReader payload)
-        {
-            SyndicationItem item = SyndicationItem.Load(XmlReader.Create(payload));
-            return ReadEntry(item);
-        }
-
-        public static JsonObject ReadFeed(TextReader payload)
-        {
-            SyndicationFeed feed = SyndicationFeed.Load(XmlReader.Create(payload));
-            JsonObject feedData = new JsonObject();
-            JsonObject feedMetadata = new JsonObject();
-
-            feedData["results"] = feed.Items.Select(item => ReadEntry(item)).ToArray();
-            feedData["__metadata"] = feedMetadata;
-
-            feedMetadata["feed_extensions"] = feed.AttributeExtensions.Select(pair => ReadExtension(pair)).ToArray();
-
-            if (feed.Id != null)
-            {
-                feedMetadata["uri"] = feed.Id;
-                feedMetadata["uri_extensions"] = new JsonObject[] { };
-            }
-
-            if (feed.Title != null)
-            {
-                feedMetadata["title"] = feed.Title.Text;
-                feedMetadata["title_extensions"] = GetTitleExtensions(feed.Title);
-            }
-
-            SyndicationLink feedSelfLink = GetLink("self", feed.Links);
-            if (feedSelfLink != null)
-            {
-                feedMetadata["self"] = feedSelfLink.GetAbsoluteUri().AbsoluteUri;
-                feedMetadata["self_extensions"] = GetLinkExtensions(feedSelfLink);
-            }
-
-            long? count = GetInlineCount(feed);
-            if (count.HasValue)
-            {
-                feedData["__count"] = count.Value;
-            }
-
-            SyndicationLink feedNextLink = GetLink("next", feed.Links);
-            if (feedNextLink != null)
-            {
-                feedData["__next"] = feedNextLink.GetAbsoluteUri().AbsoluteUri;
-                feedMetadata["next_extensions"] = GetLinkExtensions(feedNextLink);
-            }
-
-            return feedData;
-        }
-
-        private static JsonObject ReadEntry(SyndicationItem item)
-        {
-            SyndicationLink entryEditLink = GetLink("edit", item.Links);
-            SyndicationCategory entryCategory = item.Categories.FirstOrDefault();
-
-            XElement propertiesElement = GetPropertiesElement(item);
-            JsonObject entryData = ReadObject(propertiesElement);
-            entryData = JsonObject.Merge(entryData, ReadNavigationProperties(item));
-            entryData = JsonObject.Merge(entryData, ReadNamedStreams(item));
-
-            JsonObject propertiesMetadata = ReadPropertiesMetadata(propertiesElement);
-            propertiesMetadata = JsonObject.Merge(propertiesMetadata, ReadNavigationPropertiesMetadata(item));
-            propertiesMetadata = JsonObject.Merge(propertiesMetadata, ReadNamedStreamMetadata(item));
-
-            JsonObject entryMetadata = new JsonObject();
-            entryData["__metadata"] = entryMetadata;
-            entryMetadata["properties"] = propertiesMetadata;
-
-            if (item.Id != null)
-            {
-                entryMetadata["uri"] = item.Id;
-                entryMetadata["uri_extensions"] = new JsonObject[] { };
-            }
-
-            if (entryCategory != null)
-            {
-                entryMetadata["type"] = entryCategory.Name;
-                entryMetadata["type_extensions"] = new JsonObject[] { };
-            }
-
-            if (entryEditLink != null)
-            {
-                entryMetadata["edit"] = entryEditLink.GetAbsoluteUri().AbsoluteUri;
-                entryMetadata["edit_link_extensions"] = GetLinkExtensions(entryEditLink);
-            }
-
-            return entryData;
-        }
-
-        private static JsonObject ReadExtension(KeyValuePair<XmlQualifiedName, string> pair)
-        {
-            return ReaderUtils.CreateExtension(pair.Key.Name, pair.Key.Namespace, pair.Value);
-        }
-
-        private static string GetCollectionType(string type)
-        {
-            if (type != null && type.StartsWith("Collection("))
-            {
-                int start = 11;
-                int end = type.IndexOf(")") - 11;
-                return type.Substring(start, end);
-            }
-            return null;
-        }
-
-        /// <summary>
-        /// Find the m:properties element within a feed entry
-        /// </summary>
-        /// <param name="item">The feed entry</param>
-        /// <returns>The m:properties element</returns>
-        private static XElement GetPropertiesElement(SyndicationItem item)
-        {
-            // Check if the m:properties element is within the content element
-            XmlSyndicationContent xmlContent = item.Content as XmlSyndicationContent;
-            if (xmlContent != null)
-            {
-                XElement contentElement = XElement.Load(xmlContent.GetReaderAtContent());
-                return contentElement.Elements().FirstOrDefault(e => e.Name == XName.Get("properties", odataMetaXmlNs));
-            }
-            // If we're here, then we are dealing with a feed that has an MLE
-            // i.e. the m:properties element is a peer of the content element, and shows up
-            // in the elementExtensions instead
-            SyndicationElementExtension propertiesElementExtension = item.ElementExtensions.FirstOrDefault(e => e.OuterName.Equals("properties"));
-            if (propertiesElementExtension != null)
-            {
-                XNode propertiesElement = XNode.ReadFrom(propertiesElementExtension.GetReader());
-                return (XElement)propertiesElement;
-            }
-
-            throw new NotSupportedException("Unsupported feed entry format");
-        }
-
-        /// <summary>
-        /// Gets the inline count within a feed
-        /// </summary>
-        /// <param name="feed">The feed</param>
-        /// <returns>The inline count, or null if none exists</returns>
-        private static long? GetInlineCount(SyndicationFeed feed)
-        {
-            SyndicationElementExtension countElementExtension = feed.ElementExtensions.SingleOrDefault(extension =>
-                extension.OuterName.Equals("count", StringComparison.OrdinalIgnoreCase) &&
-                extension.OuterNamespace.Equals(odataMetaXmlNs));
-
-            if (countElementExtension != null)
-            {
-                XElement countElement = (XElement)XNode.ReadFrom(countElementExtension.GetReader());
-                return XmlConvert.ToInt64(countElement.Value);
-            }
-            else
-            {
-                return null;
-            }
-        }
-
-        /// <summary>
-        /// Gets the link with the specified relationship type
-        /// </summary>
-        /// <param name="rel">Relationship type</param>
-        /// <param name="links">The set of links to search from</param>
-        /// <returns>The link with the specified relationship type, or null if none exists</returns>
-        private static SyndicationLink GetLink(string rel, IEnumerable<SyndicationLink> links)
-        {
-            return links.SingleOrDefault(link => link.RelationshipType.Equals(rel, StringComparison.InvariantCultureIgnoreCase));
-        }
-
-        private static IEnumerable<SyndicationLink> GetLinks(string rel, IEnumerable<SyndicationLink> links)
-        {
-            return links.Where(link => link.RelationshipType.StartsWith(rel, StringComparison.Ordinal));
-        }
-
-        //TODO refactor the extraction of extensions into extension elements and extension attribute methods.
-        private static JsonObject[] GetLinkExtensions(SyndicationLink link)
-        {
-            List<JsonObject> extensions = new List<JsonObject>();
-            //TODO: fix the inclusion of title as extension.  Title attribute is not required in the link element and its
-            //inclusion as an extension should be tested for the precesence of the attribute in the xml element.  Unfortunately,
-            //SyndicationLink doesn't allow for accessing the underlying XML document.. perhaps using an AtomFormatter10?? 
-            extensions.Add(ReaderUtils.CreateExtension("title", null, link.Title));
-            extensions.AddRange(link.AttributeExtensions.Select(pair => ReadExtension(pair)));
-
-            return extensions.ToArray();
-        }
-
-        private static JsonObject[] GetTitleExtensions(TextSyndicationContent title)
-        {
-            List<JsonObject> extensions = new List<JsonObject>();
-            extensions.Add(ReaderUtils.CreateExtension("type", null, title.Type));
-            extensions.AddRange(title.AttributeExtensions.Select(pair => ReadExtension(pair)));
-
-            return extensions.ToArray();
-        }
-
-        /// <summary>
-        /// Gets the "type" value from a property element
-        /// </summary>
-        /// <param name="propertyElement">The property element</param>
-        /// <returns>The "type" value, or default (Edm.String) if none specified</returns>
-        private static string GetTypeAttribute(XElement propertyElement)
-        {
-            XAttribute typeAttribute = propertyElement.Attribute(XName.Get("type", odataMetaXmlNs));
-            if (typeAttribute == null)
-            {
-                if (propertyElement.HasElements)
-                {
-                    return null;
-                }
-                return "Edm.String";
-            }
-            return typeAttribute.Value;
-        }
-
-        private static bool HasTypeAttribute(XElement propertyElement)
-        {
-            return propertyElement.Attribute(XName.Get("type", odataMetaXmlNs)) != null;
-        }
-
-        private static bool IsCollectionProperty(XElement propertyElement)
-        {
-            string type = GetTypeAttribute(propertyElement);
-            if (type != null && type.StartsWith("Collection("))
-            {
-                return true;
-
-            }
-            return propertyElement.Elements().Count(pe => pe.Name == XName.Get("element", odataXmlNs)) > 1;
-        }
-
-        private static JsonObject ReadWorkspaceObject(XElement container, string baseUri)
-        {
-            JsonObject jsonObject = new JsonObject();
-
-            jsonObject["collections"] =
-                container
-                    .Elements()
-                        .Where(element => element.Name.LocalName.Equals("collection"))
-                        .Select(element => ReadWorkspaceCollections(element, baseUri))
-                        .ToArray();
-
-            jsonObject["extensions"] =
-                container
-                    .Elements()
-                        .Where(element =>
-                            !(element.Name.LocalName.Equals("collection") ||
-                              element.Name.LocalName.Equals("title")))
-                        .Select(element => ReadExtensionElement(element))
-                        .ToArray();
-
-            jsonObject["title"] =
-                container
-                    .Elements()
-                    .Where(element => element.Name.LocalName.Equals("title"))
-                    .First()
-                    .Value;
-
-            return jsonObject;
-        }
-
-        private static JsonObject ReadWorkspaceCollections(XElement container, string baseUri)
-        {
-            JsonObject jsonObject = new JsonObject();
-            string title = string.Empty;
-
-            jsonObject["extensions"] =
-                container
-                    .Elements()
-                        .Where(element =>
-                            !(element.Name.LocalName.Equals(collectionElement) ||
-                              element.Name.LocalName.Equals(titleElement)))
-                        .Select(element => ReadExtensionElement(element))
-                        .ToArray();
-
-            jsonObject["title"] =
-                container
-                    .Elements()
-                        .Where(element => element.Name.LocalName.Equals("title"))
-                        .First()
-                        .Value;
-
-            IEnumerable<XAttribute> hrefAttributes =
-                container
-                    .Attributes()
-                        .Where(element => element.Name.LocalName.Equals("href"));
-
-            jsonObject["href"] = baseUri + hrefAttributes.First().Value;
-
-            return jsonObject;
-        }
-
-        private static JsonObject ReadExtensionElement(XElement element)
-        {
-            JsonObject jsonObject = ReaderUtils.CreateExtension(element.Name.LocalName, element.BaseUri, null);
-            jsonObject.Remove("value");
-            jsonObject["attributes"] = ReadExtensionAttributes(element);
-            jsonObject["children"] = element.Elements().Select(child => ReadExtensionElement(element)).ToArray();
-
-            return jsonObject;
-        }
-
-        private static JsonObject ReadExtensionAttribute(XAttribute attribute)
-        {
-            return ReaderUtils.CreateExtension(attribute.Name.LocalName, attribute.BaseUri, attribute.Value);
-        }
-
-        private static JsonObject[] ReadExtensionAttributes(XElement container)
-        {
-            List<JsonObject> attributes = new List<JsonObject>();
-            foreach (XAttribute attribute in container.Attributes())
-            {
-                attributes.Add(ReadExtensionAttribute(attribute));
-            }
-            return attributes.ToArray();
-        }
-
-        private static JsonObject ReadNamedStreamMetadata(SyndicationItem item)
-        {
-            JsonObject propertiesMetadata = new JsonObject();
-            JsonObject streamMetadata;
-            string propertyName;
-
-            foreach (SyndicationLink link in GetLinks(odataEditMediaPrefix, item.Links))
-            {
-                streamMetadata = new JsonObject();
-                streamMetadata["edit_media_extensions"] = GetLinkExtensions(link);
-                streamMetadata["media_src_extensions"] = new JsonObject[0];
-
-                propertyName = link.RelationshipType.Substring(odataEditMediaPrefix.Length + 1);
-                propertiesMetadata[propertyName] = streamMetadata;
-            }
-
-            foreach (SyndicationLink link in GetLinks(odataMediaResourcePrefix, item.Links))
-            {
-                streamMetadata = new JsonObject();
-                streamMetadata["media_src_extensions"] = GetLinkExtensions(link);
-
-                propertyName = link.RelationshipType.Substring(odataMediaResourcePrefix.Length + 1);
-                if (propertiesMetadata.ContainsKey(propertyName))
-                {
-                    streamMetadata = JsonObject.Merge((JsonObject)propertiesMetadata[propertyName], streamMetadata);
-                }
-                propertiesMetadata[propertyName] = streamMetadata;
-            }
-            return propertiesMetadata;
-        }
-
-        private static JsonObject ReadNamedStreams(SyndicationItem item)
-        {
-            // Not very elegant, but quick and easy, do it in two passes.
-            JsonObject streams = new JsonObject();
-            JsonObject streamValue;
-            JsonObject mediaResource;
-            string propertyName;
-
-            foreach (SyndicationLink link in GetLinks(odataEditMediaPrefix, item.Links))
-            {
-                propertyName = link.RelationshipType.Substring(odataEditMediaPrefix.Length + 1);
-                streamValue = new JsonObject();
-                mediaResource = new JsonObject();
-
-                streams[propertyName] = streamValue;
-
-                streamValue["__mediaresource"] = mediaResource;
-
-                mediaResource["edit_media"] = link.GetAbsoluteUri().AbsoluteUri;
-                mediaResource["content_type"] = link.MediaType;
-                mediaResource["media_src"] = link.GetAbsoluteUri().AbsoluteUri;
-
-                var etagAttributeName = new XmlQualifiedName("etag", odataMetaXmlNs);
-                if (link.AttributeExtensions.ContainsKey(etagAttributeName))
-                {
-                    mediaResource["media_etag"] = link.AttributeExtensions[etagAttributeName];
-                    link.AttributeExtensions.Remove(etagAttributeName);
-                }
-            }
-
-            foreach (SyndicationLink link in GetLinks(odataMediaResourcePrefix, item.Links))
-            {
-                propertyName = link.RelationshipType.Substring(odataMediaResourcePrefix.Length + 1);
-                mediaResource = new JsonObject();
-                mediaResource["content_type"] = link.MediaType;
-                mediaResource["media_src"] = link.GetAbsoluteUri().AbsoluteUri;
-
-                if (streams.ContainsKey(propertyName))
-                {
-                    streamValue = streams[propertyName] as JsonObject;
-                    mediaResource = JsonObject.Merge(streamValue["__mediaresource"] as JsonObject, mediaResource);
-                }
-                else
-                {
-                    streamValue = new JsonObject();
-                }
-                streamValue["__mediaresource"] = mediaResource;
-                streams[propertyName] = streamValue;
-            }
-            return streams;
-        }
-
-        private static JsonObject ReadNavigationProperties(SyndicationItem item)
-        {
-            JsonObject navProperties = new JsonObject();
-            SyndicationElementExtension inline;
-
-            string propertyName;
-            JsonObject propertyValue = null;
-
-            foreach (SyndicationLink link in GetLinks(odataRelatedPrefix, item.Links))
-            {
-                propertyName = link.RelationshipType.Substring(odataRelatedPrefix.Length + 1);
-                inline = link.ElementExtensions.SingleOrDefault(e =>
-                    odataMetaXmlNs.Equals(e.OuterNamespace, StringComparison.Ordinal) &&
-                    e.OuterName.Equals("inline", StringComparison.Ordinal));
-
-                if (inline != null)
-                {
-                    XElement inlineElement = (XElement)XNode.ReadFrom(inline.GetReader());
-                    XElement innerElement = inlineElement.Elements().FirstOrDefault();
-
-                    if (innerElement != null)
-                    {
-                        // By default the inner feed/entry does not have the xml:base attribute, so we need to
-                        // add it so that the parsed SyndicationFeed or SyndicationItem retains the baseUri
-                        if (link.BaseUri != null)
-                        {
-                            innerElement.SetAttributeValue(XNamespace.Xml + "base", link.BaseUri.OriginalString);
-                        }
-
-                        // We are converting to a string before creating the reader to strip out extra indenting,
-                        // otherwise the reader creates extra XmlText nodes that SyndicationFeed/SyndicationItem cannot handle
-                        try
-                        {
-                            propertyValue = ReadFeed(new StringReader(innerElement.ToString()));
-                        }
-                        catch (XmlException)
-                        {
-                            // Try with entry instead .. 
-
-                            propertyValue = ReadEntry(new StringReader(innerElement.ToString()));
-                        }
-                    }
-                }
-                else
-                {
-                    JsonObject deferred = new JsonObject();
-                    deferred["uri"] = link.GetAbsoluteUri().AbsoluteUri;
-
-                    propertyValue = new JsonObject();
-                    propertyValue["__deferred"] = deferred;
-                }
-                navProperties[propertyName] = propertyValue;
-            }
-            return navProperties;
-        }
-
-        private static JsonObject ReadNavigationPropertiesMetadata(SyndicationItem item)
-        {
-            JsonObject propertiesMetadata = new JsonObject();
-            JsonObject navMetadata;
-            string propertyName;
-
-            foreach (SyndicationLink link in GetLinks(odataRelatedPrefix, item.Links))
-            {
-                navMetadata = new JsonObject();
-                navMetadata["extensions"] = GetLinkExtensions(link).Where(e =>
-                    !(string.Equals(e["name"] as string, "inline", StringComparison.Ordinal) &&
-                        string.Equals(e["namespaceURI"] as string, odataMetaXmlNs, StringComparison.Ordinal))
-                ).ToArray();
-
-                propertyName = link.RelationshipType.Substring(odataRelatedPrefix.Length + 1);
-                propertiesMetadata[propertyName] = navMetadata;
-            }
-
-            foreach (SyndicationLink link in GetLinks(odataRelatedLinksPrefix, item.Links))
-            {
-                navMetadata = new JsonObject();
-                navMetadata["associationuri"] = link.GetAbsoluteUri().AbsoluteUri;
-                navMetadata["associationuri_extensions"] = link.GetAbsoluteUri().AbsoluteUri;
-
-                propertyName = link.RelationshipType.Substring(odataRelatedLinksPrefix.Length + 1);
-                if (propertiesMetadata.ContainsKey(propertyName))
-                {
-                    navMetadata = JsonObject.Merge(propertiesMetadata[propertyName] as JsonObject, navMetadata);
-                }
-                propertiesMetadata[propertyName] = navMetadata;
-            }
-
-            return propertiesMetadata;
-        }
-
-        private static JsonObject ReadPropertiesMetadata(XElement container)
-        {
-            JsonObject json = null;
-            if (container != null && container.Elements().Any(e => e.Name.NamespaceName == odataXmlNs))
-            {
-                json = new JsonObject();
-                foreach (XElement propertyElement in container.Elements())
-                {
-                    json[propertyElement.Name.LocalName] = ReadPropertyMetadata(propertyElement);
-                }
-            }
-            return json;
-        }
-
-        private static JsonObject ReadPropertyMetadata(XElement property)
-        {
-            var metadata = ReaderUtils.CreateEntryPropertyMetadata(GetTypeAttribute(property));
-
-            if (IsCollectionProperty(property))
-            {
-                string collectionType = GetCollectionType(GetTypeAttribute(property));
-                if (collectionType == null)
-                {
-                    metadata["type"] = "Collection()";
-                }
-
-                List<JsonObject> elements = new List<JsonObject>();
-                foreach (XElement item in property.Elements(XName.Get("element", odataXmlNs)))
-                {
-                    string itemType =
-                        HasTypeAttribute(item) ? GetTypeAttribute(item) :
-                        IsCollectionProperty(item) ? "Collection()" : collectionType;
-
-                    var itemMetadata = ReaderUtils.CreateEntryPropertyMetadata(itemType);
-                    if (item.Elements().Any(e => e.Name.NamespaceName == odataXmlNs))
-                    {
-                        itemMetadata["properties"] = ReadPropertiesMetadata(item);
-                    }
-                    elements.Add(itemMetadata);
-                }
-                metadata["elements"] = elements.ToArray();
-            }
-            else if (property != null && property.Elements().Any(e => e.Name.NamespaceName == odataXmlNs))
-            {
-                metadata["properties"] = ReadPropertiesMetadata(property);
-            }
-
-            return metadata;
-        }
-
-        /// <summary>
-        /// Creates a JsonObject from an XML container element (e.g. the m:properties element) of an OData ATOM feed entry. 
-        /// </summary>
-        /// <param name="container">The XML container</param>
-        /// <param name="buildValue">Function that builds a value from a property element</param>
-        /// <returns>The JsonObject containing the name-value pairs</returns>
-        private static JsonObject ReadObject(XElement container)
-        {
-            if (container == null)
-            {
-                return null;
-            }
-
-            var json = new JsonObject();
-            foreach (XElement propertyElement in container.Elements())
-            {
-                json[propertyElement.Name.LocalName] = ReadDataItem(propertyElement);
-            }
-            return json;
-        }
-
-        private static JsonObject ReadCollectionProperty(XElement property, string typeName)
-        {
-            var collectionType = GetCollectionType(typeName);
-
-            var json = new JsonObject();
-            var results = new List<object>();
-
-            foreach (XElement item in property.Elements())
-            {
-                object resultItem = ReadDataItem(item);
-                results.Add(resultItem);
-
-                JsonObject complexValue = resultItem as JsonObject;
-                if (complexValue != null)
-                {
-                    var metadata = complexValue["__metadata"] as JsonObject;
-                    if (!string.IsNullOrEmpty(collectionType) && metadata["type"] == null)
-                    {
-                        metadata["type"] = collectionType;
-                    }
-                }
-            }
-
-            json["results"] = results;
-            json["__metadata"] = ReaderUtils.CreateEntryPropertyMetadata(typeName, false);
-
-            return json;
-        }
-
-        private static JsonObject ReadComplexProperty(XElement container, string typeName)
-        {
-            JsonObject json = ReadObject(container);
-            json["__metadata"] = ReaderUtils.CreateEntryPropertyMetadata(GetTypeAttribute(container), false);
-            return json;
-        }
-
-        private static JsonObject ReadJsonSpatialProperty(XElement container, XElement gmlValue, bool isGeography)
-        {
-            GmlFormatter gmlFormatter = GmlFormatter.Create();
-            GeoJsonObjectFormatter jsonformatter = GeoJsonObjectFormatter.Create();
-
-            bool ignoreCrc = !gmlValue.Attributes().Any(a => a.Name.LocalName == "srsName");
-
-            ISpatial spatialValue;
-            if (isGeography)
-            {
-                spatialValue = gmlFormatter.Read<Geography>(gmlValue.CreateReader());
-            }
-            else
-            {
-                spatialValue = gmlFormatter.Read<Geometry>(gmlValue.CreateReader());
-            }
-
-            IDictionary<string, object> geoJsonData = jsonformatter.Write(spatialValue);
-            JsonObject json = new JsonObject();
-
-            Queue<object> geoJsonScopes = new Queue<object>();
-            Queue<object> jsonScopes = new Queue<object>();
-
-            geoJsonScopes.Enqueue(geoJsonData);
-            jsonScopes.Enqueue(json);
-
-            Func<object, object> convertScope = (scope) =>
-            {
-                object newScope =
-                        scope is List<object> || scope is object[] ? (object)new List<Object>() :
-                        scope is IDictionary<string, object> ? (object)new JsonObject() :
-                        null;
-
-                if (newScope != null)
-                {
-                    geoJsonScopes.Enqueue(scope);
-                    jsonScopes.Enqueue(newScope);
-                }
-
-                return newScope ?? scope;
-            };
-
-            while (jsonScopes.Count > 0)
-            {
-                if (jsonScopes.Peek() is JsonObject)
-                {
-                    var currentGeoJson = (IDictionary<string, object>)geoJsonScopes.Dequeue();
-                    var currentJson = (JsonObject)jsonScopes.Dequeue();
-
-                    foreach (var item in currentGeoJson)
-                    {
-                        if (!ignoreCrc || item.Key != "crs")
-                        {
-                            currentJson[item.Key] = convertScope(item.Value);
-                        }
-                    }
-                }
-                else
-                {
-                    var currentGeoJson = (IEnumerable<object>)geoJsonScopes.Dequeue();
-                    var currentJson = (List<object>)jsonScopes.Dequeue();
-
-                    foreach (var item in currentGeoJson)
-                    {
-                        currentJson.Add(convertScope(item));
-                    }
-                }
-            }
-            json["__metadata"] = ReaderUtils.CreateEntryPropertyMetadata(GetTypeAttribute(container), false);
-            return json;
-        }
-
-        public static object ReadDataItem(XElement item)
-        {
-            string typeName = GetTypeAttribute(item);
-            XElement gmlRoot = item.Elements().SingleOrDefault(e => e.Name.NamespaceName == gmlXmlNs);
-
-            if (gmlRoot != null)
-            {
-                bool isGeography = typeName.StartsWith("Edm.Geography");
-                return ReadJsonSpatialProperty(item, gmlRoot, isGeography);
-            }
-
-            bool isCollection = IsCollectionProperty(item);
-            if (item.HasElements || isCollection)
-            {
-                // Complex type, Collection Type: parse recursively
-                return isCollection ? ReadCollectionProperty(item, typeName) : ReadComplexProperty(item, typeName);
-            }
-
-            // Primitive type: null value
-            XNamespace mNamespace = item.GetNamespaceOfPrefix("m");
-            XAttribute nullAttribute = mNamespace == null ? null : item.Attribute(mNamespace.GetName("null"));
-            if (nullAttribute != null && nullAttribute.Value.Equals("true", StringComparison.InvariantCultureIgnoreCase))
-            {
-                return null;
-            }
-
-            // Primitive type: check type and parse value accordingly
-            string value = item.Value;
-            switch (typeName)
-            {
-                case "Edm.Byte":
-                    return XmlConvert.ToByte(value);
-                case "Edm.Int16":
-                    return XmlConvert.ToInt16(value);
-                case "Edm.Int32":
-                    return XmlConvert.ToInt32(value);
-                case "Edm.SByte":
-                    return XmlConvert.ToSByte(value);
-                case "Edm.Boolean":
-                    return XmlConvert.ToBoolean(value);
-                case "Edm.Double":
-                    return XmlConvert.ToDouble(value);
-                case "Edm.Single":
-                    return XmlConvert.ToSingle(value);
-                case "Edm.Guid":
-                    return XmlConvert.ToGuid(value);
-                case "Edm.DateTime":
-                    return new JsDate(XmlConvert.ToDateTime(value, XmlDateTimeSerializationMode.Utc));
-                case "Edm.DateTimeOffset":
-                    return new JsDate(XmlConvert.ToDateTimeOffset(value));
-                case "Edm.Time":
-                    throw new NotSupportedException(typeName + " is not supported");
-                // Decimal and Int64 values are sent as strings over the wire.  This is the same behavior as WCF Data Services JSON serializer.
-                case "Edm.Decimal":
-                case "Edm.Int64":
-                case "":
-                default:
-                    return value;
-            }
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/014949ce/datajs/tests/common/ODataReadOracle.js
----------------------------------------------------------------------
diff --git a/datajs/tests/common/ODataReadOracle.js b/datajs/tests/common/ODataReadOracle.js
index c18db57..450b089 100644
--- a/datajs/tests/common/ODataReadOracle.js
+++ b/datajs/tests/common/ODataReadOracle.js
@@ -23,14 +23,13 @@
 (function (window, undefined) {
     var jsonMime = "application/json";
     var universalMime = "*/*";
-    var atomMime = "application/atom+xml";
 
     var readFeed = function (url, success, mimeType, recognizeDates) {
         /// <summary>Calls the ReadFeed endpoint with the specified URL</summary>
         /// <param name="url" type="String">The URL to read the feed from</param>
         /// <param name="success" type="Function">The success callback function</param>
         /// <param name="mimeType" type="String">The MIME media type in the Accept header</param>
-        var readMethod = getReadMethod(mimeType, "ReadFeed");
+        var readMethod = getReadMethod(mimeType);
         oracleRequest("GET", readMethod, typeof url === "string" ? { url: url} : url, mimeType, recognizeDates, function (data) {
             success(data);
         });
@@ -41,24 +40,10 @@
         /// <param name="url" type="String">The URL to read the entry from</param>
         /// <param name="success" type="Function">The success callback function</param>
         /// <param name="mimeType" type="String">The MIME media type in the Accept header</param>
-        var readMethod = getReadMethod(mimeType, "ReadEntry");
+        var readMethod = getReadMethod(mimeType);
         oracleRequest("GET", readMethod, typeof url === "string" ? { url: url} : url, mimeType, recognizeDates, success);
     };
 
-    var readFeedLoopback = function (atomFeedXml, success, recognizeDates) {
-        /// <summary>Calls the ReadFeedLoopback endpoint with the specified atom feed xml</summary>
-        /// <param name="atomFeedXml" type="String">The atom feed xml</param>
-        /// <param name="success" type="Function">The success callback function</param>
-        oracleRequest("POST", "ReadFeedLoopback", atomFeedXml, atomMime, recognizeDates, success);
-    };
-
-    var readEntryLoopback = function (atomEntryXml, success, recognizeDates) {
-        /// <summary>Calls the ReadEntryLoopback endpoint with the specified atom entry xml</summary>
-        /// <param name="atomEntryXml" type="String">The atom entry xml</param>
-        /// <param name="success" type="Function">The success callback function</param>
-        oracleRequest("POST", "ReadEntryLoopback", atomEntryXml, atomMime, recognizeDates, success);
-    };
-
     var readLinksEntry = function (url, success) {
         /// <summary>Calls the ReadMetadata endpoint with the specified URL</summary>
         /// <param name="url" type="String">The URL to read the metadata from</param>
@@ -93,7 +78,7 @@
         /// <param name="url" type="String">The URL to the service</param>
         /// <param name="success" type="Function">The success callback function</param>
         /// <param name="mimeType" type="String">The MIME type being tested</param>
-        var readMethod = getReadMethod(mimeType, "ReadServiceDocument");
+        var readMethod = getReadMethod(mimeType);
         oracleRequest("GET", readMethod, typeof url === "string" ? { url: url} : url, mimeType, null, success);
     };
 
@@ -147,10 +132,8 @@
         readPage(url);
     };
 
-    var getReadMethod = function (mimeType, defaultEndpoint) {
+    var getReadMethod = function (mimeType) {
         switch (mimeType) {
-            case atomMime:
-                return defaultEndpoint;
             case jsonMime:
             case universalMime:
             default:
@@ -200,8 +183,6 @@
     window.ODataReadOracle = {
         readFeed: readFeed,
         readEntry: readEntry,
-        readFeedLoopback: readFeedLoopback,
-        readEntryLoopback: readEntryLoopback,
         readLinksEntry: readLinksEntry,
         readLinksFeed: readLinksFeed,
         readJson: readJson,

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/014949ce/datajs/tests/common/ODataReadOracle.svc
----------------------------------------------------------------------
diff --git a/datajs/tests/common/ODataReadOracle.svc b/datajs/tests/common/ODataReadOracle.svc
index 51ccd62..7536de4 100644
--- a/datajs/tests/common/ODataReadOracle.svc
+++ b/datajs/tests/common/ODataReadOracle.svc
@@ -46,36 +46,6 @@ namespace DataJS.Tests
         const string jsonlightMediaType = "application/json";
 
         /// <summary>
-        /// Reads a URI that will return an OData ATOM feed
-        /// </summary>
-        /// <param name="url">The URL to send the request to</param>
-        /// <param name="user">The username for basic authentication</param>
-        /// <param name="password">The password for basic authentication</param>
-        /// <returns>JSON object expected to be returned by OData.read (plus type metadata markers that will need to be removed)</returns>
-        [OperationContract]
-        [WebGet(ResponseFormat = WebMessageFormat.Json)]
-        public JsonObject ReadFeed(string url, string user, string password)
-        {
-            WebResponse response = ReaderUtils.CreateRequest(ResolveUri(url, UriKind.Absolute), user, password).GetResponse();
-            return AtomReader.ReadFeed(new StreamReader(response.GetResponseStream()));
-        }
-
-        /// <summary>
-        /// Reads a URI that will return an OData ATOM feed entry
-        /// </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>JSON object expected to be returned by OData.read</returns>
-        [OperationContract]
-        [WebGet(ResponseFormat = WebMessageFormat.Json)]
-        public JsonObject ReadEntry(string url, string user, string password)
-        {
-            WebResponse response = ReaderUtils.CreateRequest(ResolveUri(url, UriKind.Absolute), user, password).GetResponse();
-            return AtomReader.ReadEntry(new StreamReader(response.GetResponseStream()));
-        }
-
-        /// <summary>
         /// Reads a URI that will return a metadata object
         /// </summary>
         /// <param name="url">The URL to send the request to</param>
@@ -88,33 +58,7 @@ namespace DataJS.Tests
             Dictionary<string, object> jsonObject = CsdlReader.ReadCsdl(new StreamReader(response.GetResponseStream()));
             return ReaderUtils.ConvertDictionarytoJsonlightStream(jsonObject);
         }
-
-        /// <summary>
-        /// Reads a URI that will return a metadata object
-        /// </summary>
-        /// <param name="url">The URL to send the request to</param>
-        /// <param name="mimeType">Mime type being tested to determine base URI</param>
-        /// <returns>JSON object expected to be returned by OData.read (plus type metadata markers that will need to be removed)</returns>
-        [OperationContract]
-        [WebGet(ResponseFormat = WebMessageFormat.Json)]
-        public JsonObject ReadServiceDocument(string url, string mimeType)
-        {
-            WebResponse response = WebRequest.Create(ResolveUri(url, UriKind.Absolute)).GetResponse();
-            string baseUri = string.Empty;
-
-            // With JSON responses only relative path passed to the library is available
-            if (mimeType.Equals(jsonlightMediaType))
-            {
-                baseUri = ResolveUri(url, UriKind.Relative).ToString();
-            }
-            else
-            {
-                baseUri = response.ResponseUri.AbsoluteUri;
-            }
-
-            return AtomReader.ReadServiceDocument(new StreamReader(response.GetResponseStream()), baseUri);
-        }
-
+        
         /// <summary>
         /// Reads a URI that will get the Json response and return the stream
         /// </summary>
@@ -138,31 +82,6 @@ namespace DataJS.Tests
             return response.GetResponseStream();
         }
 
-
-        /// <summary>
-        /// Loops back an ATOM feed passed to the webservice in JSON format.
-        /// </summary>
-        /// <param name="content">The ATOM feed xml stream to loopback as JSON</param>
-        /// <returns>JSON object expected to be returned by OData.read (plus type metadata markers that will need to be removed)</returns>
-        [OperationContract]
-        [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json)]
-        public JsonObject ReadFeedLoopback(Stream content)
-        {
-            return AtomReader.ReadFeed(new StreamReader(content));
-        }
-
-        /// <summary>
-        /// Loops back an ATOM entry passed to the webservice in JSON format.
-        /// </summary>
-        /// <param name="content">The ATOM entry xml stream to loopback as JSON</param>
-        /// <returns>JSON object expected to be returned by OData.read (plus type metadata markers that will need to be removed)</returns>
-        [OperationContract]
-        [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json)]
-        public JsonObject ReadEntryLoopback(Stream content)
-        {
-            return AtomReader.ReadEntry(new StreamReader(content));
-        }
-
         /// <summary>
         /// Resolves the given url string to a URI
         /// </summary>

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/014949ce/datajs/tests/datajs-cache-large-collection-functional-tests.html
----------------------------------------------------------------------
diff --git a/datajs/tests/datajs-cache-large-collection-functional-tests.html b/datajs/tests/datajs-cache-large-collection-functional-tests.html
index fbed913..357998a 100644
--- a/datajs/tests/datajs-cache-large-collection-functional-tests.html
+++ b/datajs/tests/datajs-cache-large-collection-functional-tests.html
@@ -15,30 +15,8 @@
         window.TestSynchronizer.init(QUnit);
     </script>
     <script type="text/javascript" src="../build/datajs-2.0.0.js"></script>   
+    <script type="text/javascript" src="common/common.js"></script>
 
-    <!--<script type="text/javascript" src="../src/datajs.js"></script>
-    <script type="text/javascript" src="../src/utils.js"></script>
-    <script type="text/javascript" src="../src/xml.js"></script>
-
-    <script type="text/javascript" src="../src/odata-utils.js"></script>
-    <script type="text/javascript" src="../src/odata-handler.js"></script>
-    <script type="text/javascript" src="../src/odata-xml.js"></script>
-    <script type="text/javascript" src="../src/odata-net.js"></script>
-    <script type="text/javascript" src="../src/odata-json.js"></script>
-    <script type="text/javascript" src="../src/odata-atom.js"></script>
-    <script type="text/javascript" src="../src/odata-metadata.js"></script>
-    <script type="text/javascript" src="../src/odata-batch.js"></script>
-    <script type="text/javascript" src="../src/odata.js"></script>
-
-    <script type="text/javascript" src="../src/store-dom.js"></script>
-    <script type="text/javascript" src="../src/store-indexeddb.js"></script>
-    <script type="text/javascript" src="../src/store-memory.js"></script>
-    <script type="text/javascript" src="../src/store.js"></script>
-  
-    <script type="text/javascript" src="../src/deferred.js"></script>
-    <script type="text/javascript" src="../src/cache-source.js"></script>
-    <script type="text/javascript" src="../src/cache.js"></script>-->
-    
     <script type="text/javascript" src="common/djstest.js"></script>
     <script type="text/javascript" src="common/CacheOracle.js"></script>
     <script type="text/javascript" src="common/ObservableHttpClient.js"></script>

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/014949ce/datajs/tests/datajs-cache-large-collection-functional-tests.js
----------------------------------------------------------------------
diff --git a/datajs/tests/datajs-cache-large-collection-functional-tests.js b/datajs/tests/datajs-cache-large-collection-functional-tests.js
index e8d973c..2788974 100644
--- a/datajs/tests/datajs-cache-large-collection-functional-tests.js
+++ b/datajs/tests/datajs-cache-large-collection-functional-tests.js
@@ -18,7 +18,7 @@
  */
 
 (function (window, undefined) {
-    OData.defaultHandler.accept = "application/json;q=0.9, application/atomsvc+xml;q=0.8, */*;q=0.1";
+    OData.defaultHandler.accept = "application/json;q=0.9, */*;q=0.1";
     var largeCollectionFeed = "./endpoints/LargeCollectionService.svc/Customers";
     var itemsInCollection = 2 * 1024 * 1024;
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/014949ce/datajs/tests/datajs-cache-long-haul-tests.html
----------------------------------------------------------------------
diff --git a/datajs/tests/datajs-cache-long-haul-tests.html b/datajs/tests/datajs-cache-long-haul-tests.html
index c73fa71..a5f00c4 100644
--- a/datajs/tests/datajs-cache-long-haul-tests.html
+++ b/datajs/tests/datajs-cache-long-haul-tests.html
@@ -8,26 +8,7 @@
     <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/datajs-2.0.0.js"></script>   
-    <!-- <script type="text/javascript" src="../src/datajs.js"></script>
-    <script type="text/javascript" src="../src/utils.js"></script>
-    <script type="text/javascript" src="../src/xml.js"></script>
-    <script type="text/javascript" src="../src/odata-utils.js"></script>
-    <script type="text/javascript" src="../src/odata-handler.js"></script>
-    <script type="text/javascript" src="../src/odata-gml.js"></script>
-    <script type="text/javascript" src="../src/odata-xml.js"></script>
-    <script type="text/javascript" src="../src/odata-net.js"></script>
-    <script type="text/javascript" src="../src/odata-json.js"></script>
-    <script type="text/javascript" src="../src/odata-atom.js"></script>
-    <script type="text/javascript" src="../src/odata-metadata.js"></script>
-    <script type="text/javascript" src="../src/odata-batch.js"></script>
-    <script type="text/javascript" src="../src/odata.js"></script>
-    <script type="text/javascript" src="../src/store-dom.js"></script>
-    <script type="text/javascript" src="../src/store-indexeddb.js"></script>
-    <script type="text/javascript" src="../src/store-memory.js"></script>
-    <script type="text/javascript" src="../src/store.js"></script>
-    <script type="text/javascript" src="../src/deferred.js"></script>
-    <script type="text/javascript" src="../src/cache-source.js"></script>
-    <script type="text/javascript" src="../src/cache.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/Instrument.js"></script>
     <script type="text/javascript">

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/014949ce/datajs/tests/datajs-startup-perf-test.html
----------------------------------------------------------------------
diff --git a/datajs/tests/datajs-startup-perf-test.html b/datajs/tests/datajs-startup-perf-test.html
index 58534ed..d717db4 100644
--- a/datajs/tests/datajs-startup-perf-test.html
+++ b/datajs/tests/datajs-startup-perf-test.html
@@ -38,8 +38,7 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEAL
                 var durationLimit = 500;
                 var memorySizeDeltaLimit = 5000000;
 
-                //var filename = "datajs-0.0.0.min.js";
-                var filename = "../build/datajs-0.0.0.min.js";
+                var filename = "../build/datajs-2.0.0.min.js";
                 var getBrowserMemorySize = Instrument.getBrowserMemorySize;
 
                 $.ajax({