Examples of RegionMaster


Examples of com.opengamma.master.region.RegionMaster

  //-------------------------------------------------------------------------
  @Override
  public void init(ComponentRepository repo, LinkedHashMap<String, String> regionuration) {

    RegionMaster master = new EHCachingRegionMaster(getClassifier(),
                                                    getUnderlying(),
                                                    getCacheManager());

    // register
    ComponentInfo info = new ComponentInfo(RegionMaster.class, getClassifier());
View Full Code Here

Examples of com.opengamma.master.region.RegionMaster

  private FudgeContext _fudgeContext;

  @BeforeMethod(groups = TestGroup.UNIT)
  public void createFudgeContext() {
    _fudgeContext = OpenGammaFudgeContext.getInstance();
    final RegionMaster regionMaster = new InMemoryRegionMaster();
    RegionFileReader.createPopulated(regionMaster);
    _regionSource = new MasterRegionSource(regionMaster);
  }
View Full Code Here

Examples of com.opengamma.master.region.RegionMaster

    new MasterRegionSource(null, null);
  }

  //-------------------------------------------------------------------------
  public void test_getRegion_UniqueId_noOverride_found() throws Exception {
    RegionMaster mock = mock(RegionMaster.class);
   
    RegionDocument doc = new RegionDocument(example());
    when(mock.get(UID)).thenReturn(doc);
    MasterRegionSource test = new MasterRegionSource(mock);
    Region testResult = test.get(UID);
    verify(mock, times(1)).get(UID);
   
    assertEquals(example(), testResult);
View Full Code Here

Examples of com.opengamma.master.region.RegionMaster

   
    assertEquals(example(), testResult);
  }

  public void test_getRegion_UniqueId_found() throws Exception {
    RegionMaster mock = mock(RegionMaster.class);
   
    RegionDocument doc = new RegionDocument(example());
    when(mock.get(OID, VC)).thenReturn(doc);
    MasterRegionSource test = new MasterRegionSource(mock, VC);
    Region testResult = test.get(UID);
    verify(mock, times(1)).get(OID, VC);
   
    assertEquals(example(), testResult);
View Full Code Here

Examples of com.opengamma.master.region.RegionMaster

    assertEquals(example(), testResult);
  }

  @Test(expectedExceptions = DataNotFoundException.class)
  public void test_getRegion_UniqueId_notFound() throws Exception {
    RegionMaster mock = mock(RegionMaster.class);
   
    when(mock.get(OID, VC)).thenThrow(new DataNotFoundException(""));
    MasterRegionSource test = new MasterRegionSource(mock, VC);
    try {
      test.get(UID);
    } finally {
      verify(mock, times(1)).get(OID, VC);
View Full Code Here

Examples of com.opengamma.master.region.RegionMaster

    }
  }

  //-------------------------------------------------------------------------
  public void test_getRegion_ObjectId_found() throws Exception {
    RegionMaster mock = mock(RegionMaster.class);
   
    RegionDocument doc = new RegionDocument(example());
    when(mock.get(OID, VC)).thenReturn(doc);
    MasterRegionSource test = new MasterRegionSource(mock, VC);
    Region testResult = test.get(OID, VC);
    verify(mock, times(1)).get(OID, VC);
   
    assertEquals(example(), testResult);
View Full Code Here

Examples of com.opengamma.master.region.RegionMaster

    assertEquals(example(), testResult);
  }

  @Test(expectedExceptions = DataNotFoundException.class)
  public void test_getRegion_ObjectId_notFound() throws Exception {
    RegionMaster mock = mock(RegionMaster.class);
   
    when(mock.get(OID, VC)).thenThrow(new DataNotFoundException(""));
    MasterRegionSource test = new MasterRegionSource(mock, VC);
    try {
      test.get(OID, VC);
    } finally {
      verify(mock, times(1)).get(OID, VC);
View Full Code Here

Examples of com.opengamma.master.region.RegionMaster

    }
  }

  //-------------------------------------------------------------------------
  public void test_getRegion_ExternalId_found() throws Exception {
    RegionMaster mock = mock(RegionMaster.class);
    RegionSearchRequest request = new RegionSearchRequest(ID);
    request.setPagingRequest(PagingRequest.ONE);
    request.setVersionCorrection(VC);
   
    RegionSearchResult result = new RegionSearchResult();
    result.getDocuments().add(new RegionDocument(example()));
   
    when(mock.search(request)).thenReturn(result);
    MasterRegionSource test = new MasterRegionSource(mock, VC);
    Region testResult = test.getHighestLevelRegion(ID);
    verify(mock, times(1)).search(request);
   
    assertEquals(example(), testResult);
View Full Code Here

Examples of com.opengamma.master.region.RegionMaster

   
    assertEquals(example(), testResult);
  }

  public void test_getRegion_ExternalId_notFound() throws Exception {
    RegionMaster mock = mock(RegionMaster.class);
    RegionSearchRequest request = new RegionSearchRequest(ID);
    request.setPagingRequest(PagingRequest.ONE);
    request.setVersionCorrection(VC);
   
    RegionSearchResult result = new RegionSearchResult();
   
    when(mock.search(request)).thenReturn(result);
    MasterRegionSource test = new MasterRegionSource(mock, VC);
    Region testResult = test.getHighestLevelRegion(ID);
    verify(mock, times(1)).search(request);
   
    assertEquals(null, testResult);
View Full Code Here

Examples of com.opengamma.master.region.RegionMaster

    assertEquals(null, testResult);
  }

  //-------------------------------------------------------------------------
  public void test_getRegion_ExternalIdBundle_found() throws Exception {
    RegionMaster mock = mock(RegionMaster.class);
    RegionSearchRequest request = new RegionSearchRequest(BUNDLE);
    request.setPagingRequest(PagingRequest.ONE);
    request.setVersionCorrection(VC);
   
    RegionSearchResult result = new RegionSearchResult();
    result.getDocuments().add(new RegionDocument(example()));
   
    when(mock.search(request)).thenReturn(result);
    MasterRegionSource test = new MasterRegionSource(mock, VC);
    Region testResult = test.getHighestLevelRegion(BUNDLE);
    verify(mock, times(1)).search(request);
   
    assertEquals(example(), testResult);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.