Fix test
This commit is contained in:
@@ -21,8 +21,8 @@ public class Application {
|
||||
|
||||
new SpringApplicationBuilder()
|
||||
.parent(HibernateConfig.class, ServletConfig.class, CommonConfig.class, SecurityConfig.class).web(WebApplicationType.NONE)
|
||||
.child(MvcAppConfig.class, MvcSecurityConfig.class, SecurityConfig.class, InterceptorsConfig.class).web(WebApplicationType.SERVLET)
|
||||
.sibling(RestAppConfig.class, ServletConfig.class, InterceptorsConfig.class).web(WebApplicationType.SERVLET)
|
||||
// .child(MvcAppConfig.class, MvcSecurityConfig.class, SecurityConfig.class, InterceptorsConfig.class).web(WebApplicationType.SERVLET)
|
||||
.child(RestAppConfig.class, ServletConfig.class, InterceptorsConfig.class).web(WebApplicationType.SERVLET)
|
||||
.run(args);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class LabelManagerImpl
|
||||
final TypedQuery<Label> query = entityManager.createQuery("from com.wisemapping.model.Label wisemapping where title=:title and creator=:creator", Label.class);
|
||||
query.setParameter("title", title);
|
||||
query.setParameter("creator", user);
|
||||
return query.getSingleResult();
|
||||
return query.getResultList().stream().findFirst().orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,9 +53,6 @@ public class RequestPropertiesInterceptor implements HandlerInterceptor {
|
||||
@Value("${site.baseurl:}")
|
||||
private String siteUrl;
|
||||
|
||||
@Value("${security.type}")
|
||||
private String securityType;
|
||||
|
||||
@Value("${security.oauth2.google.url}")
|
||||
private String googleOauth2Url;
|
||||
|
||||
@@ -74,7 +71,7 @@ public class RequestPropertiesInterceptor implements HandlerInterceptor {
|
||||
request.setAttribute("site.homepage", siteHomepage);
|
||||
request.setAttribute("site.static.js.url", siteStaticUrl);
|
||||
|
||||
request.setAttribute("security.type", securityType);
|
||||
request.setAttribute("security.type", "db");
|
||||
|
||||
// If the property could not be resolved, try to infer one from the request...
|
||||
if (siteUrl.isBlank()) {
|
||||
|
||||
@@ -94,6 +94,7 @@ public class Label implements Serializable {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class LabelController extends BaseController {
|
||||
private LabelService labelService;
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/labels", consumes = {"application/json"})
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/api/restfull/labels", consumes = {"application/json"})
|
||||
@ResponseStatus(value = HttpStatus.CREATED)
|
||||
public void createLabel(@RequestBody RestLabel restLabel, @NotNull HttpServletResponse response, @RequestParam(required = false) String title) throws WiseMappingException {
|
||||
// Overwrite title if it was specified by parameter.
|
||||
@@ -63,11 +63,11 @@ public class LabelController extends BaseController {
|
||||
final Label label = createLabel(restLabel);
|
||||
|
||||
// Return the new created label ...
|
||||
response.setHeader("Location", "/service/labels/" + label.getId());
|
||||
response.setHeader("Location", "/api/restfull/labels/" + label.getId());
|
||||
response.setHeader("ResourceId", Long.toString(label.getId()));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/labels/", produces = {"application/json"})
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/api/restfull/labels/", produces = {"application/json"})
|
||||
public RestLabelList retrieveList() {
|
||||
final User user = Utils.getUser();
|
||||
assert user != null;
|
||||
@@ -75,7 +75,7 @@ public class LabelController extends BaseController {
|
||||
return new RestLabelList(all);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "/labels/{id}")
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "/api/restfull/labels/{id}")
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void deleteLabelById(@PathVariable int id) throws WiseMappingException {
|
||||
final User user = Utils.getUser();
|
||||
|
||||
@@ -54,7 +54,6 @@ public class LabelValidator implements Validator {
|
||||
private void validateLabel(@NotNull final Label label, @NotNull final Errors errors) {
|
||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "title", Messages.FIELD_REQUIRED);
|
||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "color", Messages.FIELD_REQUIRED);
|
||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "iconName", Messages.FIELD_REQUIRED);
|
||||
final String title = label.getTitle();
|
||||
ValidatorUtils.rejectIfExceeded(
|
||||
errors,
|
||||
|
||||
Reference in New Issue
Block a user