Commit 4adc9fc4 authored by Matija Obreza's avatar Matija Obreza

Created Article#summary

parent 1d32e77c
......@@ -85,7 +85,7 @@ public class CreateContentListener extends RunAsAdminListener {
// If nothing is found, parse the resource and create content
if (article == null) {
contentService.createGlobalArticle(slug, locale, entry.getValue().get("title").asText(), entry.getValue().get("body").asText());
contentService.createGlobalArticle(slug, locale, entry.getValue().get("title").asText(), entry.getValue().get("body").asText(), null);
_logger.info("Created article for slug: " + slug + " lang=" + locale.getLanguage());
}
}
......
......@@ -55,6 +55,10 @@ public class Article extends AuditedModel {
@Lob
@Type(type = "org.hibernate.type.TextType")
private String title;
@Lob
@Type(type = "org.hibernate.type.TextType")
private String summary;
@Lob
@Type(type = "org.hibernate.type.TextType")
......@@ -79,6 +83,14 @@ public class Article extends AuditedModel {
public void setTitle(String title) {
this.title = title;
}
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
public String getBody() {
return body;
......
......@@ -85,15 +85,15 @@ public interface ContentService {
*/
ActivityPost createActivityPost(String title, String body);
Article updateArticle(EntityId entity, String slug, String title, String body, Locale locale);
Article updateArticle(EntityId entity, String slug, String title, String body, String summary, Locale locale);
Article updateArticle(Class<?> clazz, Long id, String slug, String title, String body, Locale locale);
Article updateArticle(Class<?> clazz, Long id, String slug, String title, String body, String summary, Locale locale);
Article updateArticle(long id, String slug, String title, String body);
Article updateArticle(long id, String slug, String title, String body, String summary);
Article createGlobalArticle(String slug, Locale locale, String title, String body);
Article createGlobalArticle(String slug, Locale locale, String title, String body, String summary);
Article updateGlobalArticle(String slug, Locale locale, String title, String body);
Article updateGlobalArticle(String slug, Locale locale, String title, String body, String summary);
ActivityPost getActivityPost(long id);
......
......@@ -47,7 +47,7 @@ public interface InstituteService {
void update(Collection<FaoInstitute> institutes);
void updateBlurp(FaoInstitute faoInstitute, String blurp, Locale locale);
void updateAbout(FaoInstitute faoInstitute, String body, String summary, Locale locale);
void updateCountryRefs();
......
......@@ -31,7 +31,7 @@ public interface OrganizationService {
Organization getOrganization(String slug);
Article updateBlurp(Organization organization, String blurp, Locale locale);
Article updateAbout(Organization organization, String body, String summary, Locale locale);
Organization update(long id, String newSlug, String title);
......
......@@ -70,7 +70,8 @@ public class ContentServiceImpl implements ContentService {
@Override
public Locale getDefaultLocale() {
// TODO FIXME We should use a configurable default locale for content service
// TODO FIXME We should use a configurable default locale for content
// service
return Locale.getDefault();
}
......@@ -86,14 +87,14 @@ public class ContentServiceImpl implements ContentService {
return articleRepository.findAll(pageable);
}
@Override
public Page<Article> listArticlesByLang(String lang, Pageable pageable) {
return articleRepository.getAllByLang(lang, pageable);
}
@Override
public Page<Article> listArticlesByLang(String lang, Pageable pageable) {
return articleRepository.getAllByLang(lang, pageable);
}
@Override
@Override
@Transactional(readOnly = false)
// @PreAuthorize("hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER')")
// @PreAuthorize("hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER')")
@CacheEvict(value = "contentcache", allEntries = true)
public void save(Iterable<Article> articles) {
articleRepository.save(articles);
......@@ -120,12 +121,12 @@ public class ContentServiceImpl implements ContentService {
return getArticle(entity.getClass(), entity.getId(), slug, locale, true);
}
@Override
public Article getArticleBySlugAndLang(String slug, String lang) {
return articleRepository.findBySlugAndLang(slug, lang);
}
@Override
public Article getArticleBySlugAndLang(String slug, String lang) {
return articleRepository.findBySlugAndLang(slug, lang);
}
@Override
@Override
@Cacheable(value = "contentcache", key = "'article-' + #clazz.name + '-' + #id + '-' + #slug + '-' + #locale.language + '-' + #useDefault")
public Article getArticle(Class<?> clazz, Long id, String slug, Locale locale, boolean useDefault) {
Article article = articleRepository.findByClassPkAndTargetIdAndSlugAndLang(getClassPk(clazz), id, slug, locale.getLanguage());
......@@ -139,11 +140,12 @@ public class ContentServiceImpl implements ContentService {
@Transactional(readOnly = false)
@PreAuthorize("hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER')")
@CacheEvict(value = "contentcache", allEntries = true)
public Article updateArticle(long id, String slug, String title, String body) {
public Article updateArticle(long id, String slug, String title, String body, String summary) {
final Article article = articleRepository.findOne(id);
article.setSlug(slug);
article.setTitle(htmlSanitizer.sanitize(title));
article.setSummary(htmlSanitizer.sanitize(summary));
// FIXME TODO Find a better way to distinguish between Velocity
// templates and general articles
......@@ -161,7 +163,7 @@ public class ContentServiceImpl implements ContentService {
@Transactional(readOnly = false)
@PreAuthorize("hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER')")
@CacheEvict(value = "contentcache", allEntries = true)
public Article createGlobalArticle(String slug, Locale locale, String title, String body) {
public Article createGlobalArticle(String slug, Locale locale, String title, String body, String summary) {
Article article = getGlobalArticle(slug, locale, false);
if (article != null) {
throw new RuntimeException("Article exists");
......@@ -172,19 +174,19 @@ public class ContentServiceImpl implements ContentService {
article.setLang(locale.getLanguage());
article.setSlug(slug);
article.setTitle(htmlSanitizer.sanitize(title));
article.setSummary(htmlSanitizer.sanitize(summary));
article.setBody(htmlSanitizer.sanitize(body));
article.setPostDate(Calendar.getInstance());
articleRepository.save(article);
return article;
}
@Override
@Transactional(readOnly = false)
@PreAuthorize("hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER')")
@CacheEvict(value = "contentcache", allEntries = true)
public Article updateGlobalArticle(String slug, Locale locale, String title, String body) {
public Article updateGlobalArticle(String slug, Locale locale, String title, String body, String summary) {
Article article = getGlobalArticle(slug, locale, false);
if (article == null) {
throw new RuntimeException("Article does not exist");
......@@ -194,6 +196,7 @@ public class ContentServiceImpl implements ContentService {
article.setLang(locale.getLanguage());
article.setSlug(slug);
article.setTitle(htmlSanitizer.sanitize(title));
article.setSummary(htmlSanitizer.sanitize(summary));
article.setBody(htmlSanitizer.sanitize(body));
article.setPostDate(Calendar.getInstance());
......@@ -213,18 +216,18 @@ public class ContentServiceImpl implements ContentService {
@Transactional(readOnly = false)
@PreAuthorize("hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER') or hasPermission(#entity, 'ADMINISTRATION')")
@CacheEvict(value = "contentcache", allEntries = true)
public Article updateArticle(EntityId entity, String slug, String title, String body, Locale locale) {
public Article updateArticle(EntityId entity, String slug, String title, String body, String summary, Locale locale) {
// return
// articleRepository.findByClassPkAndTargetIdAndSlugAndLang(getClassPk(clazz),
// id, slug, locale.getLanguage());
return updateArticle(entity.getClass(), entity.getId(), slug, title, body, locale);
return updateArticle(entity.getClass(), entity.getId(), slug, title, body, summary, locale);
}
@Override
@Transactional(readOnly = false)
@PreAuthorize("hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER')")
@CacheEvict(value = "contentcache", allEntries = true)
public Article updateArticle(Class<?> clazz, Long id, String slug, String title, String body, Locale locale) {
public Article updateArticle(Class<?> clazz, Long id, String slug, String title, String body, String summary, Locale locale) {
Article article = getArticle(clazz, id, slug, locale, false);
if (article == null || !article.getLang().equals(locale.getLanguage())) {
article = new Article();
......@@ -235,6 +238,7 @@ public class ContentServiceImpl implements ContentService {
article.setSlug(slug);
}
article.setBody(htmlSanitizer.sanitize(body));
article.setSummary(htmlSanitizer.sanitize(summary));
article.setTitle(htmlSanitizer.sanitize(title));
articleRepository.save(article);
......
......@@ -347,7 +347,8 @@ public class GeoServiceImpl implements GeoService {
@PreAuthorize("hasRole('ADMINISTRATOR')")
@Transactional(readOnly = false)
public void updateBlurp(Country country, String blurp, Locale locale) {
contentService.updateArticle(country, "blurp", null, blurp, locale);
// TODO Should we provide summary?
contentService.updateArticle(country, "blurp", null, blurp, null, locale);
}
@Override
......
......@@ -139,8 +139,8 @@ public class InstituteServiceImpl implements InstituteService {
@Override
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#faoInstitute, 'ADMINISTRATION')")
@Transactional(readOnly = false)
public void updateBlurp(FaoInstitute faoInstitute, String blurp, Locale locale) {
contentService.updateArticle(faoInstitute, "blurp", null, blurp, locale);
public void updateAbout(FaoInstitute faoInstitute, String body, String summary, Locale locale) {
contentService.updateArticle(faoInstitute, "blurp", null, body, summary, locale);
}
@Override
......
......@@ -85,8 +85,8 @@ public class OrganizationServiceImpl implements OrganizationService {
@Override
@PreAuthorize("hasRole('ADMINISTRATOR')")
@Transactional(readOnly = false)
public Article updateBlurp(Organization organization, String blurp, Locale locale) {
return contentService.updateArticle(organization, "blurp", null, blurp, locale);
public Article updateAbout(Organization organization, String body, String summary, Locale locale) {
return contentService.updateArticle(organization, "blurp", null, body, summary, locale);
}
@Override
......
......@@ -231,9 +231,9 @@ public class ArticleController extends BaseController {
@PreAuthorize("hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER')")
@RequestMapping(value = "/save-article/{language}", method = { RequestMethod.POST })
public String createNewGlobalArticle(ModelMap model, @RequestParam("slug") String slug, @PathVariable("language") String language,
@RequestParam("title") String title, @RequestParam("body") String body) {
@RequestParam("title") String title, @RequestParam("body") String body, @RequestParam(value = "summary", required = false) String summary) {
contentService.createGlobalArticle(slug, new Locale(language), title, body);
contentService.createGlobalArticle(slug, new Locale(language), title, body, summary);
return redirectAfterSave(slug, language);
}
......@@ -249,27 +249,27 @@ public class ArticleController extends BaseController {
@PreAuthorize("hasRole('ADMINISTRATOR') or hasRole('CONTENTMANAGER')")
@RequestMapping(value = "/save-article/{language}", params = { "id" }, method = { RequestMethod.POST })
public String saveExistingGlobalArticle(ModelMap model, @PathVariable("language") String language, @RequestParam("id") long id,
@RequestParam("slug") String slug, @RequestParam("title") String title, @RequestParam("body") String body) {
@RequestParam("slug") String slug, @RequestParam("title") String title, @RequestParam("body") String body, @RequestParam(value = "summary", required = false) String summary) {
Article article = contentService.updateArticle(id, slug, title, body);
Article article = contentService.updateArticle(id, slug, title, body, summary);
return redirectAfterSave(slug, article.getLang());
}
@RequestMapping(value = "/blurp/update-blurp", method = { RequestMethod.POST })
public String updateBlurp(ModelMap model, @RequestParam("id") long id, @RequestParam(required = false, value = "title") String title,
@RequestParam("body") String body) {
@RequestParam("body") String body, @RequestParam(value = "summary", required = false) String summary) {
contentService.updateArticle(id, null, title, body);
contentService.updateArticle(id, null, title, body, summary);
return "redirect:/";
}
@RequestMapping(value = "/blurp/create-blurp", method = { RequestMethod.POST })
public String createBlurp(ModelMap model, @RequestParam("clazz") String clazz, @RequestParam("entityId") long entityId,
@RequestParam(required = false, value = "title") String title, @RequestParam("body") String body) throws ClassNotFoundException {
@RequestParam(required = false, value = "title") String title, @RequestParam("body") String body, @RequestParam(value = "summary", required = false) String summary) throws ClassNotFoundException {
contentService.updateArticle(Class.forName(clazz), entityId, "blurp", title, body, getLocale());
contentService.updateArticle(Class.forName(clazz), entityId, "blurp", title, body, summary, getLocale());
return "redirect:/";
}
}
......@@ -141,7 +141,7 @@ public class OrganizationController extends BaseController {
@PreAuthorize("hasRole('ADMINISTRATOR')")
@RequestMapping(value = "/{slug}/update")
public String update(ModelMap model, @PathVariable(value = "slug") String slug, @RequestParam(value = "slug") String newSlug,
@RequestParam("title") String title, @RequestParam("blurp") String blurp) {
@RequestParam("title") String title, @RequestParam("blurp") String blurp, @RequestParam(value = "summary", required = false) String summary) {
_logger.debug("Updating organization " + slug);
Organization organization = organizationService.getOrganization(slug);
......@@ -152,7 +152,7 @@ public class OrganizationController extends BaseController {
organization = organizationService.update(organization.getId(), newSlug, title);
}
organizationService.updateBlurp(organization, blurp, getLocale());
organizationService.updateAbout(organization, blurp, summary, getLocale());
return "redirect:/org/" + organization.getSlug();
}
......
......@@ -195,17 +195,19 @@ public class WiewsController extends BaseController {
}
@RequestMapping("/{wiewsCode}/update")
public String update(ModelMap model, @PathVariable(value = "wiewsCode") String wiewsCode, @RequestParam("blurp") String blurp,
@RequestParam("gaTracker") String gaTracker, @RequestParam("mailto") String mailto, @RequestParam("uniqueAcceNumbs") boolean uniqueAcceNumbs,
public String update(ModelMap model, @PathVariable(value = "wiewsCode") String wiewsCode, @RequestParam("blurp") String aboutBody,
@RequestParam(value = "summary", required = false) String summary, @RequestParam("gaTracker") String gaTracker,
@RequestParam("mailto") String mailto, @RequestParam("uniqueAcceNumbs") boolean uniqueAcceNumbs,
@RequestParam(value = "allowMaterialRequests", required = false, defaultValue = "false") boolean allowMaterialRequests,
@RequestParam("codeSVGS") String codeSVGS) {
_logger.debug("Updating institite " + wiewsCode);
final FaoInstitute faoInstitute = instituteService.getInstitute(wiewsCode);
if (faoInstitute == null) {
throw new ResourceNotFoundException();
}
instituteService.updateBlurp(faoInstitute, blurp, getLocale());
instituteService.updateAbout(faoInstitute, aboutBody, summary, getLocale());
final Map<String, String> settings = new HashMap<String, String>();
settings.put("googleAnalytics.tracker", gaTracker);
settings.put("requests.mailto", mailto);
......
......@@ -16,9 +16,17 @@
package org.genesys2.server.servlet.controller.rest;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import javax.xml.bind.ValidationException;
import net.sf.oval.ConstraintViolation;
import net.sf.oval.Validator;
import org.genesys2.server.exception.AuthorizationException;
import org.genesys2.server.model.impl.Article;
import org.genesys2.server.model.impl.FaoInstitute;
......@@ -31,14 +39,14 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.xml.bind.ValidationException;
import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import com.fasterxml.jackson.core.JsonProcessingException;
@Controller("restOrganizationController")
@PreAuthorize("isAuthenticated()")
......@@ -124,7 +132,7 @@ public class OrganizationController extends RestController {
public @ResponseBody
Article updateBlurp(@PathVariable("shortName") String shortName, @RequestBody OrganizationBlurpJson blurp) throws AuthorizationException {
Organization org = organizationService.getOrganization(shortName);
return organizationService.updateBlurp(org, blurp.blurp, blurp.getLocale());
return organizationService.updateAbout(org, blurp.blurp, blurp.summary, blurp.getLocale());
}
/**
......@@ -196,6 +204,7 @@ public class OrganizationController extends RestController {
}
public static class OrganizationBlurpJson {
public String summary;
public String blurp;
public String locale;
......
......@@ -158,6 +158,7 @@ faoInstitute.code=WIEWS Code
faoInstitute.email=Contact email
faoInstitute.acronym=Acronym
faoInstitute.url=Web link
faoInstitute.summary=Summary (HTML metadata)
faoInstitute.member-of-organizations-and-networks=Organizations and Networks:
faoInstitute.uniqueAcceNumbs.true=Each accession number is unique within this institute.
faoInstitute.uniqueAcceNumbs.false=The same accession number may be used in separate collections in this institute.
......@@ -403,6 +404,7 @@ organization.page.list.title=Organizations and Networks
organization.page.profile.title={0}
organization.slug=Organization or Network acronym
organization.title=Full name
organization.summary=Summary (HTML metadata)
filter.institute.networks=Network
......@@ -414,6 +416,7 @@ article.edit-article=Editing article
article.slug=Article slug (URL)
article.title=Article title
article.body=Article body
article.summary=Summary (HTML metadata)
article.post-to-transifex=Post to Transifex
article.remove-from-transifex=Remove from Transifex
article.transifex-resource-updated=The resource was successfully updated on Transifex.
......
......@@ -29,7 +29,7 @@ db.driverClassName=com.mysql.jdbc.Driver
db.username=root
db.password=
db.showSql=false
db.hbm2ddl=false
db.hbm2ddl=true
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
c3p0.acquireIncrement=1
......
......@@ -66,7 +66,14 @@
<textarea id="article-body" name="body" class="span9 required form-control html-editor"><c:out
value="${article.body}" escapeXml="false"/></textarea>
</div>
</div>
<div class="form-group">
<label for="article-summary" class="control-label"><spring:message code="article.summary"/></label>
<div class="controls">
<textarea id="article-summary" name="summary" class="span9 required form-control html-editor"><c:out
value="${article.summary}" escapeXml="false"/></textarea>
</div>
</div>
<input type="submit" value="<spring:message code="save"/>" class="btn btn-primary"/>
......
......@@ -5,6 +5,7 @@
<html>
<head>
<title>${title}</title>
<meta name="description" content="<c:out value="${jspHelper.htmlToText(article.summary)}" />" />
</head>
<body>
<content tag="header">
......
......@@ -5,8 +5,9 @@
<html>
<head>
<title><spring:message code="organization.page.profile.title" arguments="${organization.slug}"
argumentSeparator="|"
/></title>
argumentSeparator="|" /></title>
<meta name="description" content="<c:out value="${jspHelper.htmlToText(blurp.summary)}" />" />
<meta name="keywords" content="${organization.slug}, ${organization.title}" />
</head>
<body>
<h1>
......
......@@ -35,6 +35,15 @@
</textarea>
</div>
</div>
<div class="form-group">
<label for="organization-summary" class="control-label"><spring:message code="organization.summary" /></label>
<div class="controls">
<textarea id="organization-summary" name="summary" class="span9 required html-editor">
<c:out value="${blurp.summary}" />
</textarea>
</div>
</div>
<input type="submit" value="<spring:message code="blurp.update-blurp"/>" class="btn btn-primary" />
<a href="<c:url value="/org/${organization.slug}" />" class="btn btn-default"> <spring:message code="cancel" />
......
......@@ -7,8 +7,8 @@
<title><c:out value="${faoInstitute.fullName}" /><c:if test="${faoInstitute.acronym != ''}"> | ${faoInstitute.acronym}</c:if>
| <c:out value="${faoInstitute.code}" /></title>
<meta name="description"
content="<spring:message code="faoInstitute.meta-description" arguments="${faoInstitute.fullName}|${faoInstitute.acronym}" argumentSeparator="|" />"
/>
content="<spring:message code="faoInstitute.meta-description" arguments="${faoInstitute.fullName}|${faoInstitute.acronym}" argumentSeparator="|" />
<c:out value="${jspHelper.htmlToText(blurp.summary)}" />" />
<meta name="keywords" content="${faoInstitute.acronym}, ${faoInstitute.fullName}, ${faoInstitute.code}" />
</head>
<body typeof="schema:Organization">
......
......@@ -23,6 +23,15 @@
</div>
</div>
<div class="form-group">
<label for="faoInstitute-summary" class="col-lg-12 control-label"><spring:message code="faoInstitute.summary" /></label>
<div class="controls col-lg-12">
<textarea id="faoInstitute-summary" name="summary" class="span9 required html-editor">
<c:out value="${blurp.summary}" />
</textarea>
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label"><spring:message code="ga.tracker-code" /></label>
<div class="controls col-lg-9">
......@@ -63,7 +72,7 @@
<content tag="javascript">
<script type="text/javascript">
<local:tinyMCE selector="#blurp-body.html-editor" />
<local:tinyMCE selector=".html-editor" />
</script>
</content>
......
......@@ -152,7 +152,7 @@ public class OrganizationControllerTest extends AbstractRestTest {
.content(objectMapper.writeValueAsString(organizationBlurpJson)))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(content().string(objectMapper.writeValueAsString(organizationService.updateBlurp(organization, organizationBlurpJson.blurp, organizationBlurpJson.getLocale()))));
.andExpect(content().string(objectMapper.writeValueAsString(organizationService.updateAbout(organization, organizationBlurpJson.blurp, organizationBlurpJson.summary, organizationBlurpJson.getLocale()))));
LOG.info("test updateBlurpTest is passed");
}
......
......@@ -38,8 +38,8 @@ public class ContentSanitizerTest extends AbstractServicesTest {
String articleBody = "<script></script><h2><small>Genesys account</small><br />Verify your email address</h2><p>You can already use your Genesys account. We need to confirm your email account before granting you access to all Genesys features.</p><p><a href=\"{0}/profile/{1}/validate\" rel=\"nofollow\">Verify {2}</a></p><h2>Validation key: {3}</h2><p>If you didn&#39;t make this request, <a href=\"{0}/profile/{1}/cancel\" rel=\"nofollow\">click here to cancel</a>.</p><p>Thanks,<br />Genesys team</p>";
String expectedBody = "<h2><small>Genesys account</small><br />Verify your email address</h2><p>You can already use your Genesys account. We need to confirm your email account before granting you access to all Genesys features.</p><p><a href=\"{0}/profile/{1}/validate\" rel=\"nofollow\">Verify {2}</a></p><h2>Validation key: {3}</h2><p>If you didn&#39;t make this request, <a href=\"{0}/profile/{1}/cancel\" rel=\"nofollow\">click here to cancel</a>.</p><p>Thanks,<br />Genesys team</p>";
contentService.createGlobalArticle("smtp.email-verification", Locale.ENGLISH, "Test title", articleBody);
contentService.createGlobalArticle("smtp.email-verification", Locale.ENGLISH, "Test title", articleBody, null);
contentSanitizer.sanitizeAll();
......
......@@ -166,7 +166,7 @@ public class ContentServiceTest extends AbstractServicesTest {
Article beforeUpdateArticle = contentService.listArticles(new PageRequest(0, 6)).getContent().get(0);
contentService.updateArticle(beforeUpdateArticle.getId(), "new slug for update test", "title for update test", "<h2>Body for update test</h2");
contentService.updateArticle(beforeUpdateArticle.getId(), "new slug for update test", "title for update test", "<h2>Body for update test</h2", null);
Article afterUpdateArticle = contentService.listArticles(new PageRequest(0, 6)).getContent().get(0);
......@@ -185,8 +185,9 @@ public class ContentServiceTest extends AbstractServicesTest {
Locale locale = Locale.ENGLISH;
String title = "Create Global Article";
String body = "<h1>Create Global Article</h1>";
String summary=null;
Article globalArticle = contentService.createGlobalArticle(slug, locale, title, body);
Article globalArticle = contentService.createGlobalArticle(slug, locale, title, body, summary);
assertNotNull(globalArticle);
assertTrue(contentService.listArticles(new PageRequest(0, 6)).getContent().size() == 2);
......@@ -202,7 +203,7 @@ public class ContentServiceTest extends AbstractServicesTest {
String title = "Update Global Article Title";
String body = "<h1>Update Global Article Body</h1>";
Article globalArticle = contentService.updateGlobalArticle("smtp.email-verification", locale, title, body);
Article globalArticle = contentService.updateGlobalArticle("smtp.email-verification", locale, title, body, null);
assertTrue(contentService.listArticles(new PageRequest(0, 6)).getContent().size() == 1);
assertTrue(globalArticle.getBody().equals("Update Global Article Body"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment