Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -116,15 +115,17 @@ void testFilterPurchaseHistory()
.build();

final Customer customer = Customer.builder().id(1337).build();
customer.setVersionIdentifier("123");

final ActionResponseCollection<PurchaseHistoryItem> historyItems =
service
.forEntity(customer)
.applyAction(
Customer
.filterPurchaseHistory(
Collections.singleton(Receipt.builder().customerId(1337).id(4242).build()),
Arrays.asList("milk", "eggs"),
Arrays.asList(ProductCategory.DAIRY, ProductCategory.MEAT),
List.of(Receipt.builder().customerId(1337).id(4242).build()),
List.of("milk", "eggs"),
List.of(ProductCategory.DAIRY, ProductCategory.MEAT),
dateRange))
.execute(destination);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@
"Content-Type": {
"equalTo": "application/json"
},
"If-Match": {
"equalTo": "123"
},
"Accept": {
"equalTo": "application/json"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import javax.annotation.Nonnull;

import org.apache.http.HttpHeaders;

import com.sap.cloud.sdk.datamodel.odata.client.expression.ODataResourcePath;

import io.vavr.control.Option;
Expand Down Expand Up @@ -124,10 +126,10 @@ public <ResultT> SingleValueActionRequestBuilder<ResultT> applyAction(
action.getReturnType());
maybeEntity
.filter(e -> e.getVersionIdentifier().isDefined())
.map(VdmEntity<EntityT>::getVersionIdentifier)
.map(VdmEntity::getVersionIdentifier)
.filter(Option::isDefined)
.map(Option::get)
.forEach(eTag -> requestBuilder.withHeader("ETag", eTag));
.forEach(eTag -> requestBuilder.withHeader(HttpHeaders.IF_MATCH, eTag));
return requestBuilder;
}

Expand All @@ -145,10 +147,10 @@ public <ResultT> CollectionValueActionRequestBuilder<ResultT> applyAction(
action.getReturnType());
maybeEntity
.filter(e -> e.getVersionIdentifier().isDefined())
.map(VdmEntity<EntityT>::getVersionIdentifier)
.map(VdmEntity::getVersionIdentifier)
.filter(Option::isDefined)
.map(Option::get)
.forEach(eTag -> requestBuilder.withHeader("ETag", eTag));
.forEach(eTag -> requestBuilder.withHeader(HttpHeaders.IF_MATCH, eTag));
return requestBuilder;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import java.util.Collections;

import org.apache.http.HttpHeaders;
import org.junit.jupiter.api.Test;

import com.sap.cloud.sdk.datamodel.odatav4.referenceservice.namespaces.trippin.Location;
Expand All @@ -25,7 +26,8 @@ void testActionOnEntityWithEtag()

assertThat(action.toRequest().getRelativeUri()).hasToString(targetUrl);
assertThat(action.toRequest().getActionParameters()).hasToString("{}");
assertThat(action.toRequest().getHeaders()).containsEntry("ETag", Collections.singletonList("some-etag"));
assertThat(action.toRequest().getHeaders())
.containsEntry(HttpHeaders.IF_MATCH, Collections.singletonList("some-etag"));
}

@Test
Expand All @@ -38,7 +40,7 @@ void testActionOnEntityNoEtag()

assertThat(action.toRequest().getRelativeUri()).hasToString(targetUrl);
assertThat(action.toRequest().getActionParameters()).hasToString("{}");
assertThat(action.toRequest().getHeaders()).doesNotContainEntry("ETag", Collections.singletonList("some-etag"));
assertThat(action.toRequest().getHeaders()).doesNotContainKey(HttpHeaders.IF_MATCH);
}

@Test
Expand Down
3 changes: 2 additions & 1 deletion release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
### 🐛 Fixed Issues

- [OpenAPI] Fix code generator for transitive dependency version inconsistencies for Jackson.
- [ODatav4] Fixed an issue when generating clients.
- [ODatav4] Fix incorrect HTTP header name when sending entity version identifier in bound-action requests.
- [ODatav4] Fix an issue when generating clients.
- Property names: `value`, `item` and `properties` are now allowed.