Package com.opengamma.core.holiday

Examples of com.opengamma.core.holiday.Holiday


  @Override
  public Holiday get(UniqueId uniqueId) {
    ArgumentChecker.notNull(uniqueId, "uniqueId");

    Holiday result = null;
    try (Timer.Context context = _getTimer.time()) {
      Jedis jedis = getJedisPool().getResource();
      try {
        result = loadFromRedis(jedis, uniqueId);
        getJedisPool().returnResource(jedis);
View Full Code Here


    Object result = _getHoliday1.get(uniqueId);
    if (result != null) {
      return getOrThrow(result);
    }
    try {
      final Holiday h = getUnderlying().get(uniqueId);
      result = _getHoliday1.putIfAbsent(uniqueId, safeNull(h));
      if (result != null) {
        return getOrThrow(result);
      }
      return h;
View Full Code Here

    Object result = _getHoliday2.get(versionCorrection, objectId);
    if (result != null) {
      return getOrThrow(result);
    }
    try {
      final Holiday h = getUnderlying().get(objectId, versionCorrection);
      result = _getHoliday2.putIfAbsent(versionCorrection, objectId, safeNull(h));
      if (result != null) {
        return getOrThrow(result);
      }
      return h;
View Full Code Here

      @QueryParam("versionAsOf") String versionAsOf,
      @QueryParam("correctedTo") String correctedTo) {
   
    final ObjectId objectId = ObjectId.parse(idStr);
    if (version != null) {
      final Holiday result = getHolidaySource().get(objectId.atVersion(version));
      return responseOkFudge(result);
    } else {
      final VersionCorrection vc = VersionCorrection.parse(versionAsOf, correctedTo);
      Holiday result = getHolidaySource().get(objectId, vc);
      return responseOkFudge(result);
    }
  }
View Full Code Here

    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

    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

    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

public class NonVersionedRedisHolidaySourceTest extends AbstractRedisTestCase {
 
  public void addGetByUniqueIdEmpty() {
    NonVersionedRedisHolidaySource source = new NonVersionedRedisHolidaySource(getJedisPool(), getRedisPrefix());
   
    Holiday result = source.get(UniqueId.of("TEST", "No Such Thing"));
    assertNull(result);
  }
View Full Code Here

    usd.setCurrency(Currency.USD);
    usd.setType(HolidayType.CURRENCY);
    usd.setUniqueId(UniqueId.of("TEST", "USD Test Holiday"));
    source.addHoliday(usd);
   
    Holiday result = source.get(usd.getUniqueId());
    assertNotNull(result);
    assertEquals(Currency.USD, result.getCurrency());
    assertEquals(usd.getUniqueId(), result.getUniqueId());
    assertEquals(HolidayType.CURRENCY, result.getType());
    assertNull(usd.getExchangeExternalId());
    assertNull(usd.getRegionExternalId());
  }
View Full Code Here

    usBank.setType(HolidayType.BANK);
    usBank.setRegionExternalId(ExternalId.of("RegionScheme", "Chicago"));
    usBank.setUniqueId(UniqueId.of("TEST", "USD Test Bank Holiday"));
    source.addHoliday(usBank);
   
    Holiday result = source.get(usBank.getUniqueId());
    assertNotNull(result);
    assertEquals(usBank.getUniqueId(), result.getUniqueId());
    assertEquals(HolidayType.BANK, result.getType());
    assertNull(usBank.getCurrency());
    assertEquals(usBank.getRegionExternalId(), result.getRegionExternalId());
    assertNull(result.getExchangeExternalId());
  }
View Full Code Here

TOP

Related Classes of com.opengamma.core.holiday.Holiday

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.