Package com.denimgroup.threadfix.data.interfaces

Examples of com.denimgroup.threadfix.data.interfaces.Endpoint


    EndpointQuery query = EndpointQueryBuilder.start()
        .setInformationSourceType(InformationSourceType.DYNAMIC)
        .setDynamicPath(dynamicPath)
        .generateQuery();
   
    Endpoint endpoint = db.findBestMatch(query);
   
    if (endpoint == null) {
      return "null result";
    } else {
      return endpoint.getFilePath();
    }
  }
View Full Code Here


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

        assert generator.generateEndpoints().size() == 1 : "Size should have been 1 but was " +
                generator.generateEndpoints().size();

        Endpoint endpoint = generator.generateEndpoints().get(0);

        assert endpoint.getParameters().isEmpty() :
            "Parameters weren't empty. Got " + endpoint.getParameters();
        assert endpoint.getFilePath().endsWith("ChatController.cs") :
            "File path was " + endpoint.getFilePath() + " but should have ended with ChatController.cs";
        assert endpoint.getUrlPath().equals("/Chat") :
            "Actual path was " + endpoint.getUrlPath() + " when it should have been \"/Chat\"";
        assert endpoint.getStartingLineNumber() == 13 :
            "Starting line number was " + endpoint.getStartingLineNumber() + " but should have been 13.";

    }
View Full Code Here

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

        assert allMatches.size() == 1 :
                "Got " + allMatches.size() + " endpoints for " + endpointUrl + ": " + allMatches;

        Endpoint endpoint = allMatches.iterator().next();

        for (String param : params) {
            assert endpoint.getParameters().contains(param) :
                    "Parameters for " + endpointUrl + " didn't contain " + param + " : " + endpoint.getParameters();
        }
    }
View Full Code Here

    }

    @Override
    public void process(@Nonnull Finding finding) {
        String parameter = null;
        Endpoint endpoint = null;
        total++;

        if (parameterParser != null) {
            if (finding.getSurfaceLocation() != null) {
                parameter = parameterParser.parse(ThreadFixInterface.toEndpointQuery(finding));
                foundParameter++;
                finding.getSurfaceLocation().setParameter(parameter);
            }
        }

        if (database != null) {
            endpoint = database.findBestMatch(ThreadFixInterface.toEndpointQuery(finding));
        }

        if (endpoint != null) {
            finding.setCalculatedFilePath(endpoint.getFilePath());
            finding.setCalculatedUrlPath(endpoint.getUrlPath());

            if (parameter != null) {
                finding.setEntryPointLineNumber(endpoint.getLineNumberForParameter(parameter));
            } else {
                finding.setEntryPointLineNumber(endpoint.getStartingLineNumber());
            }

        } else {

            numberMissed++;
View Full Code Here

            Set<Endpoint> endpointList = database.findAllMatches(ThreadFixInterface.toEndpointQuery(finding));
            if (!endpointList.isEmpty()) {
                String expected = getExpectedPath(finding);
                if (expected != null) {
                    Endpoint endpoint = endpointList.iterator().next();

                    System.out.println(endpoint.getCSVLine(Endpoint.PrintFormat.STATIC));

                    String firstPath = endpoint.getUrlPath();
                    assert expected.equals(firstPath) :
                            "Failed for Finding : " + finding +
                                    ", was expecting the path " + expected +
                                    " but got " + firstPath + ".";
                }
View Full Code Here

          EndpointQueryBuilder.start()
            .setDynamicPath(httpMethodTest[0])
            .setHttpMethod(httpMethodTest[1])
            .generateQuery();
     
      Endpoint result = db.findBestMatch(query);
     
      String currentQuery = httpMethodTest[0] + ": " + httpMethodTest[1];
     
      if (result == null) {
        assertTrue("No result was found, but line " + httpMethodTest[2] + " was expected for " + currentQuery,
            httpMethodTest[2] == null);
      } else {
       
        //String currentQuery = httpMethodTest[0] + ": " + httpMethodTest[1];
       
        assertTrue("Got an endpoint, but was not expecting one with " + currentQuery,
            httpMethodTest[2] != null);
       
        Integer value = Integer.valueOf(httpMethodTest[2]);
       
        assertTrue("Got " + result.getStartingLineNumber() + " but was expecting " + value + " with " + currentQuery,
            value.equals(result.getStartingLineNumber()));
      }
    }
  }
View Full Code Here

                    EndpointQueryBuilder.start()
                            .setDynamicPath(httpMethodTest[0])
                            .setParameter(httpMethodTest[1])
                            .generateQuery();

            Endpoint result = db.findBestMatch(query);

            String currentQuery = httpMethodTest[0] + ": " + httpMethodTest[1];

            if (result == null) {
                assertTrue("No result was found, but line " + httpMethodTest[2] + " was expected for " + currentQuery,
                        httpMethodTest[2] == null);
            } else {
                assertTrue("Got an endpoint, but was not expecting one with " + currentQuery,
                        httpMethodTest[2] != null);

                Integer value = Integer.valueOf(httpMethodTest[2]);

                assertTrue("Got " + result.getStartingLineNumber() + " but was expecting " + value + " with " + currentQuery,
                        value.equals(result.getStartingLineNumber()));
            }
        }
    }
View Full Code Here

        EndpointQuery query = EndpointQueryBuilder.start()
                .setCodePoints(basicModelElements)
                .setStaticPath("java/org/springframework/samples/petclinic/repository/jpa/JpaOwnerRepositoryImpl.java")
                .generateQuery();

        Endpoint result = db.findBestMatch(query);

        assertTrue("Result was null!", result != null);
    }
View Full Code Here

  }
 
  @Override
  public Endpoint findBestMatch(@Nonnull EndpointQuery query) {
   
    Endpoint returnEndpoint = null;
   
    Set<Endpoint> endpoints = findAllMatches(query);
   
    if (!endpoints.isEmpty()) {
      returnEndpoint = endpoints.iterator().next();
View Full Code Here

TOP

Related Classes of com.denimgroup.threadfix.data.interfaces.Endpoint

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.