Package eu.admire.dispel.graph

Examples of eu.admire.dispel.graph.ProcessingElementNode


    {
        for (RequestNode node : graph.getNodes())
        {
            if (node instanceof ProcessingElementNode)
            {
                ProcessingElementNode peNode = (ProcessingElementNode) node;
                ProcessingElementDescriptor descriptor =
                    peNode.getProcessingElementDescriptor();
               
                if (descriptor == null)
                {
                    throw new TransformationException(
                        "No processing element descriptor for PE : " +
                        peNode.getName());
                }
               
                for( ProcessingElementInputDescriptor inputDesc :
                     descriptor.getInputs())
                {
                    if (inputDesc.getIsDataSourceInput())
                    {
                        // We have an anchor (that keeps the soul)
                       
                        // It is connected to a literal?
                        Connection conn =
                            peNode.getInput(inputDesc.getName(), 0);
                       
                        RequestNode source = conn.getSource();
                        if (source instanceof LiteralValuesNode)
                        {
                            List<Object> values =
View Full Code Here


    }
   
    @Test
    public void testTuple() throws Exception
    {
        ProcessingElementNode a = new ProcessingElementNode("A");
        ProcessingElementNode b = new ProcessingElementNode("B");
        ProcessingElementInputDescriptor inp = new ProcessingElementInputDescriptor("input");
        TupleSType t = new TupleSType();
        t.addElement("el1", new PrimitiveSType("String"));
        t.addElement("el2", new PrimitiveSType("Integer"));
        inp.setSType(t);
        ProcessingElementDescriptor desc =
            new SimpleProcessingElementDescriptor(
                    Arrays.asList(inp),
                    Collections.<ProcessingElementOutputDescriptor>emptyList(),
                    null);
        a.setDescriptor(desc);
        ProcessingElementOutputDescriptor outp = new ProcessingElementOutputDescriptor("output");
        t = new TupleSType();
        t.setRest(true);
        outp.setSType(t);
        desc = new SimpleProcessingElementDescriptor(
                    Collections.<ProcessingElementInputDescriptor>emptyList(),
                    Arrays.asList(outp),
                    null);
        b.setDescriptor(desc);
        b.connectOutput("output", 0, a.getInput("input", 0));
        Graph graph = new Graph();
        graph.add(a);
        graph.add(b);
        TypeValidator validator = new TypeValidator();
        validator.setTypeChecker(new StrictTypeChecker());
View Full Code Here

    }

    @Test
    public void testTupleIncompatible() throws Exception
    {
        ProcessingElementNode a = new ProcessingElementNode("A");
        ProcessingElementNode b = new ProcessingElementNode("B");
        ProcessingElementInputDescriptor inp = new ProcessingElementInputDescriptor("input");
        TupleSType t = new TupleSType();
        t.addElement("a", new PrimitiveSType("String"));
        inp.setSType(t);
        ProcessingElementDescriptor desc =
            new SimpleProcessingElementDescriptor(
                    Arrays.asList(inp),
                    Collections.<ProcessingElementOutputDescriptor>emptyList(),
                    null);
        a.setDescriptor(desc);
        ProcessingElementOutputDescriptor outp = new ProcessingElementOutputDescriptor("output");
        t = new TupleSType();
        t.addElement("b", new PrimitiveSType("String"));
        outp.setSType(t);
        desc = new SimpleProcessingElementDescriptor(
                    Collections.<ProcessingElementInputDescriptor>emptyList(),
                    Arrays.asList(outp),
                    null);
        b.setDescriptor(desc);
        b.connectOutput("output", 0, a.getInput("input", 0));
        Graph graph = new Graph();
        graph.add(a);
        graph.add(b);
        TypeValidator validator = new TypeValidator();
        validator.setTypeChecker(new StrictTypeChecker());
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);
View Full Code Here

    }
   
    public void testSimple() throws Exception
    {
        Graph graph = new Graph();
        ProcessingElementNode nodeA = new ProcessingElementNode("uk.org.ogsadai.SQLQuery");
        graph.add(nodeA);
        ProcessingElementNode nodeB = new ProcessingElementNode("uk.org.ogsadai.DeliverToRequestStatus");
        graph.add(nodeB);
        Connection connection = new TeeConnection();
        nodeA.connectOutput("out1", 0, connection);
        nodeB.connectInput("in1", 0, connection);
        Connection connection2 = new TeeConnection();
        nodeA.connectOutput("out2", 0, connection2);
        nodeB.connectInput("in2", 0, connection2);
        String dot = DotGenerator.generate(graph);
//        writeFile(dot);
        System.out.println(dot);
    }
View Full Code Here

        boolean foundQueryPE = false;
        for( RequestNode node : graph.getNodes())
        {
            if (node instanceof ProcessingElementNode)
            {
                ProcessingElementNode peNode = (ProcessingElementNode) node;
               
                if (peNode.getName().equals("uk.org.ogsadai.SQLQuery"))
                {
                    foundQueryPE = true;
                    assertEquals(
                        "Expected annotation",
                        "MyAnnotationValue",
                        peNode.getAnnotation("my.anno.key"));
                }
            }
        }
       
        assertTrue(
View Full Code Here

    }

    public void testSimpleWithVariableName() throws Exception
    {       
        Graph graph = new Graph();
        ProcessingElementNode nodeA = new ProcessingElementNode("uk.org.ogsadai.SQLQuery");
        graph.add(nodeA);
        ProcessingElementNode nodeB = new ProcessingElementNode("eu.admire.Results");
        graph.add(nodeB);
        Connection connection = new TeeConnection();
        nodeA.connectOutput("out1", 0, connection);
        nodeB.connectInput("in1", 0, connection);
        Connection connection2 = new TeeConnection();
        nodeA.connectOutput("out2", 0, connection2);
        nodeB.connectInput("in2", 0, connection2);
        Map<String, Variable> variables = new HashMap<String, Variable>();
        variables.put("query", new Variable(new ProcessingElementType("uk.org.ogsadai.SQLQuery"), nodeA));
        variables.put("results", new Variable(new ProcessingElementType("eu.admire.Results"), nodeB));
        String dot = DotGenerator.generate(graph.getNodes(), variables);
        writeFile(dot);
View Full Code Here

    }

    public void testMultipleInputs() throws Exception
    {
        Graph graph = new Graph();
        ProcessingElementNode nodeA = new ProcessingElementNode("uk.org.ogsadai.SQLQuery");
        graph.add(nodeA);
        ProcessingElementNode nodeB = new ProcessingElementNode("uk.org.ogsadai.DeliverToRequestStatus");
        graph.add(nodeB);
        Connection connection = new TeeConnection();
        nodeA.connectOutput("out1", 0, connection);
        nodeB.connectInput("in1", 0, connection);
        Connection connection2 = new TeeConnection();
        nodeA.connectOutput("out1", 1, connection2);
        nodeB.connectInput("in2", 0, connection2);
        String dot = DotGenerator.generate(graph);
//        writeFile(dot);
        System.out.println(dot);
    }
View Full Code Here

        outputDescriptors.add(outputDesc);
        ProcessingElementDescriptor desc =
            new SimpleProcessingElementDescriptor(inputDescriptors, outputDescriptors, null);

        Graph graph = new Graph();
        ProcessingElementNode nodeA = new ProcessingElementNode("uk.org.ogsadai.SQLQuery");
        nodeA.setDescriptor(desc);
        graph.add(nodeA);
        ProcessingElementNode nodeB = new ProcessingElementNode("uk.org.ogsadai.DeliverToRequestStatus");
        nodeB.setDescriptor(desc);
        graph.add(nodeB);
        Connection connection = new TeeConnection();
        nodeA.connectOutput("out1", 0, connection);
        nodeB.connectInput("in1", 0, connection);
        Connection connection2 = new TeeConnection();
        nodeA.connectOutput("out1", 1, connection2);
        nodeB.connectInput("in2", 0, connection2);
        String dot = DotGenerator.generate(graph);
//        writeFile(dot);
        System.out.println(dot);
    }
View Full Code Here

        int numQueryPE = 0;
        for( RequestNode node : graph.getNodes())
        {
            if (node instanceof ProcessingElementNode)
            {
                ProcessingElementNode peNode = (ProcessingElementNode) node;
               
                if (peNode.getName().equals("uk.org.ogsadai.SQLQuery"))
                {
                    numQueryPE++;
                    assertEquals(
                        "Expected annotation",
                        "MyAnnotationValue",
                        peNode.getAnnotation("my.anno.key"));
                }
            }
        }
       
        assertEquals(
View Full Code Here

TOP

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

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.