Package com.opengamma.engine.cache

Examples of com.opengamma.engine.cache.CachingIdentifierMap


        return valueSpec[(int)identifier];
      }

    };
   
    CachingIdentifierMap cachingSource = new CachingIdentifierMap(underlying);
   
    assertEquals(0L, cachingSource.getIdentifier(valueSpec[0]));
    final Map<ValueSpecification, Long> identifiers1 = new HashMap<ValueSpecification, Long> ();
    identifiers1.put (valueSpec[1], 1L);
    identifiers1.put (valueSpec[2], 2L);
    final Map<ValueSpecification, Long> identifiers2 = new HashMap<ValueSpecification, Long> ();
    identifiers2.put (valueSpec[3], 3L);
    identifiers2.put (valueSpec[4], 4L);
    assertEquals (identifiers1, cachingSource.getIdentifiers (Arrays.asList(valueSpec[1], valueSpec[2])));   
    assertEquals (valueSpec[3], cachingSource.getValueSpecification (3));
    final Map<Long, ValueSpecification> valueSpecs1 = new HashMap<Long, ValueSpecification> ();
    valueSpecs1.put (1L, valueSpec[1]);
    valueSpecs1.put (2L, valueSpec[2]);
    final Map<Long, ValueSpecification> valueSpecs2 = new HashMap<Long, ValueSpecification> ();
    valueSpecs2.put (4L, valueSpec[4]);
    valueSpecs2.put (5L, valueSpec[5]);
    assertEquals(valueSpecs2, cachingSource.getValueSpecifications(new LongArraySet(new long[] {4L, 5L })));
    shouldFail.set(true);
    for (int i = 0; i < valueSpec.length; i++) {
      assertEquals((long)i, cachingSource.getIdentifier(valueSpec[i]));
      assertEquals((long)i, cachingSource.getIdentifier(valueSpec[i]));
      assertEquals (valueSpec[i], cachingSource.getValueSpecification (i));
      assertEquals (valueSpec[i], cachingSource.getValueSpecification (i));
    }
    assertEquals (identifiers1, cachingSource.getIdentifiers (Arrays.asList(valueSpec[1], valueSpec[2])));
    assertEquals (identifiers1, cachingSource.getIdentifiers (Arrays.asList(valueSpec[1], valueSpec[2])));
    assertEquals(valueSpecs1, cachingSource.getValueSpecifications(new LongArraySet(new long[] {1L, 2L })));
    assertEquals(valueSpecs1, cachingSource.getValueSpecifications(new LongArraySet(new long[] {1L, 2L })));
    assertEquals (identifiers2, cachingSource.getIdentifiers (Arrays.asList(valueSpec[3], valueSpec[4])));
    assertEquals (identifiers2, cachingSource.getIdentifiers (Arrays.asList(valueSpec[3], valueSpec[4])));
    assertEquals(valueSpecs2, cachingSource.getValueSpecifications(new LongArraySet(new long[] {4L, 5L })));
    assertEquals(valueSpecs2, cachingSource.getValueSpecifications(new LongArraySet(new long[] {4L, 5L })));
   
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.cache.CachingIdentifierMap

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.