@Test
  public void testCreateCxfEndpointFromURI() throws Exception {
    CxfEndpoint endpoint1 =
        context.getEndpoint(
            "cxf:bean:routerEndpoint?address=http://localhost:9000/test1", CxfEndpoint.class);
    CxfEndpoint endpoint2 =
        context.getEndpoint(
            "cxf:bean:routerEndpoint?address=http://localhost:8000/test2", CxfEndpoint.class);
    assertEquals(
        "Get a wrong endpoint address.", "http://localhost:9000/test1", endpoint1.getAddress());
    assertEquals(
        "Get a wrong endpoint address.", "http://localhost:8000/test2", endpoint2.getAddress());

    // the uri will always be normalized
    String uri1 =
        URISupport.normalizeUri("cxf://bean:routerEndpoint?address=http://localhost:9000/test1");
    String uri2 =
        URISupport.normalizeUri("cxf://bean:routerEndpoint?address=http://localhost:8000/test2");
    assertEquals("Get a wrong endpoint key.", uri1, endpoint1.getEndpointKey());
    assertEquals("Get a wrong endpoint key.", uri2, endpoint2.getEndpointKey());
  }
Beispiel #2
0
  @Override
  protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters)
      throws Exception {
    ObjectHelper.notNull(getCamelContext(), "Camel Context");

    AbstractIgniteEndpoint answer = null;
    URI remainingUri = new URI(URISupport.normalizeUri(remaining));
    String scheme = remainingUri.getScheme();

    switch (scheme) {
      case "cache":
        answer = new IgniteCacheEndpoint(uri, remainingUri, parameters, this);
        break;
      case "compute":
        answer = new IgniteComputeEndpoint(uri, remainingUri, parameters, this);
        break;
      case "messaging":
        answer = new IgniteMessagingEndpoint(uri, remainingUri, parameters, this);
        break;
      case "events":
        answer = new IgniteEventsEndpoint(uri, remainingUri, parameters, this);
        break;
      case "set":
        answer = new IgniteSetEndpoint(uri, remainingUri, parameters, this);
        break;
      case "idgen":
        answer = new IgniteIdGenEndpoint(uri, remainingUri, parameters, this);
        break;
      case "queue":
        answer = new IgniteQueueEndpoint(uri, remainingUri, parameters, this);
        break;

      default:
        throw new MalformedURLException(
            "An invalid Ignite endpoint URI was provided. Please check that "
                + "it starts with:"
                + " ignite:[cache/compute/messaging/...]:...");
    }

    setProperties(answer, parameters);

    return answer;
  }