Search in sources :

Example 76 with Action

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

Example 77 with Action

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

the class TestIntroNewContentAction method testCreateNewVoid_3.

public void testCreateNewVoid_3() throws Throwable {
    this.initAction("/do/jacms/Content", "createNewVoid");
    this.setUserOnSession("admin");
    this.addParameter("contentTypeCode", "ART");
    this.addParameter("contentDescription", "");
    String result = this.executeAction();
    assertEquals(Action.INPUT, result);
    ActionSupport action = this.getAction();
    Map<String, List<String>> fieldErros = action.getFieldErrors();
    assertEquals(2, fieldErros.size());
    assertEquals(1, fieldErros.get("contentDescription").size());
    assertEquals(1, fieldErros.get("contentMainGroup").size());
}
Also used : ActionSupport(com.opensymphony.xwork2.ActionSupport) List(java.util.List)

Example 78 with Action

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

the class TestIntroNewContentAction method testCreateNewVoid_5.

public void testCreateNewVoid_5() throws Throwable {
    this.setUserOnSession("editorCustomers");
    this.initAction("/do/jacms/Content", "createNewVoid");
    this.addParameter("contentTypeCode", "ART");
    this.addParameter("contentDescription", "Description");
    this.addParameter("contentMainGroup", Group.FREE_GROUP_NAME);
    String result = this.executeAction();
    assertEquals(Action.INPUT, result);
    ActionSupport action = this.getAction();
    Map<String, List<String>> fieldErros = action.getFieldErrors();
    assertEquals(1, fieldErros.size());
    assertEquals(1, fieldErros.get("contentMainGroup").size());
    this.initAction("/do/jacms/Content", "createNewVoid");
    this.addParameter("contentTypeCode", "ART");
    this.addParameter("contentDescription", "Description");
    this.addParameter("contentMainGroup", "customers");
    result = this.executeAction();
    assertEquals(Action.SUCCESS, result);
}
Also used : ActionSupport(com.opensymphony.xwork2.ActionSupport) List(java.util.List)

Example 79 with Action

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

the class TestIntroNewContentAction method testCreateNewVoid_4.

public void testCreateNewVoid_4() throws Throwable {
    this.initAction("/do/jacms/Content", "createNewVoid");
    this.setUserOnSession("admin");
    this.addParameter("contentTypeCode", "ART");
    this.addParameter("contentDescription", "Description");
    this.addParameter("contentMainGroup", "invalidGroupCode");
    String result = this.executeAction();
    assertEquals(Action.INPUT, result);
    ActionSupport action = this.getAction();
    Map<String, List<String>> fieldErros = action.getFieldErrors();
    assertEquals(1, fieldErros.size());
    assertEquals(1, fieldErros.get("contentMainGroup").size());
}
Also used : ActionSupport(com.opensymphony.xwork2.ActionSupport) List(java.util.List)

Example 80 with Action

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

the class TestPageAction method testSavePage.

public void testSavePage() throws Throwable {
    String pageCode = "customer_subpage_2";
    IPage page = this._pageManager.getDraftPage(pageCode);
    assertNotNull(page);
    try {
        PageMetadata metadata = page.getMetadata();
        this.setUserOnSession("admin");
        this.initAction("/do/Page", "save");
        this.addParameter("strutsAction", String.valueOf(ApsAdminSystemConstants.EDIT));
        this.addParameter("langit", "");
        this.addParameter("langen", metadata.getTitle("en"));
        this.addParameter("model", metadata.getModel().getCode());
        this.addParameter("group", page.getGroup());
        this.addParameter("pageCode", pageCode);
        Collection<String> extraGroups = metadata.getExtraGroups();
        if (null != extraGroups) {
            Iterator<String> extraGroupIter = extraGroups.iterator();
            while (extraGroupIter.hasNext()) {
                String extraGroup = (String) extraGroupIter.next();
                this.addParameter("extraGroups", extraGroup);
            }
        }
        this.addParameter("extraGroups", "management");
        String result = this.executeAction();
        assertEquals(Action.INPUT, result);
        ActionSupport action = this.getAction();
        assertEquals(2, action.getFieldErrors().size());
        assertEquals(1, action.getFieldErrors().get("langit").size());
        assertEquals(1, action.getFieldErrors().get("extraGroups").size());
    } catch (Throwable t) {
        this._pageManager.updatePage(page);
        throw t;
    }
}
Also used : PageMetadata(com.agiletec.aps.system.services.page.PageMetadata) IPage(com.agiletec.aps.system.services.page.IPage) 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