Various small improvements, added test for instance annotations

This commit is contained in:
Francesco Chicchiriccò 2014-05-12 12:41:25 +02:00
parent c32f4a0bb1
commit 8720a30e21
20 changed files with 589 additions and 456 deletions

View File

@ -345,6 +345,17 @@ public class V4Services extends AbstractServices {
return new ByteArrayInputStream(bos.toByteArray()); return new ByteArrayInputStream(bos.toByteArray());
} }
@GET
@Path("/Boss")
public Response getSingletonBoss(
@Context UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
return getEntityInternal(
uriInfo.getRequestUri().toASCIIString(), accept, "Boss", StringUtils.EMPTY, format, null, null, false);
}
@GET @GET
@Path("/Company") @Path("/Company")
public Response getSingletonCompany( public Response getSingletonCompany(

View File

@ -125,6 +125,8 @@ public class DataBinder {
properties.add(toJSONProperty((AtomPropertyImpl) property)); properties.add(toJSONProperty((AtomPropertyImpl) property));
} }
jsonEntity.getAnnotations().addAll(atomEntity.getAnnotations());
return jsonEntity; return jsonEntity;
} }

View File

@ -0,0 +1,46 @@
{
"@odata.context": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Boss",
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Customer",
"@odata.id": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss",
"@odata.editLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer",
"@Microsoft.Test.OData.Services.ODataWCFService.IsBoss": true,
"PersonID": 2,
"FirstName": "Jill",
"LastName": "Jones",
"MiddleName": null,
"HomeAddress": null,
"Home@odata.type": "#GeographyPoint",
"Home": {
"type": "Point",
"coordinates": [161.8, 15.0],
"crs": {
"type": "name",
"properties": {
"name": "EPSG:4326"
}
}
},
"Numbers@odata.type": "#Collection(String)",
"Numbers": [],
"Emails@odata.type": "#Collection(String)",
"Emails": [],
"City": "Sydney",
"Birthday@odata.type": "#DateTimeOffset",
"Birthday": "1983-01-15T00:00:00Z",
"TimeBetweenLastTwoOrders@odata.type": "#Duration",
"TimeBetweenLastTwoOrders": "PT0.0000002S",
"Parent@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent/$ref",
"Parent@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent",
"Orders@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders/$ref",
"Orders@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders",
"Company@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company/$ref",
"Company@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company",
"#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress": {
"title": "Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
"target": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"
},
"#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress": {
"title": "Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
"target": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
}
}

View File

@ -0,0 +1,51 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
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.
-->
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:gml="http://www.opengis.net/gml" xmlns:georss="http://www.georss.org/georss">
<id>http://localhost:9080/stub/StaticService/V40/Static.svc/Boss</id>
<category scheme="http://docs.oasis-open.org/odata/ns/scheme" term="#Microsoft.Test.OData.Services.ODataWCFService.Customer"/>
<link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/Parent" title="Parent" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent/$ref" type="application/xml"/>
<link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/Orders" title="Orders" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders/$ref" type="application/xml"/>
<link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/Company" title="Company" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company/$ref" type="application/xml"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/Parent" title="Parent" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent" type="application/atom+xml;type=entry"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/Orders" title="Orders" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders" type="application/atom+xml;type=entry"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/Company" title="Company" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company" type="application/atom+xml;type=entry"/>
<content type="application/xml">
<m:properties>
<d:PersonID m:type="Int32">2</d:PersonID>
<d:FirstName>Jill</d:FirstName>
<d:LastName>Jones</d:LastName>
<d:MiddleName m:null="true"/>
<d:HomeAddress m:null="true"/>
<d:Home m:type="GeographyPoint">
<gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
<gml:pos>161.8 15.0</gml:pos>
</gml:Point>
</d:Home>
<d:Numbers m:type="#Collection(String)"/>
<d:Emails m:type="#Collection(String)"/>
<d:City>Sydney</d:City>
<d:Birthday m:type="DateTimeOffset">1983-01-15T01:00:00+01:00</d:Birthday>
<d:TimeBetweenLastTwoOrders m:type="Duration">PT0.0000002S</d:TimeBetweenLastTwoOrders>
</m:properties>
</content>
<m:annotation term="Microsoft.Test.OData.Services.ODataWCFService.IsBoss" m:type="Boolean">true</m:annotation>
</entry>

View File

@ -1,35 +1,24 @@
{ {
"error": { "error": {
"code": "400", "code": "400",
"message": "Bad request.", "message": "Bad request.",
"target": "query", "target": "query",
"details": [ "details": [
{ {
"code": "400", "code": "400",
"target": "$search",
"target": "$search" ,
"message": "Microsoft.Data.OData.BadRequest" "message": "Microsoft.Data.OData.BadRequest"
} }
], ],
"innererror": { "innererror": {
"trace": ["at Microsoft.Data.OData.MediaTypeUtils.GetContentTypeFromSettings....", "callmethod2 etc"],
"trace": ["at Microsoft.Data.OData.MediaTypeUtils.GetContentTypeFromSettings....","callmethod2 etc"], "context": {
"key1": "for debug deployment only"
"context": {"key1":"for debug deployment only"}
} }
} }
}
} }

View File

