Package org.fusesource.ide.camel.model

Examples of org.fusesource.ide.camel.model.Endpoint


public class ContentBasedRouterTest extends ModelTestSupport {

  @Test
  public void testContentBasedRouterModel() throws Exception {
    Endpoint ep1 = new Endpoint();
    ep1.setUri("seda:a");
    Endpoint ep2 = new Endpoint();
    ep2.setUri("seda:b");
    Endpoint ep3 = new Endpoint();
    ep3.setUri("seda:c");
    Endpoint ep4 = new Endpoint();
    ep4.setUri("seda:d");

    Choice choice = new Choice();
    ep1.addTargetNode(choice);
    // adding out of order to check we add the otherwise first before the non-when/otherwise
    choice.addTargetNode(ep4);
View Full Code Here


    assertRoute(route2);
    **/
  }

  protected void assertRoute(RouteSupport route) {
    Endpoint e1 = assertSingleInput(route, Endpoint.class);
    assertEquals("from", "seda:a", e1.getUri());
   
    Choice c1 = assertSingleOutput(e1, Choice.class);
    When w1 = assertOutput(c1, 0, When.class);
    Endpoint e2 = assertSingleOutput(w1, Endpoint.class);
    assertEquals("when -> to", "seda:b", e2.getUri());

    Otherwise o1 = assertOutput(c1, 1, Otherwise.class);
    Endpoint e3 = assertSingleOutput(o1, Endpoint.class);
    assertEquals("otherwise -> to", "seda:c", e3.getUri());

    Endpoint e4 = assertOutput(c1, 2, Endpoint.class);
    assertEquals("choice -> to", "seda:d", e4.getUri());
   
    assertSize(c1.getOutputs(), 3);
  }
View Full Code Here

public class AddOrderingTest extends ModelTestSupport {

  @Test
  public void testContentBasedRouter() throws Exception {
    Endpoint ep1 = new Endpoint();
    ep1.setUri("seda:a");
    Endpoint ep2 = new Endpoint();
    ep2.setUri("seda:b");
    Endpoint ep3 = new Endpoint();
    ep3.setUri("seda:c");
    Endpoint ep4 = new Endpoint();
    ep4.setUri("seda:d");

    Choice choice = new Choice();
    ep1.addTargetNode(choice);

    choice.addTargetNode(ep2);
    Otherwise otherwise = new Otherwise();
    choice.addTargetNode(otherwise);
    When when = new When();
    choice.addTargetNode(when);
    choice.addTargetNode(ep3);

    assertOutput(choice, 0, When.class);
    assertOutput(choice, 1, Otherwise.class);
    Endpoint e2 = assertOutput(choice, 2, Endpoint.class);
    assertEquals("e2", "seda:b", e2.getUri());

    Endpoint e3 = assertOutput(choice, 3, Endpoint.class);
    assertEquals("e3", "seda:c", e3.getUri());
  }
View Full Code Here

  }
 

  @Test
  public void testTryCatch() throws Exception {
    Endpoint ep1 = new Endpoint();
    ep1.setUri("seda:a");
    Endpoint ep2 = new Endpoint();
    ep2.setUri("seda:b");
    Endpoint ep3 = new Endpoint();
    ep3.setUri("seda:c");
    Endpoint ep4 = new Endpoint();
    ep4.setUri("seda:d");

    Try t = new Try();
    ep1.addTargetNode(t);

    Finally fin = new Finally();
    t.addTargetNode(fin);
    Catch c = new Catch();
    t.addTargetNode(c);
    t.addTargetNode(ep2);
    t.addTargetNode(ep3);

    Endpoint e2 = assertOutput(t, 0, Endpoint.class);
    assertEquals("e2", "seda:b", e2.getUri());

    Endpoint e3 = assertOutput(t, 1, Endpoint.class);
    assertEquals("e3", "seda:c", e3.getUri());

    assertOutput(t, 2, Catch.class);
    assertOutput(t, 3, Finally.class);
  }
View Full Code Here

public class ModelTest extends ModelTestSupport {

