mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 06:53:09 +00:00
97425: Fix minor issues
This commit is contained in:
@@ -18,34 +18,35 @@ package org.dspace.alerts;
|
|||||||
* sessions.
|
* sessions.
|
||||||
*/
|
*/
|
||||||
public enum AllowSessionsEnum {
|
public enum AllowSessionsEnum {
|
||||||
ALLOW_ALL_SESSIONS(0),
|
ALLOW_ALL_SESSIONS("all"),
|
||||||
ALLOW_CURRENT_SESSIONS_ONLY(1),
|
ALLOW_CURRENT_SESSIONS_ONLY("current"),
|
||||||
ALLOW_ADMIN_SESSIONS_ONLY(2);
|
ALLOW_ADMIN_SESSIONS_ONLY("admin");
|
||||||
|
|
||||||
private int allowSessionsType;
|
private String allowSessionsType;
|
||||||
|
|
||||||
AllowSessionsEnum(int allowSessionsType) {
|
AllowSessionsEnum(String allowSessionsType) {
|
||||||
this.allowSessionsType = allowSessionsType;
|
this.allowSessionsType = allowSessionsType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getValue() {
|
public String getValue() {
|
||||||
return allowSessionsType;
|
return allowSessionsType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AllowSessionsEnum fromInt(Integer alertAllowSessionType) {
|
public static AllowSessionsEnum fromString(String alertAllowSessionType) {
|
||||||
if (alertAllowSessionType == null) {
|
if (alertAllowSessionType == null) {
|
||||||
return AllowSessionsEnum.ALLOW_ALL_SESSIONS;
|
return AllowSessionsEnum.ALLOW_ALL_SESSIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (alertAllowSessionType) {
|
switch (alertAllowSessionType) {
|
||||||
case 0:
|
case "all":
|
||||||
return AllowSessionsEnum.ALLOW_ALL_SESSIONS;
|
return AllowSessionsEnum.ALLOW_ALL_SESSIONS;
|
||||||
case 1:
|
case "current":
|
||||||
return AllowSessionsEnum.ALLOW_CURRENT_SESSIONS_ONLY;
|
return AllowSessionsEnum.ALLOW_CURRENT_SESSIONS_ONLY;
|
||||||
case 2:
|
case "admin" :
|
||||||
return AllowSessionsEnum.ALLOW_ADMIN_SESSIONS_ONLY;
|
return AllowSessionsEnum.ALLOW_ADMIN_SESSIONS_ONLY;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("No corresponding enum value for integer");
|
throw new IllegalArgumentException("No corresponding enum value for provided string: "
|
||||||
|
+ alertAllowSessionType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ public class SystemWideAlert implements ReloadableEntity<Integer> {
|
|||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
@Column(name = "allow_sessions")
|
@Column(name = "allow_sessions")
|
||||||
private int allowSessions;
|
private String allowSessions;
|
||||||
|
|
||||||
@Column(name = "countdown_to")
|
@Column(name = "countdown_to")
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
@@ -97,8 +97,8 @@ public class SystemWideAlert implements ReloadableEntity<Integer> {
|
|||||||
*
|
*
|
||||||
* @return what kind of sessions are allowed while the system-wide alert is active
|
* @return what kind of sessions are allowed while the system-wide alert is active
|
||||||
*/
|
*/
|
||||||
public int getAllowSessions() {
|
public AllowSessionsEnum getAllowSessions() {
|
||||||
return allowSessions;
|
return AllowSessionsEnum.fromString(allowSessions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -112,7 +112,7 @@ public class SystemWideAlertServiceImpl implements SystemWideAlertService {
|
|||||||
if (active == null || active.isEmpty()) {
|
if (active == null || active.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return active.get(0).getAllowSessions() == AllowSessionsEnum.ALLOW_ALL_SESSIONS.getValue();
|
return active.get(0).getAllowSessions() == AllowSessionsEnum.ALLOW_ALL_SESSIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -124,6 +124,6 @@ public class SystemWideAlertServiceImpl implements SystemWideAlertService {
|
|||||||
if (active == null || active.isEmpty()) {
|
if (active == null || active.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return active.get(0).getAllowSessions() != AllowSessionsEnum.ALLOW_ADMIN_SESSIONS_ONLY.getValue();
|
return active.get(0).getAllowSessions() != AllowSessionsEnum.ALLOW_ADMIN_SESSIONS_ONLY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@ CREATE TABLE systemwidealert
|
|||||||
(
|
(
|
||||||
alert_id INTEGER NOT NULL PRIMARY KEY,
|
alert_id INTEGER NOT NULL PRIMARY KEY,
|
||||||
message VARCHAR(512),
|
message VARCHAR(512),
|
||||||
allow_sessions INTEGER,
|
allow_sessions VARCHAR(64),
|
||||||
countdown_to TIMESTAMP,
|
countdown_to TIMESTAMP,
|
||||||
active BOOLEAN
|
active BOOLEAN
|
||||||
);
|
);
|
||||||
|
@@ -16,7 +16,7 @@ CREATE TABLE systemwidealert
|
|||||||
(
|
(
|
||||||
alert_id INTEGER NOT NULL PRIMARY KEY,
|
alert_id INTEGER NOT NULL PRIMARY KEY,
|
||||||
message VARCHAR(512),
|
message VARCHAR(512),
|
||||||
allow_sessions INTEGER,
|
allow_sessions VARCHAR(64),
|
||||||
countdown_to TIMESTAMP,
|
countdown_to TIMESTAMP,
|
||||||
active BOOLEAN
|
active BOOLEAN
|
||||||
);
|
);
|
||||||
|
@@ -16,7 +16,7 @@ CREATE TABLE systemwidealert
|
|||||||
(
|
(
|
||||||
alert_id INTEGER NOT NULL PRIMARY KEY,
|
alert_id INTEGER NOT NULL PRIMARY KEY,
|
||||||
message VARCHAR(512),
|
message VARCHAR(512),
|
||||||
allow_sessions INTEGER,
|
allow_sessions VARCHAR(64),
|
||||||
countdown_to TIMESTAMP,
|
countdown_to TIMESTAMP,
|
||||||
active BOOLEAN
|
active BOOLEAN
|
||||||
);
|
);
|
||||||
|
@@ -133,7 +133,7 @@ public class SystemWideAlertServiceTest {
|
|||||||
@Test
|
@Test
|
||||||
public void canNonAdminUserLoginTrueTest() throws Exception {
|
public void canNonAdminUserLoginTrueTest() throws Exception {
|
||||||
// Mock the alert state
|
// Mock the alert state
|
||||||
when(systemWideAlert.getAllowSessions()).thenReturn(AllowSessionsEnum.ALLOW_ALL_SESSIONS.getValue());
|
when(systemWideAlert.getAllowSessions()).thenReturn(AllowSessionsEnum.ALLOW_ALL_SESSIONS);
|
||||||
|
|
||||||
// Mock DAO to return our defined systemWideAlertList
|
// Mock DAO to return our defined systemWideAlertList
|
||||||
List<SystemWideAlert> systemWideAlertList = new ArrayList<>();
|
List<SystemWideAlert> systemWideAlertList = new ArrayList<>();
|
||||||
@@ -147,7 +147,7 @@ public class SystemWideAlertServiceTest {
|
|||||||
@Test
|
@Test
|
||||||
public void canNonAdminUserLoginFalseTest() throws Exception {
|
public void canNonAdminUserLoginFalseTest() throws Exception {
|
||||||
// Mock the alert state
|
// Mock the alert state
|
||||||
when(systemWideAlert.getAllowSessions()).thenReturn(AllowSessionsEnum.ALLOW_ADMIN_SESSIONS_ONLY.getValue());
|
when(systemWideAlert.getAllowSessions()).thenReturn(AllowSessionsEnum.ALLOW_ADMIN_SESSIONS_ONLY);
|
||||||
|
|
||||||
// Mock DAO to return our defined systemWideAlertList
|
// Mock DAO to return our defined systemWideAlertList
|
||||||
List<SystemWideAlert> systemWideAlertList = new ArrayList<>();
|
List<SystemWideAlert> systemWideAlertList = new ArrayList<>();
|
||||||
@@ -169,7 +169,7 @@ public class SystemWideAlertServiceTest {
|
|||||||
when(authorizeService.isAdmin(context, eperson)).thenReturn(false);
|
when(authorizeService.isAdmin(context, eperson)).thenReturn(false);
|
||||||
|
|
||||||
// Mock the alert state
|
// Mock the alert state
|
||||||
when(systemWideAlert.getAllowSessions()).thenReturn(AllowSessionsEnum.ALLOW_CURRENT_SESSIONS_ONLY.getValue());
|
when(systemWideAlert.getAllowSessions()).thenReturn(AllowSessionsEnum.ALLOW_CURRENT_SESSIONS_ONLY);
|
||||||
|
|
||||||
// Mock DAO to return our defined systemWideAlertList
|
// Mock DAO to return our defined systemWideAlertList
|
||||||
List<SystemWideAlert> systemWideAlertList = new ArrayList<>();
|
List<SystemWideAlert> systemWideAlertList = new ArrayList<>();
|
||||||
@@ -186,7 +186,7 @@ public class SystemWideAlertServiceTest {
|
|||||||
when(authorizeService.isAdmin(context, eperson)).thenReturn(false);
|
when(authorizeService.isAdmin(context, eperson)).thenReturn(false);
|
||||||
|
|
||||||
// Mock the alert state
|
// Mock the alert state
|
||||||
when(systemWideAlert.getAllowSessions()).thenReturn(AllowSessionsEnum.ALLOW_ADMIN_SESSIONS_ONLY.getValue());
|
when(systemWideAlert.getAllowSessions()).thenReturn(AllowSessionsEnum.ALLOW_ADMIN_SESSIONS_ONLY);
|
||||||
|
|
||||||
// Mock DAO to return our defined systemWideAlertList
|
// Mock DAO to return our defined systemWideAlertList
|
||||||
List<SystemWideAlert> systemWideAlertList = new ArrayList<>();
|
List<SystemWideAlert> systemWideAlertList = new ArrayList<>();
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.dspace.builder;
|
package org.dspace.builder;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -16,7 +15,6 @@ import org.dspace.alerts.SystemWideAlert;
|
|||||||
import org.dspace.alerts.service.SystemWideAlertService;
|
import org.dspace.alerts.service.SystemWideAlertService;
|
||||||
import org.dspace.authorize.AuthorizeException;
|
import org.dspace.authorize.AuthorizeException;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.dspace.scripts.Process;
|
|
||||||
|
|
||||||
public class SystemWideAlertBuilder extends AbstractBuilder<SystemWideAlert, SystemWideAlertService> {
|
public class SystemWideAlertBuilder extends AbstractBuilder<SystemWideAlert, SystemWideAlertService> {
|
||||||
|
|
||||||
@@ -93,20 +91,4 @@ public class SystemWideAlertBuilder extends AbstractBuilder<SystemWideAlert, Sys
|
|||||||
getService().delete(c, alert);
|
getService().delete(c, alert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void deleteProcess(Integer integer) throws SQLException, IOException {
|
|
||||||
try (Context c = new Context()) {
|
|
||||||
c.turnOffAuthorisationSystem();
|
|
||||||
Process process = processService.find(c, integer);
|
|
||||||
if (process != null) {
|
|
||||||
try {
|
|
||||||
processService.delete(c, process);
|
|
||||||
} catch (AuthorizeException e) {
|
|
||||||
// cannot occur, just wrap it to make the compiler happy
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
c.complete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,7 @@ public class SystemWideAlertConverter implements DSpaceConverter<SystemWideAlert
|
|||||||
systemWideAlertRest.setId(systemWideAlert.getID());
|
systemWideAlertRest.setId(systemWideAlert.getID());
|
||||||
systemWideAlertRest.setAlertId(systemWideAlert.getID());
|
systemWideAlertRest.setAlertId(systemWideAlert.getID());
|
||||||
systemWideAlertRest.setMessage(systemWideAlert.getMessage());
|
systemWideAlertRest.setMessage(systemWideAlert.getMessage());
|
||||||
systemWideAlertRest.setAllowSessions(systemWideAlert.getAllowSessions());
|
systemWideAlertRest.setAllowSessions(systemWideAlert.getAllowSessions().getValue());
|
||||||
systemWideAlertRest.setCountdownTo(systemWideAlert.getCountdownTo());
|
systemWideAlertRest.setCountdownTo(systemWideAlert.getCountdownTo());
|
||||||
systemWideAlertRest.setActive(systemWideAlert.isActive());
|
systemWideAlertRest.setActive(systemWideAlert.isActive());
|
||||||
return systemWideAlertRest;
|
return systemWideAlertRest;
|
||||||
|
@@ -36,7 +36,7 @@ public class SystemWideAlertRest extends BaseObjectRest<Integer> {
|
|||||||
|
|
||||||
private Integer alertId;
|
private Integer alertId;
|
||||||
private String message;
|
private String message;
|
||||||
private Integer allowSessions;
|
private String allowSessions;
|
||||||
private Date countdownTo;
|
private Date countdownTo;
|
||||||
private boolean active;
|
private boolean active;
|
||||||
|
|
||||||
@@ -56,11 +56,11 @@ public class SystemWideAlertRest extends BaseObjectRest<Integer> {
|
|||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getAllowSessions() {
|
public String getAllowSessions() {
|
||||||
return allowSessions;
|
return allowSessions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAllowSessions(final Integer allowSessions) {
|
public void setAllowSessions(final String allowSessions) {
|
||||||
this.allowSessions = allowSessions;
|
this.allowSessions = allowSessions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -80,7 +80,7 @@ public class SystemWideAlertRestRepository extends DSpaceRestRepository<SystemWi
|
|||||||
throw new ResourceNotFoundException(
|
throw new ResourceNotFoundException(
|
||||||
"systemWideAlert with id " + systemWideAlert.getID() + " was not found");
|
"systemWideAlert with id " + systemWideAlert.getID() + " was not found");
|
||||||
}
|
}
|
||||||
if (!authorizeService.isAdmin(context) && !systemWideAlert.isActive()) {
|
if (!systemWideAlert.isActive() && !authorizeService.isAdmin(context)) {
|
||||||
throw new AuthorizeException("Non admin users are not allowed to retrieve inactive alerts");
|
throw new AuthorizeException("Non admin users are not allowed to retrieve inactive alerts");
|
||||||
}
|
}
|
||||||
return converter.toRest(systemWideAlert, utils.obtainProjection());
|
return converter.toRest(systemWideAlert, utils.obtainProjection());
|
||||||
@@ -125,7 +125,7 @@ public class SystemWideAlertRestRepository extends DSpaceRestRepository<SystemWi
|
|||||||
}
|
}
|
||||||
|
|
||||||
systemWideAlert.setMessage(systemWideAlertRest.getMessage());
|
systemWideAlert.setMessage(systemWideAlertRest.getMessage());
|
||||||
systemWideAlert.setAllowSessions(AllowSessionsEnum.fromInt(systemWideAlertRest.getAllowSessions()));
|
systemWideAlert.setAllowSessions(AllowSessionsEnum.fromString(systemWideAlertRest.getAllowSessions()));
|
||||||
systemWideAlert.setCountdownTo(systemWideAlertRest.getCountdownTo());
|
systemWideAlert.setCountdownTo(systemWideAlertRest.getCountdownTo());
|
||||||
systemWideAlert.setActive(systemWideAlertRest.isActive());
|
systemWideAlert.setActive(systemWideAlertRest.isActive());
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ public class SystemWideAlertRestRepository extends DSpaceRestRepository<SystemWi
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
systemWideAlert = systemWideAlertService.create(context, systemWideAlertRest.getMessage(),
|
systemWideAlert = systemWideAlertService.create(context, systemWideAlertRest.getMessage(),
|
||||||
AllowSessionsEnum.fromInt(
|
AllowSessionsEnum.fromString(
|
||||||
systemWideAlertRest.getAllowSessions()),
|
systemWideAlertRest.getAllowSessions()),
|
||||||
systemWideAlertRest.getCountdownTo(),
|
systemWideAlertRest.getCountdownTo(),
|
||||||
systemWideAlertRest.isActive());
|
systemWideAlertRest.isActive());
|
||||||
|
@@ -68,7 +68,7 @@ public class SystemWideAlertRestRepositoryIT extends AbstractControllerIntegrati
|
|||||||
allOf(
|
allOf(
|
||||||
hasJsonPath("$.alertId", is(systemWideAlert1.getID())),
|
hasJsonPath("$.alertId", is(systemWideAlert1.getID())),
|
||||||
hasJsonPath("$.message", is(systemWideAlert1.getMessage())),
|
hasJsonPath("$.message", is(systemWideAlert1.getMessage())),
|
||||||
hasJsonPath("$.allowSessions", is(systemWideAlert1.getAllowSessions())),
|
hasJsonPath("$.allowSessions", is(systemWideAlert1.getAllowSessions().getValue())),
|
||||||
hasJsonPath("$.countdownTo",
|
hasJsonPath("$.countdownTo",
|
||||||
startsWith(sdf.format(systemWideAlert1.getCountdownTo()))),
|
startsWith(sdf.format(systemWideAlert1.getCountdownTo()))),
|
||||||
hasJsonPath("$.active", is(systemWideAlert1.isActive()))
|
hasJsonPath("$.active", is(systemWideAlert1.isActive()))
|
||||||
@@ -76,7 +76,7 @@ public class SystemWideAlertRestRepositoryIT extends AbstractControllerIntegrati
|
|||||||
allOf(
|
allOf(
|
||||||
hasJsonPath("$.alertId", is(systemWideAlert2.getID())),
|
hasJsonPath("$.alertId", is(systemWideAlert2.getID())),
|
||||||
hasJsonPath("$.message", is(systemWideAlert2.getMessage())),
|
hasJsonPath("$.message", is(systemWideAlert2.getMessage())),
|
||||||
hasJsonPath("$.allowSessions", is(systemWideAlert2.getAllowSessions())),
|
hasJsonPath("$.allowSessions", is(systemWideAlert2.getAllowSessions().getValue())),
|
||||||
hasJsonPath("$.countdownTo", is(systemWideAlert2.getCountdownTo())),
|
hasJsonPath("$.countdownTo", is(systemWideAlert2.getCountdownTo())),
|
||||||
hasJsonPath("$.active", is(systemWideAlert2.isActive()))
|
hasJsonPath("$.active", is(systemWideAlert2.isActive()))
|
||||||
)
|
)
|
||||||
@@ -168,7 +168,7 @@ public class SystemWideAlertRestRepositoryIT extends AbstractControllerIntegrati
|
|||||||
hasJsonPath("$.alertId", is(systemWideAlert1.getID())),
|
hasJsonPath("$.alertId", is(systemWideAlert1.getID())),
|
||||||
hasJsonPath("$.message", is(systemWideAlert1.getMessage())),
|
hasJsonPath("$.message", is(systemWideAlert1.getMessage())),
|
||||||
hasJsonPath("$.allowSessions",
|
hasJsonPath("$.allowSessions",
|
||||||
is(systemWideAlert1.getAllowSessions())),
|
is(systemWideAlert1.getAllowSessions().getValue())),
|
||||||
hasJsonPath("$.countdownTo",
|
hasJsonPath("$.countdownTo",
|
||||||
startsWith(sdf.format(systemWideAlert1.getCountdownTo()))),
|
startsWith(sdf.format(systemWideAlert1.getCountdownTo()))),
|
||||||
hasJsonPath("$.active", is(systemWideAlert1.isActive()))
|
hasJsonPath("$.active", is(systemWideAlert1.isActive()))
|
||||||
@@ -209,7 +209,7 @@ public class SystemWideAlertRestRepositoryIT extends AbstractControllerIntegrati
|
|||||||
hasJsonPath("$.alertId", is(systemWideAlert1.getID())),
|
hasJsonPath("$.alertId", is(systemWideAlert1.getID())),
|
||||||
hasJsonPath("$.message", is(systemWideAlert1.getMessage())),
|
hasJsonPath("$.message", is(systemWideAlert1.getMessage())),
|
||||||
hasJsonPath("$.allowSessions",
|
hasJsonPath("$.allowSessions",
|
||||||
is(systemWideAlert1.getAllowSessions())),
|
is(systemWideAlert1.getAllowSessions().getValue())),
|
||||||
hasJsonPath("$.countdownTo",
|
hasJsonPath("$.countdownTo",
|
||||||
startsWith(sdf.format(systemWideAlert1.getCountdownTo()))),
|
startsWith(sdf.format(systemWideAlert1.getCountdownTo()))),
|
||||||
hasJsonPath("$.active", is(systemWideAlert1.isActive()))
|
hasJsonPath("$.active", is(systemWideAlert1.isActive()))
|
||||||
@@ -255,7 +255,7 @@ public class SystemWideAlertRestRepositoryIT extends AbstractControllerIntegrati
|
|||||||
hasJsonPath("$.alertId", is(systemWideAlert1.getID())),
|
hasJsonPath("$.alertId", is(systemWideAlert1.getID())),
|
||||||
hasJsonPath("$.message", is(systemWideAlert1.getMessage())),
|
hasJsonPath("$.message", is(systemWideAlert1.getMessage())),
|
||||||
hasJsonPath("$.allowSessions",
|
hasJsonPath("$.allowSessions",
|
||||||
is(systemWideAlert1.getAllowSessions())),
|
is(systemWideAlert1.getAllowSessions().getValue())),
|
||||||
hasJsonPath("$.countdownTo",
|
hasJsonPath("$.countdownTo",
|
||||||
startsWith(sdf.format(systemWideAlert1.getCountdownTo()))),
|
startsWith(sdf.format(systemWideAlert1.getCountdownTo()))),
|
||||||
hasJsonPath("$.active", is(systemWideAlert1.isActive()))
|
hasJsonPath("$.active", is(systemWideAlert1.isActive()))
|
||||||
@@ -303,19 +303,19 @@ public class SystemWideAlertRestRepositoryIT extends AbstractControllerIntegrati
|
|||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$._embedded.systemwidealerts", containsInAnyOrder(
|
.andExpect(jsonPath("$._embedded.systemwidealerts", containsInAnyOrder(
|
||||||
allOf(
|
allOf(
|
||||||
hasJsonPath("$.alertId", is(systemWideAlert1.getID())),
|
hasJsonPath("$.alertId", is(systemWideAlert1.getID())),
|
||||||
hasJsonPath("$.message", is(systemWideAlert1.getMessage())),
|
hasJsonPath("$.message", is(systemWideAlert1.getMessage())),
|
||||||
hasJsonPath("$.allowSessions", is(systemWideAlert1.getAllowSessions())),
|
hasJsonPath("$.allowSessions", is(systemWideAlert1.getAllowSessions().getValue())),
|
||||||
hasJsonPath("$.countdownTo",
|
hasJsonPath("$.countdownTo",
|
||||||
startsWith(sdf.format(systemWideAlert1.getCountdownTo()))),
|
startsWith(sdf.format(systemWideAlert1.getCountdownTo()))),
|
||||||
hasJsonPath("$.active", is(systemWideAlert1.isActive()))
|
hasJsonPath("$.active", is(systemWideAlert1.isActive()))
|
||||||
),
|
),
|
||||||
allOf(
|
allOf(
|
||||||
hasJsonPath("$.alertId", is(systemWideAlert3.getID())),
|
hasJsonPath("$.alertId", is(systemWideAlert3.getID())),
|
||||||
hasJsonPath("$.message", is(systemWideAlert3.getMessage())),
|
hasJsonPath("$.message", is(systemWideAlert3.getMessage())),
|
||||||
hasJsonPath("$.allowSessions", is(systemWideAlert3.getAllowSessions())),
|
hasJsonPath("$.allowSessions", is(systemWideAlert3.getAllowSessions().getValue())),
|
||||||
hasJsonPath("$.countdownTo", is(systemWideAlert3.getCountdownTo())),
|
hasJsonPath("$.countdownTo", is(systemWideAlert3.getCountdownTo())),
|
||||||
hasJsonPath("$.active", is(systemWideAlert3.isActive()))
|
hasJsonPath("$.active", is(systemWideAlert3.isActive()))
|
||||||
)
|
)
|
||||||
)));
|
)));
|
||||||
|
|
||||||
@@ -326,7 +326,7 @@ public class SystemWideAlertRestRepositoryIT extends AbstractControllerIntegrati
|
|||||||
SystemWideAlertRest systemWideAlertRest = new SystemWideAlertRest();
|
SystemWideAlertRest systemWideAlertRest = new SystemWideAlertRest();
|
||||||
systemWideAlertRest.setMessage("Alert test message");
|
systemWideAlertRest.setMessage("Alert test message");
|
||||||
systemWideAlertRest.setCountdownTo(new Date());
|
systemWideAlertRest.setCountdownTo(new Date());
|
||||||
systemWideAlertRest.setAllowSessions(1);
|
systemWideAlertRest.setAllowSessions(AllowSessionsEnum.ALLOW_CURRENT_SESSIONS_ONLY.getValue());
|
||||||
systemWideAlertRest.setActive(true);
|
systemWideAlertRest.setActive(true);
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
@@ -376,7 +376,7 @@ public class SystemWideAlertRestRepositoryIT extends AbstractControllerIntegrati
|
|||||||
SystemWideAlertRest systemWideAlertRest = new SystemWideAlertRest();
|
SystemWideAlertRest systemWideAlertRest = new SystemWideAlertRest();
|
||||||
systemWideAlertRest.setMessage("Alert test message");
|
systemWideAlertRest.setMessage("Alert test message");
|
||||||
systemWideAlertRest.setCountdownTo(new Date());
|
systemWideAlertRest.setCountdownTo(new Date());
|
||||||
systemWideAlertRest.setAllowSessions(1);
|
systemWideAlertRest.setAllowSessions(AllowSessionsEnum.ALLOW_CURRENT_SESSIONS_ONLY.getValue());
|
||||||
systemWideAlertRest.setActive(true);
|
systemWideAlertRest.setActive(true);
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
@@ -396,7 +396,7 @@ public class SystemWideAlertRestRepositoryIT extends AbstractControllerIntegrati
|
|||||||
SystemWideAlertRest systemWideAlertRest = new SystemWideAlertRest();
|
SystemWideAlertRest systemWideAlertRest = new SystemWideAlertRest();
|
||||||
systemWideAlertRest.setMessage("Alert test message");
|
systemWideAlertRest.setMessage("Alert test message");
|
||||||
systemWideAlertRest.setCountdownTo(new Date());
|
systemWideAlertRest.setCountdownTo(new Date());
|
||||||
systemWideAlertRest.setAllowSessions(1);
|
systemWideAlertRest.setAllowSessions(AllowSessionsEnum.ALLOW_CURRENT_SESSIONS_ONLY.getValue());
|
||||||
systemWideAlertRest.setActive(true);
|
systemWideAlertRest.setActive(true);
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
@@ -425,7 +425,7 @@ public class SystemWideAlertRestRepositoryIT extends AbstractControllerIntegrati
|
|||||||
SystemWideAlertRest systemWideAlertRest = new SystemWideAlertRest();
|
SystemWideAlertRest systemWideAlertRest = new SystemWideAlertRest();
|
||||||
systemWideAlertRest.setMessage("Alert test message");
|
systemWideAlertRest.setMessage("Alert test message");
|
||||||
systemWideAlertRest.setCountdownTo(new Date());
|
systemWideAlertRest.setCountdownTo(new Date());
|
||||||
systemWideAlertRest.setAllowSessions(1);
|
systemWideAlertRest.setAllowSessions(AllowSessionsEnum.ALLOW_CURRENT_SESSIONS_ONLY.getValue());
|
||||||
systemWideAlertRest.setActive(true);
|
systemWideAlertRest.setActive(true);
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
@@ -454,7 +454,7 @@ public class SystemWideAlertRestRepositoryIT extends AbstractControllerIntegrati
|
|||||||
systemWideAlertRest.setAlertId(systemWideAlert.getID());
|
systemWideAlertRest.setAlertId(systemWideAlert.getID());
|
||||||
systemWideAlertRest.setMessage("Updated alert test message");
|
systemWideAlertRest.setMessage("Updated alert test message");
|
||||||
systemWideAlertRest.setCountdownTo(new Date());
|
systemWideAlertRest.setCountdownTo(new Date());
|
||||||
systemWideAlertRest.setAllowSessions(1);
|
systemWideAlertRest.setAllowSessions(AllowSessionsEnum.ALLOW_CURRENT_SESSIONS_ONLY.getValue());
|
||||||
systemWideAlertRest.setActive(true);
|
systemWideAlertRest.setActive(true);
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
Reference in New Issue
Block a user