assertNull(mmdl.getScopedRetrieval(sl));
}
}
}
MetaDataContext parent = new AbstractMetaDataContext(retrievals[0]);
MetaDataContext context = new AbstractMetaDataContext(parent, aemdl);
assertSame(aemdl, context.getScopedRetrieval(CommonLevels.CLASS));
MetaDataRetrieval mmdl = new MemoryMetaDataLoader(new ScopeKey(CommonLevels.INSTANCE, "123"));
context = new AbstractMetaDataContext(parent, mmdl);
assertSame(mmdl, context.getScopedRetrieval(CommonLevels.INSTANCE));
context = new AbstractMetaDataContext(parent, Arrays.asList(aemdl, mmdl));
assertNotNull(context.getScopedRetrieval(CommonLevels.CLASS));
assertNotNull(context.getScopedRetrieval(CommonLevels.INSTANCE));
context = new CachingMetaDataContext(parent, Arrays.asList(aemdl, mmdl, aemdl, mmdl));
assertNotNull(context.getScopedRetrieval(CommonLevels.CLASS));
assertNotNull(context.getScopedRetrieval(CommonLevels.INSTANCE));
MetaDataRetrieval expected1 = context.getScopedRetrieval(CommonLevels.CLASS);
assertSame(expected1, context.getScopedRetrieval(CommonLevels.CLASS));
MetaDataRetrieval expected2 = context.getScopedRetrieval(CommonLevels.INSTANCE);
assertSame(expected2, context.getScopedRetrieval(CommonLevels.INSTANCE));
context.append(ThreadLocalMetaDataLoader.INSTANCE);
context.remove(ThreadLocalMetaDataLoader.INSTANCE);
assertNotNull(context.getScopedRetrieval(CommonLevels.CLASS));
assertNotNull(context.getScopedRetrieval(CommonLevels.INSTANCE));
assertNotSame(expected1, context.getScopedRetrieval(CommonLevels.CLASS));
assertNotSame(expected2, context.getScopedRetrieval(CommonLevels.INSTANCE));
context = new AbstractMetaDataContext(parent, Arrays.asList(mmdl, mmdl));
assertNull(context.getScopedRetrieval(CommonLevels.CLASS));
context = new AbstractMetaDataContext(parent, Arrays.asList(aemdl, aemdl));
assertNull(context.getScopedRetrieval(CommonLevels.INSTANCE));
parent = new AbstractMetaDataContext(new MemoryMetaDataLoader(new ScopeKey(CommonLevels.INSTANCE, "0123")));
context = new CachingMetaDataContext(parent, Arrays.asList(mmdl, mmdl));
assertNull(context.getScopedRetrieval(CommonLevels.CLASS));
MetaDataRetrieval scr1 = context.getScopedRetrieval(CommonLevels.INSTANCE);
assertNotNull(scr1);
assertTrue(scr1.isEmpty());
parent = new AbstractMetaDataContext(new MemoryMetaDataLoader(new ScopeKey(CommonLevels.CLASS, "0123")));
context = new CachingMetaDataContext(parent, Arrays.asList(aemdl, aemdl));
assertNull(context.getScopedRetrieval(CommonLevels.INSTANCE));
MetaDataRetrieval scr2 = context.getScopedRetrieval(CommonLevels.CLASS);
assertNotNull(scr2);
assertFalse(scr2.isEmpty());
}