@ -22,418 +22,441 @@
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"> <edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:DataServices> <edmx:DataServices>
<Schema Namespace="Microsoft.Test.OData.Services.ODataWCFService" xmlns="http://docs.oasis-open.org/odata/ns/edm"> <Schema Namespace="Microsoft.Test.OData.Services.ODataWCFService" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<Term Name="IsBoss" Type="Edm.Boolean"/>
<ComplexType Name="Address"> <ComplexType Name="Address">
<Property Name="Street" Type="Edm.String" Nullable="false" /> <Property Name="Street" Type="Edm.String" Nullable="false"/>
<Property Name="City" Type="Edm.String" Nullable="false" /> <Property Name="City" Type="Edm.String" Nullable="false"/>
<Property Name="PostalCode" Type="Edm.String" Nullable="false" /> <Property Name="PostalCode" Type="Edm.String" Nullable="false"/>
</ComplexType> </ComplexType>
<ComplexType Name="HomeAddress" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Address"> <ComplexType Name="HomeAddress" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Address">
<Property Name="FamilyName" Type="Edm.String" /> <Property Name="FamilyName" Type="Edm.String"/>
</ComplexType> </ComplexType>
<ComplexType Name="CompanyAddress" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Address"> <ComplexType Name="CompanyAddress" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Address">
<Property Name="CompanyName" Type="Edm.String" Nullable="false" /> <Property Name="CompanyName" Type="Edm.String" Nullable="false"/>
<NavigationProperty Name="Contact" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="true" />
</ComplexType> </ComplexType>
<EnumType Name="AccessLevel" IsFlags="true"> <EnumType Name="AccessLevel" IsFlags="true">
<Member Name="None" Value="0" /> <Member Name="None" Value="0"/>
<Member Name="Read" Value="1" /> <Member Name="Read" Value="1"/>
<Member Name="Write" Value="2" /> <Member Name="Write" Value="2"/>
<Member Name="Execute" Value="4" /> <Member Name="Execute" Value="4"/>
<Member Name="ReadWrite" Value="3" /> <Member Name="ReadWrite" Value="3"/>
</EnumType> </EnumType>
<EnumType Name="Color"> <EnumType Name="Color">
<Member Name="Red" Value="1" /> <Member Name="Red" Value="1"/>
<Member Name="Green" Value="2" /> <Member Name="Green" Value="2"/>
<Member Name="Blue" Value="4" /> <Member Name="Blue" Value="4"/>
</EnumType> </EnumType>
<EnumType Name="CompanyCategory"> <EnumType Name="CompanyCategory">
<Member Name="IT" Value="0" /> <Member Name="IT" Value="0"/>
<Member Name="Communication" Value="1" /> <Member Name="Communication" Value="1"/>
<Member Name="Electronics" Value="2" /> <Member Name="Electronics" Value="2"/>
<Member Name="Others" Value="4" /> <Member Name="Others" Value="4"/>
</EnumType> </EnumType>
<EntityType Name="Person"> <EntityType Name="Person">
<Key> <Key>
<PropertyRef Name="PersonID" /> <PropertyRef Name="PersonID"/>
</Key> </Key>
<Property Name="PersonID" Type="Edm.Int32" Nullable="false" /> <Property Name="PersonID" Type="Edm.Int32" Nullable="false"/>
<Property Name="FirstName" Type="Edm.String" Nullable="false" /> <Property Name="FirstName" Type="Edm.String" Nullable="false"/>
<Property Name="LastName" Type="Edm.String" Nullable="false" /> <Property Name="LastName" Type="Edm.String" Nullable="false"/>
<Property Name="MiddleName" Type="Edm.String" /> <Property Name="MiddleName" Type="Edm.String"/>
<Property Name="HomeAddress" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" /> <Property Name="HomeAddress" Type="Microsoft.Test.OData.Services.ODataWCFService.Address"/>
<Property Name="Home" Type="Edm.GeographyPoint" SRID="4326" /> <Property Name="Home" Type="Edm.GeographyPoint" SRID="4326"/>
<Property Name="Numbers" Type="Collection(Edm.String)" Nullable="false" /> <Property Name="Numbers" Type="Collection(Edm.String)" Nullable="false"/>
<Property Name="Emails" Type="Collection(Edm.String)" /> <Property Name="Emails" Type="Collection(Edm.String)"/>
<NavigationProperty Name="Parent" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" /> <NavigationProperty Name="Parent" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
</EntityType> </EntityType>
<EntityType Name="Customer" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Person"> <EntityType Name="Customer" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Person">
<Property Name="City" Type="Edm.String" Nullable="false" /> <Property Name="City" Type="Edm.String" Nullable="false"/>
<Property Name="Birthday" Type="Edm.DateTimeOffset" Nullable="false" /> <Property Name="Birthday" Type="Edm.DateTimeOffset" Nullable="false"/>
<Property Name="TimeBetweenLastTwoOrders" Type="Edm.Duration" Nullable="false" /> <Property Name="TimeBetweenLastTwoOrders" Type="Edm.Duration" Nullable="false"/>
<NavigationProperty Name="Orders" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Order)" /> <NavigationProperty Name="Orders" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Order)"/>
<NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="VipCustomer" /> <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="VipCustomer"/>
</EntityType> </EntityType>
<EntityType Name="Employee" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Person"> <EntityType Name="Employee" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Person">
<Property Name="DateHired" Type="Edm.DateTimeOffset" Nullable="false" /> <Property Name="DateHired" Type="Edm.DateTimeOffset" Nullable="false"/>
<Property Name="Office" Type="Edm.GeographyPoint" SRID="4326" /> <Property Name="Office" Type="Edm.GeographyPoint" SRID="4326"/>
<NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Employees" /> <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Employees"/>
</EntityType> </EntityType>
<EntityType Name="Product"> <EntityType Name="Product">
<Key> <Key>
<PropertyRef Name="ProductID" /> <PropertyRef Name="ProductID"/>
</Key> </Key>
<Property Name="ProductID" Type="Edm.Int32" Nullable="false" /> <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Name" Type="Edm.String" Nullable="false" /> <Property Name="Name" Type="Edm.String" Nullable="false"/>
<Property Name="QuantityPerUnit" Type="Edm.String" Nullable="false" /> <Property Name="QuantityPerUnit" Type="Edm.String" Nullable="false"/>
<Property Name="UnitPrice" Type="Edm.Single" Nullable="false" /> <Property Name="UnitPrice" Type="Edm.Single" Nullable="false"/>
<Property Name="QuantityInStock" Type="Edm.Int32" Nullable="false" /> <Property Name="QuantityInStock" Type="Edm.Int32" Nullable="false"/>
<Property Name="Discontinued" Type="Edm.Boolean" Nullable="false" /> <Property Name="Discontinued" Type="Edm.Boolean" Nullable="false"/>
<Property Name="UserAccess" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" /> <Property Name="UserAccess" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel"/>
<Property Name="SkinColor" Type="Microsoft.Test.OData.Services.ODataWCFService.Color" /> <Property Name="SkinColor" Type="Microsoft.Test.OData.Services.ODataWCFService.Color"/>
<Property Name="CoverColors" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)" Nullable="false" /> <Property Name="CoverColors" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)" Nullable="false"/>
<NavigationProperty Name="Details" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)"> <NavigationProperty Name="Details" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)">
<ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID" /> <ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID"/>
</NavigationProperty> </NavigationProperty>
</EntityType> </EntityType>
<EntityType Name="ProductDetail"> <EntityType Name="ProductDetail">
<Key> <Key>
<PropertyRef Name="ProductID" /> <PropertyRef Name="ProductID"/>
<PropertyRef Name="ProductDetailID" /> <PropertyRef Name="ProductDetailID"/>
</Key> </Key>
<Property Name="ProductID" Type="Edm.Int32" Nullable="false" /> <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
<Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false" /> <Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false"/>
<Property Name="ProductName" Type="Edm.String" Nullable="false" /> <Property Name="ProductName" Type="Edm.String" Nullable="false"/>
<Property Name="Description" Type="Edm.String" Nullable="false" /> <Property Name="Description" Type="Edm.String" Nullable="false"/>
<NavigationProperty Name="RelatedProduct" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" /> <NavigationProperty Name="RelatedProduct" Type="Microsoft.Test.OData.Services.ODataWCFService.Product"/>
<NavigationProperty Name="Reviews" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductReview)"> <NavigationProperty Name="Reviews" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductReview)">
<ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID" /> <ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID"/>
<ReferentialConstraint Property="ProductDetailID" ReferencedProperty="ProductDetailID" /> <ReferentialConstraint Property="ProductDetailID" ReferencedProperty="ProductDetailID"/>
</NavigationProperty> </NavigationProperty>
</EntityType> </EntityType>
<EntityType Name="ProductReview"> <EntityType Name="ProductReview">
<Key> <Key>
<PropertyRef Name="ProductID" /> <PropertyRef Name="ProductID"/>
<PropertyRef Name="ProductDetailID" /> <PropertyRef Name="ProductDetailID"/>
<PropertyRef Name="ReviewTitle" /> <PropertyRef Name="ReviewTitle"/>
<PropertyRef Name="RevisionID" /> <PropertyRef Name="RevisionID"/>
</Key> </Key>
<Property Name="ProductID" Type="Edm.Int32" Nullable="false" /> <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
<Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false" /> <Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false"/>
<Property Name="ReviewTitle" Type="Edm.String" Nullable="false" /> <Property Name="ReviewTitle" Type="Edm.String" Nullable="false"/>
<Property Name="RevisionID" Type="Edm.Int32" Nullable="false" /> <Property Name="RevisionID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Comment" Type="Edm.String" Nullable="false" /> <Property Name="Comment" Type="Edm.String" Nullable="false"/>
<Property Name="Author" Type="Edm.String" Nullable="false" /> <Property Name="Author" Type="Edm.String" Nullable="false"/>
</EntityType> </EntityType>
<EntityType Name="Order"> <EntityType Name="Order">
<Key> <Key>
<PropertyRef Name="OrderID" /> <PropertyRef Name="OrderID"/>
</Key> </Key>
<Property Name="OrderID" Type="Edm.Int32" Nullable="false" /> <Property Name="OrderID" Type="Edm.Int32" Nullable="false"/>
<Property Name="OrderDate" Type="Edm.DateTimeOffset" Nullable="false" /> <Property Name="OrderDate" Type="Edm.DateTimeOffset" Nullable="false"/>
<Property Name="ShelfLife" Type="Edm.Duration" /> <Property Name="ShelfLife" Type="Edm.Duration"/>
<Property Name="OrderShelfLifes" Type="Collection(Edm.Duration)" /> <Property Name="OrderShelfLifes" Type="Collection(Edm.Duration)"/>
<NavigationProperty Name="LoggedInEmployee" Type="Microsoft.Test.OData.Services.ODataWCFService.Employee" Nullable="false" /> <NavigationProperty Name="LoggedInEmployee" Type="Microsoft.Test.OData.Services.ODataWCFService.Employee" Nullable="false"/>
<NavigationProperty Name="CustomerForOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false" /> <NavigationProperty Name="CustomerForOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false"/>
<NavigationProperty Name="OrderDetails" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.OrderDetail)" /> <NavigationProperty Name="OrderDetails" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.OrderDetail)"/>
</EntityType> </EntityType>
<EntityType Name="OrderDetail"> <EntityType Name="OrderDetail">
<Key> <Key>
<PropertyRef Name="OrderID" /> <PropertyRef Name="OrderID"/>
<PropertyRef Name="ProductID" /> <PropertyRef Name="ProductID"/>
</Key> </Key>
<Property Name="OrderID" Type="Edm.Int32" Nullable="false" /> <Property Name="OrderID" Type="Edm.Int32" Nullable="false"/>
<Property Name="ProductID" Type="Edm.Int32" Nullable="false" /> <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
<Property Name="OrderPlaced" Type="Edm.DateTimeOffset" Nullable="false" /> <Property Name="OrderPlaced" Type="Edm.DateTimeOffset" Nullable="false"/>
<Property Name="Quantity" Type="Edm.Int32" Nullable="false" /> <Property Name="Quantity" Type="Edm.Int32" Nullable="false"/>
<Property Name="UnitPrice" Type="Edm.Single" Nullable="false" /> <Property Name="UnitPrice" Type="Edm.Single" Nullable="false"/>
<NavigationProperty Name="ProductOrdered" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" /> <NavigationProperty Name="ProductOrdered" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)"/>
<NavigationProperty Name="AssociatedOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Order" Nullable="false" /> <NavigationProperty Name="AssociatedOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Order" Nullable="false"/>
</EntityType> </EntityType>
<EntityType Name="Department"> <EntityType Name="Department">
<Key> <Key>
<PropertyRef Name="DepartmentID" /> <PropertyRef Name="DepartmentID"/>
</Key> </Key>
<Property Name="DepartmentID" Type="Edm.Int32" Nullable="false" /> <Property Name="DepartmentID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Name" Type="Edm.String" Nullable="false" /> <Property Name="Name" Type="Edm.String" Nullable="false"/>
<NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Departments" /> <Property Name="DepartmentNO" Type="Edm.String"/>
<NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Departments"/>
</EntityType> </EntityType>
<EntityType Name="Company"> <EntityType Name="Company" OpenType="true">
<Key> <Key>
<PropertyRef Name="CompanyID" /> <PropertyRef Name="CompanyID"/>
</Key> </Key>
<Property Name="CompanyID" Type="Edm.Int32" Nullable="false" /> <Property Name="CompanyID" Type="Edm.Int32" Nullable="false"/>
<Property Name="CompanyCategory" Type="Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory" /> <Property Name="CompanyCategory" Type="Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory"/>
<Property Name="Revenue" Type="Edm.Int64" Nullable="false" /> <Property Name="Revenue" Type="Edm.Int64" Nullable="false"/>
<Property Name="Name" Type="Edm.String" /> <Property Name="Name" Type="Edm.String"/>
<Property Name="Address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" /> <Property Name="Address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address"/>
<NavigationProperty Name="Employees" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Employee)" Partner="Company" /> <NavigationProperty Name="Employees" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Employee)" Partner="Company"/>
<NavigationProperty Name="VipCustomer" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false" Partner="Company" /> <NavigationProperty Name="VipCustomer" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false" Partner="Company"/>
<NavigationProperty Name="Departments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Department)" Partner="Company" /> <NavigationProperty Name="Departments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Department)" Partner="Company"/>
<NavigationProperty Name="CoreDepartment" Type="Microsoft.Test.OData.Services.ODataWCFService.Department" Nullable="false" /> <NavigationProperty Name="CoreDepartment" Type="Microsoft.Test.OData.Services.ODataWCFService.Department" Nullable="false"/>
</EntityType> </EntityType>
<EntityType Name="PublicCompany" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Company"> <EntityType Name="PublicCompany" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Company" OpenType="true">
<Property Name="StockExchange" Type="Edm.String" /> <Property Name="StockExchange" Type="Edm.String"/>
<NavigationProperty Name="Assets" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Asset)" ContainsTarget="true" /> <NavigationProperty Name="Assets" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Asset)" ContainsTarget="true"/>
<NavigationProperty Name="Club" Type="Microsoft.Test.OData.Services.ODataWCFService.Club" Nullable="false" ContainsTarget="true" /> <NavigationProperty Name="Club" Type="Microsoft.Test.OData.Services.ODataWCFService.Club" Nullable="false" ContainsTarget="true"/>
<NavigationProperty Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion" Nullable="false" /> <NavigationProperty Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion" Nullable="false"/>
</EntityType> </EntityType>
<EntityType Name="Asset"> <EntityType Name="Asset">
<Key> <Key>
<PropertyRef Name="AssetID" /> <PropertyRef Name="AssetID"/>
</Key> </Key>
<Property Name="AssetID" Type="Edm.Int32" Nullable="false" /> <Property Name="AssetID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Name" Type="Edm.String" /> <Property Name="Name" Type="Edm.String"/>
<Property Name="Number" Type="Edm.Int32" Nullable="false" /> <Property Name="Number" Type="Edm.Int32" Nullable="false"/>
</EntityType> </EntityType>
<EntityType Name="Club"> <EntityType Name="Club">
<Key> <Key>
<PropertyRef Name="ClubID" /> <PropertyRef Name="ClubID"/>
</Key> </Key>
<Property Name="ClubID" Type="Edm.Int32" Nullable="false" /> <Property Name="ClubID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Name" Type="Edm.String" /> <Property Name="Name" Type="Edm.String"/>
</EntityType> </EntityType>
<EntityType Name="LabourUnion"> <EntityType Name="LabourUnion">
<Key> <Key>
<PropertyRef Name="LabourUnionID" /> <PropertyRef Name="LabourUnionID"/>
</Key> </Key>
<Property Name="LabourUnionID" Type="Edm.Int32" Nullable="false" /> <Property Name="LabourUnionID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Name" Type="Edm.String" /> <Property Name="Name" Type="Edm.String"/>
</EntityType> </EntityType>
<Action Name="AddAccessRight" IsBound="true"> <Action Name="AddAccessRight" IsBound="true">
<Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false" /> <Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false"/>
<Parameter Name="accessRight" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" /> <Parameter Name="accessRight" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" /> <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel"/>
</Action> </Action>
<Action Name="IncreaseRevenue" IsBound="true"> <Action Name="IncreaseRevenue" IsBound="true">
<Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" /> <Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false"/>
<Parameter Name="IncreaseValue" Type="Edm.Int64" /> <Parameter Name="IncreaseValue" Type="Edm.Int64"/>
<ReturnType Type="Edm.Int64" Nullable="false" /> <ReturnType Type="Edm.Int64" Nullable="false"/>
</Action> </Action>
<Action Name="ResetAddress" IsBound="true" EntitySetPath="person"> <Action Name="ResetAddress" IsBound="true" EntitySetPath="person">
<Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" /> <Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
<Parameter Name="addresses" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)" Nullable="false" /> <Parameter Name="addresses" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)" Nullable="false"/>
<Parameter Name="index" Type="Edm.Int32" Nullable="false" /> <Parameter Name="index" Type="Edm.Int32" Nullable="false"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" /> <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
</Action> </Action>
<Action Name="Discount" IsBound="true" EntitySetPath="products"> <Action Name="Discount" IsBound="true" EntitySetPath="products">
<Parameter Name="products" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false" /> <Parameter Name="products" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false"/>
<Parameter Name="percentage" Type="Edm.Int32" Nullable="false" /> <Parameter Name="percentage" Type="Edm.Int32" Nullable="false"/>
<ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false" /> <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false"/>
</Action> </Action>
<Action Name="Discount"> <Action Name="Discount">
<Parameter Name="percentage" Type="Edm.Int32" Nullable="false" /> <Parameter Name="percentage" Type="Edm.Int32" Nullable="false"/>
</Action> </Action>
<Action Name="ResetBossEmail"> <Action Name="ResetBossEmail">
<Parameter Name="emails" Type="Collection(Edm.String)" Nullable="false" /> <Parameter Name="emails" Type="Collection(Edm.String)" Nullable="false"/>
<ReturnType Type="Collection(Edm.String)" Nullable="false" /> <ReturnType Type="Collection(Edm.String)" Nullable="false"/>
</Action> </Action>
<Action Name="ResetBossAddress"> <Action Name="ResetBossAddress">
<Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false" /> <Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false" /> <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false"/>
</Action> </Action>
<Action Name="ResetDataSource"/>
<Function Name="GetEmployeesCount" IsBound="true"> <Function Name="GetEmployeesCount" IsBound="true">
<Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" /> <Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false"/>
<ReturnType Type="Edm.Int32" Nullable="false" /> <ReturnType Type="Edm.Int32" Nullable="false"/>
</Function> </Function>
<Function Name="GetProductDetails" IsBound="true" EntitySetPath="product/Details" IsComposable="true"> <Function Name="GetProductDetails" IsBound="true" EntitySetPath="product/Details" IsComposable="true">
<Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false" /> <Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false"/>
<Parameter Name="count" Type="Edm.Int32" /> <Parameter Name="count" Type="Edm.Int32"/>
<ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)" Nullable="false" /> <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)" Nullable="false"/>
</Function> </Function>
<Function Name="GetRelatedProduct" IsBound="true" EntitySetPath="productDetail/Products" IsComposable="true"> <Function Name="GetRelatedProduct" IsBound="true" EntitySetPath="productDetail/RelatedProduct" IsComposable="true">
<Parameter Name="productDetail" Type="Microsoft.Test.OData.Services.ODataWCFService.ProductDetail" Nullable="false" /> <Parameter Name="productDetail" Type="Microsoft.Test.OData.Services.ODataWCFService.ProductDetail" Nullable="false"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false" /> <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false"/>
</Function> </Function>
<Function Name="GetDefaultColor" IsComposable="true"> <Function Name="GetDefaultColor" IsComposable="true">
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Color" /> <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Color"/>
</Function> </Function>
<Function Name="GetPerson" IsComposable="true"> <Function Name="GetPerson" IsComposable="true">
<Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false" /> <Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" /> <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
</Function> </Function>
<Function Name="GetPerson2" IsComposable="true"> <Function Name="GetPerson2" IsComposable="true">
<Parameter Name="city" Type="Edm.String" Nullable="false" /> <Parameter Name="city" Type="Edm.String" Nullable="false"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" /> <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
</Function> </Function>
<Function Name="GetAllProducts" IsComposable="true"> <Function Name="GetAllProducts" IsComposable="true">
<ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false" /> <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false"/>
</Function> </Function>
<Function Name="GetBossEmails"> <Function Name="GetBossEmails">
<Parameter Name="start" Type="Edm.Int32" Nullable="false" /> <Parameter Name="start" Type="Edm.Int32" Nullable="false"/>
<Parameter Name="count" Type="Edm.Int32" Nullable="false" /> <Parameter Name="count" Type="Edm.Int32" Nullable="false"/>
<ReturnType Type="Collection(Edm.String)" Nullable="false" /> <ReturnType Type="Collection(Edm.String)" Nullable="false"/>
</Function> </Function>
<Function Name="GetProductsByAccessLevel"> <Function Name="GetProductsByAccessLevel">
<Parameter Name="accessLevel" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" /> <Parameter Name="accessLevel" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" Nullable="false"/>
<ReturnType Type="Collection(Edm.String)" Nullable="false" /> <ReturnType Type="Collection(Edm.String)" Nullable="false"/>
</Function> </Function>
<Function Name="GetActualAmount" IsBound="true"> <Function Name="GetActualAmount" IsBound="true">
<Parameter Name="giftcard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" Nullable="false" /> <Parameter Name="giftcard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" Nullable="false"/>
<Parameter Name="bonusRate" Type="Edm.Double" /> <Parameter Name="bonusRate" Type="Edm.Double"/>
<ReturnType Type="Edm.Double" Nullable="false" /> <ReturnType Type="Edm.Double" Nullable="false"/>
</Function> </Function>
<Function Name="GetDefaultPI" IsBound="true" EntitySetPath="account/MyPaymentInstruments"> <Function Name="GetDefaultPI" IsBound="true" EntitySetPath="account/MyPaymentInstruments">
<Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false" /> <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" /> <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument"/>
</Function> </Function>
<Action Name="RefreshDefaultPI" IsBound="true" EntitySetPath="account/MyPaymentInstruments"> <Action Name="RefreshDefaultPI" IsBound="true" EntitySetPath="account/MyPaymentInstruments">
<Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false" /> <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false"/>
<Parameter Name="newDate" Type="Edm.DateTimeOffset" /> <Parameter Name="newDate" Type="Edm.DateTimeOffset"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" /> <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument"/>
</Action> </Action>
<Function Name="GetHomeAddress" IsBound="true" IsComposable="true"> <Function Name="GetHomeAddress" IsBound="true" IsComposable="true">
<Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" /> <Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.HomeAddress" Nullable="false" /> <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.HomeAddress" Nullable="false"/>
</Function> </Function>
<Function Name="GetAccountInfo" IsBound="true" IsComposable="true"> <Function Name="GetAccountInfo" IsBound="true" IsComposable="true">
<Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false" /> <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo" Nullable="false" /> <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo" Nullable="false"/>
</Function> </Function>
<ComplexType Name="AccountInfo" OpenType="true"> <ComplexType Name="AccountInfo" OpenType="true">
<Property Name="FirstName" Type="Edm.String" Nullable="false" /> <Property Name="FirstName" Type="Edm.String" Nullable="false"/>
<Property Name="LastName" Type="Edm.String" Nullable="false" /> <Property Name="LastName" Type="Edm.String" Nullable="false"/>
</ComplexType> </ComplexType>
<EntityType Name="Account"> <EntityType Name="Account">
<Key> <Key>
<PropertyRef Name="AccountID" /> <PropertyRef Name="AccountID"/>
</Key> </Key>
<Property Name="AccountID" Type="Edm.Int32" Nullable="false" /> <Property Name="AccountID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Country" Type="Edm.String" Nullable="false" /> <Property Name="Country" Type="Edm.String" Nullable="false"/>
<Property Name="AccountInfo" Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo" /> <Property Name="AccountInfo" Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo"/>
<NavigationProperty Name="MyGiftCard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" ContainsTarget="true" /> <NavigationProperty Name="MyGiftCard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" ContainsTarget="true"/>
<NavigationProperty Name="MyPaymentInstruments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument)" ContainsTarget="true" /> <NavigationProperty Name="MyPaymentInstruments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument)" ContainsTarget="true"/>
<NavigationProperty Name="ActiveSubscriptions" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)" ContainsTarget="true" /> <NavigationProperty Name="ActiveSubscriptions" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)" ContainsTarget="true"/>
<NavigationProperty Name="AvailableSubscriptionTemplatess" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)" /> <NavigationProperty Name="AvailableSubscriptionTemplatess" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)"/>
</EntityType> </EntityType>
<EntityType Name="GiftCard"> <EntityType Name="GiftCard">
<Key> <Key>
<PropertyRef Name="GiftCardID" /> <PropertyRef Name="GiftCardID"/>
</Key> </Key>
<Property Name="GiftCardID" Type="Edm.Int32" Nullable="false" /> <Property Name="GiftCardID" Type="Edm.Int32" Nullable="false"/>
<Property Name="GiftCardNO" Type="Edm.String" Nullable="false" /> <Property Name="GiftCardNO" Type="Edm.String" Nullable="false"/>
<Property Name="Amount" Type="Edm.Double" Nullable="false" /> <Property Name="Amount" Type="Edm.Double" Nullable="false"/>
<Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false" /> <Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false"/>
<Property Name="OwnerName" Type="Edm.String"/>
</EntityType> </EntityType>
<EntityType Name="PaymentInstrument"> <EntityType Name="PaymentInstrument">
<Key> <Key>
<PropertyRef Name="PaymentInstrumentID" /> <PropertyRef Name="PaymentInstrumentID"/>
</Key> </Key>
<Property Name="PaymentInstrumentID" Type="Edm.Int32" Nullable="false" /> <Property Name="PaymentInstrumentID" Type="Edm.Int32" Nullable="false"/>
<Property Name="FriendlyName" Type="Edm.String" Nullable="false" /> <Property Name="FriendlyName" Type="Edm.String" Nullable="false"/>
<Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false" /> <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
<NavigationProperty Name="TheStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false" /> <NavigationProperty Name="TheStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false"/>
<NavigationProperty Name="BillingStatements" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Statement)" ContainsTarget="true" /> <NavigationProperty Name="BillingStatements" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Statement)" ContainsTarget="true"/>
<NavigationProperty Name="BackupStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false" /> <NavigationProperty Name="BackupStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false"/>
</EntityType> </EntityType>
<EntityType Name="CreditCardPI" BaseType="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument"> <EntityType Name="CreditCardPI" BaseType="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument">
<Property Name="CardNumber" Type="Edm.String" Nullable="false" /> <Property Name="CardNumber" Type="Edm.String" Nullable="false"/>
<Property Name="CVV" Type="Edm.String" Nullable="false" /> <Property Name="CVV" Type="Edm.String" Nullable="false"/>
<Property Name="HolderName" Type="Edm.String" Nullable="false" /> <Property Name="HolderName" Type="Edm.String" Nullable="false"/>
<Property Name="Balance" Type="Edm.Double" Nullable="false" /> <Property Name="Balance" Type="Edm.Double" Nullable="false"/>
<Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false" /> <Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false"/>
<NavigationProperty Name="CreditRecords" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.CreditRecord)" ContainsTarget="true" /> <NavigationProperty Name="CreditRecords" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.CreditRecord)" ContainsTarget="true"/>
</EntityType> </EntityType>
<EntityType Name="StoredPI"> <EntityType Name="StoredPI">
<Key> <Key>
<PropertyRef Name="StoredPIID" /> <PropertyRef Name="StoredPIID"/>
</Key> </Key>
<Property Name="StoredPIID" Type="Edm.Int32" Nullable="false" /> <Property Name="StoredPIID" Type="Edm.Int32" Nullable="false"/>
<Property Name="PIName" Type="Edm.String" Nullable="false" /> <Property Name="PIName" Type="Edm.String" Nullable="false"/>
<Property Name="PIType" Type="Edm.String" Nullable="false" /> <Property Name="PIType" Type="Edm.String" Nullable="false"/>
<Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false" /> <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
</EntityType> </EntityType>
<EntityType Name="Statement"> <EntityType Name="Statement">
<Key> <Key>
<PropertyRef Name="StatementID" /> <PropertyRef Name="StatementID"/>
</Key> </Key>
<Property Name="StatementID" Type="Edm.Int32" Nullable="false" /> <Property Name="StatementID" Type="Edm.Int32" Nullable="false"/>
<Property Name="TransactionType" Type="Edm.String" Nullable="false" /> <Property Name="TransactionType" Type="Edm.String" Nullable="false"/>
<Property Name="TransactionDescription" Type="Edm.String" Nullable="false" /> <Property Name="TransactionDescription" Type="Edm.String" Nullable="false"/>
<Property Name="Amount" Type="Edm.Double" Nullable="false" /> <Property Name="Amount" Type="Edm.Double" Nullable="false"/>
</EntityType> </EntityType>
<EntityType Name="CreditRecord"> <EntityType Name="CreditRecord">
<Key> <Key>
<PropertyRef Name="CreditRecordID" /> <PropertyRef Name="CreditRecordID"/>
</Key> </Key>
<Property Name="CreditRecordID" Type="Edm.Int32" Nullable="false" /> <Property Name="CreditRecordID" Type="Edm.Int32" Nullable="false"/>
<Property Name="IsGood" Type="Edm.Boolean" Nullable="false" /> <Property Name="IsGood" Type="Edm.Boolean" Nullable="false"/>
<Property Name="Reason" Type="Edm.String" Nullable="false" /> <Property Name="Reason" Type="Edm.String" Nullable="false"/>
<Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false" /> <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
</EntityType> </EntityType>
<EntityType Name="Subscription"> <EntityType Name="Subscription">
<Key> <Key>
<PropertyRef Name="SubscriptionID" /> <PropertyRef Name="SubscriptionID"/>
</Key> </Key>
<Property Name="SubscriptionID" Type="Edm.Int32" Nullable="false" /> <Property Name="SubscriptionID" Type="Edm.Int32" Nullable="false"/>
<Property Name="TemplateGuid" Type="Edm.String" Nullable="false" /> <Property Name="TemplateGuid" Type="Edm.String" Nullable="false"/>
<Property Name="Title" Type="Edm.String" Nullable="false" /> <Property Name="Title" Type="Edm.String" Nullable="false"/>
<Property Name="Category" Type="Edm.String" Nullable="false" /> <Property Name="Category" Type="Edm.String" Nullable="false"/>
<Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false" /> <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
</EntityType> </EntityType>
<EntityContainer Name="InMemoryEntities"> <EntityContainer Name="InMemoryEntities">
<EntitySet Name="People" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Person"> <EntitySet Name="People" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Person">
<NavigationPropertyBinding Path="Parent" Target="People" /> <NavigationPropertyBinding Path="Parent" Target="People"/>
</EntitySet> </EntitySet>
<Singleton Name="Boss" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" /> <Singleton Name="Boss" Type="Microsoft.Test.OData.Services.ODataWCFService.Person">
<NavigationPropertyBinding Path="Parent" Target="People"/>
</Singleton>
<EntitySet Name="Customers" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Customer"> <EntitySet Name="Customers" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Customer">
<NavigationPropertyBinding Path="Orders" Target="Orders" /> <NavigationPropertyBinding Path="Orders" Target="Orders"/>
<NavigationPropertyBinding Path="Parent" Target="People"/>
</EntitySet> </EntitySet>
<Singleton Name="VipCustomer" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer"> <Singleton Name="VipCustomer" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer">
<NavigationPropertyBinding Path="Orders" Target="Orders" /> <NavigationPropertyBinding Path="Orders" Target="Orders"/>
<NavigationPropertyBinding Path="Company" Target="Company" /> <NavigationPropertyBinding Path="Parent" Target="People"/>
<NavigationPropertyBinding Path="Company" Target="Company"/>
</Singleton> </Singleton>
<EntitySet Name="Employees" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Employee"> <EntitySet Name="Employees" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Employee">
<NavigationPropertyBinding Path="Company" Target="Company" /> <NavigationPropertyBinding Path="Parent" Target="People"/>
<NavigationPropertyBinding Path="Company" Target="Company"/>
</EntitySet> </EntitySet>
<EntitySet Name="Products" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Product"> <EntitySet Name="Products" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Product">
<NavigationPropertyBinding Path="Details" Target="ProductDetails" /> <NavigationPropertyBinding Path="Details" Target="ProductDetails"/>
</EntitySet> </EntitySet>
<EntitySet Name="ProductDetails" EntityType="Microsoft.Test.OData.Services.ODataWCFService.ProductDetail"> <EntitySet Name="ProductDetails" EntityType="Microsoft.Test.OData.Services.ODataWCFService.ProductDetail">
<NavigationPropertyBinding Path="RelatedProduct" Target="Products" /> <NavigationPropertyBinding Path="RelatedProduct" Target="Products"/>
<NavigationPropertyBinding Path="Reviews" Target="ProductReviews" /> <NavigationPropertyBinding Path="Reviews" Target="ProductReviews"/>
</EntitySet> </EntitySet>
<EntitySet Name="ProductReviews" EntityType="Microsoft.Test.OData.Services.ODataWCFService.ProductReview" /> <EntitySet Name="ProductReviews" EntityType="Microsoft.Test.OData.Services.ODataWCFService.ProductReview"/>
<EntitySet Name="Orders" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Order"> <EntitySet Name="Orders" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Order">
<NavigationPropertyBinding Path="LoggedInEmployee" Target="Employees" /> <NavigationPropertyBinding Path="LoggedInEmployee" Target="Employees"/>
<NavigationPropertyBinding Path="CustomerForOrder" Target="Customers" /> <NavigationPropertyBinding Path="CustomerForOrder" Target="Customers"/>
<NavigationPropertyBinding Path="OrderDetails" Target="OrderDetails" /> <NavigationPropertyBinding Path="OrderDetails" Target="OrderDetails"/>
<Annotation Term="Core.ChangeTracking">
<Record>
<PropertyValue Property="Supported" Bool="true"/>
<PropertyValue Property="FilterableProperties">
<Collection>
<PropertyPath>OrderID</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="ExpandableProperties">
<Collection>
<PropertyPath>OrderDetails</PropertyPath>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</EntitySet> </EntitySet>
<EntitySet Name="OrderDetails" EntityType="Microsoft.Test.OData.Services.ODataWCFService.OrderDetail"> <EntitySet Name="OrderDetails" EntityType="Microsoft.Test.OData.Services.ODataWCFService.OrderDetail">
<NavigationPropertyBinding Path="AssociatedOrder" Target="Orders" /> <NavigationPropertyBinding Path="AssociatedOrder" Target="Orders"/>
<NavigationPropertyBinding Path="ProductOrdered" Target="Products" /> <NavigationPropertyBinding Path="ProductOrdered" Target="Products"/>
</EntitySet> </EntitySet>
<EntitySet Name="Departments" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Department"> <EntitySet Name="Departments" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Department">
<NavigationPropertyBinding Path="Company" Target="Company" /> <NavigationPropertyBinding Path="Company" Target="Company"/>
</EntitySet> </EntitySet>
<Singleton Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company"> <Singleton Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company">
<NavigationPropertyBinding Path="Employees" Target="Employees" /> <NavigationPropertyBinding Path="Employees" Target="Employees"/>
<NavigationPropertyBinding Path="VipCustomer" Target="VipCustomer" /> <NavigationPropertyBinding Path="VipCustomer" Target="VipCustomer"/>
<NavigationPropertyBinding Path="Departments" Target="Departments" /> <NavigationPropertyBinding Path="Departments" Target="Departments"/>
<NavigationPropertyBinding Path="CoreDepartment" Target="Departments" /> <NavigationPropertyBinding Path="CoreDepartment" Target="Departments"/>
</Singleton> </Singleton>
<Singleton Name="PublicCompany" Type="Microsoft.Test.OData.Services.ODataWCFService.Company"> <Singleton Name="PublicCompany" Type="Microsoft.Test.OData.Services.ODataWCFService.Company">
<NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PublicCompany/LabourUnion" Target="LabourUnion" /> <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PublicCompany/LabourUnion" Target="LabourUnion"/>
</Singleton> </Singleton>
<Singleton Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion" /> <Singleton Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion"/>
<ActionImport Name="Discount" Action="Microsoft.Test.OData.Services.ODataWCFService.Discount" /> <ActionImport Name="Discount" Action="Microsoft.Test.OData.Services.ODataWCFService.Discount"/>
<ActionImport Name="ResetBossEmail" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossEmail" /> <ActionImport Name="ResetBossEmail" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossEmail"/>
<ActionImport Name="ResetBossAddress" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossAddress" /> <ActionImport Name="ResetBossAddress" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossAddress"/>
<FunctionImport Name="GetDefaultColor" Function="Microsoft.Test.OData.Services.ODataWCFService.GetDefaultColor" /> <ActionImport Name="ResetDataSource" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetDataSource"/>
<FunctionImport Name="GetPerson" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson" EntitySet="People" /> <FunctionImport Name="GetDefaultColor" Function="Microsoft.Test.OData.Services.ODataWCFService.GetDefaultColor" IncludeInServiceDocument="true"/>
<FunctionImport Name="GetPerson2" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson2" EntitySet="People" /> <FunctionImport Name="GetPerson" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson" EntitySet="People" IncludeInServiceDocument="true"/>
<FunctionImport Name="GetAllProducts" Function="Microsoft.Test.OData.Services.ODataWCFService.GetAllProducts" EntitySet="Products" /> <FunctionImport Name="GetPerson2" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson2" EntitySet="People" IncludeInServiceDocument="true"/>
<FunctionImport Name="GetBossEmails" Function="Microsoft.Test.OData.Services.ODataWCFService.GetBossEmails" /> <FunctionImport Name="GetAllProducts" Function="Microsoft.Test.OData.Services.ODataWCFService.GetAllProducts" EntitySet="Products" IncludeInServiceDocument="true"/>
<FunctionImport Name="GetProductsByAccessLevel" Function="Microsoft.Test.OData.Services.ODataWCFService.GetProductsByAccessLevel" /> <FunctionImport Name="GetBossEmails" Function="Microsoft.Test.OData.Services.ODataWCFService.GetBossEmails" IncludeInServiceDocument="true"/>
<FunctionImport Name="GetProductsByAccessLevel" Function="Microsoft.Test.OData.Services.ODataWCFService.GetProductsByAccessLevel" IncludeInServiceDocument="true"/>
<EntitySet Name="Accounts" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Account"> <EntitySet Name="Accounts" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Account">
<NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/TheStoredPI" Target="StoredPIs" /> <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/TheStoredPI" Target="StoredPIs"/>
<NavigationPropertyBinding Path="AvailableSubscriptionTemplatess" Target="SubscriptionTemplates" /> <NavigationPropertyBinding Path="AvailableSubscriptionTemplatess" Target="SubscriptionTemplates"/>
<NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/BackupStoredPI" Target="DefaultStoredPI" /> <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/BackupStoredPI" Target="DefaultStoredPI"/>
</EntitySet> </EntitySet>
<EntitySet Name="StoredPIs" EntityType="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" /> <EntitySet Name="StoredPIs" EntityType="Microsoft.Test.OData.Services.ODataWCFService.StoredPI"/>
<EntitySet Name="SubscriptionTemplates" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Subscription" /> <EntitySet Name="SubscriptionTemplates" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Subscription"/>
<Singleton Name="DefaultStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" /> <Singleton Name="DefaultStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI"/>
</EntityContainer> </EntityContainer>
</Schema> </Schema>
</edmx:DataServices> </edmx:DataServices>
</edmx:Edmx> </edmx:Edmx>

