Skip to content
Open
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
17 changes: 10 additions & 7 deletions scenarios/tomee/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,27 @@ resources:
4. Create the file structure `webapp/META-INF/sap_java_buildpack/config/resource_configuration.yml` with the following content:
```yaml
---
tomee/webapps/ROOT/META-INF/context.xml:
tomee/webapps/ROOT/WEB-INF/resources.xml:
service_name_for_DefaultDB: <service-instance-name>
```
5. Under `webapp/META-INF`, create a `resources.xml` file:

5. Under `webapp/WEB-INF`, create a `resources.xml` file:
```xml
<?xml version='1.0' encoding='utf-8'?>

<resources>
<Resource id="jdbc/DefaultD"
<Resource id="jdbc/DefaultDB"
provider="xs.openejb:XS Default JDBC Database"
type="javax.sql.DataSource"
service="${service_name_for_DefaultDB}" />
type="javax.sql.DataSource">
service=${service_name_for_DefaultDB}
</Resource>
</resources>
```

6. Add the following line to the application module's properties in the `mtad.yaml` file. This is how the name of the service instance is passed to the application.
```yaml
JBP_CONFIG_RESOURCE_CONFIGURATION: [ "tomee/webapps/ROOT/META-INF/context.xml": { "service_name_for_DefaultDB": "<service-instance-name>" } ]
JBP_CONFIG_RESOURCE_CONFIGURATION:
- tomee/webapps/ROOT/WEB-INF/resources.xml:
service_name_for_DefaultDB: <service-instance-name>
```
## Related Information
- [TomEE-10 documentation| SAP Help Portal](https://help.sap.com/docs/btp/sap-business-technology-platform/tomee-10)
Expand Down
4 changes: 3 additions & 1 deletion scenarios/tomee/cf/mtad.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ modules:
properties:
TARGET_RUNTIME: tomee
ENABLE_SECURITY_JAVA_API_V2: true
JBP_CONFIG_RESOURCE_CONFIGURATION: [ "tomee/webapps/ROOT/META-INF/context.xml": { "service_name_for_DefaultDB": "persistence-javaee10-app-hana" } ]
JBP_CONFIG_RESOURCE_CONFIGURATION:
- tomee/webapps/ROOT/WEB-INF/resources.xml:
service_name_for_DefaultDB: persistence-javaee10-app-hana
SET_LOGGING_LEVEL: 'ROOT: INFO'
requires:
- name: persistence-javaee10-app-hana
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<jta-data-source>jdbc/DefaultDB</jta-data-source>
<class>com.sap.cloud.sample.persistence.Person</class>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.ddl-generation" value="create-or-extend-tables" />
<property name="eclipselink.logging.level" value="SEVERE" />
</properties>
</persistence-unit>
Expand Down
9 changes: 0 additions & 9 deletions scenarios/tomee/cf/src/main/webapp/META-INF/resources.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
tomee/webapps/ROOT/META-INF/context.xml:
tomee/webapps/ROOT/WEB-INF/resources.xml:
service_name_for_DefaultDB: persistence-javaee10-app-hana
9 changes: 9 additions & 0 deletions scenarios/tomee/cf/src/main/webapp/WEB-INF/resources.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>

<resources>
<Resource id="jdbc/DefaultDB"
provider="xs.openejb:XS Default JDBC Database"
type="javax.sql.DataSource">
service=${service_name_for_DefaultDB}
</Resource>
</resources>
4 changes: 2 additions & 2 deletions scenarios/tomee/integration-test/mtad-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ modules:
TARGET_RUNTIME: tomee
ENABLE_SECURITY_JAVA_API_V2: true
JBP_CONFIG_RESOURCE_CONFIGURATION:
- tomee/webapps/ROOT/META-INF/context.xml:
service_name_for_DefaultDB: ${APP_NAME}-hana
- tomee/webapps/ROOT/WEB-INF/resources.xml:
service_name_for_DefaultDB: ${APP_NAME}-hana
SET_LOGGING_LEVEL: 'ROOT: INFO'
requires:
- name: ${APP_NAME}-hana
Expand Down
21 changes: 20 additions & 1 deletion scenarios/tomee/integration-test/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,33 @@ function execute_tests() {
echo "Maven test execution completed"
}

# Regression test: Verify TomEE is using HANA, not HSQLDB
# If the HSQLDB folder exists, it means TomEE is misconfigured
function check_no_hsqldb() {
echo "Checking that TomEE is NOT using HSQLDB..."
local result
result=$(cf ssh "${APP_NAME}" -c "ls -la /home/vcap/app/META-INF/.sap_java_buildpack/tomee/data/hsqldb/ 2>/dev/null || echo 'No HSQLDB folder!'")

if [[ "${result}" == *"No HSQLDB folder!"* ]]; then
echo "SUCCESS: No HSQLDB folder - TomEE is correctly using HANA"
else
echo "ERROR: HSQLDB folder found! TomEE is using HSQLDB instead of HANA."
echo "Check that WEB-INF/resources.xml exists and JBP_CONFIG_RESOURCE_CONFIGURATION"
echo "points to tomee/webapps/ROOT/WEB-INF/resources.xml"
echo "Folder contents: ${result}"
return 1
fi
}

function main(){
if [[ -n "${DEBUG}" && "${DEBUG}" == "true" ]]; then
set -x
fi

validate_env APP_URL
validate_env APP_URL APP_NAME

execute_tests
check_no_hsqldb
}

main "${@}"