Skip to content

Commit df8177d

Browse files
committed
fix multitenant
1 parent 643ce0a commit df8177d

9 files changed

Lines changed: 15 additions & 27 deletions

File tree

.github/workflows/multi tenancy_Integration.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ jobs:
179179
CMIS_URL="${{ secrets.CMIS_URL }}"
180180
cmisClientID="$CMIS_CLIENT_ID"
181181
cmisClientSecret="$CMIS_CLIENT_SECRET"
182+
defaultRepositoryID="${{ secrets.DEFAULTREPOSITORYID }}"
183+
defaultRepositoryIDMT="${{ secrets.DEFAULTREPOSITORYIDMT }}"
182184
183185
echo "::add-mask::$clientSecret"
184186
echo "::add-mask::$clientID"
@@ -226,6 +228,8 @@ jobs:
226228
CMIS_URL=$CMIS_URL
227229
cmisClientID=$cmisClientID
228230
cmisClientSecret=$cmisClientSecret
231+
defaultRepositoryID=$defaultRepositoryID
232+
defaultRepositoryIDMT=$defaultRepositoryIDMT
229233
EOL
230234
echo "✅ Credentials file prepared!"
231235

sdm/src/test/java/integration/com/sap/cds/sdm/utils/cf-subscribe.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CONFIG_FILE="${SCRIPT_DIR}/../../../../../../../resources/credentials.properties
66