View File

@ -1,35 +1,23 @@
{ {
"error": { "error": {
"code": "501", "code": "501",
"message": "Unsupported functionality", "message": "Unsupported functionality",
"target": "query", "target": "query",
"details": [ "details": [
{ {
"code": "301", "code": "301",
"target": "$search", "target": "$search",
"message": "$search query option not supported" "message": "$search query option not supported"
} }
], ],
"innererror": { "innererror": {
"trace": ["callmethod1 etc", "callmethod2 etc"],
"trace": ["callmethod1 etc","callmethod2 etc"], "context": {
"key1": "for debug deployment only"
"context": {"key1":"for debug deployment only"}
} }
} }
}
} }

View File

@ -19,11 +19,10 @@
package org.apache.olingo.fit.v4; package org.apache.olingo.fit.v4;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail;
import java.net.URI; import java.net.URI;
import java.util.Dictionary; import java.util.Map;
import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.commons.api.domain.ODataError; import org.apache.olingo.commons.api.domain.ODataError;
@ -36,41 +35,31 @@ public class ErrorResponseTestITCase extends AbstractTestITCase {
@Test @Test
public void jsonError() { public void jsonError() {
final URI readURI = getClient().getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customers").appendKeySegment(32).
build();
ODataPubFormat format = ODataPubFormat.JSON; final ODataEntityRequest<ODataEntity> req = getClient().getRetrieveRequestFactory().getEntityRequest(readURI);
final URI readURI = getClient().getURIBuilder(testStaticServiceRootURL)
.appendEntitySetSegment("Customers").appendKeySegment(32)
.build();
final ODataEntityRequest<ODataEntity> req = getClient()
.getRetrieveRequestFactory().getEntityRequest(readURI);
try { try {
final ODataEntity read = read(format, readURI); final ODataEntity read = read(ODataPubFormat.JSON, readURI);
fail("should have got exception");
} catch (Exception ex) { } catch (Exception ex) {
ODataError err = ((ODataClientErrorException) ex).getODataError(); final ODataError err = ((ODataClientErrorException) ex).getODataError();
// verify details // verify details
ODataErrorDetail detail = (ODataErrorDetail) err.getDetails() final ODataErrorDetail detail = (ODataErrorDetail) err.getDetails().get(0);
.get(0);
assertEquals("Code should be correct", "301", detail.getCode()); assertEquals("Code should be correct", "301", detail.getCode());
assertEquals("Target should be correct", "$search", assertEquals("Target should be correct", "$search", detail.getTarget());
detail.getTarget()); assertEquals("Message should be correct", "$search query option not supported", detail.getMessage());
assertEquals("Message should be correct",
"$search query option not supported", detail.getMessage());
// verify inner error dictionary // verify inner error dictionary
Dictionary<String, Object> innerErr = err.getInnerError(); final Map<String, String> innerErr = err.getInnerError();
assertEquals("innerError dictionary size should be correct", 2, assertEquals("innerError dictionary size should be correct", 2, innerErr.size());
innerErr.size());
assertEquals("innerError['context'] should be correct", assertEquals("innerError['context'] should be correct",
"{\"key1\":\"for debug deployment only\"}", "{\"key1\":\"for debug deployment only\"}", innerErr.get("context"));
innerErr.get("context"));
assertEquals("innerError['trace'] should be correct", assertEquals("innerError['trace'] should be correct",
"[\"callmethod1 etc\",\"callmethod2 etc\"]", "[\"callmethod1 etc\",\"callmethod2 etc\"]", innerErr.get("trace"));
innerErr.get("trace"));
return;
} }
assertNotNull("should have got exception", null);
} }
} }