  @Test
  public void testModelSave() throws Exception {
   
    Endpoint ep1 = new Endpoint();
    assertValidNode(ep1, "ep1");
    ep1.setUri("seda:a");

    assertNodeText("ep1", ep1, "", "", "");
   
    Filter filter1 = new Filter();
    assertValidNode(filter1, "filter1");
    // TODO set the filter...
   
    Endpoint ep2 = new Endpoint();
    assertValidNode(ep2, "ep2");
    ep2.setUri("seda:b");
   
    // wire them up...
    ep1.addTargetNode(filter1);
    filter1.addTargetNode(ep2);
   
View Full Code Here

   
    // from seda:a -> filter -> seda:b
    RouteSupport route1 = new Route();
    routeContainer.addChild(route1);
   
    Endpoint endpoint1 = new Endpoint("seda:a");
    route1.addChild(endpoint1);
   
    Filter filter1 = new Filter();
    endpoint1.addTargetNode(filter1);
   
    Endpoint endpoint2 = new Endpoint("seda:b");
    filter1.addTargetNode(endpoint2);

    // from seda:b -> filter -> seda:c
    RouteSupport route2 = new Route();
    routeContainer.addChild(route2);
   
    Endpoint endpoint3 = new Endpoint("seda:b");
    route2.addChild(endpoint3);
   
    Filter filter2 = new Filter();
    endpoint3.addTargetNode(filter2);
   
    Endpoint endpoint4 = new Endpoint("seda:c");
    filter2.addTargetNode(endpoint4);

   
    EndpointSummary summary = new EndpointSummary(routeContainer);
   
View Full Code Here

public class DisplayTextTest extends ModelTestSupport {

  @Test
  public void testModelSave() throws Exception {
   
    assertDisplayText(new Endpoint());
    assertDisplayText(new Filter());
    assertDisplayText(new Route());
  }
View Full Code Here

public class CanConnectTest {

  @Test
  public void testCanConnect() throws Exception {
    Endpoint endpoint = new Endpoint();
    Filter filter = new Filter();
    Choice choice = new Choice();
    When when = new When();
    Otherwise otherwise = new Otherwise();
    Bean bean = new Bean();
   
    assertCanConnect(true, endpoint, choice);
    assertCanConnect(true, choice, when);
    assertCanConnect(true, choice, otherwise);
   
    assertCanConnect(true, when, endpoint);
    assertCanConnect(true, when, filter);
    assertCanConnect(true, otherwise, endpoint);
    assertCanConnect(true, otherwise, filter);

    assertCanConnect(true, choice, endpoint);
    assertCanConnect(true, choice, filter);
   
    assertCanConnect(false, endpoint, when);
    assertCanConnect(false, filter, when);
    assertCanConnect(false, endpoint, otherwise);
    assertCanConnect(false, filter, otherwise);
   
    // now lets check we can't connect to something we've already connected in the other direction
    assertCanConnect(true, endpoint, filter);
    assertCanConnect(true, filter, endpoint);
    endpoint.addTargetNode(filter);
    assertCanConnect(false, endpoint, filter);
    assertCanConnect(false, filter, endpoint);

    // we should still be able to connect this filter to another output
    assertCanConnect(true, filter, bean);
View Full Code Here

public class UnmarshalTest extends ModelTestSupport {

  @Test
  public void testContentBasedRouterModel() throws Exception {
    Endpoint ep1 = new Endpoint();
    ep1.setUri("seda:a");
    Endpoint ep2 = new Endpoint();
    ep2.setUri("seda:b");
    Endpoint ep3 = new Endpoint();
    ep3.setUri("seda:c");
    Endpoint ep4 = new Endpoint();
    ep4.setUri("seda:d");

   
    Unmarshal um = new Unmarshal();
    ep1.addTargetNode(um);
    um.addTargetNode(ep2);
View Full Code Here

    ToDefinition ed4 = assertOutput(routeDef, 1, ToDefinition.class);
    assertEquals("unmarshal -> to", "seda:b", ed4.getUri());
  }

  protected void assertRoute(RouteSupport route) {
    Endpoint e1 = assertSingleInput(route, Endpoint.class);
    assertEquals("from", "seda:a", e1.getUri());
   
    Choice c1 = assertSingleOutput(e1, Choice.class);
    When w1 = assertOutput(c1, 0, When.class);
    Endpoint e2 = assertSingleOutput(w1, Endpoint.class);
    assertEquals("when -> to", "seda:b", e2.getUri());

    Otherwise o1 = assertOutput(c1, 1, Otherwise.class);
    Endpoint e3 = assertSingleOutput(o1, Endpoint.class);
    assertEquals("otherwise -> to", "seda:c", e3.getUri());

    Endpoint e4 = assertOutput(c1, 2, Endpoint.class);
    assertEquals("choice -> to", "seda:d", e4.getUri());
   
    assertSize(c1.getOutputs(), 3);
  }
View Full Code Here

TOP

Related Classes of org.fusesource.ide.camel.model.Endpoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.