Package eu.admire.dispel.graph

Examples of eu.admire.dispel.graph.Graph


    @Test
    public void testOneGraph() throws Exception
    {
        GatewayLocation gw = new SimpleGatewayLocation("GWA", "EPR");
        Graph graph = new Graph();
        ProcessingElementNode a = new ProcessingElementNode("A");
        a.addAnnotation(AnnotationKeys.GATEWAY, gw);
        ProcessingElementNode b = new ProcessingElementNode("B");
        b.addAnnotation(AnnotationKeys.GATEWAY, gw);
        ProcessingElementNode c = new ProcessingElementNode("C");
        c.addAnnotation(AnnotationKeys.GATEWAY, gw);
        b.connectInput("in", 0, a.getOutput("out", 0));
        c.connectInput("in", 0, b.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(1, partitions.size());
        Graph g = partitions.get(gw);
        TestCase.assertEquals(3, g.getNodes().size());
        TestCase.assertTrue(g.getNodes().containsAll(Arrays.asList(a, b, c)));
    }
View Full Code Here


        ProcessingElementNode c = new ProcessingElementNode("C");
        ProcessingElementNode d = new ProcessingElementNode("D");
        a.connectInput("in1", 0, b.getOutput("out", 0));
        a.connectInput("in2", 0, c.getOutput("out", 0));
        a.connectInput("in3", 0, d.getOutput("out", 0));
        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

       
        do
        {
            processedComposite = false;

            Graph newGraph = new Graph();
            for (RequestNode node : graph.getNodes())
            {
                // Don't process a CPE twice - the optimiser set includes
                // flatten then we will never get a CPE here.
                if (!(node instanceof CompositeProcessingElement))
                {
                    String impl = null;
                    if (node instanceof ProcessingElementNode)
                    {
                        String name = ((ProcessingElementNode)node).getChosenPEOrNodeName();
                        Map<String, Set<DispelObject>> reg;
                        try
                        {
                            reg = mAdmireRegistry.lookup(Collections.singleton(name));
                        }
                        catch (LookupFailedException e)
                        {
                            throw new TransformationException(e);
                        }
                        Iterator<DispelObject> iterator = reg.get(name).iterator();
                        // assume that there is at least one PE
                        if (!iterator.hasNext())
                        {
                            throw new TransformationException(
                                    new UnregisteredUsedObjectException(name));
                        }
                        impl = iterator.next().dispel;
                    }
                   
                    if (impl != null)
                    {
                        insertComposite(context, newGraph, node, impl);
                        processedComposite = true;
                    }
                    else
                    {
                        newGraph.add(node);
                    }
                }
                else
                {
                    newGraph.add(node);
                }
            }

            graph = newGraph;
View Full Code Here

    {
        DISPELGraphBuilder builder =
            runDISPEL(new StringReader(
                "Type A is PE(<Connection:String input> => <>); " +
                "A a = new A; |- \"xxxx\" -|:String => a.input; submit a; "));
        Graph graph = builder.getSubmittedGraphs().iterator().next();
        TypeValidator validator = new TypeValidator();
        validator.setTypeChecker(new StrictTypeChecker());
        validator.transform(null, graph);
    }
View Full Code Here

                    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());
        validator.transform(null, graph);
    }
View Full Code Here

                    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());
        try
        {
            validator.transform(null, graph);
View Full Code Here

        super.tearDown();
    }
   
    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);
View Full Code Here

        System.out.println(dot);
    }

    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);
        System.out.println(dot);
    }
View Full Code Here

        System.out.println(dot);
    }

    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);
View Full Code Here

        outputDesc.setSType(list);
        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);
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.