ItEr08S06ArquitecturaClientesItEr07S07: Hibernate validations dependences added. Annotating Worker with. Add facility to show messages to the user, integrated with WorkerCrudController.
This commit is contained in:
parent
4924acc8b9
commit
fd9e9feba9
14 changed files with 728 additions and 463 deletions
|
|
@ -41,6 +41,14 @@
|
|||
<artifactId>easymock</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-annotations</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -1,64 +1,69 @@
|
|||
package org.navalplanner.business.resources.entities;
|
||||
|
||||
import org.hibernate.validator.Min;
|
||||
import org.hibernate.validator.NotEmpty;
|
||||
|
||||
/**
|
||||
* This class models a worker.
|
||||
*
|
||||
* @author Fernando Bellas Permuy <fbellas@udc.es>
|
||||
*
|
||||
*/
|
||||
public class Worker extends Resource {
|
||||
|
||||
@NotEmpty
|
||||
private String firstName;
|
||||
|
||||
@NotEmpty
|
||||
private String surname;
|
||||
|
||||
@NotEmpty
|
||||
private String nif;
|
||||
|
||||
@Min(0)
|
||||
private int dailyHours;
|
||||
|
||||
public Worker() {}
|
||||
|
||||
public Worker(String firstName, String surname, String nif,
|
||||
int dailyHours) {
|
||||
|
||||
|
||||
public Worker() {
|
||||
}
|
||||
|
||||
public Worker(String firstName, String surname, String nif, int dailyHours) {
|
||||
this.firstName = firstName;
|
||||
this.surname = surname;
|
||||
this.nif = nif;
|
||||
this.dailyHours = dailyHours;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
|
||||
public String getSurname() {
|
||||
return surname;
|
||||
}
|
||||
|
||||
|
||||
public void setSurname(String surname) {
|
||||
this.surname = surname;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getNif() {
|
||||
return nif;
|
||||
}
|
||||
|
||||
|
||||
public void setNif(String nif) {
|
||||
this.nif = nif;
|
||||
}
|
||||
|
||||
|
||||
public int getDailyHours() {
|
||||
return dailyHours;
|
||||
}
|
||||
|
||||
|
||||
public void setDailyHours(int dailyHours) {
|
||||
this.dailyHours = dailyHours;
|
||||
}
|
||||
|
||||
|
||||
public int getDailyCapacity() {
|
||||
return dailyHours;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
/**
|
||||
* Implementation of the resource management service. Resource DAOs are
|
||||
* autowired.
|
||||
*
|
||||
* @author Fernando Bellas Permuy <fbellas@udc.es>
|
||||
*
|
||||
*/
|
||||
@Transactional
|
||||
public class ResourceServiceImpl implements ResourceService {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<!DOCTYPE hibernate-configuration
|
||||
<!DOCTYPE hibernate-configuration
|
||||
PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
|
||||
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
|
||||
|
||||
|
|
@ -9,5 +9,11 @@
|
|||
<property name="hibernate.format_sql">${hibernate.format_sql}</property>
|
||||
<property name="hibernate.use_sql_comments">${hibernate.use_sql_comments}</property>
|
||||
<property name="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</property>
|
||||
<event type="pre-update">
|
||||
<listener class="org.hibernate.validator.event.ValidateEventListener" />
|
||||
</event>
|
||||
<event type="pre-insert">
|
||||
<listener class="org.hibernate.validator.event.ValidateEventListener" />
|
||||
</event>
|
||||
</session-factory>
|
||||
</hibernate-configuration>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
package org.navalplanner.business.test.resources.services;
|
||||
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.validator.ClassValidator;
|
||||
import org.hibernate.validator.InvalidStateException;
|
||||
import org.hibernate.validator.InvalidValue;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.navalplanner.business.common.exceptions.InstanceNotFoundException;
|
||||
|
|
@ -8,6 +12,7 @@ import org.navalplanner.business.resources.entities.ResourceGroup;
|
|||
import org.navalplanner.business.resources.entities.Worker;
|
||||
import org.navalplanner.business.resources.services.ResourceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.annotation.NotTransactional;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -16,6 +21,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.navalplanner.business.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_FILE;
|
||||
import static org.navalplanner.business.test.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_TEST_FILE;
|
||||
|
||||
|
|
@ -36,6 +42,9 @@ public class ResourceServiceTest {
|
|||
@Autowired
|
||||
private IResourceDao resourceDao;
|
||||
|
||||
@Autowired
|
||||
private SessionFactory sessionFactory;
|
||||
|
||||
@Test
|
||||
public void testAddResourceToResourceGroup()
|
||||
throws InstanceNotFoundException {
|
||||
|
|
@ -194,4 +203,27 @@ public class ResourceServiceTest {
|
|||
resourceService.getWorkers().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
@NotTransactional
|
||||
public void testWorkerValidation() throws Exception {
|
||||
ClassValidator<Worker> workerValidator = new ClassValidator<Worker>(
|
||||
Worker.class);
|
||||
Worker[] invalidWorkers = {
|
||||
new Worker("first name", null, "233233", 3),
|
||||
new Worker("first name", "second name", "233233", -1),
|
||||
new Worker(null, "second name", "233233", 3),
|
||||
new Worker("first name", "second name", null, 3) };
|
||||
for (Worker invalidWorker : invalidWorkers) {
|
||||
InvalidValue[] invalidValues = workerValidator
|
||||
.getInvalidValues(invalidWorker);
|
||||
assertEquals(1, invalidValues.length);
|
||||
try {
|
||||
resourceService.saveResource(invalidWorker);
|
||||
fail("must send invalid state exception");
|
||||
} catch (InvalidStateException e) {
|
||||
// ok
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<!DOCTYPE hibernate-configuration
|
||||
<!DOCTYPE hibernate-configuration
|
||||
PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
|
||||
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
|
||||
|
||||
<hibernate-configuration>
|
||||
<session-factory>
|
||||
<property name="hibernate.dialect">${hibernate.dialect}</property>
|
||||
|
|
@ -9,5 +8,11 @@
|
|||
<property name="hibernate.format_sql">true</property>
|
||||
<property name="hibernate.use_sql_comments">true</property>
|
||||
<property name="hibernate.hbm2ddl.auto">update</property>
|
||||
<event type="pre-update">
|
||||
<listener class="org.hibernate.validator.event.ValidateEventListener" />
|
||||
</event>
|
||||
<event type="pre-insert">
|
||||
<listener class="org.hibernate.validator.event.ValidateEventListener" />
|
||||
</event>
|
||||
</session-factory>
|
||||
</hibernate-configuration>
|
||||
|
|
|
|||
|
|
@ -15,57 +15,61 @@
|
|||
<finalName>navalplanner-webapp</finalName>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring</artifactId>
|
||||
</dependency>
|
||||
<!-- BeanShell (required by ZK) -->
|
||||
<dependency>
|
||||
<groupId>org.beanshell</groupId>
|
||||
<artifactId>bsh</artifactId>
|
||||
</dependency>
|
||||
<!-- Apache Commons Fileupload (required by ZK) -->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
</dependency>
|
||||
<!-- ZK -->
|
||||
<dependency>
|
||||
<groupId>org.zkoss.zk</groupId>
|
||||
<artifactId>zul</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.zkoss.zk</groupId>
|
||||
<artifactId>zkplus</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.zkoss.zk</groupId>
|
||||
<artifactId>zk</artifactId>
|
||||
</dependency>
|
||||
<!-- Naval Planner ZK Components -->
|
||||
<dependency>
|
||||
<groupId>org.navalplanner</groupId>
|
||||
<artifactId>navalplanner-gantt-zk</artifactId>
|
||||
</dependency>
|
||||
<!-- Naval Planner Business -->
|
||||
<dependency>
|
||||
<groupId>org.navalplanner</groupId>
|
||||
<artifactId>navalplanner-business</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
<dependencies>
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring</artifactId>
|
||||
</dependency>
|
||||
<!-- BeanShell (required by ZK) -->
|
||||
<dependency>
|
||||
<groupId>org.beanshell</groupId>
|
||||
<artifactId>bsh</artifactId>
|
||||
</dependency>
|
||||
<!-- Apache Commons Fileupload (required by ZK) -->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
</dependency>
|
||||
<!-- ZK -->
|
||||
<dependency>
|
||||
<groupId>org.zkoss.zk</groupId>
|
||||
<artifactId>zul</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.zkoss.zk</groupId>
|
||||
<artifactId>zkplus</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.zkoss.zk</groupId>
|
||||
<artifactId>zk</artifactId>
|
||||
</dependency>
|
||||
<!-- Naval Planner ZK Components -->
|
||||
<dependency>
|
||||
<groupId>org.navalplanner</groupId>
|
||||
<artifactId>navalplanner-gantt-zk</artifactId>
|
||||
</dependency>
|
||||
<!-- Naval Planner Business -->
|
||||
<dependency>
|
||||
<groupId>org.navalplanner</groupId>
|
||||
<artifactId>navalplanner-business</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
package org.navalplanner.web.common;
|
||||
|
||||
import org.hibernate.validator.InvalidValue;
|
||||
|
||||
/**
|
||||
* Defines the ways in which information messages can be shown to the user <br />
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*/
|
||||
public interface IMessagesForUser {
|
||||
|
||||
void invalidValue(InvalidValue invalidValue);
|
||||
|
||||
void showMessage(Level level, String message);
|
||||
|
||||
void clearMessages();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package org.navalplanner.web.common;
|
||||
|
||||
public enum Level {
|
||||
INFO, WARNING, ERROR;
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package org.navalplanner.web.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import org.hibernate.validator.InvalidValue;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zk.ui.util.EventInterceptor;
|
||||
import org.zkoss.zk.ui.util.GenericForwardComposer;
|
||||
import org.zkoss.zul.Label;
|
||||
|
||||
/**
|
||||
* It shows messages to the user. <br />
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*/
|
||||
public class MessagesForUser extends GenericForwardComposer implements
|
||||
IMessagesForUser {
|
||||
|
||||
private Component container;
|
||||
|
||||
private Queue<Component> pendingToDetach = new ConcurrentLinkedQueue<Component>();
|
||||
|
||||
private static final String DETACH_EVENT_NAME = "onMarkDetached";
|
||||
|
||||
public MessagesForUser(Component container) {
|
||||
this.container = container;
|
||||
container.getPage().getDesktop().addListener(new EventInterceptor() {
|
||||
|
||||
@Override
|
||||
public void afterProcessEvent(Event event) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event beforePostEvent(Event event) {
|
||||
return event;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event beforeProcessEvent(Event event) {
|
||||
if (event.getName().equals(DETACH_EVENT_NAME)
|
||||
|| pendingToDetach.isEmpty()) {
|
||||
return event;
|
||||
}
|
||||
Component currrent = null;
|
||||
while ((currrent = pendingToDetach.poll()) != null) {
|
||||
currrent.detach();
|
||||
}
|
||||
return event;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event beforeSendEvent(Event event) {
|
||||
return event;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidValue(InvalidValue invalidValue) {
|
||||
addMessage(createLabelFor(invalidValue));
|
||||
}
|
||||
|
||||
private Component createLabelFor(InvalidValue invalidValue) {
|
||||
Label result = new Label();
|
||||
result.setValue(invalidValue.getPropertyName() + ": "
|
||||
+ invalidValue.getMessage());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMessage(Level level, String message) {
|
||||
final Label label = new Label(message);
|
||||
addMessage(label);
|
||||
}
|
||||
|
||||
private void addMessage(final Component label) {
|
||||
container.appendChild(label);
|
||||
Events.echoEvent(DETACH_EVENT_NAME, label, "");
|
||||
label.addEventListener(DETACH_EVENT_NAME, new EventListener() {
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
pendingToDetach.offer(label);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearMessages() {
|
||||
List<Object> children = new ArrayList<Object>(container.getChildren());
|
||||
for (Object child : children) {
|
||||
Component c = (Component) child;
|
||||
c.detach();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4,7 +4,12 @@ import java.util.List;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.hibernate.validator.ClassValidator;
|
||||
import org.hibernate.validator.InvalidValue;
|
||||
import org.navalplanner.business.resources.entities.Worker;
|
||||
import org.navalplanner.web.common.IMessagesForUser;
|
||||
import org.navalplanner.web.common.Level;
|
||||
import org.navalplanner.web.common.MessagesForUser;
|
||||
import org.navalplanner.web.common.OnlyOneVisible;
|
||||
import org.navalplanner.web.common.Util;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
|
|
@ -20,6 +25,9 @@ public class WorkerCRUDController extends GenericForwardComposer {
|
|||
private static final Log LOG = LogFactory
|
||||
.getLog(WorkerCRUDController.class);
|
||||
|
||||
private ClassValidator<Worker> workerValidator = new ClassValidator<Worker>(
|
||||
Worker.class);
|
||||
|
||||
private Window createWindow;
|
||||
|
||||
private Window listWindow;
|
||||
|
|
@ -32,16 +40,21 @@ public class WorkerCRUDController extends GenericForwardComposer {
|
|||
|
||||
private OnlyOneVisible visibility;
|
||||
|
||||
public WorkerCRUDController() {
|
||||
private IMessagesForUser messages;
|
||||
|
||||
private Component messagesContainer;
|
||||
|
||||
public WorkerCRUDController() {
|
||||
}
|
||||
|
||||
public WorkerCRUDController(Window createWindow, Window listWindow,
|
||||
Window editWindow, IWorkerModel workerModel) {
|
||||
Window editWindow, IWorkerModel workerModel,
|
||||
IMessagesForUser messages) {
|
||||
this.createWindow = createWindow;
|
||||
this.listWindow = listWindow;
|
||||
this.editWindow = editWindow;
|
||||
this.workerModel = workerModel;
|
||||
this.messages = messages;
|
||||
}
|
||||
|
||||
public Worker getWorker() {
|
||||
|
|
@ -56,9 +69,17 @@ public class WorkerCRUDController extends GenericForwardComposer {
|
|||
}
|
||||
|
||||
public void save() {
|
||||
InvalidValue[] invalidValues = workerValidator.getInvalidValues(worker);
|
||||
if (invalidValues.length > 0) {
|
||||
for (InvalidValue invalidValue : invalidValues) {
|
||||
messages.invalidValue(invalidValue);
|
||||
}
|
||||
return;
|
||||
}
|
||||
workerModel.save(worker);
|
||||
getVisibility().showOnly(listWindow);
|
||||
Util.reloadBindings(listWindow);
|
||||
messages.showMessage(Level.INFO, "traballador gardado");
|
||||
worker = null;
|
||||
}
|
||||
|
||||
|
|
@ -86,6 +107,9 @@ public class WorkerCRUDController extends GenericForwardComposer {
|
|||
super.doAfterCompose(comp);
|
||||
comp.setVariable("controller", this, true);
|
||||
getVisibility().showOnly(listWindow);
|
||||
if (messagesContainer == null)
|
||||
throw new RuntimeException("messagesContainer is needed");
|
||||
messages = new MessagesForUser(messagesContainer);
|
||||
}
|
||||
|
||||
private OnlyOneVisible getVisibility() {
|
||||
|
|
|
|||
|
|
@ -11,10 +11,12 @@
|
|||
<window self="@{define(content)}"
|
||||
apply="org.navalplanner.web.resources.WorkerCRUDController"
|
||||
sclass="workerwindow">
|
||||
<vbox id="messagesContainer">
|
||||
</vbox>
|
||||
<list top_id="listWindow" />
|
||||
<edition top_id="createWindow" title="Create"
|
||||
save_button_label="Save" cancel_button_label="Cancel" />
|
||||
<edition top_id="editWindow" title="Edit"
|
||||
save_button_label="Save" cancel_button_label="Cancel" />
|
||||
</window>
|
||||
</zk>
|
||||
</zk>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
package org.navalplanner.web.resources;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static org.easymock.EasyMock.createMock;
|
||||
import static org.easymock.EasyMock.createNiceMock;
|
||||
import static org.easymock.EasyMock.expect;
|
||||
import static org.easymock.EasyMock.expectLastCall;
|
||||
import static org.easymock.EasyMock.isA;
|
||||
import static org.easymock.EasyMock.replay;
|
||||
import static org.easymock.EasyMock.verify;
|
||||
|
||||
|
|
@ -11,8 +14,12 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.validator.ClassValidator;
|
||||
import org.hibernate.validator.InvalidValue;
|
||||
import org.junit.Test;
|
||||
import org.navalplanner.business.resources.entities.Worker;
|
||||
import org.navalplanner.web.common.IMessagesForUser;
|
||||
import org.navalplanner.web.common.Level;
|
||||
import org.zkoss.zul.api.Window;
|
||||
|
||||
/**
|
||||
|
|
@ -27,31 +34,44 @@ public class WorkerCRUDControllerTest {
|
|||
|
||||
private WorkerCRUDController createControllerForModel(
|
||||
IWorkerModel workerModel) {
|
||||
return createControllerForModel(workerModel, null);
|
||||
}
|
||||
|
||||
private WorkerCRUDController createControllerForModel(
|
||||
IWorkerModel workerModel, IMessagesForUser messages) {
|
||||
createWindow = createNiceMock(Window.class);
|
||||
listWindow = createNiceMock(Window.class);
|
||||
editWindow = createNiceMock(Window.class);
|
||||
|
||||
WorkerCRUDController workerCRUDController = new WorkerCRUDController(
|
||||
createWindow, listWindow, editWindow, workerModel);
|
||||
createWindow, listWindow, editWindow, workerModel, messages);
|
||||
return workerCRUDController;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSave() throws Exception {
|
||||
IWorkerModel workerModel = createMock(IWorkerModel.class);
|
||||
IMessagesForUser messagesForUser = createMock(IMessagesForUser.class);
|
||||
Worker workerToReturn = new Worker();
|
||||
|
||||
WorkerCRUDController workerCRUDController = createControllerForModel(workerModel);
|
||||
WorkerCRUDController workerCRUDController = createControllerForModel(
|
||||
workerModel, messagesForUser);
|
||||
replay(createWindow, listWindow, editWindow);
|
||||
// expectations
|
||||
expect(workerModel.createNewInstance()).andReturn(workerToReturn);
|
||||
workerModel.save(workerToReturn);
|
||||
replay(workerModel);
|
||||
messagesForUser.showMessage(Level.INFO,
|
||||
isA(String.class));
|
||||
replay(workerModel, messagesForUser);
|
||||
// action
|
||||
workerCRUDController.goToCreateForm();
|
||||
workerToReturn.setFirstName("first");
|
||||
workerToReturn.setSurname("blabla");
|
||||
workerToReturn.setNif("11111");
|
||||
workerToReturn.setDailyHours(2);
|
||||
workerCRUDController.save();
|
||||
// verify
|
||||
verify(workerModel);
|
||||
verify(workerModel, messagesForUser);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -75,7 +95,9 @@ public class WorkerCRUDControllerTest {
|
|||
@Test
|
||||
public void testEditWorker() throws Exception {
|
||||
IWorkerModel workerModel = createMock(IWorkerModel.class);
|
||||
WorkerCRUDController workerCRUDController = createControllerForModel(workerModel);
|
||||
IMessagesForUser messagesForUser = createMock(IMessagesForUser.class);
|
||||
WorkerCRUDController workerCRUDController = createControllerForModel(
|
||||
workerModel, messagesForUser);
|
||||
List<Worker> workersToReturn = new ArrayList<Worker>(Arrays.asList(
|
||||
new Worker("firstName", "surname", "nif", 4), new Worker(
|
||||
"firstName", "surname", "nif", 4)));
|
||||
|
|
@ -83,13 +105,40 @@ public class WorkerCRUDControllerTest {
|
|||
expect(workerModel.getWorkers()).andReturn(workersToReturn);
|
||||
expect(editWindow.setVisible(true)).andReturn(false);
|
||||
workerModel.save(workersToReturn.get(0));
|
||||
replay(createWindow, listWindow, editWindow, workerModel);
|
||||
messagesForUser.showMessage(Level.INFO,
|
||||
isA(String.class));
|
||||
replay(createWindow, listWindow, editWindow, workerModel,
|
||||
messagesForUser);
|
||||
// perform actions
|
||||
List<Worker> workers = workerCRUDController.getWorkers();
|
||||
assertEquals(workersToReturn, workers);
|
||||
workerCRUDController.goToEditForm(workers.get(0));
|
||||
workerCRUDController.save();
|
||||
// verify
|
||||
verify(workerModel, editWindow);
|
||||
verify(workerModel, editWindow, messagesForUser);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWorkerInvalid() {
|
||||
IWorkerModel workerModel = createMock(IWorkerModel.class);
|
||||
IMessagesForUser messages = createMock(IMessagesForUser.class);
|
||||
WorkerCRUDController workerCRUDController = createControllerForModel(
|
||||
workerModel, messages);
|
||||
Worker workerToReturn = new Worker();
|
||||
// expectations
|
||||
expect(workerModel.createNewInstance()).andReturn(workerToReturn);
|
||||
ClassValidator<Worker> workerValidator = new ClassValidator<Worker>(
|
||||
Worker.class);
|
||||
InvalidValue[] invalidValues = workerValidator
|
||||
.getInvalidValues(workerToReturn);
|
||||
assertFalse(invalidValues.length == 0);
|
||||
messages.invalidValue(isA(InvalidValue.class));
|
||||
expectLastCall().times(invalidValues.length);
|
||||
replay(createWindow, listWindow, editWindow, workerModel, messages);
|
||||
// perform actions
|
||||
workerCRUDController.goToCreateForm();
|
||||
workerCRUDController.save();
|
||||
// verify
|
||||
verify(messages);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
766
pom.xml
766
pom.xml
|
|
@ -1,410 +1,418 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.navalplanner</groupId>
|
||||
<artifactId>navalplanner</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0.0</version>
|
||||
<name>Naval Planner</name>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.navalplanner</groupId>
|
||||
<artifactId>navalplanner</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0.0</version>
|
||||
<name>Naval Planner</name>
|
||||
|
||||
<!--
|
||||
===================================================================
|
||||
-->
|
||||
<!-- Modules -->
|
||||
<modules>
|
||||
<module>navalplanner-business</module>
|
||||
<module>navalplanner-gantt-zk</module>
|
||||
<module>navalplanner-webapp</module>
|
||||
</modules>
|
||||
<!--
|
||||
===================================================================
|
||||
-->
|
||||
<!-- Modules -->
|
||||
<modules>
|
||||
<module>navalplanner-business</module>
|
||||
<module>navalplanner-gantt-zk</module>
|
||||
<module>navalplanner-webapp</module>
|
||||
</modules>
|
||||
|
||||
<!--
|
||||
===================================================================
|
||||
-->
|
||||
<!--
|
||||
Default values for properties. These default values are expected to be
|
||||
valid for most profiles. Specific profiles can overwrite values when
|
||||
necessary.
|
||||
-->
|
||||
<properties>
|
||||
<!-- Data source properties -->
|
||||
<dataSource.user>naval</dataSource.user>
|
||||
<dataSource.password>naval</dataSource.password>
|
||||
<dataSource.jndiName>jdbc/navalplanner-ds</dataSource.jndiName>
|
||||
<testDataSource.user>${dataSource.user}</testDataSource.user>
|
||||
<testDataSource.password>${dataSource.password}</testDataSource.password>
|
||||
</properties>
|
||||
<!--
|
||||
===================================================================
|
||||
-->
|
||||
<!--
|
||||
Default values for properties. These default values are expected
|
||||
to be valid for most profiles. Specific profiles can overwrite
|
||||
values when necessary.
|
||||
-->
|
||||
<properties>
|
||||
<!-- Data source properties -->
|
||||
<dataSource.user>naval</dataSource.user>
|
||||
<dataSource.password>naval</dataSource.password>
|
||||
<dataSource.jndiName>jdbc/navalplanner-ds</dataSource.jndiName>
|
||||
<testDataSource.user>${dataSource.user}</testDataSource.user>
|
||||
<testDataSource.password>${dataSource.password}</testDataSource.password>
|
||||
</properties>
|
||||
|
||||
<!--
|
||||
===================================================================
|
||||
-->
|
||||
<!--
|
||||
Profiles. * The build is always executed by selecting at least two
|
||||
non-exclusive profiles. By default, such profiles are "dev" and
|
||||
"postgresql" (meaning "use PostgreSQL assuming a development
|
||||
environment"). * General profiles. There are two general
|
||||
(database-independent) profiles: "dev" and "prod". The former is used
|
||||
for development (including testing) and the latter is used for
|
||||
production (including testing). As shown below, two dataSources
|
||||
(databases schemas) are used in both profiles: one for running
|
||||
(dataSource) and another one for the Maven test fase (testDataSource).
|
||||
Note the Maven test fase is executed both with development and
|
||||
production profiles. * Database-specific profiles. There is a profile
|
||||
for each supported database. * Specific profiles can be defined to
|
||||
better adapt to a particular environment by overwriting/adding
|
||||
properties and/or including other chunks of valid XML. * Usage: + mvn
|
||||
<<goal>> => Execute <<goal>> with default profiles. + mvn
|
||||
-Pdev,<<database>> <<goal> => Execute <<goal>> with "dev" and
|
||||
<<database>> profiles. + mvn -Pprod,<<database>> <<goal>> => Execute
|
||||
<<goal>> with "prod" and <<database>> profiles. + Note that when using
|
||||
-P option all desired profiles must be specified (e.g. "-Pprod" with
|
||||
the intention to select "prod" and the default database profile is not
|
||||
correct; "-Pprod,<<database>>" must be used instead). * Examples: +
|
||||
mvn <<goal>> + mvn -Ppostgresql,prod <<goal>> + mvn -Ppostgresql,dev
|
||||
<<goal>>
|
||||
-->
|
||||
<profiles>
|
||||
<!--
|
||||
===================================================================
|
||||
-->
|
||||
<!--
|
||||
Profiles. * The build is always executed by selecting at least
|
||||
two non-exclusive profiles. By default, such profiles are "dev"
|
||||
and "postgresql" (meaning "use PostgreSQL assuming a development
|
||||
environment"). * General profiles. There are two general
|
||||
(database-independent) profiles: "dev" and "prod". The former is
|
||||
used for development (including testing) and the latter is used
|
||||
for production (including testing). As shown below, two
|
||||
dataSources (databases schemas) are used in both profiles: one
|
||||
for running (dataSource) and another one for the Maven test fase
|
||||
(testDataSource). Note the Maven test fase is executed both with
|
||||
development and production profiles. * Database-specific
|
||||
profiles. There is a profile for each supported database. *
|
||||
Specific profiles can be defined to better adapt to a particular
|
||||
environment by overwriting/adding properties and/or including
|
||||
other chunks of valid XML. * Usage: + mvn <<goal>> => Execute
|
||||
<<goal>> with default profiles. + mvn -Pdev,<<database>> <<goal>
|
||||
=> Execute <<goal>> with "dev" and <<database>> profiles. + mvn
|
||||
-Pprod,<<database>> <<goal>> => Execute <<goal>> with "prod" and
|
||||
<<database>> profiles. + Note that when using -P option all
|
||||
desired profiles must be specified (e.g. "-Pprod" with the
|
||||
intention to select "prod" and the default database profile is
|
||||
not correct; "-Pprod,<<database>>" must be used instead). *
|
||||
Examples: + mvn <<goal>> + mvn -Ppostgresql,prod <<goal>> + mvn
|
||||
-Ppostgresql,dev <<goal>>
|
||||
-->
|
||||
<profiles>
|
||||
|
||||
<!-- Development profile -->
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<!-- Naval Planner environment properties -->
|
||||
<navalplanner.mode>dev</navalplanner.mode>
|
||||
<!-- Hibernate properties -->
|
||||
<hibernate.show_sql>true</hibernate.show_sql>
|
||||
<hibernate.format_sql>true</hibernate.format_sql>
|
||||
<hibernate.use_sql_comments>true</hibernate.use_sql_comments>
|
||||
<hibernate.hbm2ddl.auto>update</hibernate.hbm2ddl.auto>
|
||||
</properties>
|
||||
</profile>
|
||||
<!-- Development profile -->
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<!-- Naval Planner environment properties -->
|
||||
<navalplanner.mode>dev</navalplanner.mode>
|
||||
<!-- Hibernate properties -->
|
||||
<hibernate.show_sql>true</hibernate.show_sql>
|
||||
<hibernate.format_sql>true</hibernate.format_sql>
|
||||
<hibernate.use_sql_comments>true</hibernate.use_sql_comments>
|
||||
<hibernate.hbm2ddl.auto>update</hibernate.hbm2ddl.auto>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<!-- Production profile -->
|
||||
<profile>
|
||||
<id>prod</id>
|
||||
<properties>
|
||||
<!-- Naval Planner environment properties -->
|
||||
<navalplanner.mode>prod</navalplanner.mode>
|
||||
<!-- Hibernate properties -->
|
||||
<hibernate.show_sql>false</hibernate.show_sql>
|
||||
<hibernate.format_sql>false</hibernate.format_sql>
|
||||
<hibernate.use_sql_comments>false</hibernate.use_sql_comments>
|
||||
<hibernate.hbm2ddl.auto>update</hibernate.hbm2ddl.auto>
|
||||
</properties>
|
||||
</profile>
|
||||
<!-- Production profile -->
|
||||
<profile>
|
||||
<id>prod</id>
|
||||
<properties>
|
||||
<!-- Naval Planner environment properties -->
|
||||
<navalplanner.mode>prod</navalplanner.mode>
|
||||
<!-- Hibernate properties -->
|
||||
<hibernate.show_sql>false</hibernate.show_sql>
|
||||
<hibernate.format_sql>false</hibernate.format_sql>
|
||||
<hibernate.use_sql_comments>false</hibernate.use_sql_comments>
|
||||
<hibernate.hbm2ddl.auto>update</hibernate.hbm2ddl.auto>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<!-- PostgreSQL profile -->
|
||||
<profile>
|
||||
<id>postgresql</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<!-- JDBC driver properties -->
|
||||
<jdbcDriver.groupId>postgresql</jdbcDriver.groupId>
|
||||
<jdbcDriver.artifactId>postgresql</jdbcDriver.artifactId>
|
||||
<jdbcDriver.version>8.3-603.jdbc4</jdbcDriver.version>
|
||||
<jdbcDriver.className>org.postgresql.Driver</jdbcDriver.className>
|
||||
<!-- Data source properties -->
|
||||
<dataSource.url>jdbc:postgresql://localhost/naval${navalplanner.mode}</dataSource.url>
|
||||
<testDataSource.url>${dataSource.url}test</testDataSource.url>
|
||||
<!-- Hibernate properties -->
|
||||
<hibernate.dialect>org.hibernate.dialect.PostgreSQLDialect</hibernate.dialect>
|
||||
</properties>
|
||||
</profile>
|
||||
<!-- PostgreSQL profile -->
|
||||
<profile>
|
||||
<id>postgresql</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<!-- JDBC driver properties -->
|
||||
<jdbcDriver.groupId>postgresql</jdbcDriver.groupId>
|
||||
<jdbcDriver.artifactId>postgresql</jdbcDriver.artifactId>
|
||||
<jdbcDriver.version>8.3-603.jdbc4</jdbcDriver.version>
|
||||
<jdbcDriver.className>org.postgresql.Driver</jdbcDriver.className>
|
||||
<!-- Data source properties -->
|
||||
<dataSource.url>jdbc:postgresql://localhost/naval${navalplanner.mode}</dataSource.url>
|
||||
<testDataSource.url>${dataSource.url}test</testDataSource.url>
|
||||
<!-- Hibernate properties -->
|
||||
<hibernate.dialect>org.hibernate.dialect.PostgreSQLDialect</hibernate.dialect>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<!-- MySQL profile -->
|
||||
<profile>
|
||||
<id>mysql</id>
|
||||
<properties>
|
||||
<!-- JDBC driver properties -->
|
||||
<jdbcDriver.groupId>mysql</jdbcDriver.groupId>
|
||||
<jdbcDriver.artifactId>mysql-connector-java</jdbcDriver.artifactId>
|
||||
<jdbcDriver.version>5.0.5</jdbcDriver.version>
|
||||
<jdbcDriver.className>com.mysql.jdbc.Driver</jdbcDriver.className>
|
||||
<!-- Data source properties -->
|
||||
<dataSource.url>jdbc:mysql://localhost/naval${navalplanner.mode}</dataSource.url>
|
||||
<testDataSource.url>${dataSource.url}test</testDataSource.url>
|
||||
<!-- Hibernate properties -->
|
||||
<hibernate.dialect>org.hibernate.dialect.MySQLDialect</hibernate.dialect>
|
||||
</properties>
|
||||
</profile>
|
||||
<!-- MySQL profile -->
|
||||
<profile>
|
||||
<id>mysql</id>
|
||||
<properties>
|
||||
<!-- JDBC driver properties -->
|
||||
<jdbcDriver.groupId>mysql</jdbcDriver.groupId>
|
||||
<jdbcDriver.artifactId>mysql-connector-java</jdbcDriver.artifactId>
|
||||
<jdbcDriver.version>5.0.5</jdbcDriver.version>
|
||||
<jdbcDriver.className>com.mysql.jdbc.Driver</jdbcDriver.className>
|
||||
<!-- Data source properties -->
|
||||
<dataSource.url>jdbc:mysql://localhost/naval${navalplanner.mode}</dataSource.url>
|
||||
<testDataSource.url>${dataSource.url}test</testDataSource.url>
|
||||
<!-- Hibernate properties -->
|
||||
<hibernate.dialect>org.hibernate.dialect.MySQLDialect</hibernate.dialect>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<!-- HSQLDB profile -->
|
||||
<profile>
|
||||
<id>hsqldb</id>
|
||||
<properties>
|
||||
<!-- JDBC driver properties -->
|
||||
<jdbcDriver.groupId>hsqldb</jdbcDriver.groupId>
|
||||
<jdbcDriver.artifactId>hsqldb</jdbcDriver.artifactId>
|
||||
<jdbcDriver.version>1.8.0.7</jdbcDriver.version>
|
||||
<jdbcDriver.className>org.hsqldb.jdbcDriver</jdbcDriver.className>
|
||||
<!-- Data source properties -->
|
||||
<dataSource.user>sa</dataSource.user>
|
||||
<dataSource.password />
|
||||
<dataSource.url>jdbc:hsqldb:${java.io.tmpdir}/naval${navalplanner.mode};shutdown=true</dataSource.url>
|
||||
<testDataSource.url>jdbc:hsqldb:${java.io.tmpdir}/naval${navalplanner.mode}test;shutdown=true</testDataSource.url>
|
||||
<!-- Hibernate properties -->
|
||||
<hibernate.dialect>org.hibernate.dialect.HSQLDialect</hibernate.dialect>
|
||||
</properties>
|
||||
</profile>
|
||||
<!-- HSQLDB profile -->
|
||||
<profile>
|
||||
<id>hsqldb</id>
|
||||
<properties>
|
||||
<!-- JDBC driver properties -->
|
||||
<jdbcDriver.groupId>hsqldb</jdbcDriver.groupId>
|
||||
<jdbcDriver.artifactId>hsqldb</jdbcDriver.artifactId>
|
||||
<jdbcDriver.version>1.8.0.7</jdbcDriver.version>
|
||||
<jdbcDriver.className>org.hsqldb.jdbcDriver</jdbcDriver.className>
|
||||
<!-- Data source properties -->
|
||||
<dataSource.user>sa</dataSource.user>
|
||||
<dataSource.password />
|
||||
<dataSource.url>jdbc:hsqldb:${java.io.tmpdir}/naval${navalplanner.mode};shutdown=true</dataSource.url>
|
||||
<testDataSource.url>jdbc:hsqldb:${java.io.tmpdir}/naval${navalplanner.mode}test;shutdown=true</testDataSource.url>
|
||||
<!-- Hibernate properties -->
|
||||
<hibernate.dialect>org.hibernate.dialect.HSQLDialect</hibernate.dialect>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
</profiles>
|
||||
</profiles>
|
||||
|
||||
<!--
|
||||
===================================================================
|
||||
-->
|
||||
<!-- Dependency management -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- JDBC driver -->
|
||||
<dependency>
|
||||
<groupId>${jdbcDriver.groupId}</groupId>
|
||||
<artifactId>${jdbcDriver.artifactId}</artifactId>
|
||||
<version>${jdbcDriver.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Hibernate -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate</artifactId>
|
||||
<version>3.2.6.ga</version>
|
||||
</dependency>
|
||||
<!-- JUnit -->
|
||||
<!--
|
||||
IMPORTANT: Spring TestContext 2.5.x is not compatible with JUnit
|
||||
4.5.
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!--
|
||||
===================================================================
|
||||
-->
|
||||
<!-- Dependency management -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- JDBC driver -->
|
||||
<dependency>
|
||||
<groupId>${jdbcDriver.groupId}</groupId>
|
||||
<artifactId>${jdbcDriver.artifactId}</artifactId>
|
||||
<version>${jdbcDriver.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Hibernate -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate</artifactId>
|
||||
<version>3.2.6.ga</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-annotations</artifactId>
|
||||
<version>3.3.1.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>3.0.0.ga</version>
|
||||
</dependency>
|
||||
<!-- JUnit -->
|
||||
<!--
|
||||
IMPORTANT: Spring TestContext 2.5.x is not compatible
|
||||
with JUnit 4.5.
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Easy mock -->
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<version>2.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Easy mock -->
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<version>2.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring</artifactId>
|
||||
<version>2.5.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>2.5.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Commons Logging (required by many frameworks)-->
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>1.0.4</version>
|
||||
</dependency>
|
||||
<!-- BeanShell (required by ZK)-->
|
||||
<dependency>
|
||||
<groupId>org.beanshell</groupId>
|
||||
<artifactId>bsh</artifactId>
|
||||
<version>2.0b4</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- Apache Commons Fileupload (required by ZK) -->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- ZK -->
|
||||
<dependency>
|
||||
<groupId>org.zkoss.zk</groupId>
|
||||
<artifactId>zul</artifactId>
|
||||
<version>3.6.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.zkoss.zk</groupId>
|
||||
<artifactId>zkplus</artifactId>
|
||||
<version>3.6.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.zkoss.zk</groupId>
|
||||
<artifactId>zk</artifactId>
|
||||
<version>3.6.1</version>
|
||||
</dependency>
|
||||
<!-- JGraphT -->
|
||||
<dependency>
|
||||
<groupId>org.jgrapht</groupId>
|
||||
<artifactId>jgrapht-jdk1.5</artifactId>
|
||||
<version>0.7.3</version>
|
||||
</dependency>
|
||||
<!-- Naval Planner ZK Components -->
|
||||
<dependency>
|
||||
<groupId>org.navalplanner</groupId>
|
||||
<artifactId>navalplanner-gantt-zk</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<!-- Naval Planner Business -->
|
||||
<dependency>
|
||||
<groupId>org.navalplanner</groupId>
|
||||
<artifactId>navalplanner-business</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring</artifactId>
|
||||
<version>2.5.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>2.5.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Commons Logging (required by many frameworks)-->
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>1.0.4</version>
|
||||
</dependency>
|
||||
<!-- BeanShell (required by ZK)-->
|
||||
<dependency>
|
||||
<groupId>org.beanshell</groupId>
|
||||
<artifactId>bsh</artifactId>
|
||||
<version>2.0b4</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- Apache Commons Fileupload (required by ZK) -->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- ZK -->
|
||||
<dependency>
|
||||
<groupId>org.zkoss.zk</groupId>
|
||||
<artifactId>zul</artifactId>
|
||||
<version>3.6.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.zkoss.zk</groupId>
|
||||
<artifactId>zkplus</artifactId>
|
||||
<version>3.6.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.zkoss.zk</groupId>
|
||||
<artifactId>zk</artifactId>
|
||||
<version>3.6.1</version>
|
||||
</dependency>
|
||||
<!-- JGraphT -->
|
||||
<dependency>
|
||||
<groupId>org.jgrapht</groupId>
|
||||
<artifactId>jgrapht-jdk1.5</artifactId>
|
||||
<version>0.7.3</version>
|
||||
</dependency>
|
||||
<!-- Naval Planner ZK Components -->
|
||||
<dependency>
|
||||
<groupId>org.navalplanner</groupId>
|
||||
<artifactId>navalplanner-gantt-zk</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<!-- Naval Planner Business -->
|
||||
<dependency>
|
||||
<groupId>org.navalplanner</groupId>
|
||||
<artifactId>navalplanner-business</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<build>
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Filtering -->
|
||||
<resources>
|
||||
<!-- =============================================================== -->
|
||||
<!-- Filtering -->
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Apply filtering to files matching the following expressions in
|
||||
src/main/resources.
|
||||
-->
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>*spring-config.xml</include>
|
||||
<include>*hibernate.cfg.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<!--
|
||||
Apply filtering to files matching the following
|
||||
expressions in src/main/resources.
|
||||
-->
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>*spring-config.xml</include>
|
||||
<include>*hibernate.cfg.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
|
||||
<!--
|
||||
Continue considering resources the files in src/main/resources, but
|
||||
without applying filtering.
|
||||
-->
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
<!--
|
||||
Continue considering resources the files in
|
||||
src/main/resources, but without applying filtering.
|
||||
-->
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
|
||||
<!-- Filter Jetty configuration -->
|
||||
<resource>
|
||||
<directory>../src/main/jetty</directory>
|
||||
<includes>
|
||||
<include>jetty-env.xml</include>
|
||||
</includes>
|
||||
<targetPath>../jetty</targetPath>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<!-- Filter Jetty configuration -->
|
||||
<resource>
|
||||
<directory>../src/main/jetty</directory>
|
||||
<includes>
|
||||
<include>jetty-env.xml</include>
|
||||
</includes>
|
||||
<targetPath>../jetty</targetPath>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<testResources>
|
||||
<testResources>
|
||||
|
||||
<!--
|
||||
Apply filtering to files matching the following expressions in
|
||||
src/test/resources.
|
||||
-->
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>*spring-config-test.xml</include>
|
||||
<include>*hibernate-test.cfg.xml</include>
|
||||
</includes>
|
||||
</testResource>
|
||||
<!--
|
||||
Apply filtering to files matching the following
|
||||
expressions in src/test/resources.
|
||||
-->
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>*spring-config-test.xml</include>
|
||||
<include>*hibernate-test.cfg.xml</include>
|
||||
</includes>
|
||||
</testResource>
|
||||
|
||||
<!--
|
||||
Continue considering resources the files in src/test/resources, but
|
||||
without applying filtering.
|
||||
-->
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
</testResource>
|
||||
<!--
|
||||
Continue considering resources the files in
|
||||
src/test/resources, but without applying filtering.
|
||||
-->
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
</testResource>
|
||||
|
||||
</testResources>
|
||||
</testResources>
|
||||
|
||||
<plugins>
|
||||
<plugins>
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Compiler configuration -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<verbose>true</verbose>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- =========================================================== -->
|
||||
<!-- Compiler configuration -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<verbose>true</verbose>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Assembly configuration -->
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/src.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- =========================================================== -->
|
||||
<!-- Assembly configuration -->
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/src.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Jetty configuration -->
|
||||
<plugin>
|
||||
<!-- =========================================================== -->
|
||||
<!-- Jetty configuration -->
|
||||
<plugin>
|
||||
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<!-- FIXME: try to not to specify version. -->
|
||||
<version>6.1.12.rc2</version>
|
||||
<configuration>
|
||||
<jettyEnvXml>target/jetty/jetty-env.xml</jettyEnvXml>
|
||||
<scanIntervalSeconds>5</scanIntervalSeconds>
|
||||
<scanTargetPatterns>
|
||||
<scanTargetPattern>
|
||||
<directory>src/main/webapp/WEB-INF</directory>
|
||||
<includes>
|
||||
<include>*</include>
|
||||
</includes>
|
||||
</scanTargetPattern>
|
||||
</scanTargetPatterns>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<!-- FIXME: try to not to specify version. -->
|
||||
<version>6.1.12.rc2</version>
|
||||
<configuration>
|
||||
<jettyEnvXml>target/jetty/jetty-env.xml</jettyEnvXml>
|
||||
<scanIntervalSeconds>5</scanIntervalSeconds>
|
||||
<scanTargetPatterns>
|
||||
<scanTargetPattern>
|
||||
<directory>src/main/webapp/WEB-INF</directory>
|
||||
<includes>
|
||||
<include>*</include>
|
||||
</includes>
|
||||
</scanTargetPattern>
|
||||
</scanTargetPatterns>
|
||||
|
||||
<!-- Log to the console. -->
|
||||
<requestLog implementation="org.mortbay.jetty.NCSARequestLog">
|
||||
<!--
|
||||
This do anything for Jetty, but is a workaround for a Maven bug
|
||||
that prevents the requestLog from being set.
|
||||
-->
|
||||
<append>true</append>
|
||||
</requestLog>
|
||||
<!--
|
||||
<connectors> <connector
|
||||
implementation="org.mortbay.jetty.nio.SelectChannelConnector">
|
||||
<port>9090</port> </connector> </connectors>
|
||||
-->
|
||||
</configuration>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${jdbcDriver.groupId}</groupId>
|
||||
<artifactId>${jdbcDriver.artifactId}</artifactId>
|
||||
<version>${jdbcDriver.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
<!-- Log to the console. -->
|
||||
<requestLog implementation="org.mortbay.jetty.NCSARequestLog">
|
||||
<!--
|
||||
This do anything for Jetty, but is a
|
||||
workaround for a Maven bug that prevents the
|
||||
requestLog from being set.
|
||||
-->
|
||||
<append>true</append>
|
||||
</requestLog>
|
||||
<!--
|
||||
<connectors> <connector
|
||||
implementation="org.mortbay.jetty.nio.SelectChannelConnector">
|
||||
<port>9090</port> </connector> </connectors>
|
||||
-->
|
||||
</configuration>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${jdbcDriver.groupId}</groupId>
|
||||
<artifactId>${jdbcDriver.artifactId}</artifactId>
|
||||
<version>${jdbcDriver.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue