use of io.crnk.meta.provider.MetaProvider in project crnk-framework by crnk-project.
the class MetaModuleTest method testTransitiveRegistrationOfProviderDependencies.
@Test
public void testTransitiveRegistrationOfProviderDependencies() {
MetaProvider testProvider = Mockito.mock(MetaProvider.class);
Mockito.when(testProvider.getDependencies()).thenReturn((Collection) Arrays.asList(new ResourceMetaProvider()));
metaModuleConfig = new MetaModuleConfig();
metaModuleConfig.addMetaProvider(testProvider);
metaModule = MetaModule.createServerModule(metaModuleConfig);
setupBoot();
Set<Class<? extends MetaElement>> metaClasses = metaModule.collectMetaClasses();
// meta classes out of testProvider dependency (resource meta provider)
Assert.assertTrue(metaClasses.contains(MetaResource.class));
Assert.assertTrue(metaClasses.contains(MetaResourceRepository.class));
}
use of io.crnk.meta.provider.MetaProvider in project crnk-framework by crnk-project.
the class MetaModule method collectMetaClasses.
private void collectMetaClasses(Set<Class<? extends MetaElement>> metaClasses, Collection<MetaProvider> providers) {
for (MetaProvider provider : providers) {
metaClasses.addAll(provider.getMetaTypes());
collectMetaClasses(metaClasses, provider.getDependencies());
}
}
Aggregations