Package eu.admire.dispel.graph

Examples of eu.admire.dispel.graph.Graph


        ResultNode result = new ResultNode("result");
        a.connectOutput("out", 0, b.getInput("in", 0));
        out.connectInput(b.getOutput("out", 0));
        a.connectInput("in", 0, in.getOutput());
        result.connectInput(b.getOutput("xxx", 0));
        Graph graph = new Graph();
        graph.add(a);
        graph.add(b);
        graph.add(in);
        graph.add(out);
        graph.add(result);
//        System.out.println(GraphConverter.convertToDISPEL(graph));
    }
View Full Code Here


        ProcessingElementNode a = new ProcessingElementNode("eu.admire.A");
        ProcessingElementNode b = new ProcessingElementNode("eu.admire.B");
        ResultNode result = new ResultNode("result");
        a.connectOutput("out", 0, b.getInput("in", 0));
        result.connectInput(b.getOutput("out", 0));
        Graph graph = new Graph();
        graph.add(a);
        graph.add(b);
        graph.add(result);
//        System.out.println(GraphConverter.convertToDISPEL(graph));
    }
View Full Code Here

        ProcessingElementNode a = new ProcessingElementNode("eu.admire.A");
        ProcessingElementNode dt = new ProcessingElementNode("eu.admire.DataTransfer");
        ProcessingElementNode b = new ProcessingElementNode("eu.admire.B");
        a.connectOutput("out", 0, dt.getInput("input", 0));
        dt.connectOutput("output", 0, b.getInput("in", 0));
        Graph graph = new Graph();
        graph.add(a);
        graph.add(b);
        graph.add(dt);
//        System.out.println(GraphConverter.convertToDISPEL(graph));
    }
View Full Code Here

        ProcessingElementNode b = new ProcessingElementNode("eu.admire.B");
        ProcessingElementNode c = new ProcessingElementNode("eu.admire.C");
        ProcessingElementNode d = new ProcessingElementNode("eu.admire.D");
        a.connectOutput("out", 0, b.getInput("in", 0));
        c.connectOutput("out", 0, d.getInput("in", 0));
        Graph graph = new Graph();
        graph.add(a);
        graph.add(b);
        graph.add(c);
        graph.add(d);
//        System.out.println(GraphConverter.convertToDISPEL(graph));
    }
View Full Code Here

    @Override
    public Graph transform(RequestContext context, Graph graph)
            throws TransformationException
    {
        LOG.debug("Flattening DISPEL graph.");
        Graph newGraph = new Graph();
        for (RequestNode node : graph.getNodes())
        {
            if (node instanceof CompositeProcessingElement)
            {
                List<RequestNode> elements =
                    ((CompositeProcessingElement) node).getElements();
                newGraph.addAll(elements);
            }
            else
            {
                newGraph.add(node);
            }
        }
        return newGraph;
    }
View Full Code Here

    @Test
    public void testSimple() throws Exception
    {
        GatewayLocation gw1 = new SimpleGatewayLocation("GWA", "EPR");
        GatewayLocation gw2 = new SimpleGatewayLocation("GWB", "EPR");
        Graph graph = new Graph();
        ProcessingElementNode a = new ProcessingElementNode("A");
        a.addAnnotation(AnnotationKeys.GATEWAY, gw1);
        ProcessingElementNode b = new ProcessingElementNode("B");
        b.addAnnotation(AnnotationKeys.GATEWAY, gw1);
        ProcessingElementNode c = new ProcessingElementNode("C");
        c.addAnnotation(AnnotationKeys.GATEWAY, gw2);
        b.connectInput("in", 0, a.getOutput("out", 0));
        graph.add(a); graph.add(b); graph.add(c);
       
        SimplePartitioner partitioner = new SimplePartitioner();
        Map<GatewayLocation, Graph> partitions = partitioner.partition(graph);
        TestCase.assertEquals(2, partitions.size());
        Graph g = partitions.get(gw1);
        TestCase.assertTrue(g.getNodes().containsAll(Arrays.asList(a, b)));
        g = partitions.get(gw2);
        TestCase.assertTrue(g.getNodes().contains(c));
    }
View Full Code Here

        b.connectInput("in1", 0, a.getOutput("out", 0));
        ProcessingElementNode c = new ProcessingElementNode("C");
        b.connectInput("in2", 0, c.getOutput("out", 0));
        ProcessingElementNode d = new ProcessingElementNode("D");
        ProcessingElementNode e = new ProcessingElementNode("E");
        Graph graph = GraphUtilities.getConnectedComponent(a);
        List<RequestNode> nodes = graph.getNodes();
        Assert.assertEquals(3, nodes.size());
        Assert.assertTrue(nodes.contains(a));
        Assert.assertTrue(nodes.contains(b));
        Assert.assertTrue(nodes.contains(c));
    }
View Full Code Here

        c.connectInput("in", 0, b.getOutput("out", 0));
        a.connectInput("in", 0, c.getOutput("out", 0));
        ProcessingElementNode d = new ProcessingElementNode("D");
        d.connectInput("in", 0, b.getOutput("out2", 0));
        ProcessingElementNode e = new ProcessingElementNode("E");
        Graph graph = GraphUtilities.getConnectedComponent(a);
        List<RequestNode> nodes = graph.getNodes();
        Assert.assertEquals(4, nodes.size());
        Assert.assertTrue(nodes.contains(a));
        Assert.assertTrue(nodes.contains(b));
        Assert.assertTrue(nodes.contains(c));
        Assert.assertTrue(nodes.contains(d));
View Full Code Here

   
    @Test
    public void testSingleNode()
    {
        ProcessingElementNode a = new ProcessingElementNode("A");
        Graph graph = GraphUtilities.getConnectedComponent(a);
        List<RequestNode> nodes = graph.getNodes();
        Assert.assertEquals(1, nodes.size());
        Assert.assertTrue(nodes.contains(a));
    }
View Full Code Here

        a.connectInput("in", 0, b.getOutput("out", 0));
        CompositeProcessingElement composite =
            new CompositeProcessingElement("C", Arrays.<RequestNode>asList(a, b));
        composite.setInput("in", 0, b.getInput("in", 0));
        c.connectOutput("out", 0, composite.getInput("in", 0));
        Graph graph = GraphUtilities.getConnectedComponent(composite);
        List<RequestNode> nodes = graph.getNodes();
        System.out.println(graph);
        Assert.assertEquals(2, nodes.size());
        Assert.assertTrue(nodes.contains(composite));
        Assert.assertTrue(nodes.contains(c));
    }
View Full Code Here

TOP

Related Classes of eu.admire.dispel.graph.Graph

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.