Package com.denimgroup.threadfix.framework.engine.parameter

Examples of com.denimgroup.threadfix.framework.engine.parameter.ParameterParser


                .generateQuery();
    }

    @Test
    public void testBasicDataFlow() {
        ParameterParser webFormsParser = new WebFormsParameterParser();

        EndpointQuery query = generateCodePoints(
                "string sql = @\"SELECT * FROM [User] WHERE Username = '\" + txtUsername.Text + @\"'\";",
                "sql",
                "sql",
                "SqlCommand"
        );

        String param = webFormsParser.parse(query);

        assert param != null : "Received null parameter.";
        assert param.equals("txtUsername") : "Didn't get txtUsername, got " + param;
    }
View Full Code Here


        assert param.equals("txtUsername") : "Didn't get txtUsername, got " + param;
    }

    @Test
    public void testOnlyOnLeftSideOfEquals() {
        ParameterParser webFormsParser = new WebFormsParameterParser();

        EndpointQuery query = generateCodePoints(
                "retVal = cmd.ExecuteReader();",
                "retVal",
                "ExecuteDataReader",
                "lblStateLocalTaxes.Text = String.Format(\"{0:c}\", (decimal)reader[\"StateLocalTaxes\"]);"
        );

        String param = webFormsParser.parse(query);

        assert param == null : "Didn't get null, got " + param;
    }
View Full Code Here

        assert param == null : "Didn't get null, got " + param;
    }

    @Test
    public void testOnBothSidesOfEquals() {
        ParameterParser webFormsParser = new WebFormsParameterParser();

        EndpointQuery query = generateCodePoints(
                "lblMessage.Text = \"Message sent to \" + Request[\"email\"] + \" with subject \" + txtSubject.Text + \" and content \" + txtMessage.Text;",
                "lblMessage.Text = \"Message sent to \" + Request[\"email\"] + \" with subject \" + txtSubject.Text + \" and content \" + txtMessage.Text;"
        );

        String param = webFormsParser.parse(query);

        assert param != null : "Param was null.";
        assert !param.equals("lblMessage") :
                "Got lblMessage, but was expecting something else because " +
                        "lblMessages is on the left side of the equals.";
View Full Code Here

TOP

Related Classes of com.denimgroup.threadfix.framework.engine.parameter.ParameterParser

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.