Skip to content

Commit 78f1180

Browse files
authored
Merge branch 'develop' into mofterdinger-patch-1
2 parents 69c1750 + 92c7d19 commit 78f1180

8 files changed

Lines changed: 1409 additions & 716 deletions

File tree

.github/workflows/deploy_and_Integration_test.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,17 @@ jobs:
176176
clientSecret="${{ env.CLIENT_SECRET }}"
177177
username="${{ secrets.CF_USER }}"
178178
password="${{ secrets.CF_PASSWORD }}"
179+
noSDMRoleUsername="${{ secrets.NOSDMROLEUSERNAME }}"
180+
noSDMRoleUserPassword="${{ secrets.NOSDMROLEUSERPASSWORD }}"
179181
# Ensure all required variables are set
180182
if [ -z "$appUrl" ]; then echo "Error: appUrl is not set"; exit 1; fi
181183
if [ -z "$authUrl" ]; then echo "Error: authUrl is not set"; exit 1; fi
182184
if [ -z "$clientID" ]; then echo "Error: clientID is not set"; exit 1; fi
183185
if [ -z "$clientSecret" ]; then echo "Error: clientSecret is not set"; exit 1; fi
184186
if [ -z "$username" ]; then echo "Error: username is not set"; exit 1; fi
185187
if [ -z "$password" ]; then echo "Error: password is not set"; exit 1; fi
188+
if [ -z "$noSDMRoleUsername" ]; then echo "Error: noSDMRoleUsername is not set"; exit 1; fi
189+
if [ -z "$noSDMRoleUserPassword" ]; then echo "Error: noSDMRoleUserPassword is not set"; exit 1; fi
186190
# Function to partially mask sensitive information for logging
187191
mask() {
188192
local value="$1"
@@ -200,10 +204,12 @@ jobs:
200204
clientSecret=$clientSecret
201205
username=$username
202206
password=$password
207+
noSDMRoleUsername=$noSDMRoleUsername
208+
noSDMRoleUserPassword=$noSDMRoleUserPassword
203209
EOL
204210
# Run Maven integration tests
205-
mvn clean verify -P integration-tests -DtokenFlow=technicalUser -DskipUnitTests || { echo "Maven tests failed for Technical User Flow"; exit 1; }
206-
mvn clean verify -P integration-tests -DtokenFlow=namedUser -DskipUnitTests || { echo "Maven tests failed for Named User Flow"; exit 1; }
211+
mvn clean verify -P integration-tests -DtokenFlow=namedUser -DtenancyModel=single -DskipUnitTests || { echo "Maven tests failed for Technical User Flow"; exit 1; }
212+
mvn clean verify -P integration-tests -DtokenFlow=technicalUser -DtenancyModel=single -DskipUnitTests || { echo "Maven tests failed for Named User Flow"; exit 1; }
207213
208214

209215

.github/workflows/integration_test.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,16 @@ jobs:
9191
clientSecret="${{ env.CLIENT_SECRET }}"
9292
username="${{ secrets.CF_USER }}"
9393
password="${{ secrets.CF_PASSWORD }}"
94-
94+
noSDMRoleUsername="${{ secrets.NOSDMROLEUSERNAME }}"
95+
noSDMRoleUserPassword="${{ secrets.NOSDMROLEUSERPASSWORD }}"
9596
if [ -z "$appUrl" ]; then echo "Error: appUrl is not set"; exit 1; fi
9697
if [ -z "$authUrl" ]; then echo "Error: authUrl is not set"; exit 1; fi
9798
if [ -z "$clientID" ]; then echo "Error: clientID is not set"; exit 1; fi
9899
if [ -z "$clientSecret" ]; then echo "Error: clientSecret is not set"; exit 1; fi
99100
if [ -z "$username" ]; then echo "Error: username is not set"; exit 1; fi
100101
if [ -z "$password" ]; then echo "Error: password is not set"; exit 1; fi
102+
if [ -z "$noSDMRoleUsername" ]; then echo "Error: noSDMRoleUsername is not set"; exit 1; fi
103+
if [ -z "$noSDMRoleUserPassword" ]; then echo "Error: noSDMRoleUserPassword is not set"; exit 1; fi
101104
102105
mask() {
103106
local value="$1"
@@ -115,8 +118,10 @@ jobs:
115118
clientSecret=$clientSecret
116119
username=$username
117120
password=$password
121+
noSDMRoleUsername=$noSDMRoleUsername
122+
noSDMRoleUserPassword=$noSDMRoleUserPassword
118123
EOL
119124
120125
# Run Maven integration tests
121-
mvn clean verify -P integration-tests -DtokenFlow=technicalUser -DskipUnitTests || { echo "Maven tests failed for Technical User Flow"; exit 1; }
122-
mvn clean verify -P integration-tests -DtokenFlow=namedUser -DskipUnitTests || { echo "Maven tests failed for Named User Flow"; exit 1; }
126+
mvn clean verify -P integration-tests -DtokenFlow=namedUser -DtenancyModel=single -DskipUnitTests || { echo "Maven tests failed for Technical User Flow"; exit 1; }
127+
mvn clean verify -P integration-tests -DtokenFlow=technicalUser -DtenancyModel=single -DskipUnitTests || { echo "Maven tests failed for Named User Flow"; exit 1; }

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

Lines changed: 15 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@
66
import okhttp3.*;
77
import okio.ByteString;
88

9-
public class Api {
9+
public class Api implements ApiInterface {
1010
private final Map<String, String> config;
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()
@@ -391,11 +384,11 @@ public String readAttachment(
391384
Response response = httpClient.newCall(request).execute();
392385
if (!response.isSuccessful()) {
393386
System.out.println(
394-
"Read Attachnent failed in the"
387+
"Read Attachment failed in the"
395388
+ facetName
396389
+ " section. Error :"
397390
+ response.body().string());
398-
throw new IOException("Read Attachnent failed in the" + facetName + " section");
391+
throw new IOException("Read Attachment failed in the" + facetName + " section");
399392
}
400393
return "OK";
401394
} catch (IOException e) {
@@ -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 =
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package integration.com.sap.cds.sdm;
2+
3+
import java.io.File;
4+
import java.io.IOException;
5+
import java.util.List;
6+
import java.util.Map;
7+
import okhttp3.RequestBody;
8+
9+
public interface ApiInterface {
10+
public String createEntityDraft(
11+
String appUrl, String entityName, String entityName2, String srvpath);
12+
13+
public String editEntityDraft(String appUrl, String entityName, String srvpath, String entityID);
14+
15+
public String saveEntityDraft(String appUrl, String entityName, String srvpath, String entityID);
16+
17+
public String deleteEntity(String appUrl, String entityName, String entityID);
18+
19+
public String checkEntity(String appUrl, String entityName, String entityID);
20+
21+
public List<String> createAttachment(
22+
String appUrl,
23+
String entityName,
24+
String facetName,
25+
String entityID,
26+
String srvpath,
27+
Map<String, Object> postData,
28+
File file)
29+
throws IOException;
30+
31+
public String readAttachment(
32+
String appUrl, String entityName, String facetName, String entityID, String ID)
33+
throws IOException;
34+
35+
public String readAttachmentDraft(
36+
String appUrl, String entityName, String facetName, String entityID, String ID)
37+
throws IOException;
38+
39+
public String deleteAttachment(
40+
String appUrl, String entityName, String facetName, String entityID, String ID);
41+
42+
public String renameAttachment(
43+
String appUrl, String entityName, String facetName, String entityID, String ID, String name);
44+
45+
public String updateSecondaryProperty(
46+
String appUrl,
47+
String entityName,
48+
String facetName,
49+
String entityID,
50+
String ID,
51+
RequestBody requestBody);
52+
53+
public String updateInvalidSecondaryProperty(
54+
String appUrl,
55+
String entityName,
56+
String facetName,
57+
String entityID,
58+
String ID,
59+
String invalidSecondaryProperty);
60+
61+
public Map<String, Object> fetchMetadata(
62+
String appUrl, String entityName, String facetName, String entityID, String ID)
63+
throws IOException;
64+
}

0 commit comments

Comments
 (0)