Package com.opengamma.master.region

Examples of com.opengamma.master.region.RegionDocument


  //-------------------------------------------------------------------------
  @Test
  public void testGetRegion() {
    final ManageableRegion target = new ManageableRegion();
    target.setFullName("Bananaville");
    final RegionDocument result = new RegionDocument(target);
    when(_underlying.get(OID, VersionCorrection.LATEST)).thenReturn(result);
   
    Response test = _resource.get(null, null);
    assertEquals(Status.OK.getStatusCode(), test.getStatus());
    assertSame(result, test.getEntity());
View Full Code Here


  @Test
  public void testUpdateRegion() {
    final ManageableRegion target = new ManageableRegion();
    target.setFullName("Bananaville");
    final RegionDocument request = new RegionDocument(target);
    request.setUniqueId(OID.atLatestVersion());
   
    final RegionDocument result = new RegionDocument(target);
    result.setUniqueId(OID.atVersion("1"));
    when(_underlying.update(same(request))).thenReturn(result);
   
    Response test = _resource.update(_uriInfo, request);
    assertEquals(Status.CREATED.getStatusCode(), test.getStatus());
    assertSame(result, test.getEntity());
View Full Code Here

    inputRegion.setFullName(NAME);
    inputRegion.setClassification(RegionClassification.INDEPENDENT_STATE);
    inputRegion.setCountry(Country.FR);
    inputRegion.setCurrency(Currency.EUR);
    inputRegion.setTimeZone(ZoneId.of("Europe/Paris"));
    RegionDocument inputDoc = new RegionDocument(inputRegion);
    addedDoc = master.add(inputDoc);
  }
View Full Code Here

  public void test_get_noMatch() {
    master.get(UniqueId.of("A", "B"));
  }

  public void test_get_match() {
    RegionDocument result = master.get(addedDoc.getUniqueId());
    assertEquals(UniqueId.of("MemReg", "1"), result.getUniqueId());
    assertEquals(addedDoc, result);
  }
View Full Code Here

  //-------------------------------------------------------------------------
  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);
   
View Full Code Here

  }

  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);
   
View Full Code Here

  //-------------------------------------------------------------------------
  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);
   
View Full Code Here

    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);
View Full Code Here

    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);
View Full Code Here

TOP

Related Classes of com.opengamma.master.region.RegionDocument

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.