Repository: olingo-odata2 Updated Branches: refs/heads/master 6c321d04b -> cdecf6f10
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/bd4e7efd/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContextImplTest.java ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContextImplTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContextImplTest.java index e793817..2f81bf4 100644 --- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContextImplTest.java +++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContextImplTest.java @@ -6,9 +6,9 @@ * 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 @@ -269,11 +269,7 @@ public class JPQLSelectContextImplTest { @Test public void testGetOrderByCollection() { buildSelectContext(false, false, true, true, true); - assertEquals(true, selectContext.getOrderByCollection().containsKey("E1." + JPQLSelectContextImplTest.fields[0])); - assertEquals("", selectContext.getOrderByCollection().get("E1." + JPQLSelectContextImplTest.fields[0])); - - assertEquals(true, selectContext.getOrderByCollection().containsKey("E1." + JPQLSelectContextImplTest.fields[1])); - assertEquals("DESC", selectContext.getOrderByCollection().get("E1." + JPQLSelectContextImplTest.fields[1])); + assertEquals("E1.Field1 , E1.Field2 DESC", selectContext.getOrderByCollection()); } @Test @@ -324,21 +320,14 @@ public class JPQLSelectContextImplTest { @Test public void testOrderingWithSkip() { buildSelectContext(true, false, true, true, false); - assertEquals(true, selectContext.getOrderByCollection().containsKey("E1." + JPQLSelectContextImplTest.fields[0])); - assertEquals("", selectContext.getOrderByCollection().get("E1." + JPQLSelectContextImplTest.fields[0])); - - assertEquals(false, selectContext.getOrderByCollection().containsKey("E1." + JPQLSelectContextImplTest.fields[1])); + assertEquals("E1.Field1", selectContext.getOrderByCollection()); } @Test public void testOrderingWithTop() { buildSelectContext(true, false, true, false, true); - assertEquals(true, selectContext.getOrderByCollection().containsKey("E1." + JPQLSelectContextImplTest.fields[0])); - assertEquals("", selectContext.getOrderByCollection().get("E1." + JPQLSelectContextImplTest.fields[0])); - - assertEquals(false, selectContext.getOrderByCollection().containsKey("E1." + JPQLSelectContextImplTest.fields[1])); - + assertEquals("E1.Field1", selectContext.getOrderByCollection()); } @Test http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/bd4e7efd/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleContextImplTest.java ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleContextImplTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleContextImplTest.java index 0394e54..7c4ecbb 100644 --- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleContextImplTest.java +++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleContextImplTest.java @@ -6,9 +6,9 @@ * 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 http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/bd4e7efd/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleStatementBuilderTest.java ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleStatementBuilderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleStatementBuilderTest.java index 25fd5ae..58cddc7 100644 --- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleStatementBuilderTest.java +++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleStatementBuilderTest.java @@ -6,9 +6,9 @@ * 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 http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/bd4e7efd/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java index 617365b..843ace4 100644 --- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java +++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java @@ -6,9 +6,9 @@ * 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 @@ -17,14 +17,13 @@ * under the License. ******************************************************************************/ /** - * + * */ package org.apache.olingo.odata2.jpa.processor.core.jpql; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; -import java.util.HashMap; import java.util.List; import org.apache.olingo.odata2.api.edm.EdmEntitySet; @@ -109,10 +108,7 @@ public class JPQLSelectStatementBuilderTest { OrderByExpression orderByExpression = EasyMock.createMock(OrderByExpression.class); JPQLSelectContext jpqlSelectContextImpl = createSelectContext(orderByExpression, null); - HashMap<String, String> orderByCollection = new HashMap<String, String>(); - orderByCollection.put("E1.soID", "ASC"); - orderByCollection.put("E1.buyerId", "DESC"); - jpqlSelectContextImpl.setOrderByCollection(orderByCollection); + jpqlSelectContextImpl.setOrderByCollection("E1.soID ASC , E1.buyerId DESC"); jpqlSelectStatementBuilder = new JPQLSelectStatementBuilder(jpqlSelectContextImpl); assertEquals("SELECT E1 FROM SalesOrderHeader E1 ORDER BY E1.soID ASC , E1.buyerId DESC", http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/bd4e7efd/odata2-jpa-processor/jpa-core/src/test/resources/metadata.xml ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-core/src/test/resources/metadata.xml b/odata2-jpa-processor/jpa-core/src/test/resources/metadata.xml index 1fd46a4..96f7c99 100644 --- a/odata2-jpa-processor/jpa-core/src/test/resources/metadata.xml +++ b/odata2-jpa-processor/jpa-core/src/test/resources/metadata.xml @@ -1,62 +1,71 @@ <?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. ---> -<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"> - <edmx:DataServices m:DataServiceVersion="1.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> - <Schema Namespace="SalesOrderProcessing" xmlns="http://schemas.microsoft.com/ado/2008/09/edm"> +<!-- 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. --> +<edmx:Edmx Version="1.0" + xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"> + <edmx:DataServices m:DataServiceVersion="1.0" + xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> + <Schema Namespace="SalesOrderProcessing" + xmlns="http://schemas.microsoft.com/ado/2008/09/edm"> <EntityType Name="Note"> <Key> - <PropertyRef Name="id"/> + <PropertyRef Name="id" /> </Key> - <Property Name="id" Type="Edm.String" Nullable="false"/> - <Property Name="soId" Type="Edm.Int64" Nullable="true"/> - <Property Name="text" Type="Edm.String" Nullable="true" MaxLength="255"/> - <NavigationProperty Name="salesOrderHeader" Relationship="SalesOrderProcessing.Note_SalesOrder" FromRole="Note" ToRole="SalesOrder"/> + <Property Name="id" Type="Edm.String" Nullable="false" /> + <Property Name="soId" Type="Edm.Int64" Nullable="true" /> + <Property Name="oValue" Type="SalesOrderProcessing.OrderValue" /> + <Property Name="date" Type="Edm.DateTime" Nullable="false" /> + <Property Name="time" Type="Edm.Time" Nullable="false" /> + <Property Name="text" Type="Edm.String" Nullable="true" + MaxLength="255" /> + <NavigationProperty Name="salesOrderHeader" + Relationship="SalesOrderProcessing.Note_SalesOrder" FromRole="Note" + ToRole="SalesOrder" /> </EntityType> <EntityType Name="SalesOrder"> <Key> - <PropertyRef Name="ID"/> + <PropertyRef Name="ID" /> </Key> - <Property Name="ID" Type="Edm.Int64" Nullable="false"/> - <NavigationProperty Name="NotesDetails" Relationship="SalesOrderProcessing.Note_SalesOrder" FromRole="SalesOrder" ToRole="Note"/> + <Property Name="ID" Type="Edm.Int64" Nullable="false" /> + <NavigationProperty Name="NotesDetails" + Relationship="SalesOrderProcessing.Note_SalesOrder" FromRole="SalesOrder" + ToRole="Note" /> </EntityType> - + <ComplexType Name="OrderValue"> + <Property Name="Amount" Type="Edm.Double" /> + <Property Name="Currency" Type="Edm.String" /> + </ComplexType> <Association Name="Note_SalesOrder"> - <End Type="SalesOrderProcessing.Note" Multiplicity="*" Role="Note"/> - <End Type="SalesOrderProcessing.SalesOrder" Multiplicity="1" Role="SalesOrder"/> + <End Type="SalesOrderProcessing.Note" Multiplicity="*" Role="Note" /> + <End Type="SalesOrderProcessing.SalesOrder" Multiplicity="1" + Role="SalesOrder" /> <ReferentialConstraint> <Principal Role="SalesOrder"> - <PropertyRef Name="ID"/> + <PropertyRef Name="ID" /> </Principal> <Dependent Role="Note"> - <PropertyRef Name="soId"/> + <PropertyRef Name="soId" /> </Dependent> </ReferentialConstraint> </Association> - <EntityContainer Name="SalesOrderProcessingContainer" m:IsDefaultEntityContainer="true"> - <EntitySet Name="Notes" EntityType="SalesOrderProcessing.Note"/> - <EntitySet Name="SalesOrders" EntityType="SalesOrderProcessing.SalesOrder"/> + <EntityContainer Name="SalesOrderProcessingContainer" + m:IsDefaultEntityContainer="true"> + <EntitySet Name="Notes" EntityType="SalesOrderProcessing.Note" /> + <EntitySet Name="SalesOrders" EntityType="SalesOrderProcessing.SalesOrder" /> - <AssociationSet Name="Note_SalesOrderSet" Association="SalesOrderProcessing.Note_SalesOrder"> - <End EntitySet="Notes" Role="Note"/> - <End EntitySet="SalesOrders" Role="SalesOrder"/> + <AssociationSet Name="Note_SalesOrderSet" + Association="SalesOrderProcessing.Note_SalesOrder"> + <End EntitySet="Notes" Role="Note" /> + <End EntitySet="SalesOrders" Role="SalesOrder" /> </AssociationSet> </EntityContainer>
