Skip to content

Commit 20686e1

Browse files
authored
Make streamlined MTX new default (#189)
1 parent c4a6d99 commit 20686e1

File tree

13 files changed

+104
-114
lines changed

13 files changed

+104
-114
lines changed

.cdsrc.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
{
2+
"requires": {
3+
"multitenancy": true,
4+
"extensibility": true,
5+
"toggles": true
6+
},
27
"build": {
38
"target": ".",
49
"tasks": [
510
{
611
"for": "java"
712
},
813
{
9-
"for": "mtx",
10-
"src": ".",
11-
"dest": "mtx-sidecar"
14+
"for": "mtx-sidecar"
1215
},
1316
{
1417
"for": "hana"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ hs_err*
3232
.DS_Store
3333

3434
*.db
35+
*.sqlite
3536

3637
.cdsrc-private.json
3738

38-
/chart/
39+
/chart/

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ Although CAP provides generic **event handlers** to serve most CRUD requests out
4545

4646
A SAP Fiori UI is added using predefined SAP Fiori elements templates. **[SAP Fiori annotations](https://cap.cloud.sap/docs/advanced/fiori#fiori-annotations)** add information to the service definitions, on how to render the data.
4747

48+
CAP provides built-in multitenancy support with out-of-the box tenant isolation. The sample application demonstrates usage of MTX sidecar based on [streamlined MTX](https://cap.cloud.sap/docs/guides/deployment/as-saas?impl-variant=java) and can be deployed as multitenant application. The [deprecated classic MTX](https://cap.cloud.sap/docs/java/multitenancy) setup is shown in the [mtx-classic branch](https://github.com/SAP-samples/cloud-cap-samples-java/tree/mtx-classic) for reference.
49+
4850
## Demonstrated Features
4951

5052
Framework and Infrastructure related Features:

mta-multi-tenant.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ version: 1.0.0
44
description: "Multitenant Bookshop CAP Java Project with UI"
55
parameters:
66
enable-parallel-deployments: true
7-
build-parameters:
8-
before-all:
9-
- builder: custom
10-
commands:
11-
- npm install --production
12-
- npx -p @sap/cds-dk cds build --production
137
modules:
148
# --------------------- SERVER MODULE ------------------------
159
- name: bookshop-mt-srv
@@ -49,10 +43,17 @@ modules:
4943
- name: bookshop-mt-sidecar
5044
# ------------------------------------------------------------
5145
type: nodejs
52-
path: mtx-sidecar
46+
path: mtx/sidecar
5347
parameters:
5448
memory: 256M
5549
disk-quota: 1024M
50+
build-parameters:
51+
builder: custom
52+
build-result: gen
53+
commands:
54+
- npm run build
55+
requires:
56+
- name: bookshop-mt-srv
5657
requires:
5758
- name: bookshop-mt-service-manager
5859
- name: bookshop-mt-uaa

mta-single-tenant.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ resources:
8181
- name: bookshop-hdi-container
8282
type: org.cloudfoundry.managed-service
8383
parameters:
84-
service: hanatrial
84+
service: hana
8585
service-plan: hdi-shared
8686
- name: cf-logging
8787
type: org.cloudfoundry.managed-service

mtx-sidecar/.cdsrc.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

mtx-sidecar/package.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

mtx-sidecar/server.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

mtx/sidecar/package.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"dependencies": {
3+
"@sap/cds": "^6",
4+
"@sap/cds-mtxs": "^1",
5+
"express": "^4",
6+
"hdb": "^0",
7+
"passport": "^0",
8+
"@sap/xssec": "^3"
9+
},
10+
"cds": {
11+
"requires": {
12+
"[production]": {
13+
"db": "hana-mt",
14+
"auth": "xsuaa"
15+
},
16+
"[development]": {
17+
"db": "sqlite",
18+
"auth": "dummy"
19+
},
20+
"cds.xt.ModelProviderService": "in-sidecar",
21+
"cds.xt.DeploymentService": true,
22+
"cds.xt.SaasProvisioningService": true,
23+
"cds.xt.ExtensibilityService": true
24+
}
25+
},
26+
"devDependencies": {
27+
"sqlite3": "^5"
28+
},
29+
"engines": {
30+
"node": "^16"
31+
},
32+
"scripts": {
33+
"start": "cds run",
34+
"build": "npm install && npx cds build ../.. --for mtx-sidecar && cd gen && npm install"
35+
}
36+
}

requests.http

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
### Trigger BusinessPartner.Changed event through S/4 mock
2+
3+
PATCH http://localhost:8080/api/API_BUSINESS_PARTNER/A_BusinessPartnerAddress(BusinessPartner='10401010',AddressID='200')
4+
Content-Type: application/json
5+
Authorization: Basic authenticated:
6+
7+
{"HouseNumber": "30"}
8+
9+
### Subscribe t1 tenant, in local-mtxs
10+
11+
POST http://localhost:4004/-/cds/deployment/subscribe HTTP/1.1
12+
Content-Type: application/json
13+
14+
{
15+
"tenant": "t1"
16+
}

0 commit comments

Comments
 (0)