MarcGiffing / wicket-spring-boot

Spring Boot starter for Apache Wicket
151 stars 61 forks source link

after including more wicket-bootstrap artifacts some tests don:t find the forms any more #114

Closed ghost closed 7 years ago

ghost commented 7 years ago

But the application does its job. So let me describe what i did. I use

com.giffing.wicket.spring.boot.starter wicket-spring-boot-starter-parent 1.0.8

and

7.7.0 0.10.14 and included de.agilecoders.wicket wicket-bootstrap-core ${wicketBootstrapVersion} de.agilecoders.wicket wicket-bootstrap-extensions ${wicketBootstrapVersion} de.agilecoders.wicket wicket-bootstrap-themes ${wicketBootstrapVersion} de.agilecoders.wicket wicket-bootstrap-less ${wicketBootstrapVersion} I changed BasePage public abstract class BasePage extends WebPage { private MarkupContainer defaultModal; public BasePage(PageParameters params){ super(params); initPage(); //add(newNavbar("navbar")); } public BasePage(){ initPage(); // add(newNavbar("navbar")); } private void initPage(){ add(new HtmlTag("html")); add(new Label("title", new ResourceModel("page.title"))); add(new MobileViewportMetaTag("viewport")); add(new IeEdgeMetaTag("ie-edge")); add(newNavbar("navbar")); defaultModal = new EmptyPanel("defaultModal"); defaultModal.setOutputMarkupId(true); add(defaultModal); } public void replaceDefaultModal(ModalWindow newModal){ defaultModal.replaceWith(newModal); defaultModal = newModal; defaultModal.setOutputMarkupId(true); } protected Navbar newNavbar(String markupId) { Navbar navbar = new Navbar(markupId); navbar.setOutputMarkupId(true); navbar.setPosition(Navbar.Position.TOP); navbar.setInverted(true); navbar.setBrandName(new ResourceModel("app.name")); navbar.addComponents(NavbarComponents.transform(Navbar.ComponentPosition.LEFT, ParameterDropDownButton() ) ); return navbar; } @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem.forReference(getApplication().getJavaScriptLibrarySettings().getJQueryReference())); response.render(JavaScriptHeaderItem.forReference(getApplication().getJavaScriptLibrarySettings().getWicketEventReference())); response.render(JavaScriptHeaderItem.forReference(getApplication().getJavaScriptLibrarySettings().getWicketAjaxReference())); String bootstrapPrefixPath = "bootstrap/current"; response.render(JavaScriptHeaderItem.forReference(new WebjarsJavaScriptResourceReference(bootstrapPrefixPath + "/js/bootstrap.js"))); response.render(CssHeaderItem.forReference(new WebjarsJavaScriptResourceReference(bootstrapPrefixPath + "/css/bootstrap.css"))); response.render(CssReferenceHeaderItem.forReference(FontAwesomeCssReference.instance())); response.render(CssReferenceHeaderItem.forReference(new CssResourceReference(BasePage.class, "theme.css"))); } private Component ParameterDropDownButton() { return new NavbarDropDownButton(Model.of("Parameter")) { /** serialVersionUID. */ private static final long serialVersionUID = 1L; @Override protected List newSubMenuButtons(String buttonMarkupId) { final List subMenu = new ArrayList(); subMenu.add(new MenuBookmarkablePageLink(AngstatusListPage.class, Model.of("Angstatus")).setIconType(GlyphIconType.downloadalt)); return subMenu; } }.setIconType(GlyphIconType.thlarge); } } and created the following Class @ApplicationInitExtension public class BraunimmobilienExtensionConfig implements WicketApplicationInitConfiguration{ @Override public void init(WebApplication webApplication) { configureBootstrap(webApplication); } private void configureBootstrap(WebApplication webApplication) { // System.exit(5); Bootstrap.install(webApplication, new BootstrapSettings().setThemeProvider(new SingleThemeProvider(new BootstrapTheme()))); } } Be3sides the Tests the application is ok But 2 tests produce errors ------------------------------------------------------------------------------- Test set: braunimmobilien.web.pages.customers.create.CustomerCreatePageIntTest ------------------------------------------------------------------------------- Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.222 sec <<< FAILURE! - in braunimmobilien.web.pages.customers.create.CustomerCreatePageIntTest assert_new_customer_saved(braunimmobilien.web.pages.customers.create.CustomerCreatePageIntTest) Time elapsed: 0.161 sec <<< FAILURE! java.lang.AssertionError: path: 'form' does not exist for page: CustomerCreatePage at org.junit.Assert.fail(Assert.java:88) at org.apache.wicket.util.tester.BaseWicketTester.getComponentFromLastRenderedPage(BaseWicketTester.java:1611) at org.apache.wicket.util.tester.BaseWicketTester.getComponentFromLastRenderedPage(BaseWicketTester.java:1637) at org.apache.wicket.util.tester.BaseWicketTester.newFormTester(BaseWicketTester.java:1323) at org.apache.wicket.util.tester.BaseWicketTester.newFormTester(BaseWicketTester.java:1307) at braunimmobilien.web.pages.customers.create.CustomerCreatePageIntTest.assert_new_customer_saved(CustomerCreatePageIntTest.java:35) assert_error_when_create_existing_customer(braunimmobilien.web.pages.customers.create.CustomerCreatePageIntTest) Time elapsed: 0.06 sec <<< FAILURE! java.lang.AssertionError: path: 'form' does not exist for page: CustomerCreatePage at org.junit.Assert.fail(Assert.java:88) at org.apache.wicket.util.tester.BaseWicketTester.getComponentFromLastRenderedPage(BaseWicketTester.java:1611) at org.apache.wicket.util.tester.BaseWicketTester.getComponentFromLastRenderedPage(BaseWicketTester.java:1637) at org.apache.wicket.util.tester.BaseWicketTester.newFormTester(BaseWicketTester.java:1323) at org.apache.wicket.util.tester.BaseWicketTester.newFormTester(BaseWicketTester.java:1307) at braunimmobilien.web.pages.customers.create.CustomerCreatePageIntTest.assert_error_when_create_existing_customer(CustomerCreatePageIntTest.java:61) ------------------------------------------------------------------------------- Test set: braunimmobilien.web.pages.customers.CustomerListIntTest ------------------------------------------------------------------------------- Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 8.508 sec <<< FAILURE! - in braunimmobilien.web.pages.customers.CustomerListIntTest assert_delete_customer_method_called_once(braunimmobilien.web.pages.customers.CustomerListIntTest) Time elapsed: 1.377 sec <<< FAILURE! java.lang.AssertionError: path: 'filterForm:table' does not exist for page: CustomerListPage at org.junit.Assert.fail(Assert.java:88) at org.apache.wicket.util.tester.BaseWicketTester.getComponentFromLastRenderedPage(BaseWicketTester.java:1611) at org.apache.wicket.util.tester.BaseWicketTester.getComponentFromLastRenderedPage(BaseWicketTester.java:1637) at braunimmobilien.web.pages.customers.CustomerListIntTest.assert_delete_customer_method_called_once(CustomerListIntTest.java:56) assert_start_customer_list_page(braunimmobilien.web.pages.customers.CustomerListIntTest) Time elapsed: 0.097 sec <<< FAILURE! java.lang.AssertionError: path: 'filterForm' does not exist for page: CustomerListPage at org.junit.Assert.fail(Assert.java:88) at org.apache.wicket.util.tester.BaseWicketTester.getComponentFromLastRenderedPage(BaseWicketTester.java:1611) at org.apache.wicket.util.tester.BaseWicketTester.getComponentFromLastRenderedPage(BaseWicketTester.java:1637) at org.apache.wicket.util.tester.BaseWicketTester.newFormTester(BaseWicketTester.java:1323) at org.apache.wicket.util.tester.BaseWicketTester.newFormTester(BaseWicketTester.java:1307) at braunimmobilien.web.pages.customers.CustomerListIntTest.assert_start_customer_list_page(CustomerListIntTest.java:34) I also tried to supress some tests by defining org.apache.maven.plugins maven-surefire-plugin **/CustomerEditPageTest.java **/CustomerListPageTest.java **/CustomerCreatePageTest.java but it does not succeed.
MarcGiffing commented 7 years ago

Please use debugComponentTrees() from the wicket tester to inspect the current components of the page.. You havn't provided the code of the CustomerListPage/CustomerListPageTest classes. Its hard to tell whats the problem...

ghost commented 7 years ago

Here both classes:

package braunimmobilien.web.pages.customers;

import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify;

import java.util.ArrayList; import java.util.List;

import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable; import org.apache.wicket.markup.repeater.Item; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import org.springframework.boot.test.mock.mockito.MockBean;

import braunimmobilien.model.Customer; import braunimmobilien.repository.services.customer.CustomerRepositoryService; import braunimmobilien.repository.services.customer.filter.CustomerSort; import braunimmobilien.web.WicketBaseTest; import braunimmobilien.web.html.modal.YesNoModal; import braunimmobilien.web.pages.customers.CustomerListPage; import braunimmobilien.web.pages.customers.create.CustomerCreatePage;

public class CustomerListPageTest extends WicketBaseTest {

private static final long CUSTOMERS_COUNT = 5;

@MockBean private CustomerRepositoryService repository; @Override @Before public void setUp(){ super.setUp(); Mockito.when(repository.findAll(Mockito.anyLong(), Mockito.anyLong(), Mockito.any())).thenReturn(createCustomers(CUSTOMERS_COUNT)); Mockito.when(repository.count(Mockito.any())).thenReturn(CUSTOMERS_COUNT); for (long i=1; i <= CUSTOMERS_COUNT; i++) { Mockito.when(repository.findById(i)).thenReturn(createCustomer(i)); } } @Test @SuppressWarnings({ "rawtypes", "unchecked" }) public void assert_start_customer_list_page(){ getTester().startPage(CustomerListPage.class); getTester().assertRenderedPage(CustomerListPage.class); getTester().assertComponent("filterForm:table", DataTable.class); DataTable<Customer, CustomerSort> dataTable = (DataTable) getTester().getComponentFromLastRenderedPage("filterForm:table"); assertThat(dataTable.getItemCount(), equalTo(CUSTOMERS_COUNT)); //id, username, firstname, lastname, active, actions assertThat(dataTable.getColumns().size(), equalTo(6)); //get third row Item item3 = (Item) getTester().getComponentFromLastRenderedPage("filterForm:table:body:rows:3"); assertThat(item3.getModelObject().getId(), equalTo(3L)); assertThat(item3.getModelObject().getUsername(), equalTo("username3")); Item item5 = (Item) getTester().getComponentFromLastRenderedPage("filterForm:table:body:rows:5"); assertThat(item5.getModelObject().getId(), equalTo(5L)); assertThat(item5.getModelObject().getUsername(), equalTo("username5")); } @Test public void assert_click_customer_edit_page(){ getTester().startPage(CustomerListPage.class); getTester().assertRenderedPage(CustomerListPage.class); getTester().clickLink(getTableCell(5, 6) + "items:0:item:link"); getTester().assertRenderedPage(CustomerCreatePage.class); } @Test public void assert_click_customer_create_page(){ getTester().startPage(CustomerListPage.class); getTester().assertRenderedPage(CustomerListPage.class); getTester().clickLink("create"); getTester().assertRenderedPage(CustomerCreatePage.class); } @Test public void assert_delete_customer_method_called_once(){ getTester().startPage(CustomerListPage.class); getTester().assertRenderedPage(CustomerListPage.class); getTester().clickLink(getTableCell(5, 6) + "items:1:item:link"); getTester().assertComponent("defaultModal", YesNoModal.class); getTester().clickLink("defaultModal:content:yes", true); verify(repository, times(1)).delete(Mockito.anyLong()); verify(repository, times(1)).delete(5L); } private String getTableCell(int row, int cell){ return "filterForm:table:body:rows:" + row + ":cells:" + cell + ":cell:"; } public static List createCustomers(long count) { List customers = new ArrayList<>(); for(long i = 1; i <= count; i++){ customers.add(createCustomer(i)); } return customers; }

public static Customer createCustomer(long i) { Customer customer = new Customer(); customer.setId(Long.valueOf(i)); customer.setUsername("username" + i); customer.setFirstname("firstname" + i); customer.setLastname("lastname" + i); customer.setPassword("password" + i); return customer; } }

package braunimmobilien.web.pages.customers;

import java.util.ArrayList; import java.util.List;

import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation; import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable; import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn; import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable; import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterForm; import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterToolbar; import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilteredPropertyColumn; import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.CheckBox; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.link.BookmarkablePageLink; import org.apache.wicket.markup.repeater.Item; import org.apache.wicket.model.CompoundPropertyModel; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; import org.apache.wicket.model.PropertyModel; import org.apache.wicket.model.ResourceModel; import org.apache.wicket.protocol.ws.api.WebSocketBehavior; import org.apache.wicket.protocol.ws.api.WebSocketRequestHandler; import org.apache.wicket.protocol.ws.api.message.IWebSocketPushMessage; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.spring.injection.annot.SpringBean; import org.apache.wicket.validation.validator.StringValidator; import org.wicketstuff.annotation.mount.MountPath;

import braunimmobilien.model.Customer; import braunimmobilien.repository.services.customer.CustomerRepositoryService; import braunimmobilien.repository.services.customer.filter.CustomerFilter; import braunimmobilien.repository.services.customer.filter.CustomerSort; import braunimmobilien.web.general.action.panel.ActionPanel; import braunimmobilien.web.general.action.panel.items.AbstrractActionItem; import braunimmobilien.web.general.action.panel.items.links.ActionItemLink; import braunimmobilien.web.general.action.panel.items.yesno.YesNoLink; import braunimmobilien.web.general.icons.IconType; import braunimmobilien.web.html.basic.YesNoLabel; import braunimmobilien.web.html.border.LabeledFormBorder; import braunimmobilien.web.html.form.ValidationForm; import braunimmobilien.web.html.panel.FeedbackPanel; import braunimmobilien.web.html.repeater.data.table.filter.AbstractCheckBoxFilter; import braunimmobilien.web.html.repeater.data.table.filter.AbstractTextFieldFilter; import braunimmobilien.web.pages.BasePage; import braunimmobilien.web.pages.customers.create.CustomerCreatePage; import braunimmobilien.web.pages.customers.edit.CustomerEditPage; import braunimmobilien.web.pages.customers.events.CustomerChangedEvent; import braunimmobilien.web.pages.customers.model.CustomerDataProvider; import braunimmobilien.web.pages.customers.model.UsernameSearchTextField;

@MountPath("customers") @AuthorizeInstantiation("USER") public class CustomerListPage extends BasePage {

@SpringBean private CustomerRepositoryService customerRepositoryService; private IModel customerFilterModel;

private FilterForm filterForm; public CustomerListPage() { FeedbackPanel feedbackPanel = new FeedbackPanel("feedback"); feedbackPanel.setOutputMarkupId(true); add(feedbackPanel); System.err.println("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"+customerRepositoryService.search("a").size()); add(new WebSocketBehavior() {

@Override protected void onPush(WebSocketRequestHandler handler, IWebSocketPushMessage message) { if (message instanceof CustomerChangedEvent) { CustomerChangedEvent event = (CustomerChangedEvent)message; info("changed/created " + event.getCustomer().getFirstname() + " " + event.getCustomer().getLastname()); handler.add(feedbackPanel); } }

}); customerFilterModel = new CompoundPropertyModel<>(new CustomerFilter()); CustomerDataProvider customerDataProvider = new CustomerDataProvider(customerFilterModel); queue(new BookmarkablePageLink("create", CustomerCreatePage.class)); queue(new ValidationForm<>("form", customerFilterModel)); queue(new LabeledFormBorder<>(getString("id"), new TextField<>("id"))); queue(new LabeledFormBorder<>(getString("username"), new UsernameSearchTextField("usernameLike"))); queue(new LabeledFormBorder<>(getString("firstname"), new TextField("firstnameLike").add(StringValidator.minimumLength(3)))); queue(new LabeledFormBorder<>(getString("lastname"), new TextField("lastnameLike").add(StringValidator.minimumLength(3)))); queue(new LabeledFormBorder<>(getString("active"), new CheckBox("active"))); queue(cancelButton()); customerDataTable(customerDataProvider);

}

private Button cancelButton() { Button cancelButton = new Button("cancel") {

@Override public void onSubmit() { customerFilterModel.setObject(new CustomerFilter()); getForm().clearInput(); filterForm.clearInput(); }

}; cancelButton.setDefaultFormProcessing(false); return cancelButton; }

private void customerDataTable(CustomerDataProvider customerDataProvider) {

filterForm = new FilterForm("filterForm", customerDataProvider); queue(filterForm);

List<IColumn<Customer, CustomerSort>> columns = new ArrayList<>(); columns.add(idColumn()); columns.add(usernameColumn()); columns.add(firstnameColumn()); columns.add(lastnameColumn()); columns.add(activeColumn()); columns.add(actionColumn());

DataTable<Customer, CustomerSort> dataTable = new AjaxFallbackDefaultDataTable<Customer, CustomerSort>("table", columns, customerDataProvider, 10); FilterToolbar filterToolbar = new FilterToolbar(dataTable, filterForm);

dataTable.addTopToolbar(filterToolbar); queue(dataTable); }

private PropertyColumn<Customer, CustomerSort> idColumn() { return new PropertyColumn<>(Model.of("Id"), CustomerSort.ID, CustomerSort.ID.getFieldName()); } private FilteredPropertyColumn<Customer, CustomerSort> usernameColumn() { return new FilteredPropertyColumn<Customer, CustomerSort>(new ResourceModel("username"), CustomerSort.USERNAME, CustomerSort.USERNAME.getFieldName()) {

@Override public Component getFilter(String componentId, FilterForm<?> form) { return new AbstractTextFieldFilter(componentId, new PropertyModel<>(form.getModel(), "usernameLike"), form) {

@Override public TextField createTextFieldComponent(String componentId, IModel model) { return new UsernameSearchTextField(componentId, model); }

}; }

}; } private FilteredPropertyColumn<Customer, CustomerSort> firstnameColumn() { return new FilteredPropertyColumn<Customer, CustomerSort>(new ResourceModel("firstname"), CustomerSort.FIRSTNAME, CustomerSort.FIRSTNAME.getFieldName()) {

@Override public Component getFilter(String componentId, FilterForm<?> form) { return new AbstractTextFieldFilter(componentId, new PropertyModel<>(form.getModel(), "firstnameLike"), form) {

@Override public TextField createTextFieldComponent(String componentId, IModel model) { return new TextField<>(componentId, model); }

}; }

}; } private FilteredPropertyColumn<Customer, CustomerSort> lastnameColumn() { return new FilteredPropertyColumn<Customer, CustomerSort>(new ResourceModel("lastname"), CustomerSort.LASTNAME, CustomerSort.LASTNAME.getFieldName()) {

@Override public Component getFilter(String componentId, FilterForm<?> form) { return new AbstractTextFieldFilter(componentId, new PropertyModel<>(form.getModel(), "lastnameLike"), form) {

@Override public TextField createTextFieldComponent(String componentId, IModel model) { return new TextField<>(componentId, model); }

}; }

}; }

private FilteredPropertyColumn<Customer, CustomerSort> activeColumn() { return new FilteredPropertyColumn<Customer, CustomerSort>(new ResourceModel("active"), CustomerSort.ACTIVE, CustomerSort.ACTIVE.getFieldName()) {

@Override public Component getFilter(String componentId, FilterForm<?> form) { return new AbstractCheckBoxFilter(componentId, new PropertyModel<>(form.getModel(), "active"), form); }

@Override public void populateItem(Item<ICellPopulator> item, String componentId, IModel rowModel) { item.add(new YesNoLabel(componentId, (IModel) getDataModel(rowModel))); }

}; } private AbstractColumn<Customer, CustomerSort> actionColumn() { return new AbstractColumn<Customer, CustomerSort>(Model.of("Action")) {

@Override public void populateItem(Item<ICellPopulator> cellItem, String componentId, IModel rowModel) { List abstractItems = new ArrayList<>(); PageParameters params = new PageParameters(); params.add(CustomerEditPage.CUSTOMER_ID_PARAM, rowModel.getObject().getId()); params.add(CustomerEditPage.PAGE_REFERENCE_ID, getPageId()); abstractItems.add(new ActionItemLink(Model.of("edit"), IconType.EDIT, new BookmarkablePageLink("link", CustomerEditPage.class, params ))); abstractItems.add(new YesNoLink(Model.of("xx"), IconType.DELETE) {

@Override protected void yesClicked(AjaxRequestTarget target) { customerRepositoryService.delete(rowModel.getObject().getId()); setResponsePage(CustomerListPage.this); } }); ActionPanel actionPanel = new ActionPanel(componentId, abstractItems); cellItem.add(actionPanel);

} }; }

}

2017-06-16 20:54 GMT+02:00 MarcGiffing notifications@github.com:

Please use debugComponentTrees() from the wicket tester to inspect the current components of the page.. You havn't provided the code of the CustomerListPage/CustomerListPageTest classes. Its hard to tell whats the problem...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MarcGiffing/wicket-spring-boot/issues/114#issuecomment-309107040, or mute the thread https://github.com/notifications/unsubscribe-auth/AKZkZ7pkZhyKw9Glkr_d9Wm_jv6C1E0Rks5sEs95gaJpZM4N8XgA .

ghost commented 7 years ago

I reduced the tests now and i think i found the change which causes the different behaviour of the tests. To use the agilecoders artifacts i made the following change in the BasePage : private void initPage(){ add(new HtmlTag("html")); add(new Label("title", new ResourceModel("page.title"))); add(new MobileViewportMetaTag("viewport")); add(new IeEdgeMetaTag("ie-edge")); add(newNavbar("navbar"));

    defaultModal = new EmptyPanel("defaultModal");
    defaultModal.setOutputMarkupId(true);
    add(defaultModal);
}
and just at this HTMLTag i have an error:

Tests run: 4, Failures: 0, Errors: 4, Skipped: 0, Time elapsed: 3.933 sec <<< FAILURE! - in braunimmobilien.web.pages.customers.CustomerListPageTest assert_delete_customer_method_called_once(braunimmobilien.web.pages.customers.CustomerListPageTest) Time elapsed: 0.273 sec <<< ERROR! java.lang.NullPointerException: null at de.agilecoders.wicket.core.markup.html.bootstrap.html.HtmlTag.onComponentTag(HtmlTag.java:135) at org.apache.wicket.Component.internalRenderComponent(Component.java:2542) at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1657) at org.apache.wicket.Component.internalRender(Component.java:2401) at org.apache.wicket.Component.render(Component.java:2329) at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1515) at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1718) at org.apache.wicket.Page.onRender(Page.java:879) at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:141) at org.apache.wicket.Component.internalRender(Component.java:2401) at org.apache.wicket.Component.render(Component.java:2329) at org.apache.wicket.Page.renderPage(Page.java:1018) at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:124) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:236) at org.apache.wicket.util.tester.BaseWicketTester$LastPageRecordingPageRendererProvider$1.respond(BaseWicketTester.java:2802) at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:895) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293) at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:722) at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:661) at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:633) at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:1290) at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:1263) at braunimmobilien.web.WicketBaseTest.login(WicketBaseTest.java:75) at braunimmobilien.web.WicketBaseTest.setUp(WicketBaseTest.java:60) at braunimmobilien.web.pages.customers.CustomerListPageTest.setUp(CustomerListPageTest.java:36)

