Search in sources :

Example 71 with Action

use of com.opensymphony.xwork2.Action in project entando-core by entando.

the class TestContentGroupAction method testDeleteContents_2.

public void testDeleteContents_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", "deleteContentGroup");
        this.addParameter("contentIds", newContentIds);
        String result = this.executeAction();
        assertEquals(Action.SUCCESS, result);
        int deletedContents = 0;
        for (int i = 0; i < newContentIds.length; i++) {
            Content content = this.getContentManager().loadContent(newContentIds[i], false);
            if (content == null) {
                ++deletedContents;
            } else {
                // Verifica che non si sono cancellati contenuti free
                String mainGroup = content.getMainGroup();
                assertTrue(Group.FREE_GROUP_NAME.equals(mainGroup));
            }
        }
        assertEquals(2, deletedContents);
        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 72 with Action

use of com.opensymphony.xwork2.Action 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 73 with Action

use of com.opensymphony.xwork2.Action 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 74 with Action

use of com.opensymphony.xwork2.Action 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 75 with Action

use of com.opensymphony.xwork2.Action 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)

Aggregations

ActionSupport (com.opensymphony.xwork2.ActionSupport)61 List (java.util.List)40 Action (io.atlasmap.v2.Action)35 ArrayList (java.util.ArrayList)23 Test (org.junit.jupiter.api.Test)16 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)14 SimpleField (io.atlasmap.v2.SimpleField)13 Field (io.atlasmap.v2.Field)12 Mapping (io.atlasmap.v2.Mapping)11 ActionContext (com.opensymphony.xwork2.ActionContext)9 AtlasMapping (io.atlasmap.v2.AtlasMapping)9 Collections (java.util.Collections)9 HashMap (java.util.HashMap)9 SettableApiFuture (com.google.api.core.SettableApiFuture)8 ServiceOptions (com.google.cloud.ServiceOptions)8 DlpServiceClient (com.google.cloud.dlp.v2.DlpServiceClient)8 Subscriber (com.google.cloud.pubsub.v1.Subscriber)8 Action (com.google.privacy.dlp.v2.Action)8 BigQueryTable (com.google.privacy.dlp.v2.BigQueryTable)8 CreateDlpJobRequest (com.google.privacy.dlp.v2.CreateDlpJobRequest)8