Skip to content

Commit

Permalink
CAMEL-6117: Allow empty service_type and system_type
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/camel/branches/camel-2.9.x@1461680 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Christian Mueller committed Mar 27, 2013
1 parent 30549cf commit 8f86d57
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,17 @@ protected Endpoint createEndpoint(String uri, String remaining, Map parameters)
SmppConfiguration config = this.configuration.copy();

config.configureFromURI(new URI(uri));
// TODO Camel 3.0 cmueller: We should change the default in Camel 3.0 to '' so that we can remove this special handling
// special handling to set the system type to an empty string
if (parameters.containsKey("systemType") && parameters.get("systemType") == null) {
config.setSystemType("");
parameters.remove("systemType");
}
// special handling to set the service type to an empty string
if (parameters.containsKey("serviceType") && parameters.get("serviceType") == null) {
config.setServiceType("");
parameters.remove("serviceType");
}
setProperties(config, parameters);

return createEndpoint(uri, config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,15 @@ public void createEndpointStringStringMapWithoutACamelContextShouldReturnASmppEn
}

@Test
public void allowEmptySystemTypeOption() throws Exception {
public void allowEmptySystemTypeAndServiceTypeOption() throws Exception {
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("systemType", null);
Endpoint endpoint = component.createEndpoint("smpp://smppclient@localhost:2775", "?systemType=", parameters);
parameters.put("serviceType", null);
Endpoint endpoint = component.createEndpoint("smpp://smppclient@localhost:2775", "?systemType=&serviceType=", parameters);
SmppEndpoint smppEndpoint = (SmppEndpoint) endpoint;

assertEquals("", smppEndpoint.getConfiguration().getSystemType());
assertEquals("", smppEndpoint.getConfiguration().getServiceType());
}

@Test
Expand Down

0 comments on commit 8f86d57

Please sign in to comment.