Search in sources :

Example 1 with IPageManagerProvider

use of org.apache.wicket.IPageManagerProvider in project wicket by apache.

the class TransparentWebMarkupContainerTest method ajaxUpdate.

/**
 * Test case for <a href="https://issues.apache.org/jira/browse/WICKET-3719">WICKET-3719</a>
 */
@Test
public void ajaxUpdate() {
    WicketTester wicketTester = new WicketTester() {

        @Override
        protected IPageManagerProvider newTestPageManagerProvider() {
            return new IPageManagerProvider() {

                @Override
                public IPageManager apply(IPageManagerContext context) {
                    return new MockPageManager() {

                        @Override
                        public void touchPage(IManageablePage page) {
                            page = WicketObjects.cloneObject(page);
                            super.touchPage(page);
                        }
                    };
                }
            };
        }
    };
    wicketTester.startPage(TransparentWithAjaxUpdatePage.class);
    wicketTester.clickLink("link", true);
    wicketTester.destroy();
}
Also used : MockPageManager(org.apache.wicket.mock.MockPageManager) WicketTester(org.apache.wicket.util.tester.WicketTester) IPageManagerProvider(org.apache.wicket.IPageManagerProvider) IManageablePage(org.apache.wicket.page.IManageablePage) IPageManagerContext(org.apache.wicket.page.IPageManagerContext) Test(org.junit.Test)

Example 2 with IPageManagerProvider

use of org.apache.wicket.IPageManagerProvider in project wicket by apache.

the class PageVersioningTest method setup.

/**
 * setup()
 */
@Before
public void setup() {
    final PageVersioningApplication application = new PageVersioningApplication();
    wicketTester = new WicketTester(application) {

        /**
         * @see org.apache.wicket.util.tester.BaseWicketTester#newTestPageManagerProvider()
         */
        @Override
        protected IPageManagerProvider newTestPageManagerProvider() {
            return new IPageManagerProvider() {

                @Override
                public IPageManager apply(IPageManagerContext pageManagerContext) {
                    final IDataStore dataStore = new InMemoryPageStore();
                    final AsynchronousDataStore asyncDS = new AsynchronousDataStore(dataStore, 100);
                    final DefaultPageStore pageStore = new DefaultPageStore(new JavaSerializer(application.getApplicationKey()), asyncDS, 40);
                    return new PageStoreManager(application.getName(), pageStore, pageManagerContext);
                }
            };
        }
    };
}
Also used : IPageManager(org.apache.wicket.page.IPageManager) PageStoreManager(org.apache.wicket.page.PageStoreManager) AsynchronousDataStore(org.apache.wicket.pageStore.AsynchronousDataStore) WicketTester(org.apache.wicket.util.tester.WicketTester) IPageManagerProvider(org.apache.wicket.IPageManagerProvider) JavaSerializer(org.apache.wicket.serialize.java.JavaSerializer) IPageManagerContext(org.apache.wicket.page.IPageManagerContext) IDataStore(org.apache.wicket.pageStore.IDataStore) DefaultPageStore(org.apache.wicket.pageStore.DefaultPageStore) Before(org.junit.Before)

Example 3 with IPageManagerProvider

use of org.apache.wicket.IPageManagerProvider in project wicket by apache.

the class DontStoreNotRenderedPageTestCase method newWicketTester.

@Override
protected WicketTester newWicketTester(WebApplication app) {
    app.getComponentInstantiationListeners().add(new IComponentInstantiationListener() {

        @Override
        public void onInstantiation(Component component) {
            // WICKET-5546 behavior added before Page#init()
            component.add(new Behavior() {
            });
        }
    });
    return new WicketTester(app) {

        @Override
        protected IPageManagerProvider newTestPageManagerProvider() {
            return new IPageManagerProvider() {

                @Override
                public IPageManager apply(IPageManagerContext context) {
                    return new MockPageManager() {

                        @Override
                        public void touchPage(IManageablePage page) {
                            Assert.assertFalse("PageB should not be touched!", page instanceof PageB);
                            super.touchPage(page);
                        }
                    };
                }
            };
        }
    };
}
Also used : MockPageManager(org.apache.wicket.mock.MockPageManager) Behavior(org.apache.wicket.behavior.Behavior) WicketTester(org.apache.wicket.util.tester.WicketTester) Component(org.apache.wicket.Component) IPageManagerProvider(org.apache.wicket.IPageManagerProvider) IManageablePage(org.apache.wicket.page.IManageablePage) IPageManagerContext(org.apache.wicket.page.IPageManagerContext) IComponentInstantiationListener(org.apache.wicket.application.IComponentInstantiationListener)

Example 4 with IPageManagerProvider

use of org.apache.wicket.IPageManagerProvider in project wicket by apache.

the class PageIdPoliticTest method setUp.

@Before
public void setUp() throws Exception {
    application = new MockApplication();
    dataStore = new InMemoryPageStore() {

        @Override
        public void storeData(String sessionId, int pageId, byte[] pageAsBytes) {
            super.storeData(sessionId, pageId, pageAsBytes);
            storeCount++;
        }
    };
    tester = new WicketTester(application) {

        @Override
        protected IPageManagerProvider newTestPageManagerProvider() {
            return new IPageManagerProvider() {

                @Override
                public IPageManager apply(IPageManagerContext pageManagerContext) {
                    IPageStore pageStore = new DefaultPageStore(new JavaSerializer(application.getApplicationKey()), dataStore, 4);
                    return new PageStoreManager(application.getName(), pageStore, pageManagerContext);
                }
            };
        }
    };
}
Also used : IPageStore(org.apache.wicket.pageStore.IPageStore) IPageManager(org.apache.wicket.page.IPageManager) MockApplication(org.apache.wicket.mock.MockApplication) IPageManagerProvider(org.apache.wicket.IPageManagerProvider) JavaSerializer(org.apache.wicket.serialize.java.JavaSerializer) DefaultPageStore(org.apache.wicket.pageStore.DefaultPageStore) PageStoreManager(org.apache.wicket.page.PageStoreManager) WicketTester(org.apache.wicket.util.tester.WicketTester) IPageManagerContext(org.apache.wicket.page.IPageManagerContext) InMemoryPageStore(org.apache.wicket.versioning.InMemoryPageStore) Before(org.junit.Before)

Aggregations

IPageManagerProvider (org.apache.wicket.IPageManagerProvider)4 IPageManagerContext (org.apache.wicket.page.IPageManagerContext)4 WicketTester (org.apache.wicket.util.tester.WicketTester)4 MockPageManager (org.apache.wicket.mock.MockPageManager)2 IManageablePage (org.apache.wicket.page.IManageablePage)2 IPageManager (org.apache.wicket.page.IPageManager)2 PageStoreManager (org.apache.wicket.page.PageStoreManager)2 DefaultPageStore (org.apache.wicket.pageStore.DefaultPageStore)2 JavaSerializer (org.apache.wicket.serialize.java.JavaSerializer)2 Before (org.junit.Before)2 Component (org.apache.wicket.Component)1 IComponentInstantiationListener (org.apache.wicket.application.IComponentInstantiationListener)1 Behavior (org.apache.wicket.behavior.Behavior)1 MockApplication (org.apache.wicket.mock.MockApplication)1 AsynchronousDataStore (org.apache.wicket.pageStore.AsynchronousDataStore)1 IDataStore (org.apache.wicket.pageStore.IDataStore)1 IPageStore (org.apache.wicket.pageStore.IPageStore)1 InMemoryPageStore (org.apache.wicket.versioning.InMemoryPageStore)1 Test (org.junit.Test)1