Search in sources :

Example 31 with ViewConfigDescriptor

use of org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor in project deltaspike by apache.

the class ViewConfigPathTest method testNamesWizard8.

@Test
public void testNamesWizard8() {
    this.viewConfigExtension.addPageDefinition(Pages.Wizard8.Step1.class);
    ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
    ViewConfigDescriptor viewConfigDescriptor;
    viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard8.Step1.class);
    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertEquals("/pages/w8/step1.xhtml", viewConfigDescriptor.getViewId());
}
Also used : ViewConfigDescriptor(org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor) ViewConfigResolver(org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver) Test(org.junit.Test)

Example 32 with ViewConfigDescriptor

use of org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor in project deltaspike by apache.

the class ViewConfigPathTest method testNamesWizard9.

@Test
public void testNamesWizard9() {
    this.viewConfigExtension.addPageDefinition(Pages.Wizard9.Step1.class);
    ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
    ViewConfigDescriptor viewConfigDescriptor;
    viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard9.Step1.class);
    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertEquals("/w9/step1.xhtml", viewConfigDescriptor.getViewId());
}
Also used : ViewConfigDescriptor(org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor) ViewConfigResolver(org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver) Test(org.junit.Test)

Example 33 with ViewConfigDescriptor

use of org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor in project deltaspike by apache.

the class ViewConfigPathTest method testNamesWizard1.

@Test
public void testNamesWizard1() {
    this.viewConfigExtension.addPageDefinition(Pages.Wizard1.Step1.class);
    this.viewConfigExtension.addPageDefinition(Pages.Wizard1.Step2.class);
    this.viewConfigExtension.addPageDefinition(Pages.Wizard1.Step3.class);
    this.viewConfigExtension.addPageDefinition(Pages.Wizard1.Step4.class);
    this.viewConfigExtension.addPageDefinition(Pages.Wizard1.Step5.class);
    this.viewConfigExtension.addPageDefinition(Pages.Wizard1.Step6.class);
    this.viewConfigExtension.addPageDefinition(Pages.Wizard1.Step7.class);
    ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
    ViewConfigDescriptor viewConfigDescriptor;
    viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard1.Step1.class);
    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertEquals("/pages/wizard1/step1.xhtml", viewConfigDescriptor.getViewId());
    viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard1.Step2.class);
    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertEquals("/step2.xhtml", viewConfigDescriptor.getViewId());
    viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard1.Step3.class);
    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertEquals("/pages/wizard1/step3.xhtml", viewConfigDescriptor.getViewId());
    viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard1.Step4.class);
    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertEquals("/pages/wizard1/w1/step4.xhtml", viewConfigDescriptor.getViewId());
    viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard1.Step5.class);
    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertEquals("/w1/step5.xhtml", viewConfigDescriptor.getViewId());
    viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard1.Step6.class);
    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertEquals("/pages/wizard1/w1b/step6.xhtml", viewConfigDescriptor.getViewId());
    viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard1.Step7.class);
    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertEquals("/pages/wizard1/w1b/step7.xhtml", viewConfigDescriptor.getViewId());
}
Also used : ViewConfigDescriptor(org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor) ViewConfigResolver(org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver) Test(org.junit.Test)

Example 34 with ViewConfigDescriptor

use of org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor in project deltaspike by apache.

the class ViewConfigPathTest method testNamesWizard3.

@Test
public void testNamesWizard3() {
    this.viewConfigExtension.addPageDefinition(Pages.Wizard3.Step1.class);
    this.viewConfigExtension.addPageDefinition(Pages.Wizard3.Step2.class);
    ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
    ViewConfigDescriptor viewConfigDescriptor;
    viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard3.Step1.class);
    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertEquals("/pages/wizard3/step1.xhtml", viewConfigDescriptor.getViewId());
    viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Wizard3.Step2.class);
    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertEquals("/step2.xhtml", viewConfigDescriptor.getViewId());
}
Also used : ViewConfigDescriptor(org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor) ViewConfigResolver(org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver) Test(org.junit.Test)

Example 35 with ViewConfigDescriptor

use of org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor in project deltaspike by apache.

the class ViewConfigTest method testSimpleViewConfigWithViewControllerCallback.

@Test
public void testSimpleViewConfigWithViewControllerCallback() {
    this.viewConfigExtension.addPageDefinition(SimplePageConfig.class);
    this.viewConfigExtension.addIndirectlyInheritedMetaData(PageBean003.class);
    ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
    ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(SimplePageConfig.class);
    Assert.assertNotNull(viewConfigDescriptor);
    Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, InitView.class));
    Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreViewAction.class));
    Assert.assertNotNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreRenderView.class));
    Assert.assertNull(viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PostRenderView.class));
    Assert.assertEquals(PageBean003.class, viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, InitView.class).getCallbackMethods().keySet().iterator().next());
    Assert.assertEquals("callbackMethod1", ((List<Method>) viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, InitView.class).getCallbackMethods().values().iterator().next()).iterator().next().getName());
    Assert.assertEquals(PageBean003.class, viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreViewAction.class).getCallbackMethods().keySet().iterator().next());
    Assert.assertEquals("callbackMethod1", ((List<Method>) viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreViewAction.class).getCallbackMethods().values().iterator().next()).iterator().next().getName());
    Assert.assertEquals(PageBean003.class, viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreRenderView.class).getCallbackMethods().keySet().iterator().next());
    Assert.assertEquals("callbackMethod2", ((List<Method>) viewConfigDescriptor.getCallbackDescriptor(ViewControllerRef.class, PreRenderView.class).getCallbackMethods().values().iterator().next()).iterator().next().getName());
}
Also used : ViewConfigDescriptor(org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor) Method(java.lang.reflect.Method) ViewConfigResolver(org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver) Test(org.junit.Test)

Aggregations

ViewConfigDescriptor (org.apache.deltaspike.core.api.config.view.metadata.ViewConfigDescriptor)44 ViewConfigResolver (org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver)37 Test (org.junit.Test)31 View (org.apache.deltaspike.jsf.api.config.view.View)5 Method (java.lang.reflect.Method)3 UIViewRoot (javax.faces.component.UIViewRoot)3 DefaultErrorView (org.apache.deltaspike.core.api.config.view.DefaultErrorView)3 ViewControllerRef (org.apache.deltaspike.core.api.config.view.controller.ViewControllerRef)3 ConfigDescriptor (org.apache.deltaspike.core.api.config.view.metadata.ConfigDescriptor)3 HashSet (java.util.HashSet)2 Set (java.util.Set)2 ConfigurableNavigationHandler (javax.faces.application.ConfigurableNavigationHandler)2 NavigationCase (javax.faces.application.NavigationCase)2 ViewConfig (org.apache.deltaspike.core.api.config.view.ViewConfig)2 PreRenderView (org.apache.deltaspike.core.api.config.view.controller.PreRenderView)2 PreViewConfigNavigateEvent (org.apache.deltaspike.core.api.config.view.navigation.event.PreViewConfigNavigateEvent)2 ErrorViewAwareAccessDeniedException (org.apache.deltaspike.security.api.authorization.ErrorViewAwareAccessDeniedException)2 MalformedURLException (java.net.MalformedURLException)1 HashMap (java.util.HashMap)1 List (java.util.List)1