-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use only Spring, no Java EE! #1
Closed
martin-g
wants to merge
1
commit into
dmbeer:wicket-7-test-spring-security
from
martin-g:wicket-7-test-spring-security
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 9 additions & 14 deletions
23
src/main/java/com/copperarrow/model/dataproviders/UserAccountDataProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,43 @@ | ||
package com.copperarrow.model.dataproviders; | ||
|
||
import com.copperarrow.dao.UserDAO; | ||
import com.copperarrow.model.UserAccount; | ||
import org.apache.wicket.cdi.NonContextual; | ||
import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder; | ||
import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider; | ||
import org.apache.wicket.injection.Injector; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.model.Model; | ||
import org.apache.wicket.spring.injection.annot.SpringBean; | ||
|
||
import javax.ejb.EJB; | ||
import javax.ejb.Stateless; | ||
import java.util.Iterator; | ||
import java.util.List; | ||
|
||
import javax.ejb.Stateless; | ||
|
||
import com.copperarrow.dao.UserDAO; | ||
import com.copperarrow.model.UserAccount; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. class is missing |
||
|
||
/** | ||
* Created by dbeer on 11/02/17. | ||
*/ | ||
@Stateless(name = "UserAcDataProvider") | ||
public class UserAccountDataProvider extends SortableDataProvider<UserAccount, String> { | ||
|
||
@EJB(name = "UserDAO") | ||
@SpringBean | ||
private UserDAO userDAO; | ||
|
||
public UserAccountDataProvider() { | ||
Injector.get().inject(this); | ||
setSort("firstName", SortOrder.ASCENDING); | ||
} | ||
|
||
private void getDAO() { | ||
if (userDAO == null) { | ||
NonContextual.of(UserAccountDataProvider.class).inject(this); | ||
} | ||
} | ||
|
||
@Override | ||
public Iterator<UserAccount> iterator(long first, long last) { | ||
getDAO(); | ||
List<UserAccount> users = userDAO.sort(getSort().toString(), "firstName"); | ||
|
||
return users.subList((int)first, (int)(first + last)).iterator(); | ||
} | ||
|
||
@Override | ||
public long size() { | ||
getDAO(); | ||
return userDAO.size(); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
package com.copperarrow; | ||
|
||
import org.apache.wicket.Page; | ||
import org.apache.wicket.cdi.CdiConfiguration; | ||
import org.apache.wicket.protocol.http.WebApplication; | ||
import org.apache.wicket.spring.injection.annot.SpringComponentInjector; | ||
import org.apache.wicket.spring.test.ApplicationContextMock; | ||
import org.apache.wicket.util.tester.WicketTester; | ||
import org.junit.Before; | ||
import org.springframework.stereotype.Component; | ||
import org.wicketstuff.javaee.injection.JavaEEComponentInjector; | ||
import org.wicketstuff.javaee.naming.global.ModuleJndiNamingStrategy; | ||
|
||
import com.copperarrow.dao.UserDAO; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. class is missing |
||
|
||
/** | ||
* Created by dbeer on 15/01/17. | ||
|
@@ -44,7 +43,6 @@ protected void init() { | |
//Configures the SpringBean annotation support to use the mock application context. | ||
//This ensures that the mock objects are injected instead of the actual bean classes. | ||
getComponentInstantiationListeners().add(new SpringComponentInjector(this, applicationContextMock)); | ||
getComponentInstantiationListeners().add(new JavaEEComponentInjector(this, new ModuleJndiNamingStrategy())); | ||
WicketApplicationTest.this.init(this); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class is missing