Examples of RoutesDefinition


Examples of org.apache.camel.model.RoutesDefinition

    private RouteStatistics statistics = new JMXRouteStatistics();
    @Test
    public void testRouteStats() throws Exception {
        CamelContextResource resource = new CamelContextResource(camelContext);
        RoutesDefinition routes = resource.getRoutesResource().getRouteDefinitions();
        List<RouteDefinition> list = routes.getRoutes();
        Object exchangesCompleted = statistics.getRouteStatistic(camelContext, list.get(0).getId(), "ExchangesCompleted");
        assertEquals("JMX value incorrect, should be 0", new Long(0), exchangesCompleted);

        NotifyBuilder notify = new NotifyBuilder(camelContext).whenDone(1).create();
View Full Code Here

Examples of org.apache.camel.model.RoutesDefinition

     * Returns the routes currently active within this context
     */
    @GET
    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public RoutesDefinition getRouteDefinitions() {
        RoutesDefinition answer = new RoutesDefinition();
        CamelContext camelContext = getCamelContext();
        if (camelContext != null) {
            List<RouteDefinition> list = camelContext.getRouteDefinitions();
            answer.setRoutes(list);
        }
        return answer;
    }
View Full Code Here

Examples of org.apache.camel.model.RoutesDefinition

    protected CamelContext camelContext;
    @Test
    public void testCanMarshalRoutes() throws Exception {
        CamelContextResource resource = new CamelContextResource(camelContext);
        RoutesDefinition routes = resource.getRoutesResource().getRouteDefinitions();
        List<RouteDefinition> list = routes.getRoutes();
        System.out.println("Found routes: " + list);

        // now lets marshall to XML
        JAXBContext context = JAXBContext.newInstance(RoutesDefinition.class.getPackage().getName());
        StringWriter out = new StringWriter();
View Full Code Here

Examples of org.apache.camel.model.RoutesDefinition

        String text = resource.path("routes").accept("application/xml").get(String.class);
        System.out.println("Routes XML: " + text);
        assertNotNull("XML should not be null", text);

        RoutesDefinition routes = resource.path("routes").accept("application/xml").get(RoutesDefinition.class);
        assertNotNull("Should have found routes", routes);
        List<RouteDefinition> routeList = routes.getRoutes();
        assertNotNull("Should have more than one route", routeList.size() > 0);
        System.out.println("Have routes: " + routeList);
    }
View Full Code Here

Examples of org.apache.camel.model.RoutesDefinition

        String text = resource.path("routes").accept("application/xml").get(String.class);
        System.out.println("Routes XML: " + text);
        assertNotNull("XML should not be null", text);

        RoutesDefinition routes = resource.path("routes").accept("application/xml").get(RoutesDefinition.class);
        assertNotNull("Should have found routes", routes);
        List<RouteDefinition> routeList = routes.getRoutes();
        assertNotNull("Should have more than one route", routeList.size() > 0);
        System.out.println("Have routes: " + routeList);
    }
View Full Code Here

Examples of org.apache.camel.model.RoutesDefinition

    protected AbstractXmlApplicationContext applicationContext;
    protected CamelContext camelContext;

    public void testCanMarshalRoutes() throws Exception {
        CamelContextResource resource = new CamelContextResource(camelContext);
        RoutesDefinition routes = resource.getRoutesResource().getRouteDefinitions();
        List<RouteDefinition> list = routes.getRoutes();
        System.out.println("Found routes: " + list);

        // now lets marshall to XML
        JAXBContext context = JAXBContext.newInstance(RoutesDefinition.class.getPackage().getName());
        StringWriter out = new StringWriter();
View Full Code Here

Examples of org.apache.camel.model.RoutesDefinition

     * Returns the routes currently active within this context
     */
    @GET
    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public RoutesDefinition getRouteDefinitions() {
        RoutesDefinition answer = new RoutesDefinition();
        CamelContext camelContext = getCamelContext();
        if (camelContext != null) {
            List<RouteDefinition> list = camelContext.getRouteDefinitions();
            answer.setRoutes(list);
        }
        return answer;
    }
View Full Code Here

Examples of org.apache.camel.model.RoutesDefinition

        if (result == null) {
            throw new IOException("Cannot unmarshal to routes using JAXB from input stream: " + is);
        }

        // can either be routes or a single route
        RoutesDefinition answer = null;
        if (result instanceof RouteDefinition) {
            RouteDefinition route = (RouteDefinition) result;
            answer = new RoutesDefinition();
            answer.getRoutes().add(route);
        } else if (result instanceof RoutesDefinition) {
            answer = (RoutesDefinition) result;
        } else {
            throw new IllegalArgumentException("Unmarshalled object is an unsupported type: " + ObjectHelper.className(result) + " -> " + result);
        }
View Full Code Here

Examples of org.apache.camel.model.RoutesDefinition

        if (routes.isEmpty()) {
            return null;
        }

        // use a routes definition to dump the routes
        RoutesDefinition def = new RoutesDefinition();
        def.setRoutes(routes);
        return ModelHelper.dumpModelAsXml(def);
    }
View Full Code Here

Examples of org.apache.camel.model.RoutesDefinition

    @ManagedOperation(description = "Adds or updates existing routes from XML")
    public void addOrUpdateRoutesFromXml(String xml) throws Exception {
        // convert to model from xml
        InputStream is = context.getTypeConverter().mandatoryConvertTo(InputStream.class, xml);
        RoutesDefinition def = context.loadRoutesDefinition(is);
        if (def == null) {
            return;
        }

        // add will remove existing route first
        context.addRouteDefinitions(def.getRoutes());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.