Package eu.admire.dispel.graph

Examples of eu.admire.dispel.graph.Graph


        System.out.println(dot);
    }

    public void testSameNameInputs() throws Exception
    {
        Graph graph = new Graph();
        ProcessingElementNode nodeA = new ProcessingElementNode("uk.org.ogsadai.SQLQuery");
        graph.add(nodeA);
        ProcessingElementNode nodeB = new ProcessingElementNode("uk.org.ogsadai.TupleToWebRowSetCharArrays");
        graph.add(nodeB);
        ProcessingElementNode nodeC = new ProcessingElementNode("uk.org.ogsadai.DeliverToRequestStatus");
        graph.add(nodeC);
        Connection connection = new TeeConnection();
        nodeA.connectOutput("out1", 0, connection);
        nodeB.connectInput("in1", 0, connection);
        Connection connection2 = new TeeConnection();
        nodeB.connectOutput("data", 0, connection2);
View Full Code Here


        System.out.println(dot);
    }

    public void testLiteral() throws Exception
    {
        Graph graph = new Graph();
        ProcessingElementNode nodeA = new ProcessingElementNode("uk.org.ogsadai.SQLQuery");
        graph.add(nodeA);
        LiteralValuesNode nodeB = new LiteralValuesNode(1, 2, 3);
        graph.add(nodeB);
        LiteralValuesNode nodeC = new LiteralValuesNode(
                ListMarker.BEGIN,
                "this is a string that is too long",
                "another very long string that doesn't fit",
                "and a \\\"string\\\" with quotes",
                ListMarker.END,
                ListMarker.BEGIN,
                new Repeater(null, Arrays.asList(ListMarker.BEGIN, "X", "Y", 2, ListMarker.END)),
                ListMarker.END);
        graph.add(nodeC);
        nodeA.connectInput("in1", 0, nodeB.getOutput());
        nodeA.connectInput("in2", 0, nodeC.getOutput());
        String dot = DotGenerator.generate(graph);
//        writeFile(dot);
        System.out.println(dot);
View Full Code Here

        System.out.println(dot);
    }

    public void testComposite() throws Exception
    {
        Graph graph = new Graph();
        LiteralValuesNode nodeL = new LiteralValuesNode("VALUE");
        graph.add(nodeL);
        ProcessingElementNode nodeA = new ProcessingElementNode("uk.org.ogsadai.SQLQuery");
        nodeA.connectInput("expression", 0, nodeL.getOutput());
        ProcessingElementNode nodeB = new ProcessingElementNode("uk.org.ogsadai.TupleToWebRowSetCharArrays");
        Connection connection = new TeeConnection();
        nodeA.connectOutput("out1", 0, connection);
        nodeB.connectInput("in1", 0, connection);
        Connection out = new TeeConnection();
        nodeB.connectOutput("out2", 0, out);
        CompositeProcessingElement nodeC = new CompositeProcessingElement(
                "Composite",
                Arrays.<RequestNode>asList(nodeA, nodeB));
        Map<String, Map<Integer, Connection>> inputs = new HashMap<String, Map<Integer, Connection>>();
        nodeC.setInputs(inputs);
        Map<String, Map<Integer, Connection>> outputs = new HashMap<String, Map<Integer, Connection>>();
        Map<Integer, Connection> map = new HashMap<Integer, Connection>();
        map.put(0, out);
        outputs.put("out2", map);
        nodeC.setOutputs(outputs);
        graph.add(nodeC);
        ProcessingElementNode nodeD = new ProcessingElementNode("uk.org.ogsadai.DeliverToRequestStatus");
        graph.add(nodeD);
        nodeD.connectInput("data", 0, out);
        String dot = DotGenerator.generate(graph);
//        writeFile(dot);
        System.out.println(dot);
    }
