use of io.crnk.core.boot.CrnkBoot in project crnk-framework by crnk-project.
the class CrnkConfigV3 method crnkBoot.
@Bean
@ConditionalOnMissingBean(CrnkBoot.class)
public CrnkBoot crnkBoot(ServiceDiscovery serviceDiscovery) {
CrnkBoot boot = new CrnkBoot();
boot.setObjectMapper(objectMapper);
if (properties.getDomainName() != null && properties.getPathPrefix() != null) {
String baseUrl = properties.getDomainName() + properties.getPathPrefix();
boot.setServiceUrlProvider(new ConstantServiceUrlProvider(baseUrl));
}
boot.setServiceDiscovery(serviceDiscovery);
boot.setDefaultPageLimit(properties.getDefaultPageLimit());
boot.setMaxPageLimit(properties.getMaxPageLimit());
boot.setPropertiesProvider(new PropertiesProvider() {
@Override
public String getProperty(String key) {
if (CrnkProperties.RESOURCE_SEARCH_PACKAGE.equals(key)) {
return properties.getResourcePackage();
}
if (CrnkProperties.RESOURCE_DEFAULT_DOMAIN.equals(key)) {
return properties.getDomainName();
}
if (CrnkProperties.WEB_PATH_PREFIX.equals(key)) {
return properties.getPathPrefix();
}
if (CrnkProperties.ALLOW_UNKNOWN_ATTRIBUTES.equals(key)) {
return String.valueOf(properties.getAllowUnknownAttributes());
}
if (CrnkProperties.ALLOW_UNKNOWN_PARAMETERS.equals(key)) {
return String.valueOf(properties.getAllowUnknownParameters());
}
if (CrnkProperties.RETURN_404_ON_NULL.equals(key)) {
return String.valueOf(properties.getReturn404OnNull());
}
return applicationContext.getEnvironment().getProperty(key);
}
});
boot.setAllowUnknownAttributes();
boot.addModule(new ServletModule(boot.getModuleRegistry().getHttpRequestContextProvider()));
boot.boot();
return boot;
}
use of io.crnk.core.boot.CrnkBoot in project crnk-framework by crnk-project.
the class ActivitiTestBase method setup.
@Before
public void setup() {
processEngine = ProcessEngines.getDefaultProcessEngine();
processEngine.getRepositoryService().createDeployment().addClasspathResource("approval.bpmn20.xml").deploy();
boot = new CrnkBoot();
boot.addModule(new TestModule());
boot.addModule(createActivitiModule());
boot.boot();
taskRepository = (TaskResourceRepository<ApproveTask>) boot.getResourceRegistry().getEntry(ApproveTask.class).getResourceRepository().getResourceRepository();
}
use of io.crnk.core.boot.CrnkBoot in project crnk-framework by crnk-project.
the class CdiServiceDiscoveryTest method testExceptionMapper.
@Test
public void testExceptionMapper() {
CrnkBoot boot = new CrnkBoot();
boot.boot();
Optional<JsonApiExceptionMapper> mapper = boot.getExceptionMapperRegistry().findMapperFor(IllegalStateException.class);
Assert.assertTrue(mapper.isPresent());
Assert.assertTrue(mapper.get() instanceof CdiTestExceptionMapper);
}
use of io.crnk.core.boot.CrnkBoot in project crnk-framework by crnk-project.
the class TSGeneratorTest method setup.
@Before
public void setup() {
Project project = Mockito.mock(Project.class);
TSGeneratorExtension config = new TSGeneratorExtension(project, null);
File outputDir = testProjectDir.getRoot();
MetaModuleConfig metaConfig = new MetaModuleConfig();
metaConfig.addMetaProvider(new ResourceMetaProvider());
MetaModule metaModule = MetaModule.createServerModule(metaConfig);
CrnkBoot boot = new CrnkBoot();
boot.setServiceDiscovery(new EmptyServiceDiscovery());
boot.addModule(metaModule);
boot.boot();
generator = new TSGenerator(outputDir, metaModule.getLookup(), config);
}
use of io.crnk.core.boot.CrnkBoot in project crnk-framework by crnk-project.
the class HomeResourceFilteringTest method setup.
@Before
public void setup() {
filter = Mockito.mock(ResourceFilter.class);
SimpleModule filterModule = new SimpleModule("filter");
filterModule.addResourceFilter(filter);
this.module = Mockito.spy(HomeModule.create());
boot = new CrnkBoot();
boot.addModule(module);
boot.addModule(new TestModule());
boot.setServiceUrlProvider(new ConstantServiceUrlProvider("http://localhost"));
boot.addModule(filterModule);
boot.boot();
}
Aggregations