Merge branch 'develop' into peer_reviewdate_feature
* develop: Changes to build dependencies and config files to support automated builds Done with upcomingEventPanel events now order properly Refactored some XML-related stuff to make it more reusable daily commit weekend commit fixed an issue where a test behaved differently on windows and linux Added upcomingeventpanel
This commit is contained in:
commit
6acc1d35f2
pom.xml
src
main
java/se/su/dsv/scipro
admin/pages
data
project
schedule/baseevent/panels
util/xml
webapp/WEB-INF
test/java/se/su/dsv/scipro
7
pom.xml
7
pom.xml
@ -63,7 +63,6 @@
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@ -77,7 +76,6 @@
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.13</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Deps -->
|
||||
@ -85,7 +83,6 @@
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
@ -112,7 +109,6 @@
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@ -164,7 +160,6 @@
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-ehcache</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Jackrabbit dependencies -->
|
||||
@ -187,7 +182,6 @@
|
||||
<groupId>eu.medsea.mimeutil</groupId>
|
||||
<artifactId>mime-util</artifactId>
|
||||
<version>2.1.3</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Additional dependencies -->
|
||||
@ -195,7 +189,6 @@
|
||||
<groupId>org.apache.wicket</groupId>
|
||||
<artifactId>wicket-extensions</artifactId>
|
||||
<version>${wicket.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.odlabs.wiquery</groupId>
|
||||
|
@ -56,7 +56,5 @@ public class AdminProjectPartnerPage extends AbstractAdminPage {
|
||||
|
||||
|
||||
}
|
||||
|
||||
//generalsystemsettings för att spara datum
|
||||
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ public interface EventDao extends LazyDeleteDao<Event> {
|
||||
|
||||
public List<Event> getUpcomingEventsByUserAndProject(final User u, final Project p);
|
||||
|
||||
public List<Event> getUpcomingEventsByUserAndProject(final User u, final Project p, final Integer limit);
|
||||
|
||||
public Event getNextEvent(final User u, final Project p, final Event event);
|
||||
|
||||
public boolean hasHandInsInHandInActivity(final Event event);
|
||||
|
@ -64,6 +64,7 @@ public class EventDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<Event> implement
|
||||
events.addAll(d.getEventsByUserAndProject(u, p, fromDate, toDate, limit));
|
||||
}
|
||||
Collections.sort(events);
|
||||
System.out.println(events);
|
||||
return events;
|
||||
}
|
||||
|
||||
@ -83,6 +84,10 @@ public class EventDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<Event> implement
|
||||
return getEvents(u, p, new Date(), null, null);
|
||||
}
|
||||
|
||||
public List<Event> getUpcomingEventsByUserAndProject(final User u, final Project p, Integer limit){
|
||||
return getEvents(u, p, new Date(), null, limit);
|
||||
}
|
||||
|
||||
public Event getNextEvent(final User u, final Project p, final Event e) {
|
||||
List<Event> list = getEvents(u, p, e.getDueDate() , null, 1);
|
||||
if(list.size() == 0){
|
||||
|
@ -89,6 +89,7 @@ public class GroupEventDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<GroupEvent>
|
||||
if(toDate != null){
|
||||
geQuery.setParameter("toDate", toDate);
|
||||
}
|
||||
|
||||
|
||||
try{
|
||||
return geQuery.getResultList();
|
||||
@ -131,6 +132,7 @@ public class GroupEventDaoJPAImp extends LazyDeleteAbstractDaoJPAImp<GroupEvent>
|
||||
if(toDate != null){
|
||||
query.setParameter("toDate", toDate);
|
||||
}
|
||||
|
||||
|
||||
try{
|
||||
return query.getResultList();
|
||||
|
@ -132,18 +132,19 @@ public abstract class Event extends LazyDeletableDomainObject
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (this.getClass() != obj.getClass())
|
||||
return false;
|
||||
if (obj instanceof Event){
|
||||
|
||||
Event other = (Event) obj;
|
||||
|
||||
Event other = (Event) obj;
|
||||
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -153,7 +154,7 @@ public abstract class Event extends LazyDeletableDomainObject
|
||||
|
||||
@Override
|
||||
public int compareTo(Event other) {
|
||||
int dcomp = (int) (dueDate.getTime() - other.dueDate.getTime());
|
||||
int dcomp = dueDate.compareTo(other.dueDate);
|
||||
if(dcomp == 0)
|
||||
return id.compareTo(other.id);
|
||||
else
|
||||
|
@ -34,6 +34,9 @@
|
||||
<h5 class="peer-title">Final seminar for this project</h5>
|
||||
<div wicket:id="projectSeminarPanel"></div>
|
||||
</div>
|
||||
<div class="span-10 last">
|
||||
<div wicket:id="upcomingEventPanel"></div>
|
||||
</div>
|
||||
<!-- <div class="span-10 last">-->
|
||||
<!-- <h5 class="peer-title">Oppositions & Active participations</h5>-->
|
||||
<!-- <div wicket:id="oppositionStatsPanel"></div>-->
|
||||
|
@ -12,6 +12,7 @@ import se.su.dsv.scipro.peer.pages.ProjectPeerReviewPage;
|
||||
import se.su.dsv.scipro.peer.panels.StudentPeerInfoRequestsPanel;
|
||||
import se.su.dsv.scipro.project.panels.ProjectWallPanel;
|
||||
import se.su.dsv.scipro.project.panels.StateOfMindPanel;
|
||||
import se.su.dsv.scipro.project.panels.UpcomingEventPanel;
|
||||
import se.su.dsv.scipro.schedule.panels.ProjectProgressPanel;
|
||||
import se.su.dsv.scipro.security.auth.roles.Roles;
|
||||
|
||||
@ -34,6 +35,7 @@ public class ProjectStartPage extends ProjectPage {
|
||||
add(new FeedbackPanel("feedback"));
|
||||
add(new ProjectFinalSeminarContainerPanel("projectSeminarPanel", activeProject));
|
||||
//add(new StudentOppositionStatsPanel("oppositionStatsPanel", activeProject));
|
||||
add(new UpcomingEventPanel("upcomingEventPanel", activeProject, 3));
|
||||
leftColumn.add(new StudentPeerInfoRequestsPanel("peerRequests", null, activeProject){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -45,7 +47,9 @@ public class ProjectStartPage extends ProjectPage {
|
||||
ProjectProgressPanel progressPanel = new ProjectProgressPanel("progress", activeProject);
|
||||
leftColumn.add(progressPanel.getHelpIcon("progressHelp"));
|
||||
leftColumn.add(progressPanel);
|
||||
//leftColumn.add(new UpcomingEventPanel("upcomingEventPanel", activeProject));
|
||||
leftColumn.add(new ProjectWallPanel("projectWallPanel", activeProject));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div class="span-10 last">
|
||||
<h5 class="peer-title">Upcoming events</h5>
|
||||
<div wicket:id="eventListContainer" class="span-10 last">
|
||||
<div class="span-10 last"></div>
|
||||
<div class="span-10 last" wicket:id="events">
|
||||
<div wicket:id="eventPanel"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div wicket:id="dialog">
|
||||
<div wicket:id="dialogContainer">
|
||||
<div wicket:id="containerContent">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,174 @@
|
||||
package se.su.dsv.scipro.project.panels;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.wicket.Page;
|
||||
import org.apache.wicket.PageParameters;
|
||||
import org.apache.wicket.ajax.AjaxRequestTarget;
|
||||
import org.apache.wicket.markup.html.WebMarkupContainer;
|
||||
import org.apache.wicket.markup.html.list.ListItem;
|
||||
import org.apache.wicket.markup.html.list.ListView;
|
||||
import org.apache.wicket.markup.html.panel.EmptyPanel;
|
||||
import org.apache.wicket.markup.html.panel.Panel;
|
||||
import org.apache.wicket.model.IModel;
|
||||
import org.apache.wicket.model.LoadableDetachableModel;
|
||||
import org.apache.wicket.model.Model;
|
||||
import org.apache.wicket.spring.injection.annot.SpringBean;
|
||||
import org.odlabs.wiquery.core.effects.EffectSpeed;
|
||||
import org.odlabs.wiquery.ui.dialog.Dialog;
|
||||
|
||||
import se.su.dsv.scipro.SciProSession;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.EventDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.ProjectDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.Event;
|
||||
import se.su.dsv.scipro.data.dataobjects.Project;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.project.pages.ProjectEventPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectScheduleGeneratorPage;
|
||||
import se.su.dsv.scipro.project.pages.ProjectSchedulePlannerPage;
|
||||
import se.su.dsv.scipro.schedule.baseevent.panels.EventSchedulePanel;
|
||||
import se.su.dsv.scipro.util.WiQueryCoreEffectsHelper;
|
||||
|
||||
public class UpcomingEventPanel extends Panel{
|
||||
|
||||
/**
|
||||
* @author Fredrik Norberg - fnorbe@dsv.su.se
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4481663857329726445L;
|
||||
|
||||
@SpringBean
|
||||
private ProjectDao projectDao;
|
||||
|
||||
@SpringBean
|
||||
private EventDao eventDao;
|
||||
|
||||
private Project project;
|
||||
private User user;
|
||||
private ListView<Event> eventList;
|
||||
private IModel<List<Event>> listModel;
|
||||
private WebMarkupContainer eventListContainer;
|
||||
private int amountToShow;
|
||||
private WebMarkupContainer dialogContainer;
|
||||
private Dialog dialog;
|
||||
private Model<String> dialogTitle = new Model<String>("");
|
||||
|
||||
public UpcomingEventPanel(String id, final Project p, final int amountToShow){
|
||||
super(id);
|
||||
this.project = projectDao.reLoad(p);
|
||||
this.user = SciProSession.get().getUser();
|
||||
this.amountToShow = amountToShow;
|
||||
|
||||
dialogContainer = new WebMarkupContainer("dialogContainer");
|
||||
dialogContainer.setOutputMarkupId(true);
|
||||
dialogContainer.setVersioned(false);
|
||||
dialogContainer.add(new EmptyPanel("containerContent"));
|
||||
dialog = new Dialog("dialog");
|
||||
dialog.setModal(true);
|
||||
dialog.setAutoOpen(false);
|
||||
dialog.add(dialogContainer);
|
||||
dialog.setWidth(600);
|
||||
dialog.setHeight(450);
|
||||
dialog.setTitle(dialogTitle);
|
||||
add(dialog);
|
||||
|
||||
listModel = new LoadableDetachableModel<List<Event>>(){
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4397997418096384845L;
|
||||
|
||||
@Override
|
||||
protected List<Event> load() {
|
||||
List<Event> list = eventDao.getEventsByUserAndProject(user, project,
|
||||
new Date(), null, null);
|
||||
if(amountToShow < list.size()){ //use this to limit the events shown
|
||||
list = list.subList(0, amountToShow);
|
||||
}
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
eventList = new ListView<Event>("events", listModel){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void populateItem(ListItem<Event> item) {
|
||||
final Event e = item.getModelObject();
|
||||
item.add(new EventSchedulePanel("eventPanel", e, project, false){
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void replaceAndOpenDialog(AjaxRequestTarget target,
|
||||
Panel replacePanel) {
|
||||
dialogContainer.replace(replacePanel);
|
||||
target.addComponent(dialogContainer);
|
||||
dialog.open(target);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshListView(AjaxRequestTarget target) {
|
||||
target.addComponent(WiQueryCoreEffectsHelper.fadeIn(eventListContainer, EffectSpeed.FAST));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeDialogAndRefreshListView(AjaxRequestTarget target) {
|
||||
target.addComponent(WiQueryCoreEffectsHelper.fadeIn(eventListContainer, EffectSpeed.FAST));
|
||||
dialog.close(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEventDetailsClick() {
|
||||
PageParameters pp = getEventPageParameters();
|
||||
pp.add(Event.PP_EVENT_ID, String.valueOf(e.getId()));
|
||||
setResponsePage(getEventPageClass(), pp);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
add(item);
|
||||
}
|
||||
};
|
||||
|
||||
/*@Override
|
||||
protected void populateItem(ListItem<Event> item) {
|
||||
final Event e = item.getModelObject();
|
||||
item.add(new Label("title", e.getTitle()));
|
||||
item.add(new Label("date", e.getDueDate().toString()));
|
||||
}
|
||||
|
||||
};*/
|
||||
|
||||
eventListContainer = new WebMarkupContainer("eventListContainer");
|
||||
eventListContainer.setOutputMarkupId(true);
|
||||
eventListContainer.add(eventList);
|
||||
add(eventListContainer);
|
||||
}
|
||||
|
||||
|
||||
public Class<? extends Page> getGeneratorPageClass() {
|
||||
return ProjectScheduleGeneratorPage.class;
|
||||
}
|
||||
|
||||
public Class<? extends Page> getEventPageClass() {
|
||||
return ProjectEventPage.class;
|
||||
}
|
||||
|
||||
public PageParameters getSchedulePageParameters(){
|
||||
return new PageParameters();
|
||||
}
|
||||
public PageParameters getGeneratorPageParameters(){
|
||||
return new PageParameters();
|
||||
}
|
||||
public PageParameters getEventPageParameters(){
|
||||
return new PageParameters();
|
||||
}
|
||||
|
||||
}
|
@ -165,8 +165,10 @@ public abstract class EventSchedulePanel extends Panel {
|
||||
statusIcon = ImageIcon.ICON_EVENT_ALERT;
|
||||
} else {
|
||||
//The event must be upcoming
|
||||
statusMsgModel.setObject("Event upcoming");
|
||||
statusIcon = ImageIcon.ICON_EVENT_UPCOMING;
|
||||
if(event.getDueDate().getTime() > new Date().getTime()){
|
||||
statusMsgModel.setObject("Event upcoming");
|
||||
statusIcon = ImageIcon.ICON_EVENT_UPCOMING;
|
||||
}
|
||||
}
|
||||
|
||||
add(new IconPanel("statusIcon", statusIcon){
|
||||
|
@ -0,0 +1,106 @@
|
||||
package se.su.dsv.scipro.util.xml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
|
||||
/**
|
||||
* Utility class for providing configurable namespace contexts, satisfies specification defined in the NamespaceContext interface.
|
||||
* The default namespace-prefixes (DEFAULT_NS_PREFIX, XML_NS_PREFIX and XMLNS_ATTRIBUTE) are automatically mapped to defaults and are not configurable from clients.
|
||||
* Typical usage:
|
||||
* <code>
|
||||
* MutableNamespaceContext mnc = new MutableNamespaceContext();
|
||||
* mnc.setMapping("somePrefix", "someNamespaceURI");
|
||||
* XPath xp = .....
|
||||
* xp.setNamespaceContext(mnc);
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
public final class MutableNamespaceContext implements NamespaceContext {
|
||||
private final Map<String,String> nsMap = new HashMap<String,String>();
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public MutableNamespaceContext(){
|
||||
setupDefaults();
|
||||
}
|
||||
/**
|
||||
* Attempts to resolve the given prefix into a namespaceURI.
|
||||
* @return The namespace URI or XMLConstants.NULL_NS_URI if no mapping is found.
|
||||
* @throws IllegalStateException if the given prefix is null.
|
||||
*/
|
||||
@Override
|
||||
public String getNamespaceURI(String prefix){
|
||||
if(prefix == null)
|
||||
throw new IllegalStateException("A null prefix not allowed");
|
||||
if(!nsMap.containsKey(prefix))
|
||||
return XMLConstants.NULL_NS_URI;
|
||||
else
|
||||
return nsMap.get(prefix);
|
||||
}
|
||||
/**
|
||||
* Resolves all registered prefixes for the given URI.
|
||||
* @param uri
|
||||
* @return An iterator of all registered prefixes for the given URI, the empty iterator if none are found.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Iterator<String> getPrefixes(String URI) {
|
||||
if(URI == null)
|
||||
throw new IllegalStateException("A null URI not allowed");
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(Map.Entry<String, String> entry : nsMap.entrySet()){
|
||||
if(entry.getValue().equals(URI))
|
||||
list.add(entry.getKey());
|
||||
}
|
||||
return Collections.unmodifiableList(list).iterator();
|
||||
}
|
||||
/**
|
||||
* Resolves one prefix for the given URI.
|
||||
* @param uri
|
||||
* @return The registered prefix
|
||||
*/
|
||||
@Override
|
||||
public String getPrefix(String URI) {
|
||||
if(URI == null)
|
||||
throw new IllegalStateException("A null URI not allowed");
|
||||
final Iterator<String> itr = getPrefixes(URI);
|
||||
if(itr.hasNext())
|
||||
return itr.next();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Sets a prefix to URI mapping.
|
||||
* Overwrites existing mappings if existing, does not allow setting any of the default name space prefix mappings or mapping alternative prefixes for the default name space URI's.
|
||||
* @param prefix
|
||||
* @param URI
|
||||
* @throws IllegalStateException if either argument is null.
|
||||
*/
|
||||
public void setMapping(final String prefix, final String URI){
|
||||
if(prefix==null || URI==null)
|
||||
throw new IllegalStateException("Null prefix or URI not allowed");
|
||||
if(!prefix.equals(XMLConstants.DEFAULT_NS_PREFIX) && !prefix.equals(XMLConstants.XML_NS_PREFIX) && !prefix.equals(XMLConstants.XMLNS_ATTRIBUTE)
|
||||
&& !URI.equals(XMLConstants.XML_NS_URI) && !URI.equals(XMLConstants.XML_NS_URI) && !URI.equals(XMLConstants.NULL_NS_URI))
|
||||
nsMap.put(prefix, URI);
|
||||
}
|
||||
/**
|
||||
* Clear user defined mappings.
|
||||
*/
|
||||
public void clearMappings(){
|
||||
nsMap.clear();
|
||||
setupDefaults();
|
||||
}
|
||||
private void setupDefaults(){
|
||||
nsMap.put(XMLConstants.XML_NS_PREFIX, XMLConstants.XML_NS_URI);
|
||||
nsMap.put(XMLConstants.XMLNS_ATTRIBUTE, XMLConstants.XMLNS_ATTRIBUTE_NS_URI);
|
||||
nsMap.put(XMLConstants.DEFAULT_NS_PREFIX, XMLConstants.NULL_NS_URI);
|
||||
}
|
||||
}
|
@ -64,7 +64,7 @@
|
||||
<!-- Use deployment for production, development for development -->
|
||||
<context-param>
|
||||
<param-name>configuration</param-name>
|
||||
<!-- <param-value>development</param-value>-->
|
||||
<!--param-value>development</param-value-->
|
||||
<param-value>deployment</param-value>
|
||||
</context-param>
|
||||
|
||||
|
@ -27,6 +27,8 @@ import org.w3c.dom.Node;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import se.su.dsv.scipro.util.xml.MutableNamespaceContext;
|
||||
|
||||
/**
|
||||
* Assert that deploy configuration is upheld before build can be completed.
|
||||
* @author Martin Peters - mpeters@dsv.su.se
|
||||
@ -107,21 +109,21 @@ public class TestDeployConfiguration {
|
||||
public void testExternalAuthCfg() throws XPathExpressionException, IOException{
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("true", xPath.evaluate("/defaultNS:beans/defaultNS:bean[@id='applicationSettings']/defaultNS:property[@name='acceptExternalAuthentication']/@value", applicationContextXml));
|
||||
Assert.assertEquals("true", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='applicationSettings']/beanNS:property[@name='acceptExternalAuthentication']/@value", applicationContextXml));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteUserLookupCfg() throws XPathExpressionException, IOException{
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("true", xPath.evaluate("/defaultNS:beans/defaultNS:bean[@id='applicationSettings']/defaultNS:property[@name='enableRemoteUserLookup']/@value", applicationContextXml));
|
||||
Assert.assertEquals("true", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='applicationSettings']/beanNS:property[@name='enableRemoteUserLookup']/@value", applicationContextXml));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoteUserRemoteUserLookupUrlCfg() throws XPathExpressionException, IOException{
|
||||
InputSource applicationContextXml = getInputSource(applicationContextPath);
|
||||
XPath xPath = getApplicationContextXPath();
|
||||
Assert.assertEquals("https://thesis.dsv.su.se/match/json", xPath.evaluate("/defaultNS:beans/defaultNS:bean[@id='applicationSettings']/defaultNS:property[@name='remoteLookupUrl']/@value", applicationContextXml));
|
||||
Assert.assertEquals("https://thesis.dsv.su.se/match/json", xPath.evaluate("/beanNS:beans/beanNS:bean[@id='applicationSettings']/beanNS:property[@name='remoteLookupUrl']/@value", applicationContextXml));
|
||||
}
|
||||
|
||||
private InputSource getInputSource(String filePath) throws IOException{
|
||||
@ -142,28 +144,9 @@ public class TestDeployConfiguration {
|
||||
}
|
||||
private XPath getApplicationContextXPath(){
|
||||
XPath xPath = XPathFactory.newInstance().newXPath();
|
||||
xPath.setNamespaceContext(new NamespaceContext(){
|
||||
@Override
|
||||
public String getNamespaceURI(String prefix){
|
||||
if(prefix.equals("defaultNS"))
|
||||
return "http://www.springframework.org/schema/beans";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
public Iterator<String> getPrefixes(String val) {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
list.add(getPrefix(val));
|
||||
return list.iterator();
|
||||
}
|
||||
@Override
|
||||
public String getPrefix(String uri) {
|
||||
if(uri.equals("http://www.springframework.org/schema/beans"))
|
||||
return "defaultNS";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
});
|
||||
MutableNamespaceContext mnc = new MutableNamespaceContext();
|
||||
mnc.setMapping("beanNS","http://www.springframework.org/schema/beans");
|
||||
xPath.setNamespaceContext(mnc);
|
||||
return xPath;
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public class BaseWicketTest {
|
||||
|
||||
@Mock EntityManagerFactoryInfo entityManagerFactory = Mockito.mock(LocalEntityManagerFactoryBean.class);
|
||||
|
||||
@Before
|
||||
//@Before
|
||||
public void setup() {
|
||||
/*
|
||||
* Setup a new mock applicationContext
|
||||
|
@ -59,6 +59,8 @@ public class TestWicketPages extends BaseWicketTest {
|
||||
@Test
|
||||
public void testStartPage() throws Exception {
|
||||
|
||||
|
||||
this.setLoggedIn(false);
|
||||
tester.startPage(HomePage.class);
|
||||
tester.assertRenderedPage(LoginPage.class);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user