本文整理汇总了Java中ninja.utils.NinjaProperties类的典型用法代码示例。如果您正苦于以下问题:Java NinjaProperties类的具体用法?Java NinjaProperties怎么用?Java NinjaProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NinjaProperties类属于ninja.utils包,在下文中一共展示了NinjaProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NinjaVertxServletContext
import ninja.utils.NinjaProperties; //导入依赖的package包/类
@Inject
public NinjaVertxServletContext(
BodyParserEngineManager bodyParserEngineManager,
FlashScope flashScope,
NinjaProperties ninjaProperties,
ResultHandler resultHandler,
Session session,
Validation validation,
Injector injector,
ParamParsers paramParsers) {
super(bodyParserEngineManager,
flashScope,
ninjaProperties,
resultHandler,
session,
validation,
injector,
paramParsers);
}
示例2: makeSureCorrectPropertiesGetParsed
import ninja.utils.NinjaProperties; //导入依赖的package包/类
/**
* This tests does three things
* 1) Test that stuff in {@link ninja.jooq.NinjaJooqProperties} is correct and without typos
* 2) Test that default properties are not altered accidentally.
* 3) All properties get called assuming they are ready to use inside the lifecycle.
*/
@Test
public void makeSureCorrectPropertiesGetParsed() {
// Setup and spy on the properties
NinjaProperties ninjaProperties = spy(new NinjaPropertiesImpl(NinjaMode.test));
NinjaJooqLifecycle ninjaJooqLifecycle = new NinjaJooqLifecycle(logger, ninjaProperties);
//
// Execute the server startup
ninjaJooqLifecycle.startServer();
// InOrder because I couldn't get the tests to pass with just verify. Mockito would confuse multiple calls
// to each function with different arguments incorrectly.
InOrder inOrder = inOrder(ninjaProperties);
inOrder.verify(ninjaProperties).getBooleanWithDefault("jooq.renderSchema", true);
inOrder.verify(ninjaProperties).getWithDefault("jooq.renderNameStyle", "QUOTED");
inOrder.verify(ninjaProperties).getWithDefault("jooq.renderNameStyle", "QUOTED");
inOrder.verify(ninjaProperties).getWithDefault("jooq.renderKeywordStyle", "LOWER");
inOrder.verify(ninjaProperties).getBooleanWithDefault("jooq.renderFormatted", false);
inOrder.verify(ninjaProperties).getWithDefault("jooq.statementType", "PREPARED_STATEMENT");
inOrder.verify(ninjaProperties).getBooleanWithDefault("jooq.executeLogging", true);
inOrder.verify(ninjaProperties).getBooleanWithDefault("jooq.executeWithOptimisticLocking", true);
inOrder.verify(ninjaProperties).getBooleanWithDefault("jooq.attachRecords", true);
inOrder.verify(ninjaProperties).getWithDefault("jooq.sqlDialect", "DEFAULT");
}
示例3: TemplateEngineRythm
import ninja.utils.NinjaProperties; //导入依赖的package包/类
@Inject
public TemplateEngineRythm(Messages messages,
Lang lang,
Logger ninjaLogger,
NinjaExceptionHandler exceptionHandler,
RythmHelper rythmHelper,
TemplateEngineManager templateEngineManager,
NinjaProperties ninjaProperties,
RythmEngine engine) throws Exception {
this.messages = messages;
this.lang = lang;
this.logger = ninjaLogger;
this.exceptionHandler = exceptionHandler;
this.rythmHelper = rythmHelper;
this.engine = engine;
}
示例4: TemplateEngineJade4J
import ninja.utils.NinjaProperties; //导入依赖的package包/类
@Inject
public TemplateEngineJade4J(Logger logger,
TemplateEngineHelper templateEngineHelper,
NinjaProperties ninjaProperties,
Jade4NinjaExceptionHandler exceptionHandler,
Messages messages,
Lang lang) {
this.logger = logger;
this.ninjaProperties = ninjaProperties;
this.templateEngineHelper = templateEngineHelper;
this.exceptionHandler = exceptionHandler;
this.messages = messages;
this.lang = lang;
configureJade4J();
}
示例5: VertxInitializer
import ninja.utils.NinjaProperties; //导入依赖的package包/类
public VertxInitializer(NinjaProperties ninjaProperties) {
options = new VertxOptions()
.setClustered(ninjaProperties.getBooleanWithDefault(VERTX_IS_CLUSTERED, false))
.setEventLoopPoolSize(ninjaProperties.getIntegerWithDefault(VERTX_EVENT_LOOP_SIZE,DEFAULT_EVENT_LOOP_POOL_SIZE))
.setMaxEventLoopExecuteTime(Long.valueOf(ninjaProperties.getWithDefault(VERTX_MAX_EVENTLOOP_EXECUTE_TIME,"2000000000")))
.setWorkerPoolSize(ninjaProperties.getIntegerWithDefault(VERTX_WORKER_POOL_SIZE, 20))
.setMaxWorkerExecuteTime(Long.valueOf(ninjaProperties.getWithDefault(VERTX_MAX_WORKER_EXECITE_TIME,"60000000000")));
if (ninjaProperties.getBooleanWithDefault(VERTX_IS_METRICS_ENABLED, false)) {
options.setMetricsOptions(new MetricsOptions().setEnabled(true));
}
deploymentOptions = new DeploymentOptions().setInstances(ninjaProperties.getIntegerWithDefault(VERTX_INSTANCES, 1));
if (ninjaProperties.getBooleanWithDefault(VERTX_IS_WORKER, true)) {
deploymentOptions
.setWorker(true)
.setWorkerPoolName("ninja-vertx");
}
if (options.isClustered()) {
CountDownLatch countDownLatch = new CountDownLatch(1);
Vertx.clusteredVertx(options, res -> {
if (res.succeeded()) {
vertx = res.result();
countDownLatch.countDown();
} else {
log.error(res.cause().getMessage(), res.cause());
}
});
await(countDownLatch);
} else {
vertx = Vertx.vertx(options);
}
}
示例6: NinjaJooqLifecycle
import ninja.utils.NinjaProperties; //导入依赖的package包/类
@Inject
public NinjaJooqLifecycle(Logger logger,
NinjaProperties ninjaProperties) {
this.logger = logger;
this.ninjaProperties = ninjaProperties;
startServer();
}
示例7: testSchedule4
import ninja.utils.NinjaProperties; //导入依赖的package包/类
/**
* Run every 5 seconds (configured in application.conf), guice-injected
* {@link NinjaProperties} argument.
*
* @param context
*/
@QuartzSchedule(cronSchedule = "0/2 * * * * ?", schedulerDelay = 4, jobDescription = "Test Schedule 4", jobName = "test4")
public void testSchedule4(NinjaProperties ninjaProperties) {
Integer value = counter.updateValue(SCHEDULE_TEST_4);
Application.LOG.info("\n\n\ntestSchedule4() updated value to {}. Available ninjaProperties: {}\n\n\n", value,
ninjaProperties.getAllCurrentNinjaProperties().size());
}
示例8: testSchedule5
import ninja.utils.NinjaProperties; //导入依赖的package包/类
/**
* Run every 5 seconds (configured in application.conf), guice-injected
* {@link NinjaProperties} argument.
*
* @param context
*/
@QuartzSchedule(cronSchedule = "0/2 * * * * ?", schedulerDelay = 5, jobDescription = "Test Schedule 5", jobName = "test5")
public void testSchedule5(NinjaProperties ninjaProperties, JobExecutionContext context) {
Integer value = counter.updateValue(SCHEDULE_TEST_5);
Application.LOG.info(
"\n\n\ntestSchedule5() updated value to {}. Context: {}, Available ninjaProperties: {}\n\n\n", value,
context.hashCode(), ninjaProperties.getAllCurrentNinjaProperties().size());
}
示例9: copyProperties
import ninja.utils.NinjaProperties; //导入依赖的package包/类
private void copyProperties(Properties properties , NinjaProperties ninjaProperties , String key , String subKey) {
String s = ninjaProperties.get(key);
if (s != null) {
properties.put(key , s);
}
s = ninjaProperties.get(subKey);
if (s != null) {
properties.put(key , s);
}
}
示例10: MongoDB
import ninja.utils.NinjaProperties; //导入依赖的package包/类
@Inject
public MongoDB(NinjaProperties ninjaProperties) {
this.ninjaProperties = ninjaProperties;
if (this.ninjaProperties.getBooleanWithDefault(MONGODB_CONNECT_ON_STARTUP, true)) {
this.connect();
}
// init morphia is only possible if connect on startup is true
if (this.ninjaProperties.getBooleanWithDefault(MONGODB_CONNECT_ON_STARTUP, true)
&& this.ninjaProperties.getBooleanWithDefault(MORPHIA_INIT, true)) {
this.initMorphia();
}
}
示例11: MustacheFactoryProvider
import ninja.utils.NinjaProperties; //导入依赖的package包/类
@Inject
public MustacheFactoryProvider(Logger logger,
NinjaProperties ninjaProperties) {
this.logger = logger;
this.ninjaProperties = ninjaProperties;
initResourceRoots();
}
示例12: MustacheTemplateEngine
import ninja.utils.NinjaProperties; //导入依赖的package包/类
@Inject
public MustacheTemplateEngine(Messages messages, Lang lang,
Logger ninjaLogger, NinjaExceptionHandler exceptionHandler,
MustacheTemplateEngineHelper templateEngineHelper,
TemplateEngineManager templateEngineManager,
NinjaProperties ninjaProperties, MustacheFactory mustacheFactory)
throws Exception {
this.messages = messages;
this.lang = lang;
this.logger = ninjaLogger;
this.templateEngineHelper = templateEngineHelper;
this.exceptionHandler = exceptionHandler;
this.mustacheFactory = mustacheFactory;
}
示例13: RythmEngineProvider
import ninja.utils.NinjaProperties; //导入依赖的package包/类
@Inject
public RythmEngineProvider(Messages messages,
Logger logger,
TemplateEngineManager templateEngineManager,
NinjaProperties ninjaProperties) {
this.messages = messages;
this.logger = logger;
this.templateEngineManager = templateEngineManager;
this.ninjaProperties = ninjaProperties;
}
示例14: TemplateRythmConfiguration
import ninja.utils.NinjaProperties; //导入依赖的package包/类
@Inject
public TemplateRythmConfiguration(Messages messages,
Logger ninjaLogger,
TemplateEngineManager templateEngineManager,
NinjaProperties ninjaProperties) {
this.messages = messages;
this.logger = ninjaLogger;
this.ninjaProperties = ninjaProperties;
init();
}
示例15: getInstance
import ninja.utils.NinjaProperties; //导入依赖的package包/类
public synchronized static VertxInitializer getInstance(NinjaProperties ninjaProperties) {
if (vertxInitializer == null) {
vertxInitializer = new VertxInitializer(ninjaProperties);
}
return vertxInitializer;
}