Package com.opengamma.master.security

Examples of com.opengamma.master.security.SecuritySearchRequest


    testEmpty.remove(OTHER_UID);
  }

  public void test_remove_populatedMaster() {
    testPopulated.remove(doc1.getUniqueId());
    SecuritySearchRequest request = new SecuritySearchRequest();
    SecuritySearchResult result = testPopulated.search(request);
    assertEquals(1, result.getPaging().getTotalItems());
    List<SecurityDocument> docs = result.getDocuments();
    assertEquals(1, docs.size());
    assertEquals(true, docs.contains(doc2));
View Full Code Here


    _securityMaster = securityMaster;
  }

  @Override
  public ManageableSecurity visitSwaptionSecurity(SwaptionSecurity security) {
    SecuritySearchResult result = _securityMaster.search(new SecuritySearchRequest(security.getUnderlyingId()));
    ManageableSecurity underlying = result.getSingleSecurity();
    return _securityMaster.get(underlying.getUniqueId().getObjectId(), _versionCorrection).getSecurity();
  }
View Full Code Here

    return _securityMaster.get(underlying.getUniqueId().getObjectId(), _versionCorrection).getSecurity();
  }

  @Override
  public ManageableSecurity visitCreditDefaultSwapOptionSecurity(CreditDefaultSwapOptionSecurity security) {
    SecuritySearchResult result = _securityMaster.search(new SecuritySearchRequest(security.getUnderlyingId()));
    ManageableSecurity underlying = result.getSingleSecurity();
    return _securityMaster.get(underlying.getUniqueId().getObjectId(), _versionCorrection).getSecurity();
  }
View Full Code Here

    for (int requestSize = 1; requestSize < TOTAL_SIZE; requestSize = requestSize + 17) {
      for (int requestStartStepSize = 1; requestStartStepSize < TOTAL_SIZE / 2; requestStartStepSize = requestStartStepSize + 71) {
        EHCachingSearchCache searchCache = getCleanSearchCache();
        for (int requestStartPos = 0; requestStartPos * requestStartStepSize < TOTAL_SIZE * 4; requestStartPos++) {
          PagingRequest pagingRequest = PagingRequest.ofIndex((requestStartPos * requestStartStepSize) % TOTAL_SIZE, requestSize);
          assertEquals(searchCache.search(new SecuritySearchRequest(), pagingRequest, false).getSecond(),
                       buildResultIDs(
                         PagingRequest.ofIndex(
                           pagingRequest.getFirstItem(),
                           Math.min(pagingRequest.getLastItem() - pagingRequest.getFirstItem(),
                                    TOTAL_SIZE - pagingRequest.getFirstItem()
View Full Code Here

    for (int requestSize = 1; requestSize < TOTAL_SIZE; requestSize = requestSize + 17) {
      for (int requestStartStepSize = 1; requestStartStepSize < TOTAL_SIZE / 2; requestStartStepSize = requestStartStepSize + 71) {
        EHCachingSearchCache searchCache = getCleanSearchCache();
        for (int requestStartPos = 0; requestStartPos * requestStartStepSize < TOTAL_SIZE * 4; requestStartPos++) {
          PagingRequest pagingRequest = PagingRequest.ofIndex((requestStartPos * requestStartStepSize) % TOTAL_SIZE, requestSize);
          searchCache.prefetch(new SecuritySearchRequest(), pagingRequest);
          assertEquals(searchCache.search(new SecuritySearchRequest(), pagingRequest, false).getSecond(),
                       buildResultIDs(
                         PagingRequest.ofIndex(
                           pagingRequest.getFirstItem(),
                           Math.min(pagingRequest.getLastItem() - pagingRequest.getFirstItem(),
                                    TOTAL_SIZE - pagingRequest.getFirstItem()
View Full Code Here

  public String getSecurityJSON(@PathParam("securityExternalId") String securityExternalIdStr) {
    if (StringUtils.isEmpty(securityExternalIdStr)) {
      return new JSONObject().toString();
    }
    ExternalId securityExternalId = ExternalId.parse(securityExternalIdStr);
    SecuritySearchResult searchResult = _securityMaster.search(new SecuritySearchRequest(securityExternalId));
    if (searchResult.getSecurities().size() == 0) {
      throw new DataNotFoundException("No security found with ID " + securityExternalId);
    }
    ManageableSecurity security = searchResult.getFirstSecurity();
    BeanVisitor<JSONObject> securityVisitor =
View Full Code Here

    SecurityDocument securityDocument;
    if (securityLink.getObjectId() != null) {
      // TODO do we definitely want the LATEST?
      securityDocument = _securityMaster.get(securityLink.getObjectId(), VersionCorrection.LATEST);
    } else {
      SecuritySearchRequest searchRequest = new SecuritySearchRequest(securityLink.getExternalId());
      SecuritySearchResult searchResult = _securityMaster.search(searchRequest);
      securityDocument = searchResult.getFirstDocument();
      if (securityDocument == null) {
        throw new DataNotFoundException("No security found with external IDs " + securityLink.getExternalId());
      }
View Full Code Here

                        false, false, false, true,
                        true, null).execute();

    assertEquals(_portfolioMaster.search(new PortfolioSearchRequest()).getPortfolios().size(), expectedPortfolios);
    assertEquals(_positionMaster.search(new PositionSearchRequest()).getPositions().size(), expectedPositions);
    assertEquals(_securityMaster.search(new SecuritySearchRequest()).getSecurities().size(), expectedSecurities);
  }
View Full Code Here

    File file = new File(fileLocation);
    new PortfolioLoader(_toolContext, "guff", null, file.getAbsolutePath(), true, false, false, false, true, true, null).execute();

    assertEquals(_portfolioMaster.search(new PortfolioSearchRequest()).getPortfolios().size(), 1);
    assertEquals(_positionMaster.search(new PositionSearchRequest()).getPositions().size(), 0);
    assertEquals(_securityMaster.search(new SecuritySearchRequest()).getSecurities().size(), 0);
  }
View Full Code Here

    catch (OpenGammaRuntimeException e) {

      // Parse failed so no data should have been added to masters
      assertEquals(_portfolioMaster.search(new PortfolioSearchRequest()).getPortfolios().size(), 0);
      assertEquals(_positionMaster.search(new PositionSearchRequest()).getPositions().size(), 0);
      assertEquals(_securityMaster.search(new SecuritySearchRequest()).getSecurities().size(), 0);
    }
  }
View Full Code Here

TOP

Related Classes of com.opengamma.master.security.SecuritySearchRequest

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.