Search in sources :

Example 1 with ContextCacheKey

use of com.ibm.cohort.cql.evaluation.CqlContextFactory.ContextCacheKey in project quality-measure-and-cohort-service by Alvearie.

the class CqlContextFactoryTest method testContextCacheKeyEquals.

@Test
public void testContextCacheKeyEquals() {
    CqlLibraryProvider libraryProvider = mock(CqlLibraryProvider.class);
    CqlTerminologyProvider terminologyProvider = mock(CqlTerminologyProvider.class);
    CqlVersionedIdentifier topLevelLibraryIdentifier = new CqlVersionedIdentifier("Test", "1.0.0");
    Map<String, Parameter> parameters = new HashMap<>();
    ZonedDateTime evaluationDateTime = ZonedDateTime.now();
    CqlContextFactory.ContextCacheKey k1 = new CqlContextFactory.ContextCacheKey(libraryProvider, topLevelLibraryIdentifier, terminologyProvider, null, evaluationDateTime, parameters);
    assertEquals(k1, k1);
    CqlContextFactory.ContextCacheKey k2 = new CqlContextFactory.ContextCacheKey(libraryProvider, topLevelLibraryIdentifier, terminologyProvider, null, evaluationDateTime, parameters);
    assertEquals(k1, k2);
    Map<ContextCacheKey, String> map = new HashMap<>();
    map.put(k1, "Hello,World");
    assertEquals("Hello,World", map.get(k2));
}
Also used : HashMap(java.util.HashMap) ZonedDateTime(java.time.ZonedDateTime) IntegerParameter(com.ibm.cohort.cql.evaluation.parameters.IntegerParameter) StringParameter(com.ibm.cohort.cql.evaluation.parameters.StringParameter) Parameter(com.ibm.cohort.cql.evaluation.parameters.Parameter) ContextCacheKey(com.ibm.cohort.cql.evaluation.CqlContextFactory.ContextCacheKey) PriorityCqlLibraryProvider(com.ibm.cohort.cql.library.PriorityCqlLibraryProvider) TranslatingCqlLibraryProvider(com.ibm.cohort.cql.translation.TranslatingCqlLibraryProvider) ClasspathCqlLibraryProvider(com.ibm.cohort.cql.library.ClasspathCqlLibraryProvider) CqlLibraryProvider(com.ibm.cohort.cql.library.CqlLibraryProvider) CqlTerminologyProvider(com.ibm.cohort.cql.terminology.CqlTerminologyProvider) ContextCacheKey(com.ibm.cohort.cql.evaluation.CqlContextFactory.ContextCacheKey) CqlVersionedIdentifier(com.ibm.cohort.cql.library.CqlVersionedIdentifier) Test(org.junit.Test)

Aggregations

ContextCacheKey (com.ibm.cohort.cql.evaluation.CqlContextFactory.ContextCacheKey)1 IntegerParameter (com.ibm.cohort.cql.evaluation.parameters.IntegerParameter)1 Parameter (com.ibm.cohort.cql.evaluation.parameters.Parameter)1 StringParameter (com.ibm.cohort.cql.evaluation.parameters.StringParameter)1 ClasspathCqlLibraryProvider (com.ibm.cohort.cql.library.ClasspathCqlLibraryProvider)1 CqlLibraryProvider (com.ibm.cohort.cql.library.CqlLibraryProvider)1 CqlVersionedIdentifier (com.ibm.cohort.cql.library.CqlVersionedIdentifier)1 PriorityCqlLibraryProvider (com.ibm.cohort.cql.library.PriorityCqlLibraryProvider)1 CqlTerminologyProvider (com.ibm.cohort.cql.terminology.CqlTerminologyProvider)1 TranslatingCqlLibraryProvider (com.ibm.cohort.cql.translation.TranslatingCqlLibraryProvider)1 ZonedDateTime (java.time.ZonedDateTime)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1