View File

@ -20,6 +20,7 @@ package org.apache.olingo.fit.v4;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.Edm;
@ -28,35 +29,56 @@ import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmEntitySet; import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmEnumType; import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmProperty; import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmSchema; import org.apache.olingo.commons.api.edm.EdmSchema;
import org.apache.olingo.commons.api.edm.EdmTerm; import org.apache.olingo.commons.api.edm.EdmTerm;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition; import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.annotation.EdmRecord;
import org.apache.olingo.commons.core.edm.primitivetype.EdmBoolean; import org.apache.olingo.commons.core.edm.primitivetype.EdmBoolean;
import org.junit.Test; import org.junit.Test;
public class MetadataTestITCase extends AbstractTestITCase { public class MetadataTestITCase extends AbstractTestITCase {
@Test @Test
public void retrieve() { public void retrieve() throws EdmPrimitiveTypeException {
final Edm metadata = client.getRetrieveRequestFactory(). final Edm edm = client.getRetrieveRequestFactory().getMetadataRequest(testStaticServiceRootURL).execute().getBody();
getMetadataRequest(testStaticServiceRootURL).execute().getBody(); assertNotNull(edm);
assertNotNull(metadata);
final EdmEntityType order = metadata.getEntityType( final EdmEntityType order = edm.getEntityType(
new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService", "Order")); new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService", "Order"));
assertNotNull(order); assertNotNull(order);
final EdmProperty orderDate = order.getStructuralProperty("OrderDate"); final EdmProperty orderDate = order.getStructuralProperty("OrderDate");
assertNotNull(orderDate); assertNotNull(orderDate);
assertEquals("Edm.DateTimeOffset", orderDate.getType().getFullQualifiedName().toString()); assertEquals("Edm.DateTimeOffset", orderDate.getType().getFullQualifiedName().toString());
final EdmTerm isBoss = edm.getTerm(new FullQualifiedName(edm.getSchemas().get(0).getNamespace(), "IsBoss"));
assertNotNull(isBoss);
assertEquals(EdmBoolean.getInstance(), isBoss.getType());
final EdmEntitySet orders = edm.getSchemas().get(0).getEntityContainer().getEntitySet("Orders");
assertNotNull(orders);
assertFalse(orders.getAnnotations().isEmpty());
assertTrue(orders.getAnnotations().get(0).getExpression().isDynamic());
assertTrue(orders.getAnnotations().get(0).getExpression().asDynamic().isRecord());
final EdmRecord record = orders.getAnnotations().get(0).getExpression().asDynamic().asRecord();
assertNotNull(record);
assertEquals(3, record.getPropertyValues().size());
assertTrue(record.getPropertyValues().get(0).getValue().isConstant());
assertTrue(record.getPropertyValues().get(0).getValue().asConstant().getValue().asPrimitive().
toCastValue(Boolean.class));
assertTrue(record.getPropertyValues().get(1).getValue().asDynamic().isCollection());
assertEquals(1, record.getPropertyValues().get(1).getValue().asDynamic().asCollection().getItems().size());
assertTrue(record.getPropertyValues().get(1).getValue().asDynamic().asCollection().getItems().get(0).isDynamic());
assertEquals("OrderID", record.getPropertyValues().get(1).getValue().asDynamic().asCollection().
getItems().get(0).asDynamic().asPropertyPath().getValue());
} }
@Test @Test
public void include() { public void include() {
final Edm edm = client.getRetrieveRequestFactory(). final Edm edm = client.getRetrieveRequestFactory().getMetadataRequest(testNorthwindRootURL).execute().getBody();
getMetadataRequest(testNorthwindRootURL).execute().getBody();
assertNotNull(edm); assertNotNull(edm);
final EdmEntityContainer container = edm.getEntityContainer( final EdmEntityContainer container = edm.getEntityContainer(

View File

@ -20,6 +20,7 @@ package org.apache.olingo.fit.v4;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.net.URI; import java.net.URI;
@ -29,6 +30,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse; import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
import org.apache.olingo.client.api.uri.v4.URIBuilder; import org.apache.olingo.client.api.uri.v4.URIBuilder;
import org.apache.olingo.client.api.v4.ODataClient; import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
import org.apache.olingo.commons.api.domain.v4.ODataValuable; import org.apache.olingo.commons.api.domain.v4.ODataValuable;
import org.apache.olingo.commons.api.domain.v4.Singleton; import org.apache.olingo.commons.api.domain.v4.Singleton;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@ -55,12 +57,12 @@ public class SingletonTestITCase extends AbstractTestITCase {
} }
@Test @Test
public void readfromAtom() throws EdmPrimitiveTypeException { public void readFromAtom() throws EdmPrimitiveTypeException {
read(client, ODataPubFormat.ATOM); read(client, ODataPubFormat.ATOM);
} }
@Test @Test
public void readfromJSON() throws EdmPrimitiveTypeException { public void readFromJSON() throws EdmPrimitiveTypeException {
read(edmClient, ODataPubFormat.JSON); read(edmClient, ODataPubFormat.JSON);
} }
@ -69,6 +71,37 @@ public class SingletonTestITCase extends AbstractTestITCase {
read(client, ODataPubFormat.JSON_FULL_METADATA); read(client, ODataPubFormat.JSON_FULL_METADATA);
} }
private void readWithAnnotations(final ODataClient client, final ODataPubFormat format)
throws EdmPrimitiveTypeException {
final URIBuilder builder = client.getURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Boss");
final ODataEntityRequest<Singleton> singleton =
client.getRetrieveRequestFactory().getSingletonRequest(builder.build());
singleton.setFormat(format);
singleton.setPrefer(client.newPreferences().includeAnnotations("*"));
final Singleton boss = singleton.execute().getBody();
assertNotNull(boss);
assertFalse(boss.getAnnotations().isEmpty());
final ODataAnnotation isBoss = boss.getAnnotations().get(0);
assertTrue(isBoss.getPrimitiveValue().toCastValue(Boolean.class));
}
@Test
public void readWithAnnotationsFromAtom() throws EdmPrimitiveTypeException {
readWithAnnotations(client, ODataPubFormat.ATOM);
}
@Test
public void readWithAnnotationsFromJSON() throws EdmPrimitiveTypeException {
readWithAnnotations(edmClient, ODataPubFormat.JSON);
}
@Test
public void readWithAnnotationsFromJSONFull() throws EdmPrimitiveTypeException {
readWithAnnotations(client, ODataPubFormat.JSON_FULL_METADATA);
}
private void update(final ODataPubFormat format) throws EdmPrimitiveTypeException { private void update(final ODataPubFormat format) throws EdmPrimitiveTypeException {
final Singleton changes = getClient().getObjectFactory().newSingleton( final Singleton changes = getClient().getObjectFactory().newSingleton(
new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Company")); new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Company"));

View File

@ -32,15 +32,17 @@ public class EdmRecordImpl extends AbstractEdmAnnotatableDynamicAnnotationExpres
private final List<EdmPropertyValue> propertyValues; private final List<EdmPropertyValue> propertyValues;
private final EdmStructuredType type; private EdmStructuredType type;
public EdmRecordImpl(final Edm edm, final String type, final List<EdmPropertyValue> propertyValues) { public EdmRecordImpl(final Edm edm, final String type, final List<EdmPropertyValue> propertyValues) {
this.edm = edm; this.edm = edm;
this.propertyValues = propertyValues; this.propertyValues = propertyValues;
if (type != null) {
final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(type).build(); final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(type).build();
this.type = typeInfo.getEntityType() == null ? typeInfo.getComplexType() : typeInfo.getEntityType(); this.type = typeInfo.getEntityType() == null ? typeInfo.getComplexType() : typeInfo.getEntityType();
} }
}
@Override @Override
public List<EdmPropertyValue> getPropertyValues() { public List<EdmPropertyValue> getPropertyValues() {

View File

@ -145,6 +145,7 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
final Annotation annotation = new AnnotationImpl(); final Annotation annotation = new AnnotationImpl();
annotation.setTerm(odataAnnotation.getTerm()); annotation.setTerm(odataAnnotation.getTerm());
annotation.setType(odataAnnotation.getValue().getTypeName());
updateValuable(annotation, odataAnnotation, reference); updateValuable(annotation, odataAnnotation, reference);
annotatable.getAnnotations().add(annotation); annotatable.getAnnotations().add(annotation);
@ -230,8 +231,16 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
} }
} }
if (fqn == null && annotation.getType() != null) {
final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setTypeExpression(annotation.getType()).build();
if (typeInfo.isPrimitiveType()) {
fqn = typeInfo.getPrimitiveTypeKind().getFullQualifiedName();
}
}
final ODataAnnotation odataAnnotation = new ODataAnnotationImpl(annotation.getTerm(), final ODataAnnotation odataAnnotation = new ODataAnnotationImpl(annotation.getTerm(),
(org.apache.olingo.commons.api.domain.v4.ODataValue) getODataValue(fqn, annotation, null, null)); (org.apache.olingo.commons.api.domain.v4.ODataValue) getODataValue(fqn, annotation, null, null));
odataAnnotatable.getAnnotations().add(odataAnnotation);
} }
} }

