Search in sources :

Example 1 with IPageManagerContext

use of org.apache.wicket.page.IPageManagerContext in project wicket by apache.

the class TestApp1 method init.

@Override
protected void init() {
    getSharedResources().add("cancelButton", new DefaultButtonImageResource("Cancel"));
    setPageManagerProvider(new DefaultPageManagerProvider(this) {

        @Override
        public IPageManager get(IPageManagerContext pageManagerContext) {
            IDataStore dataStore = new HttpSessionDataStore(pageManagerContext, new PageNumberEvictionStrategy(100));
            IPageStore pageStore = new DefaultPageStore(new JavaSerializer(getApplicationKey()), dataStore, getStoreSettings().getInmemoryCacheSize());
            return new PageStoreManager(getName(), pageStore, pageManagerContext);
        }
    });
}
Also used : IPageStore(org.apache.wicket.pageStore.IPageStore) IPageManager(org.apache.wicket.page.IPageManager) PageStoreManager(org.apache.wicket.page.PageStoreManager) DefaultButtonImageResource(org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource) HttpSessionDataStore(org.apache.wicket.pageStore.memory.HttpSessionDataStore) PageNumberEvictionStrategy(org.apache.wicket.pageStore.memory.PageNumberEvictionStrategy) JavaSerializer(org.apache.wicket.serialize.java.JavaSerializer) IPageManagerContext(org.apache.wicket.page.IPageManagerContext) DefaultPageManagerProvider(org.apache.wicket.DefaultPageManagerProvider) IDataStore(org.apache.wicket.pageStore.IDataStore) DefaultPageStore(org.apache.wicket.pageStore.DefaultPageStore)

Example 2 with IPageManagerContext

use of org.apache.wicket.page.IPageManagerContext 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 3 with IPageManagerContext

use of org.apache.wicket.page.IPageManagerContext 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 4 with IPageManagerContext

use of org.apache.wicket.page.IPageManagerContext in project wicket by apache.

the class TestApp2 method init.

@Override
protected void init() {
    getSharedResources().add("cancelButton", new DefaultButtonImageResource("Cancel"));
    setPageManagerProvider(new DefaultPageManagerProvider(this) {

        @Override
        public IPageManager get(IPageManagerContext pageManagerContext) {
            IDataStore dataStore = new HttpSessionDataStore(pageManagerContext, new PageNumberEvictionStrategy(100));
            IPageStore pageStore = new DefaultPageStore(new JavaSerializer(getApplicationKey()), dataStore, getStoreSettings().getInmemoryCacheSize());
            return new PageStoreManager(getName(), pageStore, pageManagerContext);
        }
    });
}
Also used : IPageStore(org.apache.wicket.pageStore.IPageStore) IPageManager(org.apache.wicket.page.IPageManager) PageStoreManager(org.apache.wicket.page.PageStoreManager) DefaultButtonImageResource(org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource) HttpSessionDataStore(org.apache.wicket.pageStore.memory.HttpSessionDataStore) PageNumberEvictionStrategy(org.apache.wicket.pageStore.memory.PageNumberEvictionStrategy) JavaSerializer(org.apache.wicket.serialize.java.JavaSerializer) IPageManagerContext(org.apache.wicket.page.IPageManagerContext) DefaultPageManagerProvider(org.apache.wicket.DefaultPageManagerProvider) IDataStore(org.apache.wicket.pageStore.IDataStore) DefaultPageStore(org.apache.wicket.pageStore.DefaultPageStore)

Example 5 with IPageManagerContext

use of org.apache.wicket.page.IPageManagerContext 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)

Aggregations

IPageManagerContext (org.apache.wicket.page.IPageManagerContext)6 IPageManagerProvider (org.apache.wicket.IPageManagerProvider)4 IPageManager (org.apache.wicket.page.IPageManager)4 PageStoreManager (org.apache.wicket.page.PageStoreManager)4 DefaultPageStore (org.apache.wicket.pageStore.DefaultPageStore)4 JavaSerializer (org.apache.wicket.serialize.java.JavaSerializer)4 WicketTester (org.apache.wicket.util.tester.WicketTester)4 IDataStore (org.apache.wicket.pageStore.IDataStore)3 IPageStore (org.apache.wicket.pageStore.IPageStore)3 DefaultPageManagerProvider (org.apache.wicket.DefaultPageManagerProvider)2 DefaultButtonImageResource (org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource)2 MockPageManager (org.apache.wicket.mock.MockPageManager)2 IManageablePage (org.apache.wicket.page.IManageablePage)2 HttpSessionDataStore (org.apache.wicket.pageStore.memory.HttpSessionDataStore)2 PageNumberEvictionStrategy (org.apache.wicket.pageStore.memory.PageNumberEvictionStrategy)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