use of io.crnk.meta.provider.resource.ResourceMetaProvider 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.resource.ResourceMetaProvider in project crnk-framework by crnk-project.
the class MetaModuleTest method setup.
@Before
public void setup() {
metaModuleConfig = new MetaModuleConfig();
metaModuleConfig.addMetaProvider(new ResourceMetaProvider());
metaModule = MetaModule.createServerModule(metaModuleConfig);
setupBoot();
}
use of io.crnk.meta.provider.resource.ResourceMetaProvider in project crnk-framework by crnk-project.
the class AbstractJpaJerseyTest method setup.
@Before
public void setup() {
client = new CrnkClient(getBaseUri().toString());
client.setPushAlways(false);
JpaModule module = JpaModule.newClientModule();
setupModule(module, false);
client.addModule(module);
MetaModule clientMetaModule = MetaModule.create();
clientMetaModule.addMetaProvider(new ResourceMetaProvider());
client.addModule(clientMetaModule);
metaModule.getLookup().initialize();
setNetworkTimeout(client, 10000, TimeUnit.SECONDS);
}
use of io.crnk.meta.provider.resource.ResourceMetaProvider in project crnk-framework by crnk-project.
the class ValidationMetaProviderTest method setup.
private void setup(boolean addValidationProvider) {
CrnkBoot boot = new CrnkBoot();
boot.addModule(new JaxrsModule(null));
boot.setServiceUrlProvider(new ConstantServiceUrlProvider("http://localhost"));
boot.setServiceDiscovery(new ReflectionsServiceDiscovery("io.crnk.validation.mock", new SampleJsonServiceLocator()));
boot.boot();
resourceMetaProvider = new ResourceMetaProvider();
lookup = new MetaLookup();
lookup.setModuleContext(boot.getModuleRegistry().getContext());
lookup.addProvider(resourceMetaProvider);
if (addValidationProvider) {
lookup.addProvider(new ValidationMetaProvider());
}
lookup.initialize();
}
use of io.crnk.meta.provider.resource.ResourceMetaProvider in project crnk-framework by crnk-project.
the class GeneratorExecutor method run.
public void run(File outputDir) {
TSGeneratorConfig config = new TSGeneratorConfig();
config.setGenerateExpressions(true);
config.getNpm().setPackagingEnabled(false);
config.getNpm().setPackageName("@crnk/angular-ngrx");
config.getNpm().getPackageMapping().put(MetaElement.class.getPackage().getName(), "@crnk/angular-ngrx/meta");
MetaModule metaModule = MetaModule.create();
metaModule.addMetaProvider(new ResourceMetaProvider());
CrnkBoot boot = new CrnkBoot();
boot.setServiceDiscovery(new EmptyServiceDiscovery());
boot.addModule(metaModule);
boot.boot();
TSGenerator generator = new TSGenerator(outputDir, metaModule.getLookup(), config);
try {
generator.run();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
Aggregations