View File

@ -247,7 +247,7 @@ public interface Constants {
public static final String ERROR_DETAILS = "details"; public static final String ERROR_DETAILS = "details";
public static final String ERROR_INNERERROR= "innererror"; public static final String ERROR_INNERERROR = "innererror";
// canonical functions to be applied via dynamic annotation <tt>Apply</tt> // canonical functions to be applied via dynamic annotation <tt>Apply</tt>
public static final String CANONICAL_FUNCTION_CONCAT = "odata.concat"; public static final String CANONICAL_FUNCTION_CONCAT = "odata.concat";

View File

@ -18,8 +18,8 @@
*/ */
package org.apache.olingo.commons.api.domain; package org.apache.olingo.commons.api.domain;
import java.util.Dictionary;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* OData error. * OData error.
@ -47,7 +47,6 @@ public interface ODataError {
*/ */
String getTarget(); String getTarget();
/** /**
* Gets error details. * Gets error details.
* *
@ -58,7 +57,7 @@ public interface ODataError {
/** /**
* Gets server defined key-value pairs for debug environment only. * Gets server defined key-value pairs for debug environment only.
* *
* @return a Dictionary representing server defined object. * @return a pair representing server defined object.
*/ */
Dictionary<String, Object> getInnerError(); Map<String, String> getInnerError();
} }