View Full Code Here

        DispelEngineResult result = engine.processDispel(dispel);
       
        Collection<Graph> graphs = result.getExecutionGraphs();
        assertEquals("Expect a single execution graph", 1, graphs.size());
       
        Graph graph = graphs.iterator().next();
       
        boolean foundQueryPE = false;
        for( RequestNode node : graph.getNodes())
        {
            if (node instanceof ProcessingElementNode)
            {
                ProcessingElementNode peNode = (ProcessingElementNode) node;
               
View Full Code Here

        System.out.println(dot);
    }
   
    public void testUnconnectedComposite() throws Exception
    {
        Graph graph = new Graph();
        LiteralValuesNode nodeL = new LiteralValuesNode("VALUE");
        graph.add(nodeL);
        ProcessingElementNode nodeA = new ProcessingElementNode("uk.org.ogsadai.SQLQuery");
        nodeA.connectInput("expression", 0, nodeL.getOutput());
        ProcessingElementNode nodeB = new ProcessingElementNode("uk.org.ogsadai.TupleToWebRowSetCharArrays");
        Connection connection = new TeeConnection();
        nodeA.connectOutput("out1", 0, connection);
        nodeB.connectInput("in1", 0, connection);
        Connection out = new TeeConnection();
        nodeB.connectOutput("out2", 0, out);
        CompositeProcessingElement nodeC = new CompositeProcessingElement(
                "Composite",
                Arrays.<RequestNode>asList(nodeA, nodeB));
        Map<String, Map<Integer, Connection>> inputs = new HashMap<String, Map<Integer, Connection>>();
        nodeC.setInputs(inputs);
        Map<String, Map<Integer, Connection>> outputs = new HashMap<String, Map<Integer, Connection>>();
        Map<Integer, Connection> map = new HashMap<Integer, Connection>();
        map.put(0, out);
        outputs.put("out2", map);
        nodeC.setOutputs(outputs);
        graph.add(nodeC);
        String dot = DotGenerator.generate(graph);
//        writeFile(dot);
        System.out.println(dot);
    }
View Full Code Here

       
        // A -> B -> C ---v
        //      | -> D -> E
        //      
       
        Graph graph = new Graph();
        ProcessingElementNode a = new ProcessingElementNode("A");
        ProcessingElementNode b = new ProcessingElementNode("B");
        b.connectInput("in", 0, a.getOutput("out", 0));
        ProcessingElementNode c = new ProcessingElementNode("C");
        c.connectInput("in", 0, b.getOutput("out", 0));
        ProcessingElementNode d = new ProcessingElementNode("D");
        d.connectInput("in", 0, b.getOutput("out", 0));
        ProcessingElementNode e = new ProcessingElementNode("E");
        e.connectInput("in", 0, c.getOutput("out", 0));
        e.connectInput("in", 1, d.getOutput("out", 0));
       
        graph.add(a);
        graph.add(b);
        graph.add(c);
        graph.add(d);
        graph.add(e);
        
        Graph transformed = insert.transform(context, graph);
       
        System.out.println(transformed);
       
        List<RequestNode> nodes = transformed.getNodes();

        // 5 PE + 5 Observers + 1 Gatherer
        TestCase.assertEquals(11, nodes.size());
       
        //Gatherer should have 1 input with 5 indexes
View Full Code Here

        DispelEngineResult result = engine.processDispel(dispel);
       
        Collection<Graph> graphs = result.getExecutionGraphs();
        assertEquals("Expect a single execution graph", 1, graphs.size());
       
        Graph graph = graphs.iterator().next();
       
        int numQueryPE = 0;
        for( RequestNode node : graph.getNodes())
        {
            if (node instanceof ProcessingElementNode)
            {
                ProcessingElementNode peNode = (ProcessingElementNode) node;
               
View Full Code Here

        DISPELGraphBuilder builder =
            new DISPELGraphBuilder(registry, new SimpleDispelOptimiser());
        compiler.setRequestBuilder(builder);
        compiler.parse(new FileReader(DISPEL_PATH + "FunctionCreatingPE.dispel"));
        assertTrue(!builder.getSubmittedGraphs().isEmpty());
        Graph graph = builder.getSubmittedGraphs().iterator().next();
        String dot = DotGenerator.generate(graph);
        System.out.println(dot);
//        writeFile(dot);
    }
View Full Code Here

        Collection<Graph> graphs = result.getExecutionGraphs();
        assertEquals("Expect a single execution graph", 1, graphs.size());

        // Find SQL query node
        boolean haveSQLQueryNode = false;
        Graph graph = graphs.iterator().next();
        for( RequestNode node : graph.getNodes())
        {
            if (node instanceof ProcessingElementNode)
            {
                if (node.getName().equals("uk.org.ogsadai.SQLQuery"))
                {
View Full Code Here

        assertEquals("Expect a single execution graph", 1, graphs.size());

        Set<String> expectedNodes = new HashSet<String>();
        expectedNodes.add("uk.org.ogsadai.Echo");
        expectedNodes.add("eu.admire.Results");
        Graph graph = graphs.iterator().next();
        assertNodes(expectedNodes, graph);
    }
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.