File tree Expand file tree Collapse file tree 5 files changed +20
-11
lines changed
odata-v4-api-sample/src/test
java/com/sap/cloud/sdk/datamodel/odatav4/sample
resources/SdkGroceryStoreServiceTest/mappings
main/java/com/sap/cloud/sdk/datamodel/odatav4/core
test/java/com/sap/cloud/sdk/datamodel/odatav4/core Expand file tree Collapse file tree 5 files changed +20
-11
lines changed Original file line number Diff line number Diff line change 77import java .time .OffsetDateTime ;
88import java .time .ZoneOffset ;
99import java .util .Arrays ;
10- import java .util .Collections ;
1110import java .util .List ;
1211
1312import org .junit .jupiter .api .BeforeEach ;
@@ -116,15 +115,17 @@ void testFilterPurchaseHistory()
116115 .build ();
117116
118117 final Customer customer = Customer .builder ().id (1337 ).build ();
118+ customer .setVersionIdentifier ("123" );
119+
119120 final ActionResponseCollection <PurchaseHistoryItem > historyItems =
120121 service
121122 .forEntity (customer )
122123 .applyAction (
123124 Customer
124125 .filterPurchaseHistory (
125- Collections . singleton (Receipt .builder ().customerId (1337 ).id (4242 ).build ()),
126- Arrays . asList ("milk" , "eggs" ),
127- Arrays . asList (ProductCategory .DAIRY , ProductCategory .MEAT ),
126+ List . of (Receipt .builder ().customerId (1337 ).id (4242 ).build ()),
127+ List . of ("milk" , "eggs" ),
128+ List . of (ProductCategory .DAIRY , ProductCategory .MEAT ),
128129 dateRange ))
129130 .execute (destination );
130131
Original file line number Diff line number Diff line change 208208 "Content-Type" : {
209209 "equalTo" : " application/json"
210210 },
211+ "If-Match" : {
212+ "equalTo" : " 123"
213+ },
211214 "Accept" : {
212215 "equalTo" : " application/json"
213216 },
Original file line number Diff line number Diff line change 22
33import javax .annotation .Nonnull ;
44
5+ import org .apache .http .HttpHeaders ;
6+
57import com .sap .cloud .sdk .datamodel .odata .client .expression .ODataResourcePath ;
68
79import io .vavr .control .Option ;
@@ -124,10 +126,10 @@ public <ResultT> SingleValueActionRequestBuilder<ResultT> applyAction(
124126 action .getReturnType ());
125127 maybeEntity
126128 .filter (e -> e .getVersionIdentifier ().isDefined ())
127- .map (VdmEntity < EntityT > ::getVersionIdentifier )
129+ .map (VdmEntity ::getVersionIdentifier )
128130 .filter (Option ::isDefined )
129131 .map (Option ::get )
130- .forEach (eTag -> requestBuilder .withHeader ("ETag" , eTag ));
132+ .forEach (eTag -> requestBuilder .withHeader (HttpHeaders . IF_MATCH , eTag ));
131133 return requestBuilder ;
132134 }
133135
@@ -145,10 +147,10 @@ public <ResultT> CollectionValueActionRequestBuilder<ResultT> applyAction(
145147 action .getReturnType ());
146148 maybeEntity
147149 .filter (e -> e .getVersionIdentifier ().isDefined ())
148- .map (VdmEntity < EntityT > ::getVersionIdentifier )
150+ .map (VdmEntity ::getVersionIdentifier )
149151 .filter (Option ::isDefined )
150152 .map (Option ::get )
151- .forEach (eTag -> requestBuilder .withHeader ("ETag" , eTag ));
153+ .forEach (eTag -> requestBuilder .withHeader (HttpHeaders . IF_MATCH , eTag ));
152154 return requestBuilder ;
153155 }
154156 }
Original file line number Diff line number Diff line change 44
55import java .util .Collections ;
66
7+ import org .apache .http .HttpHeaders ;
78import org .junit .jupiter .api .Test ;
89
910import com .sap .cloud .sdk .datamodel .odatav4 .referenceservice .namespaces .trippin .Location ;
@@ -25,7 +26,8 @@ void testActionOnEntityWithEtag()
2526
2627 assertThat (action .toRequest ().getRelativeUri ()).hasToString (targetUrl );
2728 assertThat (action .toRequest ().getActionParameters ()).hasToString ("{}" );
28- assertThat (action .toRequest ().getHeaders ()).containsEntry ("ETag" , Collections .singletonList ("some-etag" ));
29+ assertThat (action .toRequest ().getHeaders ())
30+ .containsEntry (HttpHeaders .IF_MATCH , Collections .singletonList ("some-etag" ));
2931 }
3032
3133 @ Test
@@ -38,7 +40,7 @@ void testActionOnEntityNoEtag()
3840
3941 assertThat (action .toRequest ().getRelativeUri ()).hasToString (targetUrl );
4042 assertThat (action .toRequest ().getActionParameters ()).hasToString ("{}" );
41- assertThat (action .toRequest ().getHeaders ()).doesNotContainEntry ( "ETag" , Collections . singletonList ( "some-etag" ) );
43+ assertThat (action .toRequest ().getHeaders ()).doesNotContainKey ( HttpHeaders . IF_MATCH );
4244 }
4345
4446 @ Test
Original file line number Diff line number Diff line change 2323### 🐛 Fixed Issues
2424
2525- [ OpenAPI] Fix code generator for transitive dependency version inconsistencies for Jackson.
26- - [ ODatav4] Fixed an issue when generating clients.
26+ - [ ODatav4] Fix incorrect HTTP header name when sending entity version identifier in bound-action requests.
27+ - [ ODatav4] Fix an issue when generating clients.
2728 - Property names: ` value ` , ` item ` and ` properties ` are now allowed.
2829
You can’t perform that action at this time.
0 commit comments