Exemple #1
0
  @SuppressWarnings({"unchecked", "rawtypes"})
  @Override
  protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception {
    if (this.configuration == null) {
      this.configuration = new SmppConfiguration();
    }

    // create a copy of the configuration as other endpoints can adjust their copy as well
    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);
  }
  @Test
  public void getterShouldReturnTheConfigureValuesFromURI() throws URISyntaxException {
    configuration.configureFromURI(new URI("smpp://[email protected]:2776"));

    assertEquals("127.0.0.1", configuration.getHost());
    assertEquals(new Integer(2776), configuration.getPort());
    assertEquals("client", configuration.getSystemId());
  }