Package com.foursquare.heapaudit.test

Examples of com.foursquare.heapaudit.test.TestUtil$Recorder$Entry


  }

  @Override
  protected void doDelete(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    Entry e = entry(req);
    S3Object remove = map.remove(e);
    if (remove == null) {
      resp.sendError(404, "Not found " + e);
    } else {
      resp.sendError(HttpURLConnection.HTTP_NO_CONTENT, "Deleted");
View Full Code Here


    }

  }

  private Entry entry(HttpServletRequest req) {
    return new Entry(key(uri(req)));
  }
View Full Code Here

        log("doGet " + uri);
    if ("/".equals(uri.getPath())) {
      list(req, resp);
    } else {
      String key = uri.getPath().substring(1);
      Entry e = new Entry(key);
      S3Object obj = map.get(e);
        if (debug)
          log("map.get(" + key + ") = " + obj);
      if (obj == null) {
        resp.sendError(404, "Not here: " + e);
View Full Code Here

    if (maxKeysStr != null)
      maxKeys = Integer.parseInt(maxKeysStr);
    Writer w = new Writer();
    SortedMap<Entry, S3Object> submap = new TreeMap<Entry, S3Object>(map);
    if (prefix != null)
      submap = submap.tailMap(new Entry(prefix));
    int keyCount = 0;
    boolean truncated = false;
    String nextMarker = null;
    for (Entry e : submap.keySet()) {
      if (++keyCount > maxKeys) {
View Full Code Here

    log("doPut " + uri);
    if ("/".equals(uri.getPath())) {
      log("create bucket");
      bucket = true;
    } else {
      Entry e = new Entry(key(uri));
      e.setLastModified(new Date());
      e.setSize(req.getContentLength());
      e.setOwner(new Owner("id", "name"));
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      ServletInputStream is = req.getInputStream();
      byte b[] = new byte[128];
      while (true) {
        int len = is.read(b);
View Full Code Here

  }
 
  @Override
  public boolean parse(int level, Source source, boolean parentNot, boolean caseSensitive, boolean receive) {
    level++;
    Recorder recorder = source.getRecorder();
    int bookmark = source.getBookmark();
    int recIndex = recorder.getIndex();

    for (Iterator i = list.iterator(); i.hasNext();) {
      source.setBookmark(bookmark);

      ElementOutputList.ElementOutput elementOutput = (ElementOutputList.ElementOutput)i.next();
      Element element = elementOutput.getElement();
      Output output = elementOutput.getOutput();
     
      boolean elementNot = elementOutput.isNot();

      if (this.caseSensitive != null) {
        caseSensitive = this.caseSensitive.booleanValue();
      }
      if (elementOutput.isCaseSensitive() != null) {
        caseSensitive = elementOutput.isCaseSensitive().booleanValue();
      }

      boolean match = false;
      if (output.receive()) {
        if (receive) {
          match = recorder.playMatch(element, source.getBookmark());
          source.setBookmark(recorder.playBookmark());
        } else {
          output.init(source);
          int mindex = recorder.reserveMatchIndex(level, element, source.getBookmark(), parentNot, elementNot);
          int bindex = recorder.reserveBookmarkIndex();
          match = element.parse(level, source, not|parentNot|elementNot, caseSensitive, false);
          match = match != elementNot;
          recorder.set(level, source, element, bookmark, source.getBookmark(), source.getBestIndex(), mindex, bindex, match, parentNot, elementNot);
          output.set(source, bookmark);
        }
      } else {
        if (receive) {
          match = recorder.playMatch(element, source.getBookmark());
        } else {
          int index = recorder.reserveMatchIndex(level, element, source.getBookmark(), parentNot, elementNot);
          match = element.parse(level, source, not|parentNot|elementNot, caseSensitive, false);
          match = (match != elementNot);
          recorder.set(level, source, element, bookmark, source.getBookmark(), source.getBestIndex(), index, match, parentNot, elementNot);
        }
      }

      if (match) {
        if (receive && !elementNot && !not) {
          source.setBookmark(bookmark);
          output.init(source);
          element.parse(level, source, not|parentNot|elementNot, caseSensitive, receive);
          output.set(source, bookmark);
        }
                output = list.getOutput();
                if (output != null && receive) {
                    output.init(source);
                    output.set(source, bookmark);
                }
               
                return !not;
      }
    }
    if (not) {
      source.setBookmark(bookmark);
      source.skipCharacter();

      Output output = list.getOutput();
      if (output != null && receive) {
        output.init(source);
        output.set(source, bookmark);
      }
    } else {
      recorder.setIndex(recIndex);
    }

    return not;
  }
View Full Code Here

    boolean firstMatch;

    int bookmark;
    int firstBookmark;

    Recorder recorder = source.getRecorder();
    firstBookmark = bookmark = source.getBookmark();
   
    if (maxRepeats > 0) {
      if (receive) {
        match = firstMatch = recorder.playMatch(elementList, source.getBookmark());
      } else {
        int index = recorder.reserveMatchIndex(level, elementList, source.getBookmark(), parentNot, false);
        match = elementList.parse(level, source, not|parentNot, caseSensitive, false);
        match = firstMatch = (match && source.getBookmark() != bookmark);
        recorder.set(level, source, elementList, bookmark, source.getBookmark(), source.getBestIndex(), index, match, parentNot, false);
      }
    } else {
      match = firstMatch = true;
    }
   
    int repeats = 0;
   
    if (!not) {
      while (match) {
        if (receive) {
          source.setBookmark(bookmark);
          elementList.parse(level, source, not|parentNot, caseSensitive, true);
        }
        if (++repeats >= maxRepeats) {
          break;
        }
        if (source.reachedEnd()) {
          bookmark = source.getBookmark();
          break;
        }
        bookmark = source.getBookmark();

        if (receive) {
          match = recorder.playMatch(elementList, source.getBookmark());
        } else {
          int index = recorder.reserveMatchIndex(level, elementList, source.getBookmark(), parentNot, false);
          int sourceIndex = source.getBestIndex();
          match = elementList.parse(level, source, not|parentNot, caseSensitive, false);
          match = (match && source.getBookmark() != bookmark);
          recorder.set(level, source, elementList, bookmark, source.getBookmark(), sourceIndex, index, match, parentNot, false);
        }
      }
    }

    if (!match) {
View Full Code Here

    return list.iterator().hasNext();
  }

  public boolean parse(int level, Source source, boolean parentNot, boolean caseSensitive, boolean receive) {
    level++;
    Recorder recorder = source.getRecorder();
    int bestMatchIdx = source.getBestIndex();
    int startBookmark = source.getBookmark();
    int startIndex = recorder.getIndex();
   
    for (Iterator i = list.iterator(); i.hasNext();) {
      ElementOutput elementOutput = (ElementOutput)i.next();
      Element element = elementOutput.getElement();
      Output output = elementOutput.getOutput();
      boolean elementNot = elementOutput.isNot();

      if (this.caseSensitive != null) {
        caseSensitive = this.caseSensitive.booleanValue();
      }
      if (elementOutput.isCaseSensitive() != null) {
        caseSensitive = elementOutput.isCaseSensitive().booleanValue();
      }

      int bookmark = source.getBookmark();

      boolean match = false;
      if (output.receive()) {
        if (receive) {
          match = recorder.playMatch(element, source.getBookmark());
          source.setBookmark(recorder.playBookmark());
        } else {
          output.init(source);
          int mindex = recorder.reserveMatchIndex(level, element, source.getBookmark(), parentNot, elementNot);
          int bindex = recorder.reserveBookmarkIndex();
          match = element.parse(level, source, not|parentNot|elementNot, caseSensitive, false);
          match = match != elementNot;
          recorder.set(level, source, element, bookmark, source.getBookmark(), source.getBestIndex(), mindex, bindex, match, parentNot, elementNot);
          output.set(source, bookmark);
        }
      } else {
        if (receive) {
          match = recorder.playMatch(element, source.getBookmark());
        } else {
          int mindex = recorder.reserveMatchIndex(level, element, source.getBookmark(), parentNot, elementNot);
          match = element.parse(level, source, not|parentNot|elementNot, caseSensitive, false);
          match = match != elementNot;
          recorder.set(level, source, element, bookmark, source.getBookmark(), source.getBestIndex(), mindex, match, parentNot, elementNot);
        }
      }
     
      if (match == not) {
        if (!receive) {
          recorder.setIndex(startIndex);
        }
        return false;
      }
     
      if (not) {
View Full Code Here

  public void add(int id, Element element, int flags, Output output) {
    elementList.add(id, element, flags, output);
  }

  public boolean parse(int level, Source source, boolean parentNot, boolean caseSensitive, boolean receive) {
    Recorder recorder = source.getRecorder();
    int bookmark = source.getBookmark();

    boolean match;

    if (receive) {
      match = recorder.playMatch(elementList, source.getBookmark());
    } else {
      int index = recorder.reserveMatchIndex(level, elementList, source.getBookmark(), parentNot, false);
      match = elementList.parse(level, source, parentNot, caseSensitive, false);
      recorder.set(level, source, elementList, bookmark, source.getBookmark(), source.getBestIndex(), index, match, parentNot, false);
    }
   
    if (!match) {
      source.setBookmark(bookmark);
    }
View Full Code Here

                    for (TestMethod testMethod : inputTestData.getTestMethod()) {
                        List<TestRecord> originalTestRecords = testMethod.getTestRecord();
                        for (TestRecord originalTestRecord : originalTestRecords) {
                            if (originalTestRecord.getId().equals(testRecord.get(RECORD_POSITION))) {
                                OutputData outputData = new OutputData();
                                Entry outputEntry = new Entry();
                                outputEntry.setKey(ACTUAL_RESULT);
                                outputEntry.setValue(testRecord.get(ACTUAL_RESULT).toString());
                                outputData.getEntry().add(outputEntry);
                                originalTestRecord.setOutputData(outputData);
                                outputDataAdded = true;
                                break;
                            }
View Full Code Here

TOP

Related Classes of com.foursquare.heapaudit.test.TestUtil$Recorder$Entry

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.