use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.
the class TestContentGroupAction method testDeleteContents_1.
public void testDeleteContents_1() throws Throwable {
this.setUserOnSession("admin");
// CONTENUTO FREE
String[] masterContentIds = { "ART111", "EVN20" };
String[] newContentIds = null;
try {
newContentIds = this.addDraftContentsForTest(masterContentIds, false);
for (int i = 0; i < newContentIds.length; i++) {
Content content = this.getContentManager().loadContent(newContentIds[i], false);
assertFalse(content.isOnLine());
}
this.initAction("/do/jacms/Content", "deleteContentGroup");
this.addParameter("contentIds", newContentIds);
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
ActionSupport action = this.getAction();
Collection<String> messages = action.getActionMessages();
assertEquals(1, messages.size());
Collection<String> errors = action.getActionErrors();
assertEquals(0, errors.size());
} catch (Throwable t) {
throw t;
} finally {
this.deleteContents(newContentIds);
}
}
use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.
the class TestContentGroupAction method testDeleteContents_3.
public void testDeleteContents_3() throws Throwable {
this.setUserOnSession("admin");
// CONTENUTO FREE
String[] masterContentIds = { "ART111", "EVN20" };
String[] newContentIds = null;
try {
// CRERAZIONE CONTENUTI PUBBLICI
newContentIds = this.addDraftContentsForTest(masterContentIds, true);
for (int i = 0; i < newContentIds.length; i++) {
Content content = this.getContentManager().loadContent(newContentIds[i], false);
assertTrue(content.isOnLine());
}
this.initAction("/do/jacms/Content", "deleteContentGroup");
this.addParameter("contentIds", newContentIds);
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
for (int i = 0; i < newContentIds.length; i++) {
Content content = this.getContentManager().loadContent(newContentIds[i], false);
assertNotNull(content);
assertTrue(content.isOnLine());
}
ActionSupport action = this.getAction();
Collection<String> messages = action.getActionMessages();
assertEquals(0, messages.size());
Collection<String> errors = action.getActionErrors();
assertEquals(2, errors.size());
} catch (Throwable t) {
throw t;
} finally {
this.deleteContents(newContentIds);
}
}
use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.
the class TestContentGroupAction method testSuspendContents_1.
public void testSuspendContents_1() throws Throwable {
this.setUserOnSession("admin");
// CONTENUTO FREE
String[] masterContentIds = { "ART111", "EVN20" };
String[] newContentIds = null;
try {
newContentIds = this.addDraftContentsForTest(masterContentIds, true);
for (int i = 0; i < newContentIds.length; i++) {
Content content = this.getContentManager().loadContent(newContentIds[i], false);
assertTrue(content.isOnLine());
}
this.initAction("/do/jacms/Content", "suspendContentGroup");
this.addParameter("contentIds", newContentIds);
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
ActionSupport action = this.getAction();
Collection<String> messages = action.getActionMessages();
assertEquals(1, messages.size());
Collection<String> errors = action.getActionErrors();
assertEquals(0, errors.size());
} catch (Throwable t) {
throw t;
} finally {
this.deleteContents(newContentIds);
}
}
use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.
the class TestContentGroupAction method testInsertOnLineContents_2.
public void testInsertOnLineContents_2() throws Throwable {
this.setUserOnSession("supervisorCoach");
// 2 CONTENUTI FREE, 1 Customers e 1 Coach
String[] masterContentIds = { "ART180", "EVN20", "ART104", "ART102" };
String[] newContentIds = null;
try {
newContentIds = this.addDraftContentsForTest(masterContentIds, false);
for (int i = 0; i < newContentIds.length; i++) {
Content content = this.getContentManager().loadContent(newContentIds[i], false);
assertFalse(content.isOnLine());
}
this.initAction("/do/jacms/Content", "approveContentGroup");
this.addParameter("contentIds", newContentIds);
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
int unpublishedContents = 0;
for (int i = 0; i < newContentIds.length; i++) {
Content content = this.getContentManager().loadContent(newContentIds[i], false);
if (Group.FREE_GROUP_NAME.equals(content.getMainGroup())) {
assertFalse(content.isOnLine());
++unpublishedContents;
} else {
assertTrue(content.isOnLine());
}
}
assertEquals(2, unpublishedContents);
ActionSupport action = this.getAction();
Collection<String> messages = action.getActionMessages();
assertEquals(1, messages.size());
Collection<String> errors = action.getActionErrors();
assertEquals(2, errors.size());
} catch (Throwable t) {
throw t;
} finally {
this.deleteContents(newContentIds);
}
}
use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.
the class TestContentGroupAction method testInsertOnLineContents_3.
public void testInsertOnLineContents_3() throws Throwable {
this.setUserOnSession("admin");
// CONTENUTO FREE con errori di validazione
String[] masterContentIds = { "ART179" };
String[] newContentIds = null;
try {
newContentIds = this.addDraftContentsForTest(masterContentIds, false);
for (int i = 0; i < newContentIds.length; i++) {
Content content = this.getContentManager().loadContent(newContentIds[i], false);
assertFalse(content.isOnLine());
}
this.initAction("/do/jacms/Content", "approveContentGroup");
this.addParameter("contentIds", newContentIds);
String result = this.executeAction();
assertEquals(Action.SUCCESS, result);
ActionSupport action = this.getAction();
Collection<String> messages = action.getActionMessages();
assertEquals(0, messages.size());
Collection<String> errors = action.getActionErrors();
assertEquals(1, errors.size());
} catch (Throwable t) {
throw t;
} finally {
this.deleteContents(newContentIds);
}
}
Aggregations