Package com.opengamma.master.holiday

Examples of com.opengamma.master.holiday.ManageableHoliday


  }

  @Test(expectedExceptions = DataNotFoundException.class)
  public void test_correct_notFound() {
    UniqueId uniqueId = UniqueId.of("DbHol", "0", "0");
    ManageableHoliday holiday = new ManageableHoliday(Currency.USD, Arrays.asList(LocalDate.of(2010, 6, 9)));
    holiday.setUniqueId(uniqueId);
    HolidayDocument doc = new HolidayDocument(holiday);
    _holMaster.correct(doc);
  }
View Full Code Here


  public void test_correct_getUpdateGet() {
    Instant now = Instant.now(_holMaster.getClock());
   
    UniqueId uniqueId = UniqueId.of("DbHol", "101", "0");
    HolidayDocument base = _holMaster.get(uniqueId);
    ManageableHoliday holiday = new ManageableHoliday(Currency.USD, Arrays.asList(LocalDate.of(2010, 6, 9)));
    holiday.setUniqueId(uniqueId);
    HolidayDocument input = new HolidayDocument(holiday);
   
    HolidayDocument corrected = _holMaster.correct(input);
    assertEquals(false, base.getUniqueId().equals(corrected.getUniqueId()));
    assertEquals(base.getVersionFromInstant(), corrected.getVersionFromInstant());
View Full Code Here

    assertEquals(uniqueId, test.getUniqueId());
    assertEquals(_version1Instant, test.getVersionFromInstant());
    assertEquals(now, test.getVersionToInstant());
    assertEquals(_version1Instant, test.getCorrectionFromInstant());
    assertEquals(null, test.getCorrectionToInstant());
    ManageableHoliday holiday = test.getHoliday();
    assertNotNull(holiday);
    assertEquals(uniqueId, holiday.getUniqueId());
    assertEquals("TestHoliday101", test.getName());
    assertEquals(HolidayType.CURRENCY, holiday.getType());
    assertEquals("GBP", holiday.getCurrency().getCode());
    assertEquals(null, holiday.getRegionExternalId());
    assertEquals(null, holiday.getExchangeExternalId());
    assertEquals(Arrays.asList(LocalDate.of(2010, 1, 1)), holiday.getHolidayDates());
  }
View Full Code Here

  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void test_update_noHolidayId() {
    UniqueId uniqueId = UniqueId.of("DbHol", "101");
    ManageableHoliday holiday = new ManageableHoliday(Currency.USD, Arrays.asList(LocalDate.of(2010, 6, 9)));
    holiday.setUniqueId(uniqueId);
    HolidayDocument doc = new HolidayDocument();
    doc.setHoliday(holiday);
    _holMaster.update(doc);
  }
View Full Code Here

  }

  @Test(expectedExceptions = DataNotFoundException.class)
  public void test_update_notFound() {
    UniqueId uniqueId = UniqueId.of("DbHol", "0", "0");
    ManageableHoliday holiday = new ManageableHoliday(Currency.USD, Arrays.asList(LocalDate.of(2010, 6, 9)));
    holiday.setUniqueId(uniqueId);
    HolidayDocument doc = new HolidayDocument(holiday);
    _holMaster.update(doc);
  }
View Full Code Here

  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void test_update_notLatestVersion() {
    UniqueId uniqueId = UniqueId.of("DbHol", "201", "0");
    ManageableHoliday holiday = new ManageableHoliday(Currency.USD, Arrays.asList(LocalDate.of(2010, 6, 9)));
    holiday.setUniqueId(uniqueId);
    HolidayDocument doc = new HolidayDocument(holiday);
    _holMaster.update(doc);
  }
View Full Code Here

  public void test_update_getUpdateGet() {
    Instant now = Instant.now(_holMaster.getClock());
   
    UniqueId uniqueId = UniqueId.of("DbHol", "101", "0");
    HolidayDocument base = _holMaster.get(uniqueId);
    ManageableHoliday holiday = new ManageableHoliday(Currency.USD, Arrays.asList(LocalDate.of(2010, 6, 9)));
    holiday.setUniqueId(uniqueId);
    HolidayDocument input = new HolidayDocument(holiday);
   
    HolidayDocument updated = _holMaster.update(input);
    assertEquals(false, base.getUniqueId().equals(updated.getUniqueId()));
    assertEquals(now, updated.getVersionFromInstant());
View Full Code Here

  public void test_update_rollback() {
    DbHolidayMaster w = new DbHolidayMaster(_holMaster.getDbConnector());
    w.setElSqlBundle(ElSqlBundle.of(new ElSqlConfig("TestRollback"), DbHolidayMaster.class));
    final HolidayDocument base = _holMaster.get(UniqueId.of("DbHol", "101", "0"));
    UniqueId uniqueId = UniqueId.of("DbHol", "101", "0");
    ManageableHoliday holiday = new ManageableHoliday(Currency.USD, Arrays.asList(LocalDate.of(2010, 6, 9)));
    holiday.setUniqueId(uniqueId);
    HolidayDocument input = new HolidayDocument(holiday);
    try {
      w.update(input);
      Assert.fail();
    } catch (BadSqlGrammarException ex) {
View Full Code Here

      final String regionValue = rs.getString("REGION_VALUE");
      final String exchangeScheme = rs.getString("EXCHANGE_SCHEME");
      final String exchangeValue = rs.getString("EXCHANGE_VALUE");
      final String currencyISO = rs.getString("CURRENCY_ISO");
      UniqueId uniqueId = createUniqueId(docOid, docId);
      ManageableHoliday holiday = new ManageableHoliday();
      holiday.setUniqueId(uniqueId);
      holiday.setType(HolidayType.valueOf(type));
      if (regionScheme != null && regionValue != null) {
        holiday.setRegionExternalId(ExternalId.of(regionScheme, regionValue));
      }
      if (exchangeScheme != null && exchangeValue != null) {
        holiday.setExchangeExternalId(ExternalId.of(exchangeScheme, exchangeValue));
      }
      if (currencyISO != null) {
        holiday.setCurrency(Currency.of(currencyISO));
      }
      HolidayDocument doc = new HolidayDocument(holiday);
      doc.setVersionFromInstant(DbDateUtils.fromSqlTimestamp(versionFrom));
      doc.setVersionToInstant(DbDateUtils.fromSqlTimestampNullFarFuture(versionTo));
      doc.setCorrectionFromInstant(DbDateUtils.fromSqlTimestamp(correctionFrom));
View Full Code Here

        String eventDateStr = row[eventDateIdx];
        LocalDate eventDate =  LocalDate.parse(eventDateStr, DATE_FORMAT);
        HolidayDocument doc = fileMap.get(ccId);
        if (doc == null) {
          currency = fixEuro(currency, countryISO);
          doc = new HolidayDocument(new ManageableHoliday(currency, EMPTY_DATE_LIST));
          doc.setProviderId(ExternalId.of(COPP_CLARK_SCHEME, ccId));
          fileMap.put(ccId, doc);
        }
        doc.getHoliday().getHolidayDates().add(eventDate);
      }
View Full Code Here

TOP

Related Classes of com.opengamma.master.holiday.ManageableHoliday

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.