Skip to content

Commit 778decb

Browse files
adding serviceName to constructor
tested for single tenant technical user and mt named user
1 parent aa1ebd2 commit 778decb

5 files changed

Lines changed: 360 additions & 628 deletions

File tree

sdm/src/test/java/integration/com/sap/cds/sdm/Api.java

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ public class Api implements ApiInterface {
1111
private final OkHttpClient httpClient;
1212
private static final ObjectMapper objectMapper = new ObjectMapper();
1313
private final String token;
14+
private final String serviceName;
1415

1516
public Api(Map<String, String> config) {
1617
this.config = new HashMap<>(config);
1718
this.httpClient = new OkHttpClient();
1819
this.token = this.config.get("Authorization");
20+
this.serviceName = this.config.get("serviceName");
1921
}
2022

2123
public String createEntityDraft(
22-
String appUrl, String serviceName, String entityName, String entityName2, String srvpath) {
24+
String appUrl, String entityName, String entityName2, String srvpath) {
2325
MediaType mediaType = MediaType.parse("application/json");
2426

2527
// Creating the Entity (draft)
@@ -55,8 +57,7 @@ public String createEntityDraft(
5557
return ("Could not create entity");
5658
}
5759

58-
public String editEntityDraft(
59-
String appUrl, String serviceName, String entityName, String srvpath, String entityID) {
60+
public String editEntityDraft(String appUrl, String entityName, String srvpath, String entityID) {
6061
MediaType mediaType = MediaType.parse("application/json");
6162
Request request =
6263
new Request.Builder()
@@ -88,8 +89,7 @@ public String editEntityDraft(
8889
return "Could not edit entity";
8990
}
9091

91-
public String saveEntityDraft(
92-
String appUrl, String serviceName, String entityName, String srvpath, String entityID) {
92+
public String saveEntityDraft(String appUrl, String entityName, String srvpath, String entityID) {
9393
Request request =
9494
new Request.Builder()
9595
.url(
@@ -155,8 +155,7 @@ public String saveEntityDraft(
155155
return "Could not save entity";
156156
}
157157

158-
public String deleteEntity(
159-
String appUrl, String serviceName, String entityName, String entityID) {
158+
public String deleteEntity(String appUrl, String entityName, String entityID) {
160159
Request request =
161160
new Request.Builder()
162161
.url(
@@ -185,7 +184,7 @@ public String deleteEntity(
185184
return ("Could not delete entity");
186185
}
187186

188-
public String checkEntity(String appUrl, String serviceName, String entityName, String entityID) {
187+
public String checkEntity(String appUrl, String entityName, String entityID) {
189188
Request request =
190189
new Request.Builder()
191190
.url(
@@ -216,7 +215,6 @@ public String checkEntity(String appUrl, String serviceName, String entityName,
216215

217216
public List<String> createAttachment(
218217
String appUrl,
219-
String serviceName,
220218
String entityName,
221219
String facetName,
222220
String entityID,
@@ -358,12 +356,7 @@ public List<String> createAttachment(
358356
}
359357

360358
public String readAttachment(
361-
String appUrl,
362-
String serviceName,
363-
String entityName,
364-
String facetName,
365-
String entityID,
366-
String ID)
359+
String appUrl, String entityName, String facetName, String entityID, String ID)
367360
throws IOException {
368361
Request request =
369362
new Request.Builder()
@@ -405,12 +398,7 @@ public String readAttachment(
405398
}
406399

407400
public String readAttachmentDraft(
408-
String appUrl,
409-
String serviceName,
410-
String entityName,
411-
String facetName,
412-
String entityID,
413-
String ID)
401+
String appUrl, String entityName, String facetName, String entityID, String ID)
414402
throws IOException {
415403
Request request =
416404
new Request.Builder()
@@ -448,12 +436,7 @@ public String readAttachmentDraft(
448436
}
449437

450438
public String deleteAttachment(
451-
String appUrl,
452-
String serviceName,
453-
String entityName,
454-
String facetName,
455-
String entityID,
456-
String ID) {
439+
String appUrl, String entityName, String facetName, String entityID, String ID) {
457440
Request request =
458441
new Request.Builder()
459442
.url(
@@ -491,13 +474,7 @@ public String deleteAttachment(
491474
}
492475

493476
public String renameAttachment(
494-
String appUrl,
495-
String serviceName,
496-
String entityName,
497-
String facetName,
498-
String entityID,
499-
String ID,
500-
String name) {
477+
String appUrl, String entityName, String facetName, String entityID, String ID, String name) {
501478
MediaType mediaType = MediaType.parse("application/json");
502479
RequestBody body =
503480
RequestBody.create(
@@ -541,7 +518,6 @@ public String renameAttachment(
541518

542519
public String updateSecondaryProperty(
543520
String appUrl,
544-
String serviceName,
545521
String entityName,
546522
String facetName,
547523
String entityID,
@@ -584,7 +560,6 @@ public String updateSecondaryProperty(
584560

585561
public String updateInvalidSecondaryProperty(
586562
String appUrl,
587-
String serviceName,
588563
String entityName,
589564
String facetName,
590565
String entityID,
@@ -628,12 +603,7 @@ public String updateInvalidSecondaryProperty(
628603
}
629604

630605
public Map<String, Object> fetchMetadata(
631-
String appUrl,
632-
String serviceName,
633-
String entityName,
634-
String facetName,
635-
String entityID,
636-
String ID)
606+
String appUrl, String entityName, String facetName, String entityID, String ID)
637607
throws IOException {
638608
// Construct the URL for fetching attachment metadata
639609
String url =

sdm/src/test/java/integration/com/sap/cds/sdm/ApiInterface.java

Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,18 @@
88

99
public interface ApiInterface {
1010
public String createEntityDraft(
11-
String appUrl, String serviceName, String entityName, String entityName2, String srvpath);
11+
String appUrl, String entityName, String entityName2, String srvpath);
1212

13-
public String editEntityDraft(
14-
String appUrl, String serviceName, String entityName, String srvpath, String entityID);
13+
public String editEntityDraft(String appUrl, String entityName, String srvpath, String entityID);
1514

16-
public String saveEntityDraft(
17-
String appUrl, String serviceName, String entityName, String srvpath, String entityID);
15+
public String saveEntityDraft(String appUrl, String entityName, String srvpath, String entityID);
1816

19-
public String deleteEntity(String appUrl, String serviceName, String entityName, String entityID);
17+
public String deleteEntity(String appUrl, String entityName, String entityID);
2018

21-
public String checkEntity(String appUrl, String serviceName, String entityName, String entityID);
19+
public String checkEntity(String appUrl, String entityName, String entityID);
2220

2321
public List<String> createAttachment(
2422
String appUrl,
25-
String serviceName,
2623
String entityName,
2724
String facetName,
2825
String entityID,
@@ -32,43 +29,21 @@ public List<String> createAttachment(
3229
throws IOException;
3330

3431
public String readAttachment(
35-
String appUrl,
36-
String serviceName,
37-
String entityName,
38-
String facetName,
39-
String entityID,
40-
String ID)
32+
String appUrl, String entityName, String facetName, String entityID, String ID)
4133
throws IOException;
4234

4335
public String readAttachmentDraft(
44-
String appUrl,
45-
String serviceName,
46-
String entityName,
47-
String facetName,
48-
String entityID,
49-
String ID)
36+
String appUrl, String entityName, String facetName, String entityID, String ID)
5037
throws IOException;
5138

5239
public String deleteAttachment(
53-
String appUrl,
54-
String serviceName,
55-
String entityName,
56-
String facetName,
57-
String entityID,
58-
String ID);
40+
String appUrl, String entityName, String facetName, String entityID, String ID);
5941

6042
public String renameAttachment(
61-
String appUrl,
62-
String serviceName,
63-
String entityName,
64-
String facetName,
65-
String entityID,
66-
String ID,
67-
String name);
43+
String appUrl, String entityName, String facetName, String entityID, String ID, String name);
6844

6945
public String updateSecondaryProperty(
7046
String appUrl,
71-
String serviceName,
7247
String entityName,
7348
String facetName,
7449
String entityID,
@@ -77,19 +52,13 @@ public String updateSecondaryProperty(
7752

7853
public String updateInvalidSecondaryProperty(
7954
String appUrl,
80-
String serviceName,
8155
String entityName,
8256
String facetName,
8357
String entityID,
8458
String ID,
8559
String invalidSecondaryProperty);
8660

8761
public Map<String, Object> fetchMetadata(
88-
String appUrl,
89-
String serviceName,
90-
String entityName,
91-
String facetName,
92-
String entityID,
93-
String ID)
62+
String appUrl, String entityName, String facetName, String entityID, String ID)
9463
throws IOException;
9564
}

sdm/src/test/java/integration/com/sap/cds/sdm/ApiMT.java

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public ApiMT(Map<String, String> config) {
2020
}
2121

2222
public String createEntityDraft(
23-
String appUrl, String serviceName, String entityName, String entityName2, String srvpath) {
23+
String appUrl, String entityName, String entityName2, String srvpath) {
2424
MediaType mediaType = MediaType.parse("application/json");
2525

2626
// Creating the Entity (draft)
@@ -56,8 +56,7 @@ public String createEntityDraft(
5656
return ("Could not create entity");
5757
}
5858

59-
public String editEntityDraft(
60-
String appUrl, String serviceName, String entityName, String srvpath, String entityID) {
59+
public String editEntityDraft(String appUrl, String entityName, String srvpath, String entityID) {
6160
MediaType mediaType = MediaType.parse("application/json");
6261
Request request =
6362
new Request.Builder()
@@ -87,8 +86,7 @@ public String editEntityDraft(
8786
return "Could not edit entity";
8887
}
8988

90-
public String saveEntityDraft(
91-
String appUrl, String serviceName, String entityName, String srvpath, String entityID) {
89+
public String saveEntityDraft(String appUrl, String entityName, String srvpath, String entityID) {
9290
Request request =
9391
new Request.Builder()
9492
.url(
@@ -151,8 +149,7 @@ public String saveEntityDraft(
151149
return "Could not save entity";
152150
}
153151

154-
public String deleteEntity(
155-
String appUrl, String serviceName, String entityName, String entityID) {
152+
public String deleteEntity(String appUrl, String entityName, String entityID) {
156153
Request request =
157154
new Request.Builder()
158155
.url(
@@ -179,7 +176,7 @@ public String deleteEntity(
179176
return ("Could not delete entity");
180177
}
181178

182-
public String checkEntity(String appUrl, String serviceName, String entityName, String entityID) {
179+
public String checkEntity(String appUrl, String entityName, String entityID) {
183180
Request request =
184181
new Request.Builder()
185182
.url(
@@ -208,7 +205,6 @@ public String checkEntity(String appUrl, String serviceName, String entityName,
208205

209206
public List<String> createAttachment(
210207
String appUrl,
211-
String serviceName,
212208
String entityName,
213209
String facetName,
214210
String entityID,
@@ -344,12 +340,7 @@ public List<String> createAttachment(
344340
}
345341

346342
public String readAttachment(
347-
String appUrl,
348-
String serviceName,
349-
String entityName,
350-
String facetName,
351-
String entityID,
352-
String ID)
343+
String appUrl, String entityName, String facetName, String entityID, String ID)
353344
throws IOException {
354345
Request request =
355346
new Request.Builder()
@@ -389,12 +380,7 @@ public String readAttachment(
389380
}
390381

391382
public String readAttachmentDraft(
392-
String appUrl,
393-
String serviceName,
394-
String entityName,
395-
String facetName,
396-
String entityID,
397-
String ID)
383+
String appUrl, String entityName, String facetName, String entityID, String ID)
398384
throws IOException {
399385
Request request =
400386
new Request.Builder()
@@ -430,12 +416,7 @@ public String readAttachmentDraft(
430416
}
431417

432418
public String deleteAttachment(
433-
String appUrl,
434-
String serviceName,
435-
String entityName,
436-
String facetName,
437-
String entityID,
438-
String ID) {
419+
String appUrl, String entityName, String facetName, String entityID, String ID) {
439420
Request request =
440421
new Request.Builder()
441422
.url(
@@ -471,13 +452,7 @@ public String deleteAttachment(
471452
}
472453

473454
public String renameAttachment(
474-
String appUrl,
475-
String serviceName,
476-
String entityName,
477-
String facetName,
478-
String entityID,
479-
String ID,
480-
String name) {
455+
String appUrl, String entityName, String facetName, String entityID, String ID, String name) {
481456
MediaType mediaType = MediaType.parse("application/json");
482457
RequestBody body =
483458
RequestBody.create(
@@ -519,7 +494,6 @@ public String renameAttachment(
519494

520495
public String updateSecondaryProperty(
521496
String appUrl,
522-
String serviceName,
523497
String entityName,
524498
String facetName,
525499
String entityID,
@@ -560,7 +534,6 @@ public String updateSecondaryProperty(
560534

561535
public String updateInvalidSecondaryProperty(
562536
String appUrl,
563-
String serviceName,
564537
String entityName,
565538
String facetName,
566539
String entityID,
@@ -602,12 +575,7 @@ public String updateInvalidSecondaryProperty(
602575
}
603576

604577
public Map<String, Object> fetchMetadata(
605-
String appUrl,
606-
String serviceName,
607-
String entityName,
608-
String facetName,
609-
String entityID,
610-
String ID)
578+
String appUrl, String entityName, String facetName, String entityID, String ID)
611579
throws IOException {
612580
// Construct the URL for fetching attachment metadata
613581
String url =

0 commit comments

Comments
 (0)