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
29 changes: 22 additions & 7 deletions sdm/src/test/java/integration/com/sap/cds/sdm/Api.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,28 @@ private Response executeWithRetry(Request request) throws IOException {

public String createEntityDraft(
String appUrl, String entityName, String entityName2, String srvpath) {
return createEntityDraft(appUrl, entityName, entityName2, srvpath, null);
}

public String createEntityDraft(
String appUrl, String entityName, String entityName2, String srvpath, String bookID) {
MediaType mediaType = MediaType.parse("application/json");

// Creating the Entity (draft)
RequestBody body =
RequestBody.create(
mediaType,
"{\n \"title\": \"IntegrationTestEntity\",\n \""
+ entityName2
+ "\": {\n \"ID\": \"41cf82fb-94bf-4d62-9e45-fa25f959b5b0\",\n \"name\": \"Akshat\"\n }\n}");
String jsonBody;
if (bookID != null && !bookID.isEmpty()) {
// Creating a Chapter within a Book
jsonBody =
"{\n \"title\": \"IntegrationTestEntity\",\n \"book_ID\": \"" + bookID + "\"\n}";
} else {
// Creating a Book or other entity
jsonBody =
"{\n \"title\": \"IntegrationTestEntity\",\n \""
+ entityName2
+ "\": {\n \"ID\": \"41cf82fb-94bf-4d62-9e45-fa25f959b5b0\",\n \"name\": \"Akshat\"\n }\n}";
}

RequestBody body = RequestBody.create(mediaType, jsonBody);

Request request =
new Request.Builder()
Expand Down Expand Up @@ -842,7 +855,9 @@ public String openAttachment(
+ appUrl
+ "/odata/v4/"
+ serviceName
+ "/Books(ID="
+ "/"
+ entityName
+ "(ID="
+ entityID
+ ",IsActiveEntity=true)"
+ "/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public interface ApiInterface {
public String createEntityDraft(
String appUrl, String entityName, String entityName2, String srvpath);

public String createEntityDraft(
String appUrl, String entityName, String entityName2, String srvpath, String bookID);

public String editEntityDraft(String appUrl, String entityName, String srvpath, String entityID);

public String saveEntityDraft(String appUrl, String entityName, String srvpath, String entityID);
Expand Down
25 changes: 19 additions & 6 deletions sdm/src/test/java/integration/com/sap/cds/sdm/ApiMT.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,28 @@ private Response executeWithRetry(Request request) throws IOException {

public String createEntityDraft(
String appUrl, String entityName, String entityName2, String srvpath) {
return createEntityDraft(appUrl, entityName, entityName2, srvpath, null);
}

public String createEntityDraft(
String appUrl, String entityName, String entityName2, String srvpath, String bookID) {
MediaType mediaType = MediaType.parse("application/json");

// Creating the Entity (draft)
RequestBody body =
RequestBody.create(
mediaType,
"{\n \"title\": \"IntegrationTestEntity\",\n \""
+ entityName2
+ "\": {\n \"ID\": \"41cf82fb-94bf-4d62-9e45-fa25f959b5b0\",\n \"name\": \"Akshat\"\n }\n}");
String jsonBody;
if (bookID != null && !bookID.isEmpty()) {
// Creating a Chapter within a Book
jsonBody =
"{\n \"title\": \"IntegrationTestEntity\",\n \"book_ID\": \"" + bookID + "\"\n}";
} else {
// Creating a Book or other entity
jsonBody =
"{\n \"title\": \"IntegrationTestEntity\",\n \""
+ entityName2
+ "\": {\n \"ID\": \"41cf82fb-94bf-4d62-9e45-fa25f959b5b0\",\n \"name\": \"Akshat\"\n }\n}";
}

RequestBody body = RequestBody.create(mediaType, jsonBody);

Request request =
new Request.Builder()
Expand Down
Loading
Loading