Search in sources :

Example 6 with MetaModule

use of io.crnk.meta.MetaModule 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);
}
Also used : CrnkClient(io.crnk.client.CrnkClient) ResourceMetaProvider(io.crnk.meta.provider.resource.ResourceMetaProvider) MetaModule(io.crnk.meta.MetaModule) Before(org.junit.Before)

Example 7 with MetaModule

use of io.crnk.meta.MetaModule 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);
    }
}
Also used : CrnkBoot(io.crnk.core.boot.CrnkBoot) TSGenerator(io.crnk.gen.typescript.internal.TSGenerator) TSGeneratorConfig(io.crnk.gen.typescript.TSGeneratorConfig) ResourceMetaProvider(io.crnk.meta.provider.resource.ResourceMetaProvider) IOException(java.io.IOException) MetaModule(io.crnk.meta.MetaModule) EmptyServiceDiscovery(io.crnk.core.module.discovery.EmptyServiceDiscovery)

Example 8 with MetaModule

use of io.crnk.meta.MetaModule in project crnk-framework by crnk-project.

the class JsonApiFormatTest method setup.

@Before
public void setup() {
    MetaModuleConfig config = new MetaModuleConfig();
    config.addMetaProvider(new ResourceMetaProvider());
    MetaModule metaModule = MetaModule.createServerModule(config);
    this.module = Mockito.spy(HomeModule.create(HomeFormat.JSON_API));
    boot = new CrnkBoot();
    boot.addModule(module);
    boot.addModule(metaModule);
    boot.addModule(new TestModule());
    boot.setServiceUrlProvider(new ConstantServiceUrlProvider("http://localhost"));
    boot.boot();
}
Also used : CrnkBoot(io.crnk.core.boot.CrnkBoot) ResourceMetaProvider(io.crnk.meta.provider.resource.ResourceMetaProvider) ConstantServiceUrlProvider(io.crnk.core.engine.url.ConstantServiceUrlProvider) MetaModule(io.crnk.meta.MetaModule) TestModule(io.crnk.test.mock.TestModule) MetaModuleConfig(io.crnk.meta.MetaModuleConfig) Before(org.junit.Before)

Example 9 with MetaModule

use of io.crnk.meta.MetaModule in project crnk-framework by crnk-project.

the class JsonHomeFormatTest method setup.

@Before
public void setup() {
    MetaModuleConfig config = new MetaModuleConfig();
    config.addMetaProvider(new ResourceMetaProvider());
    MetaModule metaModule = MetaModule.createServerModule(config);
    this.module = Mockito.spy(HomeModule.create(HomeFormat.JSON_HOME));
    boot = new CrnkBoot();
    boot.addModule(module);
    boot.addModule(metaModule);
    boot.addModule(new TestModule());
    boot.setServiceUrlProvider(new ConstantServiceUrlProvider("http://localhost"));
    boot.boot();
}
Also used : CrnkBoot(io.crnk.core.boot.CrnkBoot) ResourceMetaProvider(io.crnk.meta.provider.resource.ResourceMetaProvider) ConstantServiceUrlProvider(io.crnk.core.engine.url.ConstantServiceUrlProvider) MetaModule(io.crnk.meta.MetaModule) TestModule(io.crnk.test.mock.TestModule) MetaModuleConfig(io.crnk.meta.MetaModuleConfig) Before(org.junit.Before)

Example 10 with MetaModule

use of io.crnk.meta.MetaModule in project crnk-framework by crnk-project.

the class AbstractOperationsTest method setup.

@Before
public void setup() {
    client = new CrnkClient(getBaseUri().toString());
    client.setActionStubFactory(JerseyActionStubFactory.newInstance());
    client.getHttpAdapter().setReceiveTimeout(10000000, TimeUnit.MILLISECONDS);
    MetaModule metaModule = MetaModule.create();
    metaModule.addMetaProvider(new ResourceMetaProvider());
    client.addModule(metaModule);
    JpaModule module = JpaModule.newClientModule();
    setupModule(module, false);
    client.addModule(module);
    setNetworkTimeout(client, 10000, TimeUnit.SECONDS);
}
Also used : CrnkClient(io.crnk.client.CrnkClient) ResourceMetaProvider(io.crnk.meta.provider.resource.ResourceMetaProvider) MetaModule(io.crnk.meta.MetaModule) JpaModule(io.crnk.jpa.JpaModule) Before(org.junit.Before)

Aggregations

MetaModule (io.crnk.meta.MetaModule)10 ResourceMetaProvider (io.crnk.meta.provider.resource.ResourceMetaProvider)8 CrnkBoot (io.crnk.core.boot.CrnkBoot)5 Before (org.junit.Before)5 MetaModuleConfig (io.crnk.meta.MetaModuleConfig)4 ConstantServiceUrlProvider (io.crnk.core.engine.url.ConstantServiceUrlProvider)3 CrnkClient (io.crnk.client.CrnkClient)2 EmptyServiceDiscovery (io.crnk.core.module.discovery.EmptyServiceDiscovery)2 MetaLookup (io.crnk.meta.MetaLookup)2 TestModule (io.crnk.test.mock.TestModule)2 IOException (java.io.IOException)2 ModuleRegistry (io.crnk.core.module.ModuleRegistry)1 TSGeneratorConfig (io.crnk.gen.typescript.TSGeneratorConfig)1 TSGeneratorExtension (io.crnk.gen.typescript.TSGeneratorExtension)1 TSGenerator (io.crnk.gen.typescript.internal.TSGenerator)1 JpaModule (io.crnk.jpa.JpaModule)1 File (java.io.File)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 ApplicationScoped (javax.enterprise.context.ApplicationScoped)1