Search in sources :

Example 6 with ViewContextBuilder

use of com.tvd12.ezyhttp.server.core.view.ViewContextBuilder 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();
}
Also used : ApplicationContext(com.tvd12.ezyhttp.server.core.ApplicationContext) ResourceDownloadManager(com.tvd12.ezyhttp.core.resources.ResourceDownloadManager) EzyHttpApplication(com.tvd12.ezyhttp.server.core.EzyHttpApplication) EzyBeanContext(com.tvd12.ezyfox.bean.EzyBeanContext) UserService(com.tvd12.ezyhttp.server.core.test.service.UserService) ResourceResolver(com.tvd12.ezyhttp.server.core.resources.ResourceResolver) ViewContextBuilder(com.tvd12.ezyhttp.server.core.view.ViewContextBuilder) Test(org.testng.annotations.Test)

Aggregations

ViewContextBuilder (com.tvd12.ezyhttp.server.core.view.ViewContextBuilder)6 Test (org.testng.annotations.Test)5 EzyBeanContext (com.tvd12.ezyfox.bean.EzyBeanContext)4 ResourceDownloadManager (com.tvd12.ezyhttp.core.resources.ResourceDownloadManager)3 ApplicationContext (com.tvd12.ezyhttp.server.core.ApplicationContext)3 ResourceResolver (com.tvd12.ezyhttp.server.core.resources.ResourceResolver)3 UserService (com.tvd12.ezyhttp.server.core.test.service.UserService)3 TemplateResolver (com.tvd12.ezyhttp.server.core.view.TemplateResolver)3 ViewContext (com.tvd12.ezyhttp.server.core.view.ViewContext)3 ApplicationContextBuilder (com.tvd12.ezyhttp.server.core.ApplicationContextBuilder)2 EzyHttpApplication (com.tvd12.ezyhttp.server.core.EzyHttpApplication)2 AbsentMessageResolver (com.tvd12.ezyhttp.server.core.view.AbsentMessageResolver)2 ViewDecorator (com.tvd12.ezyhttp.server.core.view.ViewDecorator)2 EzySingletonFactory (com.tvd12.ezyfox.bean.EzySingletonFactory)1 ComponentManager (com.tvd12.ezyhttp.server.core.manager.ComponentManager)1 EventService (com.tvd12.ezyhttp.server.core.test.event.EventService)1 SourceService (com.tvd12.ezyhttp.server.core.test.event.SourceService)1 UserService0 (com.tvd12.ezyhttp.server.core.test.service.UserService0)1 MessageProvider (com.tvd12.ezyhttp.server.core.view.MessageProvider)1 ViewDialect (com.tvd12.ezyhttp.server.core.view.ViewDialect)1