-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Describe the Bug
From BTP cockpit, I get the following destination export:
{
"Name": "s3-object-store",
"Type": "HTTP",
"type": "S3",
"Description": "",
"URL": "https://xxxxx.amazonaws.com",
"ProxyType": "Internet",
"Authentication": "OAuth2ClientCredentials",
"clientId": "xxxxx",
"clientSecret": "",
"tokenServiceURL": "https://xxxxx.amazonaws.com",
"tokenServiceURLType": "Dedicated",
"region": "xxxxxx",
"bucket": "xxxxxx",
"sap-joule-studio-document-grounding-object-store": "true",
"username": "xxxxxx"
}
When retrieving destination via REST call to Destination Service, DefaultDestination.fromMap is used to convert the JSON to a com.sap.cloud.sdk.cloudplatform.connectivity.Destination object.
Finally, when calling Destination.asHttp, it raises :
java.lang.IllegalArgumentException: Unknown DestinationType: S3.
Root cause seems to be the DefaultDestination.Builder class with its case insensitive property map:
https://github.com/SAP/cloud-sdk-java/blob/main/cloudplatform/cloudplatform-connectivity/src/main/java/com/sap/cloud/sdk/cloudplatform/connectivity/DefaultDestination.java#L122
Steps to Reproduce
Here is a unit test to reproduce the issue
@Test
void testCloudSDK() {
Map<String, Object> properties = new HashMap<>();
properties.put("Name", "s3-object-store");
properties.put("Type", "HTTP");
properties.put("type", "S3");
properties.put("Description", "");
properties.put("URL", "https://xxxxx.amazonaws.com");
properties.put("ProxyType", "Internet");
properties.put("Authentication", "OAuth2ClientCredentials");
properties.put("clientId", "xxxxx");
properties.put("clientSecret", "<removed>");
properties.put("tokenServiceURL", "https://xxxxx.amazonaws.com");
properties.put("tokenServiceURLType", "Dedicated");
properties.put("sap-joule-studio-document-grounding-object-store", "true");
DefaultDestination destination = DefaultDestination.fromMap(properties).build();
HttpDestination httpDestination = destination.asHttp();
}Expected Behavior
A destination created in the BTP cockpit should be parsable by cloud-sdk-java DefaultDestination.Builder.
It means that the builder should not be case insensitive.
Screenshots
No response
Used Versions
- Java and Maven version via
mvn --version: java 21, maven 3.9.9 - SAP Cloud SDK version: 5.22
- Spring Boot or CAP version: spring boot 3.5.6
Dependency tree via mvn dependency:tree
Dependency tree here
Code Examples
@Test
void testCloudSDK() {
Map<String, Object> properties = new HashMap<>();
properties.put("Name", "s3-object-store");
properties.put("Type", "HTTP");
properties.put("type", "S3");
properties.put("Description", "");
properties.put("URL", "https://xxxxx.amazonaws.com");
properties.put("ProxyType", "Internet");
properties.put("Authentication", "OAuth2ClientCredentials");
properties.put("clientId", "xxxxx");
properties.put("clientSecret", "<removed>");
properties.put("tokenServiceURL", "https://xxxxx.amazonaws.com");
properties.put("tokenServiceURLType", "Dedicated");
properties.put("sap-joule-studio-document-grounding-object-store", "true");
DefaultDestination destination = DefaultDestination.fromMap(properties).build();
HttpDestination httpDestination = destination.asHttp();
}Stack Trace
java.lang.IllegalArgumentException: Unknown DestinationType: S3.
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationType.ofIdentifier(DestinationType.java:73)
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationPropertyKey.lambda$createProperty$0(DestinationPropertyKey.java:73)
at io.vavr.control.Option.map(Option.java:391)
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationPropertyKey.get(DestinationPropertyKey.java:43)
at com.sap.cloud.sdk.cloudplatform.connectivity.DefaultDestination$Builder.get(DefaultDestination.java:161)
at com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpDestination$Builder.get(DefaultHttpDestination.java:626)
at com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpDestination$Builder.build(DefaultHttpDestination.java:1004)
at com.sap.cloud.sdk.cloudplatform.connectivity.Destination.asHttp(Destination.java:26)
at com.sap.ipa.runtime.service.impl.destination.DestinationConfigServiceTest.testCloudSDK(DestinationConfigServiceTest.java:138)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Log File
None
Affected Development Phase
Production
Impact
Unable to work with destinations
Timeline
No response