Skip to content
Snippets Groups Projects
Select Git revision
  • ad614ca626101079993c6aacdbfcef5b887d6451
  • main default protected
  • Kelvinrr-patch-3
  • radius_update
  • revert-616-apollo_pan
  • vims
  • 0.10
  • Kelvinrr-patch-2
  • revert-563-minirf_fix
  • Kelvinrr-patch-1
  • 0.9
  • acpaquette-patch-3
  • acpaquette-patch-2
  • acpaquette-patch-1
  • spiceql
  • ci-coverage
  • 0.10.0
  • 0.9.1
  • 0.9.0
  • 0.8.7
  • 0.8.8
  • 0.8.6
  • 0.8.3
  • 0.8.4
  • 0.8.5
  • 0.8.2
  • 0.8.1
  • 0.8.0
  • 0.7.3
  • 0.7.2
  • 0.7.1
  • 0.7.0
  • 0.6.5
  • 0.6.4
  • 0.6.3
  • 0.6.2
36 results

AleTest.cpp

Blame
    • Kristin's avatar
      ad614ca6
      ale::States implementation (#314) · ad614ca6
      Kristin authored
      
      * Adds an initial header file for the States
      
      * Small updates to State header re: disucssion about not including units
      
      * Adds most of an implementation and tests for just the constructors
      
      * Actually add tests
      
      * Adding tests for all except reduceCache
      
      * Adding in tests for minimizeCache
      
      * Add rough draft of minimizecache to states
      
      * Update error throws and a bit more cleanup
      
      * Clean up weird way I was creating vectors of states for tests
      
      * Restore Lauren's test data values
      
      * Add tests to bring test coverage up
      
      * Fix tests I didn't test before pushing up
      
      * Update for review comments 1
      
      * Make other updates based on review comments
      
      * Update to make minimizeCache return a new States object and change a lot of function signatures to use const references for vectors
      
      * Move interpolation-related utils out of States into ale.h and update tests appropriately
      
      * Updated state interpolation to reduce needed times
      
      * Changed the position and velocities in the test fixture to values from functions
      
      * Updated the spline interpolation to use the interpolation subset
      
      * Removed parenthese again
      
      * Added tests for vector size checks
      
      * Addressed PR feedback
      
      * Removed the interpolateState function as it was a copy of interpolate function
      
      * Updated States to use interpolate and not interpolateState
      
      * Removed interpolateState tests
      
      * Updated state tests
      
      * Removed interpolateState from ale header
      
      * Updated interpolation tests
      
      Co-authored-by: default avatarAdoram-Kershner <ladoramkershner@igswzawglt0046.gs.doi.net>
      Co-authored-by: default avatarJesse Mapel <jam826@nau.edu>
      Co-authored-by: default avatarAdam Paquette <acpaquette@usgs.gov>
      Co-authored-by: default avatarJesse Mapel <jmapel@usgs.gov>
      ad614ca6
      History
      ale::States implementation (#314)
      Kristin authored
      
      * Adds an initial header file for the States
      
      * Small updates to State header re: disucssion about not including units
      
      * Adds most of an implementation and tests for just the constructors
      
      * Actually add tests
      
      * Adding tests for all except reduceCache
      
      * Adding in tests for minimizeCache
      
      * Add rough draft of minimizecache to states
      
      * Update error throws and a bit more cleanup
      
      * Clean up weird way I was creating vectors of states for tests
      
      * Restore Lauren's test data values
      
      * Add tests to bring test coverage up
      
      * Fix tests I didn't test before pushing up
      
      * Update for review comments 1
      
      * Make other updates based on review comments
      
      * Update to make minimizeCache return a new States object and change a lot of function signatures to use const references for vectors
      
      * Move interpolation-related utils out of States into ale.h and update tests appropriately
      
      * Updated state interpolation to reduce needed times
      
      * Changed the position and velocities in the test fixture to values from functions
      
      * Updated the spline interpolation to use the interpolation subset
      
      * Removed parenthese again
      
      * Added tests for vector size checks
      
      * Addressed PR feedback
      
      * Removed the interpolateState function as it was a copy of interpolate function
      
      * Updated States to use interpolate and not interpolateState
      
      * Removed interpolateState tests
      
      * Updated state tests
      
      * Removed interpolateState from ale header
      
      * Updated interpolation tests
      
      Co-authored-by: default avatarAdoram-Kershner <ladoramkershner@igswzawglt0046.gs.doi.net>
      Co-authored-by: default avatarJesse Mapel <jam826@nau.edu>
      Co-authored-by: default avatarAdam Paquette <acpaquette@usgs.gov>
      Co-authored-by: default avatarJesse Mapel <jmapel@usgs.gov>
    SearchServlet.java 3.68 KiB
    
    import java.util.logging.Logger;
    import java.util.Map;
    import java.util.List;
    import java.util.ArrayList;
    
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.nio.charset.Charset;
    
    import java.io.UnsupportedEncodingException;
    import java.net.URLDecoder;
    
    import java.security.Principal;
    
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    
    public class SearchServlet extends javax.servlet.http.HttpServlet
    {
       private static final Logger         LOGGER   = Logger.getLogger("PSearch");
       private static final SearchSettings settings = SearchSettings.getInstance("discovery.properties");
    
    
       public void init() throws ServletException
       {
          super.init();
    
          LOGGER.info("URLs : " + settings.serviceUrls.toString());
          LOGGER.info("DB   : " + settings.dbConn.toString());
       }
    
    
       protected void doGet(HttpServletRequest request, HttpServletResponse response)
          throws ServletException, IOException, UnsupportedEncodingException
       {
          LOGGER.info("trace");
    
          long startTime_msec = System.currentTimeMillis();
    
          legacyLogEntry(request);
    
          Map<String, String[]> params = request.getParameterMap();
    
          try
          {
             Coord       coord           = new Coord(params);
             SubsurveyId subsurveyId     = new SubsurveyId(params);
    
             Inputs inputs = new Inputs(/*auth*/null, coord, subsurveyId, false);
    
             /* query Obscore table */
    
             DbPSearch dbps;
             synchronized(DbPSearch.class)
             {
                dbps = new DbPSearch();
             }
             String[] pubdidArr = dbps.queryOverlapingPubdid(coord, subsurveyId);
    
    
    
             final String RESPONSE_ENCODING = "UTF-8";
    
             /* if filters installed response will be wrapped */
    
             if(response instanceof PubdidResponseWrapper)
             {
                LOGGER.info("response-type is PubdidResponseWrapper");
    
                response.setContentType("text/plain");
                response.setCharacterEncoding(RESPONSE_ENCODING);
    
                /* collect all search description and set to wrapped response */
    
                SearchDescription search = new SearchDescription();
                search.pubdidArr = pubdidArr;
                search.inputs = inputs;
    
                PubdidResponseWrapper pubdidWrapper = (PubdidResponseWrapper) response;
                pubdidWrapper.set(search);
             }
             else
             {
                LOGGER.info("response-type is HttpServletResponse");
    
                response.setContentType("text/plain");
                response.setCharacterEncoding(RESPONSE_ENCODING);
                PrintWriter writer = response.getWriter();
    
                for(String pubdid : pubdidArr)
                {
                   writer.println(pubdid);
                }
                writer.close();
             }
          }
          catch (IllegalArgumentException illArg)
          {
             response.sendError(HttpServletResponse.SC_BAD_REQUEST,
                   "Request with incorrect parameters: " + illArg.getMessage());
             return;
          }
          catch(Exception ex)
          {
             LOGGER.info("Exception: " + ex.getMessage());
             ex.printStackTrace();
          }
    
          return;
       }
    
    
       private void legacyLogEntry(HttpServletRequest request) throws UnsupportedEncodingException
       {
          StringBuffer requestURL = request.getRequestURL();
          if (request.getQueryString() != null)
          {
             requestURL.append("?").append(request.getQueryString());
             String completeURL = requestURL.toString();
             String className = this.getClass().getSimpleName();
             LOGGER.info(className + " vlkb req from: "
                   + request.getRemoteAddr()
                   + " doGet: " + URLDecoder.decode(completeURL, "UTF-8"));
          }
       }
    
    
    }