use of com.tvd12.ezyhttp.server.core.EzyHttpApplication in project ezyhttp by youngmonkeys.
the class EzyHttpApplicationTest method startWith2Params.
@Test
public void startWith2Params() throws Exception {
// given
EzyHttpApplication sut = EzyHttpApplication.start(EzyHttpApplicationTest.class, getClass());
ApplicationContext applicationContext = sut.getApplicationContext();
EzyBeanContext beanContext = applicationContext.getBeanContext();
// when
int actualOneProp = beanContext.getProperty("one", int.class);
boolean managementEnable = beanContext.getProperty("management.enable", boolean.class);
UserService userService = applicationContext.getSingleton(UserService.class);
ViewContextBuilder viewContextBuilder = beanContext.getSingleton(ViewContextBuilder.class);
ResourceResolver resourceResolver = beanContext.getSingleton(ResourceResolver.class);
ResourceDownloadManager resourceDownloadManager = beanContext.getSingleton(ResourceDownloadManager.class);
List<Object> bootstraps = applicationContext.getSingletons(ApplicationBootstrap.class);
// then
Asserts.assertEquals(1, actualOneProp);
Asserts.assertTrue(managementEnable);
Asserts.assertNotNull(userService);
Asserts.assertNotNull(viewContextBuilder);
Asserts.assertNotNull(resourceDownloadManager);
Asserts.assertEquals(4, resourceResolver.getResources().size());
Asserts.assertFalse(bootstraps.isEmpty());
sut.stop();
}
use of com.tvd12.ezyhttp.server.core.EzyHttpApplication in project ezyhttp by youngmonkeys.
the class EzyHttpApplicationTest method testDisablePrintBanner.
@Test
public void testDisablePrintBanner() throws Exception {
// given
System.setProperty(EzyBeanContext.ACTIVE_PROFILES_KEY, "disable");
EzyHttpApplication sut = EzyHttpApplication.start(EzyHttpApplicationTest.class);
System.setProperty(EzyBeanContext.ACTIVE_PROFILES_KEY, "enable");
ApplicationContext applicationContext = sut.getApplicationContext();
EzyBeanContext beanContext = applicationContext.getBeanContext();
// when
boolean bannerPrintable = beanContext.getProperty("banner.printable", boolean.class);
// then
Asserts.assertFalse(bannerPrintable);
sut.stop();
}
use of com.tvd12.ezyhttp.server.core.EzyHttpApplication in project ezyhttp by youngmonkeys.
the class JettyApp method testDisable.
@Test
public void testDisable() throws Exception {
// given
System.setProperty(EzyBeanContext.ACTIVE_PROFILES_KEY, "disable");
// when
EzyHttpApplication app = EzyHttpApplication.start(JettyApp.class);
// then
app.stop();
}
use of com.tvd12.ezyhttp.server.core.EzyHttpApplication in project ezyhttp by youngmonkeys.
the class JettyApp method testEnable.
@Test
public void testEnable() throws Exception {
// given
System.setProperty(EzyBeanContext.ACTIVE_PROFILES_KEY, "enable");
// when
EzyHttpApplication app = EzyHttpApplication.start(JettyApp.class);
// then
app.stop();
}
use of com.tvd12.ezyhttp.server.core.EzyHttpApplication in project ezyhttp by youngmonkeys.
the class EzyHttpApplicationTest method test.
@Test
public void test() throws Exception {
// given
EzyHttpApplication sut = EzyHttpApplication.start(EzyHttpApplicationTest.class);
ApplicationContext applicationContext = sut.getApplicationContext();
EzyBeanContext beanContext = applicationContext.getBeanContext();
// when
int actualOneProp = beanContext.getProperty("one", int.class);
boolean managementEnable = beanContext.getProperty("management.enable", boolean.class);
UserService userService = beanContext.getSingleton(UserService.class);
ViewContextBuilder viewContextBuilder = beanContext.getSingleton(ViewContextBuilder.class);
ResourceResolver resourceResolver = beanContext.getSingleton(ResourceResolver.class);
ResourceDownloadManager resourceDownloadManager = beanContext.getSingleton(ResourceDownloadManager.class);
// then
Asserts.assertEquals(1, actualOneProp);
Asserts.assertTrue(managementEnable);
Asserts.assertNotNull(userService);
Asserts.assertNotNull(viewContextBuilder);
Asserts.assertNotNull(resourceDownloadManager);
Asserts.assertEquals(4, resourceResolver.getResources().size());
sut.stop();
}
Aggregations