Package com.denimgroup.threadfix.framework.engine.full

Examples of com.denimgroup.threadfix.framework.engine.full.EndpointDatabase


    private static void listEndpoints(File rootFile) {

        List<Endpoint> endpoints = list();

        EndpointDatabase database = EndpointDatabaseFactory.getDatabase(rootFile);

        if (database != null) {
            endpoints = database.generateEndpoints();
        }

    Collections.sort(endpoints);
   
    if (endpoints.isEmpty()) {
View Full Code Here


   
    for (String page : pages) {
      partialMappings.add(new DefaultPartialMapping(null, dynamicRoot + page));
    }
   
    EndpointDatabase db = EndpointDatabaseFactory.getDatabase(file, partialMappings);
   
    assertTrue(db.getFrameworkType() == FrameworkType.JSP);
   
    return db;
  }
View Full Code Here

  }
 
  @Test
  public void testBodgeItDynamicToStaticPathQueries() {
   
    EndpointDatabase db = getBodgeItDatabase();
   
    for (String page : pages) {
     
      String dynamicPage = dynamicRoot + page;
      String staticPage  = staticRoot + page;
View Full Code Here

                DotNetControllerParser.parse(ResourceManager.getDotNetMvcFile("InstructorController.cs"));

        DotNetEndpointGenerator generator =
                new DotNetEndpointGenerator(routeMappings, null, mappings);

        EndpointDatabase database = EndpointDatabaseFactory.getDatabase(
                generator, FrameworkType.DOT_NET_MVC, new DotNetPathCleaner());

        assert database != null;

        EndpointQuery query = EndpointQueryBuilder.start().setDynamicPath("/Instructor/Details/6").generateQuery();

        Set<Endpoint> allMatches = database.findAllMatches(query);

        assert allMatches.size() == 1 : "Size was " + allMatches.size() + " instead of 1.";

    }
View Full Code Here

        for (String project : DotNetDetectionTests.projects) {

            System.out.println(project);

            EndpointDatabase database = EndpointDatabaseFactory.getDatabase(new File(TestConstants.DOT_NET_ROOT + "/" + project));

            if (database == null) {
                errorMessages.add("Database was null for project " + project);
            } else if (database.getFrameworkType() != FrameworkType.DOT_NET_MVC) {
                errorMessages.add("Got " + database.getFrameworkType() + " instead of DOT_NET for " + project);
            } else if (database.generateEndpoints().size() == 0) {
                errorMessages.add("Database was empty for "  + project);
            }
        }

        if (!errorMessages.isEmpty()) {
View Full Code Here

    public static final String project = "ASP.NET MVC 5 Demo Authentication App with Facebook and Google",
            folderName = TestConstants.DOT_NET_ROOT + "/" + project;

    @Test
    public void testEndpointDatabase() {
        EndpointDatabase database = EndpointDatabaseFactory.getDatabase(new File(folderName));

        assert database != null : "Unable to generate a database for " + folderName + ", check the filesystem.";

        EndpointQuery endpointQuery = EndpointQueryBuilder.start()
                .setHttpMethod("POST")
                .setDynamicPath("/Account/Login")
                .setParameter("UserName")
                .setInformationSourceType(InformationSourceType.DYNAMIC)
                .generateQuery();

        Set<Endpoint> allMatches = database.findAllMatches(endpointQuery);

        assert allMatches.size() == 1 : "No endpoint was found.";

        Set<String> parameters = allMatches.iterator().next().getParameters();
View Full Code Here

    }

    // This test is meant to ensure that the model parameter is not included (student in this case)
    @Test
    public void testBindIncludeParameters() {
        EndpointDatabase database = EndpointDatabaseFactory.getDatabase(getContosoLocation());

        assert database != null : "Unable to generate a database for " + folderName + ", check the filesystem.";

        EndpointQuery endpointQuery = EndpointQueryBuilder.start()
                .setHttpMethod("POST")
                .setDynamicPath("/Student/Create")
                .setParameter("LastName")
                .setInformationSourceType(InformationSourceType.DYNAMIC)
                .generateQuery();

        Set<Endpoint> allMatches = database.findAllMatches(endpointQuery);

        assert allMatches.size() == 1 : allMatches.size() + " endpoint(s) found.";

        Set<String> parameters = allMatches.iterator().next().getParameters();
View Full Code Here

        checkParameters(TestConstants.WEB_FORMS_MODIFIED, "/StudentsAdd.aspx", params);
    }

    @Test
    public void testRiskEParameters() {
        EndpointDatabase database = EndpointDatabaseFactory.getDatabase(TestConstants.RISK_E_UTILITY);

        checkParameters(database, "/ViewStatement.aspx", "StatementID");
        checkParameters(database, "/LoginPage.aspx", "txtPassword", "txtUsername");
        checkParameters(database, "/Message.aspx", "Msg");
        checkParameters(database, "/MakePayment.aspx", "txtCardNumber");
View Full Code Here

        checkParameters(database, "/MakePayment.aspx", "txtCardNumber");
    }

    @Test
    public void testWebGoatDotNetParameters() {
        EndpointDatabase database = EndpointDatabaseFactory.getDatabase(TestConstants.WEBGOAT_DOT_NET);

        checkParameters(database, "/WebGoatCoins/ChangePassword.aspx", "txtPassword1", "txtPassword2");
        checkParameters(database, "/WebGoatCoins/CustomerLogin.aspx", "txtUserName", "txtPassword");
        checkParameters(database, "/WebGoatCoins/ForgotPassword.aspx", "txtAnswer", "txtEmail");
        checkParameters(database, "/WebGoatCoins/ProductDetails.aspx", "productNumber", "txtEmail", "txtComment", "hiddenFieldProductID");
View Full Code Here

        checkParameters(database, "/AddNewUser.aspx", "Username", "Password", "Email", "SecurityAnswer");
        checkParameters(database, "/ProxySetup.aspx", "txtName");
    }

    private void checkParameters(String databaseLocation, String endpointUrl, String... params) {
        EndpointDatabase database = EndpointDatabaseFactory.getDatabase(databaseLocation);

        assert database != null : "Database was null for " + databaseLocation;

        checkParameters(database, endpointUrl, params);
    }
View Full Code Here

TOP

Related Classes of com.denimgroup.threadfix.framework.engine.full.EndpointDatabase

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.