Search in sources :

Example 36 with ActionSupport

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);
    }
}
Also used : Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ActionSupport(com.opensymphony.xwork2.ActionSupport)

Example 37 with ActionSupport

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);
    }
}
Also used : Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ActionSupport(com.opensymphony.xwork2.ActionSupport)

Example 38 with ActionSupport

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);
    }
}
Also used : Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ActionSupport(com.opensymphony.xwork2.ActionSupport)

Example 39 with ActionSupport

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);
    }
}
Also used : Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ActionSupport(com.opensymphony.xwork2.ActionSupport)

Example 40 with ActionSupport

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);
    }
}
Also used : Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ActionSupport(com.opensymphony.xwork2.ActionSupport)

Aggregations

ActionSupport (com.opensymphony.xwork2.ActionSupport)56 List (java.util.List)28 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)14 Widget (com.agiletec.aps.system.services.page.Widget)4 ApsProperties (com.agiletec.aps.util.ApsProperties)4 HashMap (java.util.HashMap)4 WidgetType (org.entando.entando.aps.system.services.widgettype.WidgetType)4 IPage (com.agiletec.aps.system.services.page.IPage)3 ArrayList (java.util.ArrayList)3 IManager (com.agiletec.aps.system.common.IManager)2 IUserProfile (org.entando.entando.aps.system.services.userprofile.model.IUserProfile)2 BooleanAttribute (com.agiletec.aps.system.common.entity.model.attribute.BooleanAttribute)1 MonoListAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute)1 Lang (com.agiletec.aps.system.services.lang.Lang)1 PageMetadata (com.agiletec.aps.system.services.page.PageMetadata)1 PageModel (com.agiletec.aps.system.services.pagemodel.PageModel)1 SymbolicLink (com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)1 LinkAttribute (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute)1 ActionProxyFactory (com.opensymphony.xwork2.ActionProxyFactory)1