Package com.opengamma.master.orgs

Examples of com.opengamma.master.orgs.OrganizationSearchResult


 
  @Test
  public void test_search_tickerNoMatch() {
    OrganizationSearchRequest request = new OrganizationSearchRequest();
    request.setObligorTicker("NO_SUCH_TICKER");
    OrganizationSearchResult test = _orgMaster.search(request);

    assertEquals(0, test.getDocuments().size());
  }
View Full Code Here


  @Test
  public void test_search_tickerFound() {
    OrganizationSearchRequest request = new OrganizationSearchRequest();
    request.setObligorTicker("ticker_102");
    OrganizationSearchResult test = _orgMaster.search(request);

    assertEquals(1, test.getDocuments().size());
    assert102(test.getDocuments().get(0));
 
View Full Code Here

 
  @Test
  public void test_search_OrganizationIds_none() {
    OrganizationSearchRequest request = new OrganizationSearchRequest();
    request.setOrganizationObjectIds(new ArrayList<ObjectId>());
    OrganizationSearchResult test = _orgMaster.search(request);

    assertEquals(0, test.getDocuments().size());
  }
View Full Code Here

  public void test_search_OrganizationIds() {
    OrganizationSearchRequest request = new OrganizationSearchRequest();
    request.addOrganizationObjectId(ObjectId.of("DbOrg", "101"));
    request.addOrganizationObjectId(ObjectId.of("DbOrg", "201"));
    request.addOrganizationObjectId(ObjectId.of("DbOrg", "9999"));
    OrganizationSearchResult test = _orgMaster.search(request);

    assertEquals(2, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert202(test.getDocuments().get(1));
  }
View Full Code Here

 
  @Test
  public void test_search_versionAsOf_below() {
    OrganizationSearchRequest request = new OrganizationSearchRequest();
    request.setVersionCorrection(VersionCorrection.ofVersionAsOf(_version1Instant.minusSeconds(5)));
    OrganizationSearchResult test = _orgMaster.search(request);

    assertEquals(0, test.getDocuments().size());
  }
View Full Code Here

  @Test
  public void test_search_versionAsOf_mid() {
    OrganizationSearchRequest request = new OrganizationSearchRequest();
    request.setVersionCorrection(VersionCorrection.ofVersionAsOf(_version1Instant.plusSeconds(5)));
    OrganizationSearchResult test = _orgMaster.search(request);

    assertEquals(3, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert102(test.getDocuments().get(1));
    assert201(test.getDocuments().get(2))// old version
  }
View Full Code Here

  @Test
  public void test_search_versionAsOf_above() {
    OrganizationSearchRequest request = new OrganizationSearchRequest();
    request.setVersionCorrection(VersionCorrection.ofVersionAsOf(_version2Instant.plusSeconds(5)));
    OrganizationSearchResult test = _orgMaster.search(request);

    assertEquals(3, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert102(test.getDocuments().get(1));
    assert202(test.getDocuments().get(2))// new version
  }
View Full Code Here

    for (OrganizationDocument doc : _store.values()) {
      if (request.matches(doc)) {
        list.add(cloneOrganizationDocument(doc));
      }
    }
    final OrganizationSearchResult result = new OrganizationSearchResult();
    result.setPaging(Paging.of(request.getPagingRequest(), list));
    result.getDocuments().addAll(request.getPagingRequest().select(list));
    return result;
  }
View Full Code Here

  }

  @POST
  @Path("organizationSearches")
  public Response search(OrganizationSearchRequest request) {
    OrganizationSearchResult result = getOrganizationMaster().search(request);
    return responseOkFudge(result);
  }
View Full Code Here

    // Create the document search cache and register a organisation master searcher
    _documentSearchCache = new EHCachingSearchCache(name + "Organization", cacheManager, new EHCachingSearchCache.Searcher() {
      @Override
      public ObjectsPair<Integer, List<UniqueId>> search(Bean request, PagingRequest pagingRequest) {
        // Fetch search results from underlying master
        OrganizationSearchResult result = ((OrganizationMaster) getUnderlying()).search((OrganizationSearchRequest)
            EHCachingSearchCache.withPagingRequest(request, pagingRequest));

        // Cache the result documents
        EHCachingSearchCache.cacheDocuments(result.getDocuments(), getUidToDocumentCache());

        // Return the list of result UniqueIds
        return new ObjectsPair<>(result.getPaging().getTotalItems(),
                                 EHCachingSearchCache.extractUniqueIds(result.getDocuments()));
      }
    });

    // Create the history search cache and register a organisation master searcher
    _historySearchCache = new EHCachingSearchCache(name + "OrganizationHistory", cacheManager, new EHCachingSearchCache.Searcher() {
      @Override
      public ObjectsPair<Integer, List<UniqueId>> search(Bean request, PagingRequest pagingRequest) {
        // Fetch search results from underlying master
        OrganizationHistoryResult result = ((OrganizationMaster) getUnderlying()).history((OrganizationHistoryRequest)
            EHCachingSearchCache.withPagingRequest(request, pagingRequest));

        // Cache the result documents
        EHCachingSearchCache.cacheDocuments(result.getDocuments(), getUidToDocumentCache());

        // Return the list of result UniqueIds
        return new ObjectsPair<>(result.getPaging().getTotalItems(),
                                 EHCachingSearchCache.extractUniqueIds(result.getDocuments()));
      }
    });

    // Prime document search cache
    OrganizationSearchRequest defaultSearch = new OrganizationSearchRequest();
View Full Code Here

TOP

Related Classes of com.opengamma.master.orgs.OrganizationSearchResult

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.