still here the markup of the LoginPage:

<!DOCTYPE html>

Login


Username & Password: admin

I check what happens when i extinct the html Tag in the makup

ghost commented 7 years ago

THe application is running but the test error prevails. I don't know for what this HtmlTag change is good for i copied it from another application which uses more of the agilecoders artifacts maybe i erase this change and look if the application still works

ghost commented 7 years ago

I need this Tag because without i get the error org.apache.wicket.WicketRuntimeException: No BootstrapSettings associated with this Application. Did you call Bootstrap.install()?

ghost commented 7 years ago

What a pity the Application from which i copied has no tests and there is another difference OptimizedMobileViewportMetaTag doesn't exist any more i used MobileViewportMetaTag and the other applicatiuon doesn't use spring authentication. The only idea i have now is to add tests to the other application and see if i get the same error

ghost commented 7 years ago

It is always the HtmlTag which causes the problem in the test java.lang.NullPointerException: null at de.agilecoders.wicket.core.markup.html.bootstrap.html.HtmlTag.onComponentTag(HtmlTag.java:135) at org.apache.wicket.Component.internalRenderComponent(Component.java:2542) when i remove it the test passes but then i cannot use the agilecoders artifacts

2017-06-16 20:54 GMT+02:00 MarcGiffing notifications@github.com:

