use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.
the class TestContentGroupAction method testSuspendContents_2.
public void testSuspendContents_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, 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);
int suspendedContents = 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());
++suspendedContents;
} else {
assertTrue(content.isOnLine());
}
}
assertEquals(2, suspendedContents);
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_1.
public void testInsertOnLineContents_1() throws Throwable {
this.setUserOnSession("admin");
// CONTENUTI 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", "approveContentGroup");
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);
assertTrue(content.isOnLine());
}
ActionSupport action = this.getAction();
Collection<String> messages = action.getActionMessages();
assertEquals(1, messages.size());
} catch (Throwable t) {
throw t;
} finally {
this.deleteContents(newContentIds);
}
}
use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.
the class TestIntroNewContentAction method testCreateNewVoid_2.
public void testCreateNewVoid_2() throws Throwable {
this.initAction("/do/jacms/Content", "createNewVoid");
this.setUserOnSession("admin");
String result = this.executeAction();
assertEquals(Action.INPUT, result);
ActionSupport action = this.getAction();
Map<String, List<String>> fieldErros = action.getFieldErrors();
assertEquals(3, fieldErros.size());
}
use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.
the class ApsAdminBaseTestCase method initAction.
/**
* Created action class based on namespace and name
*
* @param namespace The namespace
* @param name The name of the action
* @throws java.lang.Exception In case of error
*/
protected void initAction(String namespace, String name) throws Exception {
// create a proxy class which is just a wrapper around the action call.
// The proxy is created by checking the namespace and name against the
// struts.xml configuration
ActionProxyFactory proxyFactory = (ActionProxyFactory) this._dispatcher.getContainer().getInstance(ActionProxyFactory.class);
this._proxy = proxyFactory.createActionProxy(namespace, name, null, null, true, false);
// set to true if you want to process Freemarker or JSP results
this._proxy.setExecuteResult(false);
// by default, don't pass in any request parameters
// set the actions context to the one which the proxy is using
ServletActionContext.setContext(_proxy.getInvocation().getInvocationContext());
ServletActionContext.setRequest(_request);
ServletActionContext.setResponse(_response);
ServletActionContext.setServletContext(_servletContext);
this._action = (ActionSupport) this._proxy.getAction();
// reset previsious params
List<String> paramNames = new ArrayList<String>(this._request.getParameterMap().keySet());
for (int i = 0; i < paramNames.size(); i++) {
String paramName = (String) paramNames.get(i);
this.removeParameter(paramName);
}
}
use of com.opensymphony.xwork2.ActionSupport in project entando-core by entando.
the class TestLangAction method testFailureRemoveDefaultLang.
public void testFailureRemoveDefaultLang() throws Throwable {
int initLangs = this._langManager.getLangs().size();
Lang defaultLang = this._langManager.getDefaultLang();
String result = this.executeRemoveLang("admin", defaultLang.getCode());
assertEquals(Action.INPUT, result);
assertEquals(initLangs, this._langManager.getLangs().size());
ActionSupport action = this.getAction();
Collection<String> errors = action.getActionErrors();
assertEquals(1, errors.size());
}
Aggregations