Merge branch 'master' of ssh://git.eclipse.org:29418/openk-usermodules/org.eclipse.openk-usermodules.standbyPlanning.backend
diff --git a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/common/Globals.java b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/common/Globals.java
index 0cee3fe..233900d 100644
--- a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/common/Globals.java
+++ b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/common/Globals.java
@@ -13,6 +13,8 @@
package org.eclipse.openk.common;
public final class Globals {
+
+ public static final String DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
public static final String HEADER_JSON_UTF8 = "application/json; charset=utf-8";
public static final String KEYCLOAK_AUTH_TAG = "Authorization";
diff --git a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/controller/planning/ArchiveController.java b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/controller/planning/ArchiveController.java
index e3ee197..478143b 100644
--- a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/controller/planning/ArchiveController.java
+++ b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/controller/planning/ArchiveController.java
@@ -505,7 +505,7 @@
String comment = "";
- createArchiveForIntervallAndGroups(lsGroup, actionDto.getValidFrom(), actionDto.getValidTo(),
+ createArchiveForIntervallAndGroups(lsGroup, actionDto.getValidFromDate(), actionDto.getValidToDate(),
SpMsg.STATUS_CLOSED_PLANNING, username, SpMsg.ACT_STANDBY_MOVE + " " + body.toString(), comment);
}
@@ -528,7 +528,7 @@
String text = currentUser.getFirstname() + " " + currentUser.getLastname() + " durch "
+ newUser.getFirstname() + " " + newUser.getLastname();
- createArchiveForIntervallAndGroups(lsGroup, actionDto.getValidFrom(), actionDto.getValidTo(),
+ createArchiveForIntervallAndGroups(lsGroup, actionDto.getValidFromDate(), actionDto.getValidToDate(),
SpMsg.STATUS_CLOSED_PLANNING, username, SpMsg.ACT_STANDBY_REPLACE + " " + text, comment);
}
diff --git a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/controller/planning/PlanningController.java b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/controller/planning/PlanningController.java
index 437dbe2..d128e0e 100644
--- a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/controller/planning/PlanningController.java
+++ b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/controller/planning/PlanningController.java
@@ -1289,8 +1289,8 @@
lsInputParams.add(actionDto.getNewUserId());
lsInputParams.add(actionDto.getStandbyGroupId());
lsInputParams.add(actionDto.getStatusId());
- lsInputParams.add(actionDto.getValidFrom());
- lsInputParams.add(actionDto.getValidTo());
+ lsInputParams.add(actionDto.getValidFromDate());
+ lsInputParams.add(actionDto.getValidToDate());
lsInputParams.add(username);
ValidationHelper.isNoNullValueInList(lsInputParams);
@@ -1302,8 +1302,8 @@
User currentUser = userRepository.findOne(actionDto.getCurrentUserId());
User newUser = userRepository.findOne(actionDto.getNewUserId());
StandbyGroup standbyGroup = standbyGroupRepository.findOne(actionDto.getStandbyGroupId());
- Date from = actionDto.getValidFrom();
- Date to = actionDto.getValidTo();
+ Date from = actionDto.getValidFromDate();
+ Date to = actionDto.getValidToDate();
// mail
mailing.replaceMessage1(actionDto, currentUser, newUser, standbyGroup);
@@ -1330,7 +1330,7 @@
lsValidationBeanNames.add(ValidationController.BEAN_PLACEHOLDER_STANDBY_USER_VALIDATOR);
responseDto.getLsMsg()
- .addAll(validatonController.startValidation(actionDto.getValidFrom(), actionDto.getValidTo(),
+ .addAll(validatonController.startValidation(actionDto.getValidFromDate(), actionDto.getValidToDate(),
lsStandbyGroups, lsValidationBeanNames, actionDto.getStatusId(), actionDto.getNewUserId()));
return responseDto;
@@ -1487,8 +1487,8 @@
List<Object> lsInputParams = new ArrayList<>();
lsInputParams.add(actionDto.getNewUserId());
lsInputParams.add(actionDto.getScheduleBodyId());
- lsInputParams.add(actionDto.getValidFrom());
- lsInputParams.add(actionDto.getValidTo());
+ lsInputParams.add(actionDto.getValidFromDate());
+ lsInputParams.add(actionDto.getValidToDate());
lsInputParams.add(actionDto.getStandbyGroupId());
lsInputParams.add(username);
ValidationHelper.isNoNullValueInList(lsInputParams);
@@ -1513,21 +1513,21 @@
body.setModifiedBy(username);
body.setStandbyGroup(tempNewGroup);
- DateTime dt = new DateTime(actionDto.getValidTo());
- if (DateHelper.isSameDate(actionDto.getValidFrom(), dt.minusSeconds(1).toDate())) {
+ DateTime dt = new DateTime(actionDto.getValidToDate());
+ if (DateHelper.isSameDate(actionDto.getValidFromDate(), dt.minusSeconds(1).toDate())) {
// because of no overlapping day schedule body just
// gets new values, no second body is needed.
- body.setValidFrom(actionDto.getValidFrom());
- body.setValidTo(actionDto.getValidTo());
+ body.setValidFrom(actionDto.getValidFromDate());
+ body.setValidTo(actionDto.getValidToDate());
standbyScheduleBodyRepository.save(body);
} else {
- Date nextDate = actionDto.getValidFrom();
+ Date nextDate = actionDto.getValidFromDate();
StandbyScheduleBody newBody = null;
- while (DateHelper.isDateBefore(nextDate, actionDto.getValidTo())
- && !DateHelper.isSameDate(nextDate, actionDto.getValidTo())) {
+ while (DateHelper.isDateBefore(nextDate, actionDto.getValidToDate())
+ && !DateHelper.isSameDate(nextDate, actionDto.getValidToDate())) {
newBody = body.copy();
- if (DateHelper.isSameDate(actionDto.getValidFrom(), nextDate)) {
+ if (DateHelper.isSameDate(actionDto.getValidFromDate(), nextDate)) {
// do not change start time on first day
newBody.setValidFrom(nextDate);
} else {
@@ -1546,8 +1546,8 @@
// add last day
StandbyScheduleBody lastBody = body.copy();
- lastBody.setValidFrom(DateHelper.getStartOfDay(actionDto.getValidTo()));
- lastBody.setValidTo(actionDto.getValidTo());
+ lastBody.setValidFrom(DateHelper.getStartOfDay(actionDto.getValidToDate()));
+ lastBody.setValidTo(actionDto.getValidToDate());
lastBody.setModifiedCause(TXT_MANUAL_CHANGE);
lastBody.setModificationDate(new Date());
lastBody.setModifiedBy(username);
@@ -1573,7 +1573,7 @@
lsValidationBeanNames.add(ValidationController.BEAN_DOUBLE_PLANNED_VALIDATOR);
lsValidationBeanNames.add(ValidationController.BEAN_PLACEHOLDER_STANDBY_USER_VALIDATOR);
responseDto.getLsMsg()
- .addAll(validatonController.startValidation(actionDto.getValidFrom(), actionDto.getValidTo(),
+ .addAll(validatonController.startValidation(actionDto.getValidFromDate(), actionDto.getValidToDate(),
lsStandbyGroups, lsValidationBeanNames, actionDto.getStatusId(), actionDto.getNewUserId()));
return responseDto;
diff --git a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/controller/validation/ValidationController.java b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/controller/validation/ValidationController.java
index 40d5798..1716a29 100644
--- a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/controller/validation/ValidationController.java
+++ b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/controller/validation/ValidationController.java
@@ -127,7 +127,7 @@
lsValidationBeanNames.add(ValidationController.BEAN_GROUP_COVERAGE_VALIDATOR);
lsValidationBeanNames.add(ValidationController.BEAN_DOUBLE_PLANNED_VALIDATOR);
lsValidationBeanNames.add(ValidationController.BEAN_PLACEHOLDER_STANDBY_USER_VALIDATOR);
- this.startValidation(validatonDto.getValidFrom(), validatonDto.getValidTo(), lsStandbyGroups,
+ this.startValidation(validatonDto.getValidFromDate(), validatonDto.getValidToDate(), lsStandbyGroups,
lsValidationBeanNames, validatonDto.getStatusId(), validatonDto.getNewUserId());
responseDto.getLsMsg().addAll(planningController.getLsMsgDto());
return responseDto;
diff --git a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/dto/planning/StandbyScheduleActionDto.java b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/dto/planning/StandbyScheduleActionDto.java
index 7e5331a..bdcaefa 100644
--- a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/dto/planning/StandbyScheduleActionDto.java
+++ b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/dto/planning/StandbyScheduleActionDto.java
@@ -16,7 +16,14 @@
import javax.xml.bind.annotation.XmlRootElement;
+import org.apache.log4j.Logger;
+import org.eclipse.openk.common.Globals;
import org.eclipse.openk.sp.abstracts.AbstractDto;
+import org.eclipse.openk.sp.exceptions.SpErrorEntry;
+import org.eclipse.openk.sp.exceptions.SpException;
+import org.eclipse.openk.sp.exceptions.SpExceptionEnum;
+import org.eclipse.openk.sp.util.DateHelper;
+import org.mozilla.javascript.tools.shell.Global;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -33,8 +40,10 @@
*/
private static final long serialVersionUID = 1L;
- private Date validFrom;
- private Date validTo;
+ private String validFrom;
+ private String validTo;
+ private Date validFromDate;
+ private Date validToDate;
private Long statusId;
private Long standbyGroupId;
private Long currentUserId;
@@ -48,31 +57,29 @@
/**
* @return the validFrom
*/
- public Date getValidFrom() {
- return validFrom;
+ public Date getValidFromDate() {
+ return validFromDate;
}
/**
- * @param validFrom
- * the validFrom to set
+ * @param validFrom the validFrom to set
*/
- public void setValidFrom(Date validFrom) {
- this.validFrom = validFrom;
+ public void setValidFromDate(Date validFrom) {
+ this.validFromDate = validFrom;
}
/**
* @return the validTo
*/
- public Date getValidTo() {
- return validTo;
+ public Date getValidToDate() {
+ return validToDate;
}
/**
- * @param validTo
- * the validTo to set
+ * @param validTo the validTo to set
*/
- public void setValidTo(Date validTo) {
- this.validTo = validTo;
+ public void setValidToDate(Date validTo) {
+ this.validToDate = validTo;
}
/**
@@ -83,8 +90,7 @@
}
/**
- * @param statusId
- * the statusId to set
+ * @param statusId the statusId to set
*/
public void setStatusId(Long statusId) {
this.statusId = statusId;
@@ -98,8 +104,7 @@
}
/**
- * @param standbyGroupId
- * the standbyGroupId to set
+ * @param standbyGroupId the standbyGroupId to set
*/
public void setStandbyGroupId(Long standbyGroupId) {
this.standbyGroupId = standbyGroupId;
@@ -113,8 +118,7 @@
}
/**
- * @param currentUserId
- * the currentUserId to set
+ * @param currentUserId the currentUserId to set
*/
public void setCurrentUserId(Long currentUserId) {
this.currentUserId = currentUserId;
@@ -128,8 +132,7 @@
}
/**
- * @param newUserId
- * the newUserId to set
+ * @param newUserId the newUserId to set
*/
public void setNewUserId(Long newUserId) {
this.newUserId = newUserId;
@@ -143,10 +146,53 @@
}
/**
- * @param scheduleBodyId
- * the scheduleBodyId to set
+ * @param scheduleBodyId the scheduleBodyId to set
*/
public void setScheduleBodyId(Long scheduleBodyId) {
this.scheduleBodyId = scheduleBodyId;
}
+
+ /**
+ * @return the validFrom
+ */
+ public String getValidFrom() {
+ return validFrom;
+ }
+
+ /**
+ * @param validFrom the validFrom to set
+ */
+ public void setValidFrom(String validFrom) {
+ this.validFrom = validFrom;
+ }
+
+ /**
+ * @return the validTo
+ */
+ public String getValidTo() {
+ return validTo;
+ }
+
+ /**
+ * @param validTo the validTo to set
+ */
+ public void setValidTo(String validTo) {
+ this.validTo = validTo;
+ }
+
+ public void createDatesFromStrings() throws SpException {
+ try {
+ if (this.getValidFrom() != null) {
+ this.setValidFromDate(DateHelper.getDateFromString(this.getValidFrom(), Globals.DATE_TIME_FORMAT));
+ }
+ if (this.getValidTo() != null) {
+ this.setValidToDate(DateHelper.getDateFromString(this.getValidTo(), Globals.DATE_TIME_FORMAT));
+ }
+ } catch (Exception e) {
+ Logger.getLogger(StandbyScheduleActionDto.class).error(e, e);
+ SpErrorEntry ee = SpExceptionEnum.DEFAULT_EXCEPTION.getEntry();
+ ee.setE(e);
+ throw new SpException(ee);
+ }
+ }
}
diff --git a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/mail/MailRequest.java b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/mail/MailRequest.java
index 0725d82..6ffbd39 100644
--- a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/mail/MailRequest.java
+++ b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/mail/MailRequest.java
@@ -98,8 +98,8 @@
String strSBFrom = DateHelper.convertToLocalString(standbyBody.getValidFrom(), null);
String strSBTo = DateHelper.convertToLocalString(standbyBody.getValidTo(), null);
- String strAcFrom = DateHelper.convertToLocalString(actionDto.getValidFrom(), null);
- String strAcTo = DateHelper.convertToLocalString(actionDto.getValidTo(), null);
+ String strAcFrom = DateHelper.convertToLocalString(actionDto.getValidFromDate(), null);
+ String strAcTo = DateHelper.convertToLocalString(actionDto.getValidToDate(), null);
String body = generateHTML(template, standbyBody.getStandbyGroup().getTitle(), strSBFrom, strSBTo,
targetGroup.getTitle(), strAcFrom, strAcTo, link);
@@ -146,8 +146,8 @@
String userName = newUser.getFirstname() + " " + newUser.getLastname();
String link = property.getProperty(Globals.LINK_DASHBOARD);
- String strAcFrom = DateHelper.convertToLocalString(actionDto.getValidFrom(), null);
- String strAcTo = DateHelper.convertToLocalString(actionDto.getValidTo(), null);
+ String strAcFrom = DateHelper.convertToLocalString(actionDto.getValidFromDate(), null);
+ String strAcTo = DateHelper.convertToLocalString(actionDto.getValidToDate(), null);
String body = generateHTML(template, standbyGroup.getTitle(), strAcFrom, strAcTo,
new String(userName.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8), link);
@@ -186,8 +186,8 @@
String userName = oldUser.getFirstname() + " " + oldUser.getLastname();
String link = property.getProperty(Globals.LINK_DASHBOARD);
- String strAcFrom = DateHelper.convertToLocalString(actionDto.getValidFrom(), null);
- String strAcTo = DateHelper.convertToLocalString(actionDto.getValidTo(), null);
+ String strAcFrom = DateHelper.convertToLocalString(actionDto.getValidFromDate(), null);
+ String strAcTo = DateHelper.convertToLocalString(actionDto.getValidToDate(), null);
String body = generateHTML(template, standbyGroup.getTitle(),
new String(userName.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8), strAcFrom, strAcTo,
diff --git a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/rest/StandbyScheduleRestService.java b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/rest/StandbyScheduleRestService.java
index 8ada2b2..1dd7c68 100644
--- a/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/rest/StandbyScheduleRestService.java
+++ b/oKBereitschaftsplanungBackend/src/main/java/org/eclipse/openk/sp/rest/StandbyScheduleRestService.java
@@ -40,6 +40,7 @@
import org.eclipse.openk.sp.dto.planning.StandbyScheduleCopyDto;
import org.eclipse.openk.sp.dto.planning.StandbyScheduleFilterDto;
import org.eclipse.openk.sp.dto.planning.StandbyScheduleSearchDto;
+import org.eclipse.openk.sp.exceptions.SpException;
import org.eclipse.openk.sp.util.FileHelper;
import org.springframework.beans.factory.annotation.Autowired;
@@ -170,8 +171,9 @@
@Path("/planning/user/replace")
public Response replaceUserInPlan(
@ApiParam(name = "Authorization", value = "JWT Token", required = true) @HeaderParam(value = Globals.KEYCLOAK_AUTH_TAG) String jwt,
- StandbyScheduleActionDto actionDto) {
+ StandbyScheduleActionDto actionDto) throws SpException {
+ actionDto.createDatesFromStrings();
ModifyingInvokable<PlanningMsgResponseDto> invokable = modusr -> planningController.replaceUserInPlan(actionDto,
modusr);
@@ -186,8 +188,9 @@
@Path("/planning/user/move")
public Response moveUserInPlan(
@ApiParam(name = "Authorization", value = "JWT Token", required = true) @HeaderParam(value = Globals.KEYCLOAK_AUTH_TAG) String jwt,
- StandbyScheduleActionDto actionDto) {
+ StandbyScheduleActionDto actionDto) throws SpException {
+ actionDto.createDatesFromStrings();
ModifyingInvokable<PlanningMsgResponseDto> invokable = modusr -> planningController.moveUserInPlan(actionDto,
modusr);
diff --git a/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/controller/planning/PlanningControllerTest.java b/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/controller/planning/PlanningControllerTest.java
index 0f6b1cd..8c578e5 100644
--- a/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/controller/planning/PlanningControllerTest.java
+++ b/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/controller/planning/PlanningControllerTest.java
@@ -814,8 +814,8 @@
actionDto.setScheduleBodyId(1L);
actionDto.setStandbyGroupId(1L);
actionDto.setStatusId(1L);
- actionDto.setValidFrom(new Date());
- actionDto.setValidTo(new Date());
+ actionDto.setValidFromDate(new Date());
+ actionDto.setValidToDate(new Date());
String username = "JUnit";
List<StandbyScheduleBody> lsStandbyScheduleBodies = new ArrayList<>();
@@ -938,8 +938,8 @@
public void moveUserInPlanTest() {
StandbyScheduleActionDto actionDto = new StandbyScheduleActionDto();
actionDto.setScheduleBodyId(1L);
- actionDto.setValidFrom(new Date());
- actionDto.setValidTo(new Date());
+ actionDto.setValidFromDate(new Date());
+ actionDto.setValidToDate(new Date());
actionDto.setNewUserId(1L);
actionDto.setStandbyGroupId(1L);
String username = "JUnit";
@@ -974,7 +974,7 @@
}
// test success - different date
- actionDto.setValidTo(DateHelper.addDaysToDate(new Date(), 3));
+ actionDto.setValidToDate(DateHelper.addDaysToDate(new Date(), 3));
try {
when(userController.isUserValid(Mockito.anyLong(), Mockito.any(), Mockito.any())).thenReturn(true);
when(userController.isUserInGroup(Mockito.anyLong(), Mockito.anyLong(), Mockito.any(), Mockito.any()))
@@ -985,8 +985,8 @@
}
// test success - bigger from date
- actionDto.setValidFrom(DateHelper.addDaysToDate(new Date(), 3));
- actionDto.setValidTo(new Date());
+ actionDto.setValidFromDate(DateHelper.addDaysToDate(new Date(), 3));
+ actionDto.setValidToDate(new Date());
try {
when(userController.isUserValid(Mockito.anyLong(), Mockito.any(), Mockito.any())).thenReturn(true);
when(userController.isUserInGroup(Mockito.anyLong(), Mockito.anyLong(), Mockito.any(), Mockito.any()))
diff --git a/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/controller/validation/ValidationControllerTest.java b/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/controller/validation/ValidationControllerTest.java
index 224a656..359254e 100644
--- a/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/controller/validation/ValidationControllerTest.java
+++ b/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/controller/validation/ValidationControllerTest.java
@@ -146,8 +146,8 @@
validationDto.setStandbyGroupId(1L);
validationDto.setStandbyListId(1L);
validationDto.setStatusId(1L);
- validationDto.setValidFrom(DateHelper.getDate(2018, 10, 01));
- validationDto.setValidTo(DateHelper.getDate(2018, 10, 03));
+ validationDto.setValidFromDate(DateHelper.getDate(2018, 10, 01));
+ validationDto.setValidToDate(DateHelper.getDate(2018, 10, 03));
List<PlanningMsgDto> lsPlanningList = new ArrayList<>();
diff --git a/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/dto/planning/StandbyScheduleActionDtoTest.java b/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/dto/planning/StandbyScheduleActionDtoTest.java
index 46c6cc2..69697a6 100644
--- a/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/dto/planning/StandbyScheduleActionDtoTest.java
+++ b/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/dto/planning/StandbyScheduleActionDtoTest.java
@@ -41,10 +41,10 @@
assertTrue(action.getStatusId() == 1L);
Date date = new Date();
- action.setValidFrom(date);
- assertTrue(DateHelper.isSameDate(action.getValidFrom(), date));
+ action.setValidFromDate(date);
+ assertTrue(DateHelper.isSameDate(action.getValidFromDate(), date));
- action.setValidTo(date);
- assertTrue(DateHelper.isSameDate(action.getValidTo(), date));
+ action.setValidToDate(date);
+ assertTrue(DateHelper.isSameDate(action.getValidToDate(), date));
}
}
diff --git a/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/mail/MailRequestTest.java b/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/mail/MailRequestTest.java
index ef6eb9c..888ce23 100644
--- a/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/mail/MailRequestTest.java
+++ b/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/mail/MailRequestTest.java
@@ -75,8 +75,8 @@
StandbyScheduleActionDto actionDto = new StandbyScheduleActionDto();
actionDto.setStatusId(SpMsg.STATUS_CLOSED_PLANNING);
- actionDto.setValidFrom(new Date());
- actionDto.setValidTo(new Date());
+ actionDto.setValidFromDate(new Date());
+ actionDto.setValidToDate(new Date());
StandbyGroup targetGroup = new StandbyGroup();
targetGroup.setTitle("test");
@@ -153,8 +153,8 @@
StandbyScheduleActionDto actionDto = new StandbyScheduleActionDto();
actionDto.setStatusId(SpMsg.STATUS_CLOSED_PLANNING);
- actionDto.setValidFrom(new Date());
- actionDto.setValidTo(new Date());
+ actionDto.setValidFromDate(new Date());
+ actionDto.setValidToDate(new Date());
Properties property = new Properties();
property.setProperty(Globals.MAIL_TEMPLATE_DIRECTORY, "mail");
@@ -213,8 +213,8 @@
StandbyScheduleActionDto actionDto = new StandbyScheduleActionDto();
actionDto.setStatusId(SpMsg.STATUS_CLOSED_PLANNING);
- actionDto.setValidFrom(new Date());
- actionDto.setValidTo(new Date());
+ actionDto.setValidFromDate(new Date());
+ actionDto.setValidToDate(new Date());
Properties property = new Properties();
property.setProperty(Globals.MAIL_TEMPLATE_DIRECTORY, "mail");
diff --git a/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/rest/StandbyScheduleRestServiceTest.java b/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/rest/StandbyScheduleRestServiceTest.java
index d44adb5..24d73a8 100644
--- a/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/rest/StandbyScheduleRestServiceTest.java
+++ b/oKBereitschaftsplanungBackend/src/test/java/org/eclipse/openk/sp/rest/StandbyScheduleRestServiceTest.java
@@ -13,6 +13,7 @@
package org.eclipse.openk.sp.rest;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import javax.ws.rs.core.Response;
@@ -23,6 +24,7 @@
import org.eclipse.openk.sp.dto.planning.StandbyScheduleCopyDto;
import org.eclipse.openk.sp.dto.planning.StandbyScheduleFilterDto;
import org.eclipse.openk.sp.dto.planning.StandbyScheduleSearchDto;
+import org.eclipse.openk.sp.exceptions.SpException;
import org.eclipse.openk.sp.util.SpMsg;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -83,8 +85,14 @@
String jwt = "LET-ME-IN";
StandbyScheduleActionDto replaceUserDto = new StandbyScheduleActionDto();
- Response result = standbyScheduleRestService.replaceUserInPlan(jwt, replaceUserDto);
- assertNotNull(result);
+ Response result;
+ try {
+ result = standbyScheduleRestService.replaceUserInPlan(jwt, replaceUserDto);
+ assertNotNull(result);
+ } catch (SpException e) {
+ assertNull(e);
+ }
+
}
@Test
@@ -92,8 +100,13 @@
String jwt = "LET-ME-IN";
StandbyScheduleActionDto replaceUserDto = new StandbyScheduleActionDto();
- Response result = standbyScheduleRestService.moveUserInPlan(jwt, replaceUserDto);
- assertNotNull(result);
+ Response result;
+ try {
+ result = standbyScheduleRestService.moveUserInPlan(jwt, replaceUserDto);
+ assertNotNull(result);
+ } catch (SpException e) {
+ assertNull(e);
+ }
}
@Test