Please use debugComponentTrees() from the wicket tester to inspect the current components of the page.. You havn't provided the code of the CustomerListPage/CustomerListPageTest classes. Its hard to tell whats the problem...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MarcGiffing/wicket-spring-boot/issues/114#issuecomment-309107040, or mute the thread https://github.com/notifications/unsubscribe-auth/AKZkZ7pkZhyKw9Glkr_d9Wm_jv6C1E0Rks5sEs95gaJpZM4N8XgA .

ghost commented 7 years ago

I think i have it. there is no active theme provider

ghost commented 7 years ago

But now it is a question for you: in the main stream i have the configuration class

ApplicationInitExtension public class BraunimmobilienExtensionConfig implements WicketApplicationInitConfiguration{ @Override public void init(WebApplication webApplication) { configureBootstrap(webApplication); } private void configureBootstrap(WebApplication webApplication) { // System.exit(5); Bootstrap.install(webApplication, new BootstrapSettings().setThemeProvider(new SingleThemeProvider(new BootstrapTheme()))); }

} in the test there is the configuration class @SpringBootApplication @EnableAutoConfiguration(exclude={ DataSourceAutoConfiguration.class, JpaRepositoriesAutoConfiguration.class, HibernateJpaAutoConfiguration.class, }) @ComponentScan(basePackageClasses=SpringBootWebPackageIdentifier.class) public class WicketWebApplicationConfig extends WicketBootSecuredWebApplication {

@Override
protected Class<? extends WebPage> getSignInPageClass() {
    return LoginPage.class;
}

@Override
public Class<? extends Page> getHomePage() {
    return CustomerListPage.class;
}

@Override
protected Class<? extends AbstractAuthenticatedWebSession> getWebSessionClass() {
    return SecureWebSession.class;
}

} How can i bring the themeproviderinformation in the test classes

ghost commented 7 years ago

I have it :: I put BraunimmobilienExtensionConfig in the same package as SpringBootWebPackageIdentifier and then started all paths with "html:"