77
# Load key=value pairs from .properties file without shell expansion of values
88
load_props() {
9+
local key val
910
while IFS= read -r line || [[ -n "$line" ]]; do
1011
[[ "$line" =~ ^[[:space:]]*$ || "$line" =~ ^[[:space:]]*# ]] && continue
1112
key="${line%%=*}"

sdm/src/test/java/integration/com/sap/cds/sdm/utils/cf-unsubscribe.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CONFIG_FILE="${SCRIPT_DIR}/../../../../../../../resources/credentials.properties
66

77
# Load key=value pairs from .properties file without shell expansion of values
88
load_props() {
9+
local key val
910
while IFS= read -r line || [[ -n "$line" ]]; do
1011
[[ "$line" =~ ^[[:space:]]*$ || "$line" =~ ^[[:space:]]*# ]] && continue
1112
key="${line%%=*}"

sdm/src/test/java/integration/com/sap/cds/sdm/utils/create.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ CONFIG_FILE="${SCRIPT_DIR}/../../../../../../../resources/credentials.properties
2020

2121
# Load key=value pairs from .properties file without shell expansion of values
2222
load_props() {
23+
local key val
2324
while IFS= read -r line || [[ -n "$line" ]]; do
2425
[[ "$line" =~ ^[[:space:]]*$ || "$line" =~ ^[[:space:]]*# ]] && continue
2526
key="${line%%=*}"

sdm/src/test/java/integration/com/sap/cds/sdm/utils/delete.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ CONFIG_FILE="${SCRIPT_DIR}/../../../../../../../resources/credentials.properties
2121

2222
# Load key=value pairs from .properties file without shell expansion of values
2323
load_props() {
24+
local key val
2425
while IFS= read -r line || [[ -n "$line" ]]; do
2526
[[ "$line" =~ ^[[:space:]]*$ || "$line" =~ ^[[:space:]]*# ]] && continue
2627
key="${line%%=*}"

sdm/src/test/java/integration/com/sap/cds/sdm/utils/get-metadata.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ CONFIG_FILE="${SCRIPT_DIR}/../../../../../../../resources/credentials.properties
2121

2222
# Load key=value pairs from .properties file without shell expansion of values
2323
load_props() {
24+
local key val
2425
while IFS= read -r line || [[ -n "$line" ]]; do
2526
[[ "$line" =~ ^[[:space:]]*$ || "$line" =~ ^[[:space:]]*# ]] && continue
2627
key="${line%%=*}"

sdm/src/test/java/integration/com/sap/cds/sdm/utils/get-object-id.sh

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ CONFIG_FILE="${SCRIPT_DIR}/../../../../../../../resources/credentials.properties
2525

2626
# Load key=value pairs from .properties file without shell expansion of values
2727
load_props() {
28+
local key val
2829
while IFS= read -r line || [[ -n "$line" ]]; do
2930
[[ "$line" =~ ^[[:space:]]*$ || "$line" =~ ^[[:space:]]*# ]] && continue
3031
key="${line%%=*}"
@@ -35,23 +36,14 @@ load_props() {
3536
done < "$1"
3637
}
3738

38-
echo "[DEBUG] SCRIPT_DIR=$SCRIPT_DIR"
39-
echo "[DEBUG] CONFIG_FILE=$CONFIG_FILE"
40-
4139
if [[ ! -f "$CONFIG_FILE" ]]; then
4240
echo "ERROR: Config file not found at $CONFIG_FILE"
4341
exit 1
4442
fi
45-
echo "[DEBUG] Config file found, loading properties..."
46-
load_props "$CONFIG_FILE" || {
47-
echo "ERROR: load_props failed with exit code $?"
48-
exit 1
49-
}
43+
load_props "$CONFIG_FILE"
5044
defaultRepositoryID="${SDM_REPOSITORY_ID:-$defaultRepositoryID}"
5145
authUrl="${SDM_AUTH_URL:-$authUrl}"
5246
CMIS_URL="${CMIS_URL%/}/"
53-
echo "[DEBUG] Properties loaded. defaultRepositoryID=$defaultRepositoryID"
54-
echo "[DEBUG] CMIS_URL=$CMIS_URL"
5547

5648
# --- Validate positional parameters ---
5749
if [[ $# -lt 1 || $# -gt 3 ]]; then
@@ -62,7 +54,6 @@ fi
6254
CMIS_NAME="$1"
6355
PARENT_FOLDER_ID="${2:-}"
6456
CMIS_TYPE="${3:-cmis:folder}"
65-
echo "[DEBUG] CMIS_NAME=$CMIS_NAME, PARENT_FOLDER_ID=$PARENT_FOLDER_ID, CMIS_TYPE=$CMIS_TYPE"
6657

6758
# --- Validate required config variables ---
6859
for var in CMIS_URL defaultRepositoryID authUrl cmisClientID cmisClientSecret username password; do
@@ -71,20 +62,14 @@ for var in CMIS_URL defaultRepositoryID authUrl cmisClientID cmisClientSecret us
7162
exit 1
7263
fi
7364
done
74-
echo "[DEBUG] All required config variables validated"
7565

7666
# --- Obtain OAuth2 access token (password grant) ---
77-
echo "[DEBUG] Requesting token from: ${authUrl}/oauth/token"
7867
TOKEN_RESPONSE=$(curl -s -X POST "${authUrl}/oauth/token" \
7968
--data-urlencode "grant_type=password" \
8069
--data-urlencode "client_id=${cmisClientID}" \
8170
--data-urlencode "client_secret=${cmisClientSecret}" \
8271
--data-urlencode "username=${username}" \
83-
--data-urlencode "password=${password}" 2>&1) || {
84-
echo "ERROR: curl for token failed with exit code $?"
85-
echo "Response: $TOKEN_RESPONSE"
86-
exit 1
87-
}
72+
--data-urlencode "password=${password}")
8873

8974
ACCESS_TOKEN=$(echo "$TOKEN_RESPONSE" \
9075
| grep -o '"access_token":"[^"]*"' \
@@ -95,32 +80,24 @@ if [[ -z "$ACCESS_TOKEN" ]]; then
9580
echo "Token endpoint response: $TOKEN_RESPONSE"
9681
exit 1
9782
fi
98-
echo "[DEBUG] Access token obtained (length=${#ACCESS_TOKEN})"
9983

10084
# --- Execute CMIS query to find the folder by name ---
10185
QUERY_URL="${CMIS_URL}browser/${defaultRepositoryID}"
102-
echo "[DEBUG] QUERY_URL=$QUERY_URL"
10386

10487
if [[ -n "${PARENT_FOLDER_ID}" ]]; then
10588
CMIS_QUERY="SELECT cmis:objectId FROM ${CMIS_TYPE} WHERE cmis:name = '${CMIS_NAME}' AND IN_FOLDER('${PARENT_FOLDER_ID}')"
10689
else
10790
CMIS_QUERY="SELECT cmis:objectId FROM ${CMIS_TYPE} WHERE cmis:name = '${CMIS_NAME}'"
10891
fi
109-
echo "[DEBUG] CMIS_QUERY=$CMIS_QUERY"
11092
RESPONSE=$(curl -s -w "\n%{http_code}" \
11193
-X GET "${QUERY_URL}" \
11294
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
11395
-G \
11496
--data-urlencode "cmisselector=query" \
115-
--data-urlencode "q=${CMIS_QUERY}" 2>&1) || {
116-
echo "ERROR: curl for CMIS query failed with exit code $?"
117-
echo "Response: $RESPONSE"
118-
exit 1
119-
}
97+
--data-urlencode "q=${CMIS_QUERY}")
12098

12199
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
122100
BODY=$(echo "$RESPONSE" | sed '$d')
123-
echo "[DEBUG] CMIS query HTTP_CODE=$HTTP_CODE"
124101

125102
if [[ "$HTTP_CODE" != "200" ]]; then
126103
echo "ERROR: CMIS query failed (HTTP ${HTTP_CODE})."

sdm/src/test/java/integration/com/sap/cds/sdm/utils/read.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ CONFIG_FILE="${SCRIPT_DIR}/../../../../../../../resources/credentials.properties
2020

2121
# Load key=value pairs from .properties file without shell expansion of values
2222
load_props() {
23+
local key val
2324
while IFS= read -r line || [[ -n "$line" ]]; do
2425
[[ "$line" =~ ^[[:space:]]*$ || "$line" =~ ^[[:space:]]*# ]] && continue
2526
key="${line%%=*}"

sdm/src/test/java/integration/com/sap/cds/sdm/utils/sdm-repo-manage.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ CONFIG_FILE="${SCRIPT_DIR}/../../../../../../../resources/credentials.properties
2626

2727
# Load key=value pairs from .properties file
2828
load_props() {
29+
local key val
2930
while IFS= read -r line || [[ -n "$line" ]]; do
3031
[[ "$line" =~ ^[[:space:]]*$ || "$line" =~ ^[[:space:]]*# ]] && continue
3132
key="${line%%=*}"

0 commit comments

Comments
 (0)