View File

@ -19,9 +19,9 @@
package org.apache.olingo.commons.api.domain; package org.apache.olingo.commons.api.domain;
/** /**
* OData details for example - { "error": {..., "details":[ * OData details for example <tt>{ "error": {..., "details":[
* {"code": "301","target": "$search" ,"message": "$search query option not supported"} * {"code": "301","target": "$search" ,"message": "$search query option not supported"}
* ],...}} * ],...}}</tt>.
*/ */
public interface ODataErrorDetail { public interface ODataErrorDetail {

View File

@ -209,7 +209,7 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
} }
protected void valuable(final JsonGenerator jgen, final Valuable valuable, final String name) throws IOException { protected void valuable(final JsonGenerator jgen, final Valuable valuable, final String name) throws IOException {
if (serverMode && !Constants.VALUE.equals(name)) { if (serverMode && !Constants.VALUE.equals(name) && !(valuable instanceof Annotation)) {
String type = valuable.getType(); String type = valuable.getType();
if (StringUtils.isBlank(type) && valuable.getValue().isPrimitive() || valuable.getValue().isNull()) { if (StringUtils.isBlank(type) && valuable.getValue().isPrimitive() || valuable.getValue().isNull()) {
type = EdmPrimitiveTypeKind.String.getFullQualifiedName().toString(); type = EdmPrimitiveTypeKind.String.getFullQualifiedName().toString();

View File

@ -18,30 +18,22 @@
*/ */
package org.apache.olingo.commons.core.data; package org.apache.olingo.commons.core.data;
import java.util.Dictionary; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.apache.olingo.commons.api.domain.ODataError; import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.commons.api.domain.ODataErrorDetail; import org.apache.olingo.commons.api.domain.ODataErrorDetail;
// { /**
// "error": { * Example:
// "code": "501", * <tt>
// "message": "Unsupported functionality", * {
// "target": "query", * "error": { "code": "501", "message": "Unsupported functionality", "target": "query", "details": [ { "code": "301",
// "details": [ * "target": "$search", "message": "$search query option not supported" } ], "innererror": { "trace": [...], "context":
// { * {...} } } }
// "code": "301", * </tt>.
// "target": "$search", */
// "message": "$search query option not supported"
// }
// ],
// "innererror": {
// "trace": [...],
// "context": {...}
// }
// }
// }
public abstract class AbstractODataError implements ODataError { public abstract class AbstractODataError implements ODataError {
private String code; private String code;
@ -52,7 +44,7 @@ public abstract class AbstractODataError implements ODataError {
private List<ODataErrorDetail> details; private List<ODataErrorDetail> details;
private Dictionary<String,Object> innerError; private Map<String, String> innerError = new LinkedHashMap<String, String>();
@Override @Override
public String getCode() { public String getCode() {
@ -91,11 +83,7 @@ public abstract class AbstractODataError implements ODataError {
} }
@Override @Override
public Dictionary<String,Object> getInnerError() { public Map<String, String> getInnerError() {
return innerError; return innerError;
} }
public void setInnerError(final Dictionary<String,Object> innerError) {
this.innerError = innerError;
}
} }

View File

@ -24,17 +24,12 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.domain.ODataErrorDetail; import org.apache.olingo.commons.api.domain.ODataErrorDetail;
@ -65,10 +60,9 @@ public class JSONODataErrorDeserializer extends AbstractJsonDeserializer<JSONODa
error.setTarget(errorNode.get(Constants.ERROR_TARGET).textValue()); error.setTarget(errorNode.get(Constants.ERROR_TARGET).textValue());
} }
if (errorNode.hasNonNull(Constants.ERROR_DETAILS)) { if (errorNode.hasNonNull(Constants.ERROR_DETAILS)) {
List<ODataErrorDetail> details = new ArrayList<ODataErrorDetail>(); final List<ODataErrorDetail> details = new ArrayList<ODataErrorDetail>();
for (final Iterator<JsonNode> itor = errorNode.get(Constants.ERROR_DETAILS).iterator(); itor.hasNext();) { for (final Iterator<JsonNode> itor = errorNode.get(Constants.ERROR_DETAILS).iterator(); itor.hasNext();) {
details.add( details.add(itor.next().traverse(parser.getCodec()).<ResWrap<JSONODataErrorDetailImpl>>readValueAs(
itor.next().traverse(parser.getCodec()).<ResWrap<JSONODataErrorDetailImpl>>readValueAs(
new TypeReference<JSONODataErrorDetailImpl>() { new TypeReference<JSONODataErrorDetailImpl>() {
}).getPayload()); }).getPayload());
} }
@ -76,15 +70,12 @@ public class JSONODataErrorDeserializer extends AbstractJsonDeserializer<JSONODa
error.setDetails(details); error.setDetails(details);
} }
if (errorNode.hasNonNull(Constants.ERROR_INNERERROR)) { if (errorNode.hasNonNull(Constants.ERROR_INNERERROR)) {
JsonNode innerError = errorNode.get(Constants.ERROR_INNERERROR); final JsonNode innerError = errorNode.get(Constants.ERROR_INNERERROR);
Dictionary<String, Object> innerErr = new Hashtable<String, Object>();
for (final Iterator<String> itor = innerError.fieldNames(); itor.hasNext();) { for (final Iterator<String> itor = innerError.fieldNames(); itor.hasNext();) {
String keyTmp = itor.next(); final String keyTmp = itor.next();
String val = innerError.get(keyTmp).toString(); final String val = innerError.get(keyTmp).toString();
innerErr.put(keyTmp,val); error.getInnerError().put(keyTmp, val);
} }
error.setInnerError(innerErr);
} }
} }

View File

@ -20,24 +20,14 @@ package org.apache.olingo.commons.core.data;
import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.domain.ODataErrorDetail;
public class JSONODataErrorDetailDeserializer extends public class JSONODataErrorDetailDeserializer extends AbstractJsonDeserializer<JSONODataErrorDetailImpl> {
AbstractJsonDeserializer<JSONODataErrorDetailImpl> {
@Override @Override
protected ResWrap<JSONODataErrorDetailImpl> doDeserialize( protected ResWrap<JSONODataErrorDetailImpl> doDeserialize(