Examples of HolidayMaster


Examples of com.opengamma.master.holiday.HolidayMaster

  }

  //-------------------------------------------------------------------------
  @Override
  protected void doRun() {
    HolidayMaster master = getToolContext().getHolidayMaster();
    CoppClarkHolidayFileReader.createPopulated(master);
  }
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayMaster

   * Stores the holiday calendar in the holiday master. If there is already a calendar with that name it is updated.
   *
   * @param calendar the calendar to add
   */
  private void storeHolidays(final ManageableHoliday calendar) {
    final HolidayMaster master = getToolContext().getHolidayMaster();
    final HolidaySearchRequest request = new HolidaySearchRequest();
    request.setType(calendar.getType());
    switch (calendar.getType()) {
      case CURRENCY:
        request.setCurrency(calendar.getCurrency());
        break;
      default:
        throw new UnsupportedOperationException(calendar.getType().toString());
    }
    final HolidaySearchResult result = master.search(request);
    if (result.getFirstDocument() != null) {
      //System.out.println("Updating " + calendar.getType());
      final HolidayDocument document = result.getFirstDocument();
      document.setHoliday(calendar);
      master.update(document);
    } else {
      //System.out.println("Adding " + calendar.getType());
      master.add(new HolidayDocument(calendar));
    }
  }
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayMaster

  private boolean _publishRest = true;


  @Override
  public void init(final ComponentRepository repo, final LinkedHashMap<String, String> configuration) {
    final HolidayMaster master = new InMemoryHolidayMaster();
    final ComponentInfo info = new ComponentInfo(HolidayMaster.class, getClassifier());
    info.addAttribute(ComponentInfoAttributes.LEVEL, 1);
    info.addAttribute(ComponentInfoAttributes.REMOTE_CLIENT_JAVA, RemoteHolidayMaster.class);
    info.addAttribute(ComponentInfoAttributes.UNIQUE_ID_SCHEME, InMemoryHolidayMaster.DEFAULT_OID_SCHEME);
    repo.registerComponent(info, master);
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayMaster

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

    HolidayMaster master = new EHCachingHolidayMaster(getClassifier(),
                                                      getUnderlying(),
                                                      getCacheManager());

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

Examples of com.opengamma.master.holiday.HolidayMaster

    new MasterHolidaySource(null, null);
  }

  //-------------------------------------------------------------------------
  public void test_getHoliday_UniqueId_noOverride_found() throws Exception {
    HolidayMaster mock = mock(HolidayMaster.class);
   
    HolidayDocument doc = new HolidayDocument(example());
    when(mock.get(UID)).thenReturn(doc);
    MasterHolidaySource test = new MasterHolidaySource(mock);
    Holiday testResult = test.get(UID);
    verify(mock, times(1)).get(UID);
   
    assertEquals(example(), testResult);
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayMaster

   
    assertEquals(example(), testResult);
  }

  public void test_getHoliday_UniqueId_found() throws Exception {
    HolidayMaster mock = mock(HolidayMaster.class);
   
    HolidayDocument doc = new HolidayDocument(example());
    when(mock.get(OID, VC)).thenReturn(doc);
    MasterHolidaySource test = new MasterHolidaySource(mock, VC);
    Holiday testResult = test.get(UID);
    verify(mock, times(1)).get(OID, VC);
   
    assertEquals(example(), testResult);
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayMaster

    assertEquals(example(), testResult);
  }

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

Examples of com.opengamma.master.holiday.HolidayMaster

    }
  }

  //-------------------------------------------------------------------------
  public void test_getHoliday_ObjectId_found() throws Exception {
    HolidayMaster mock = mock(HolidayMaster.class);
   
    HolidayDocument doc = new HolidayDocument(example());
    when(mock.get(OID, VC)).thenReturn(doc);
    MasterHolidaySource test = new MasterHolidaySource(mock, VC);
    Holiday testResult = test.get(OID, VC);
    verify(mock, times(1)).get(OID, VC);
   
    assertEquals(example(), testResult);
View Full Code Here

Examples of com.opengamma.master.holiday.HolidayMaster

    assertEquals(example(), testResult);
  }

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

Examples of com.opengamma.master.holiday.HolidayMaster

    }
  }

  //-------------------------------------------------------------------------
  public void test_isHoliday_LocalDateCurrency_holiday() throws Exception {
    HolidayMaster mock = mock(HolidayMaster.class);
    HolidaySearchRequest request = new HolidaySearchRequest(GBP);
    request.setDateToCheck(DATE_MONDAY);
    request.setVersionCorrection(VC);
    ManageableHoliday holiday = new ManageableHoliday(GBP, Collections.singletonList(DATE_MONDAY));
    HolidaySearchResult result = new HolidaySearchResult();
    result.getDocuments().add(new HolidayDocument(holiday));
   
    when(mock.search(request)).thenReturn(result);
    MasterHolidaySource test = new MasterHolidaySource(mock, VC);
    boolean testResult = test.isHoliday(DATE_MONDAY, GBP);
    verify(mock, times(1)).search(request);
   
    assertEquals(true, 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.