Package com.opengamma.master.position

Examples of com.opengamma.master.position.PositionSearchResult


          futures.add(_executor.submit(new Callable<Pair<UniqueId, ObjectId>>() {
            @Override
            public Pair<UniqueId, ObjectId> call() throws Exception {
              final PositionSearchRequest searchRequest = new PositionSearchRequest();
              searchRequest.setPositionProviderId(positionId);
              final PositionSearchResult searchResult = _positions.search(searchRequest);
              ObjectId id = null;
              if (searchResult.getFirstPosition() != null) {
                id = searchResult.getFirstPosition().getUniqueId().getObjectId();
                s_logger.debug("Found position {} in master at {}", position, id);
              }
              if (id == null) {
                s_cache.putIfAbsent(positionId, MISSING);
              } else {
View Full Code Here


  //-------------------------------------------------------------------------
  @Test
  public void test_search_versionAsOf_below() {
    PositionSearchRequest request = new PositionSearchRequest();
    request.setVersionCorrection(VersionCorrection.ofVersionAsOf(_version1Instant.minusSeconds(5)));
    PositionSearchResult test = _posMaster.search(request);
   
    assertEquals(0, test.getDocuments().size());
  }
View Full Code Here

  @Test
  public void test_search_versionAsOf_mid() {
    PositionSearchRequest request = new PositionSearchRequest();
    request.setVersionCorrection(VersionCorrection.ofVersionAsOf(_version1Instant.plusSeconds(5)));
    PositionSearchResult test = _posMaster.search(request);
   
    assertEquals(6, test.getDocuments().size());
    assert100(test.getDocuments().get(0));
    assert120(test.getDocuments().get(1));
    assert121(test.getDocuments().get(2));
    assert122(test.getDocuments().get(3));
    assert123(test.getDocuments().get(4));
    assert221(test.getDocuments().get(5))// old version
  }
View Full Code Here

  @Test
  public void test_search_versionAsOf_above() {
    PositionSearchRequest request = new PositionSearchRequest();
    request.setVersionCorrection(VersionCorrection.ofVersionAsOf(_version2Instant.plusSeconds(5)));
    PositionSearchResult test = _posMaster.search(request);
   
    assertEquals(6, test.getDocuments().size());
    assert100(test.getDocuments().get(0));
    assert120(test.getDocuments().get(1));
    assert121(test.getDocuments().get(2));
    assert122(test.getDocuments().get(3));
    assert123(test.getDocuments().get(4));
    assert222(test.getDocuments().get(5))// new version
  }
View Full Code Here

    assertNotNull(trade2.getUniqueId());
   
    PositionSearchRequest requestByTrade = new PositionSearchRequest();
    requestByTrade.addTradeObjectId(trade1.getUniqueId().getObjectId());
   
    PositionSearchResult test = _posMaster.search(requestByTrade);
    assertEquals(1, test.getDocuments().size());
    assertEquals(doc, test.getDocuments().get(0));
   
    PositionSearchRequest requestByPosition = new PositionSearchRequest();
    requestByPosition.addPositionObjectId(position.getUniqueId().getObjectId());
    test = _posMaster.search(requestByTrade);
    assertEquals(1, test.getDocuments().size());
    assertEquals(doc, test.getDocuments().get(0));
  }
View Full Code Here

    assertNotNull(trade2.getUniqueId());
   
    PositionSearchRequest requestByTrade = new PositionSearchRequest();
    requestByTrade.addTradeObjectId(trade1.getUniqueId().getObjectId());
   
    PositionSearchResult test = _posMaster.search(requestByTrade);
    assertEquals(1, test.getDocuments().size());
    assertEquals(doc, test.getDocuments().get(0));
   
    PositionSearchRequest requestByPosition = new PositionSearchRequest();
    requestByPosition.addPositionObjectId(position.getUniqueId().getObjectId());
    test = _posMaster.search(requestByTrade);
    assertEquals(1, test.getDocuments().size());
    assertEquals(doc, test.getDocuments().get(0));
  }
View Full Code Here

    request.addPositionObjectId(ObjectId.of("DbPos", "120"));
    request.addPositionObjectId(ObjectId.of("DbPos", "122"));
    request.addTradeObjectId(ObjectId.of("DbPos", "402"));
    request.addTradeObjectId(ObjectId.of("DbPos", "403"));
    request.addTradeObjectId(ObjectId.of("DbPos", "407"));
    PositionSearchResult test = _posMaster.search(request);
   
    assertEquals(1, test.getDocuments().size());
    assert122(test.getDocuments().get(0));
  }
View Full Code Here

    request.addPositionObjectId(ObjectId.of("DbPos", "120"));
    request.addPositionObjectId(ObjectId.of("DbPos", "121"));
    request.addTradeObjectId(ObjectId.of("DbPos", "402"));
    request.addTradeObjectId(ObjectId.of("DbPos", "403"));
    request.addTradeObjectId(ObjectId.of("DbPos", "407"));
    PositionSearchResult test = _posMaster.search(request);
   
    assertEquals(0, test.getDocuments().size());
  }
View Full Code Here

  @Test
  public void test_search_noKeys_Exact_noMatch() {
    PositionSearchRequest request = new PositionSearchRequest();
    request.setSecurityIdSearch(new ExternalIdSearch());
    request.getSecurityIdSearch().setSearchType(ExternalIdSearchType.EXACT);
    PositionSearchResult test = _posMaster.search(request);
   
    assertEquals(0, test.getDocuments().size());
  }
View Full Code Here

  @Test
  public void test_search_noKeys_All_noMatch() {
    PositionSearchRequest request = new PositionSearchRequest();
    request.setSecurityIdSearch(new ExternalIdSearch());
    request.getSecurityIdSearch().setSearchType(ExternalIdSearchType.ALL);
    PositionSearchResult test = _posMaster.search(request);
   
    assertEquals(0, test.getDocuments().size());
  }
View Full Code Here

TOP

Related Classes of com.opengamma.master.position.PositionSearchResult

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.