Package dk.brics.jwig.analysis.graph

Examples of dk.brics.jwig.analysis.graph.StateMachine


        this.fullStateMachine = fullStateMachine;
    }

    @Override
    public SiteMap construct() {
        StateMachine stateMachine = removeLambdaAndFilterTransitions(fullStateMachine);
        Set<State> seen = new HashSet<State>();
        LinkedList<State> worklist = new LinkedList<State>();
        SiteMap map = new SiteMap();
        for (WebMethodState initialState : stateMachine.getInitialStates()) {
            worklist.add(initialState);
            map.addPage(SiteMapper.makePage(initialState.getMethod()));
            seen.add(initialState);
        }
        while (!worklist.isEmpty()) {
View Full Code Here


        }
        return map;
    }

    private StateMachine removeLambdaAndFilterTransitions(StateMachine machine) {
        StateMachine clone = machine.clone();
        boolean more = true;
        while (more) {
            more = false;
            for (State s : clone.getAllStates()) {
                if (s != null) {
                    for (Transition t : s.getTransitions()) {
                        if (t instanceof LambdaTransition
                                || t instanceof FilterTransition) {
                            State target = t.getTarget();
View Full Code Here

    private static Logger log = Logger.getLogger(InvocationDetector.class);

    public StateMachine detect(Interface interfacee) {
        log.info("Detecting invocations of makeURL");

        StateMachine stateMachine = new StateMachine();
        addRegisteredMethods(interfacee, stateMachine);
        buildCallGraph(stateMachine);
        log.info("Done detecting invocations of makeURL");
        log.info("Analyzing the gap names of XML.plug invocations");
        return stateMachine;
View Full Code Here

    private static final int JWIG_ANALYZE_STATEMENTS = 17;

    @Test
    public void testEmpty() {
        StateMachine stateMachine = new Jaive(MyEmptyWebSite.class)
                .getStateMachine();
        final FormChecker checker = new FormChecker(stateMachine);
        Set<SootMethod> xmlReturners = checker.findXMLReturners();
        Map<Stmt, ValueBox> analysisStatements = checker
                .markAnalysisStatements(stateMachine.getPluggings(),
                        xmlReturners);
        // no starting states --> empty state machine
        assertEquals(0, analysisStatements.size());
    }
View Full Code Here

        assertEquals(0, analysisStatements.size());
    }

    @Test
    public void test() {
        StateMachine stateMachine = new Jaive(MyWebSite.class)
                .getStateMachine();
        final FormChecker checker = new FormChecker(stateMachine);
        Set<SootMethod> xmlReturners = checker.findXMLReturners();
        Map<Stmt, ValueBox> analysisStatements = checker
                .markAnalysisStatements(stateMachine.getPluggings(),
                        xmlReturners);
        assertEquals(11 + JWIG_ANALYZE_STATEMENTS, analysisStatements.size());
    }
View Full Code Here

    public void saveFlowGraph() {
        DotVisualizer visualizer = new DotVisualizer(stateMachine);
        System.out.println("Saving flowgraph");
        saveFlowGraph(visualizer, "lambda");

        final StateMachine clone = stateMachine.clone();
        clone.removeLambdas();

        DotVisualizer v2 = new DotVisualizer(clone);
        saveFlowGraph(v2, "");
        System.out.println("Done");
    }
View Full Code Here

        }
    }

    @Test
    public void test() {
        StateMachine stateMachine = new Jaive(MyWebSite.class)
                .getStateMachine();
        Set<SootMethod> xmlReturners = new FormChecker(stateMachine)
                .findXMLReturners();
        assertEquals(5, xmlReturners.size());
    }
View Full Code Here

    private static final int JWIG_CLASSES = 2;

    @Test
    public void test() {
        StateMachine stateMachine = new Jaive(MyWebSite.class)
                .getStateMachine();
        final FormChecker checker = new FormChecker(stateMachine);
        Set<SootMethod> xmlReturners = checker.findXMLReturners();
        final Collection<Plugging> pluggings = stateMachine.getPluggings();
        List<String> classes = checker.markAnalysisClasses(pluggings,
                xmlReturners);
        // webapp & handler = 2 classes

        assertEquals(2 + JWIG_CLASSES, classes.size());
View Full Code Here

TOP

Related Classes of dk.brics.jwig.analysis.graph.StateMachine

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.