Package com.opengamma.master.region

Examples of com.opengamma.master.region.ManageableRegion


    updateRegion(name, fullName, regionClassification, countryISO, currencyISO, timeZoneId);
    return Response.ok().build();
  }

  private URI updateRegion(String name, String fullName, RegionClassification classification, String countryISO, String currencyISO, String timeZoneId) {
    ManageableRegion region = new ManageableRegion();
    region.setUniqueId(data().getRegion().getUniqueId());
    region.setParentRegionIds(data().getRegion().getRegion().getParentRegionIds());
    region.setName(name);
    region.setFullName(fullName);
    region.setClassification(classification);
    region.setCountry(countryISO != null ? Country.of(countryISO) : null);
    region.setCurrency(currencyISO != null ? Currency.of(currencyISO) : null);
    region.setTimeZone(timeZoneId != null ? ZoneId.of(timeZoneId) : null);
    RegionDocument doc = new RegionDocument(region);
    doc = data().getRegionMaster().update(doc);
    data().setRegion(doc);
    return WebRegionResource.uri(data());
  }
View Full Code Here


  public void test_search_name() {
    RegionSearchRequest request = new RegionSearchRequest();
    request.setName("United Kingdom");
    assertEquals(1, _regionMaster.search(request).getDocuments().size());
    RegionDocument doc = _regionMaster.search(request).getFirstDocument();
    ManageableRegion ukRegion = doc.getRegion();
    assertNotNull(ukRegion);
    assertEquals("United Kingdom", ukRegion.getName());
    assertEquals(RegionClassification.INDEPENDENT_STATE, ukRegion.getClassification());
    assertEquals(Country.GB, ukRegion.getCountry());
    assertEquals(Currency.GBP, ukRegion.getCurrency());
    assertEquals(3, ukRegion.getParentRegionIds().size());
   
    RegionDocument gotDoc = _regionMaster.get(doc.getUniqueId());
    assertEquals(doc, gotDoc);
  }
View Full Code Here

  }

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

    assertSame(result, test.getEntity());
  }

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

  private RegionDocument addedDoc;

  @BeforeMethod
  public void setUp() {
    master = new InMemoryRegionMaster();
    ManageableRegion inputRegion = new ManageableRegion();
    inputRegion.setName(NAME);
    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

    assertEquals(example(), testResult);
  }

  //-------------------------------------------------------------------------
  protected ManageableRegion example() {
    ManageableRegion region = new ManageableRegion();
    region.setUniqueId(UID);
    region.setName("United Kingdom");
    region.setCurrency(Currency.GBP);
    region.setCountry(Country.GB);
    region.setTimeZone(ZoneId.of("Europe/London"));
    return region;
  }
View Full Code Here

TOP

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

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.