Search in sources :

Example 6 with AttributeTracer

use of com.agiletec.aps.system.common.entity.model.AttributeTracer in project entando-core by entando.

the class TestValidateDateAttribute method testValidate_MonolistElement.

public void testValidate_MonolistElement() throws Throwable {
    try {
        String contentOnSessionMarker = this.executeCreateNewContent();
        Content content = this.getContentOnEdit(contentOnSessionMarker);
        AttributeTracer tracer = this.getTracer();
        MonoListAttribute monolist = (MonoListAttribute) content.getAttribute("MonoLDate");
        AttributeInterface attribute = monolist.addAttribute();
        String formFieldPrefix = "Monolist:" + attribute.getType() + ":";
        tracer.setListIndex(monolist.getAttributes().size() - 1);
        tracer.setListLang(this.getLangManager().getDefaultLang());
        tracer.setMonoListElement(true);
        String formFieldName = tracer.getFormFieldName(attribute);
        assertEquals(formFieldPrefix + "MonoLDate_0", formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldName, "dateValue");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldName, "11/07/1982");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(0, formFieldName);
        AttributeInterface attribute2 = monolist.addAttribute();
        tracer.setListIndex(monolist.getAttributes().size() - 1);
        String formFieldName2 = tracer.getFormFieldName(attribute2);
        assertEquals(formFieldPrefix + "MonoLDate_1", formFieldName2);
        this.initSaveContentAction(contentOnSessionMarker);
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName2);
        this.initSaveContentAction(contentOnSessionMarker);
        this.executeAction(Action.INPUT);
        this.addParameter(formFieldName2, "18/04/1971");
        this.checkFieldErrors(1, formFieldName2);
    } catch (Throwable t) {
        this.deleteTestContent();
        throw t;
    }
}
Also used : MonoListAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute) AttributeTracer(com.agiletec.aps.system.common.entity.model.AttributeTracer) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 7 with AttributeTracer

use of com.agiletec.aps.system.common.entity.model.AttributeTracer in project entando-core by entando.

the class TestValidateMonotextAttribute method testValidate_Single_2.

public void testValidate_Single_2() throws Throwable {
    try {
        String contentOnSessionMarker = this.executeCreateNewContent();
        Content content = this.getContentOnEdit(contentOnSessionMarker);
        AttributeTracer tracer = this.getTracer();
        AttributeInterface monotext = (AttributeInterface) content.getAttribute("Monotext2");
        // Mail attribute (required, min=15, max=30, regex=**mailFormat**)
        String formFieldName = tracer.getFormFieldName(monotext);
        this.initSaveContentAction(contentOnSessionMarker);
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(0, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldName, "invalidMonotext2Value");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldName, "ii@22.it");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldName, "aabbccddeeffgghh112233@iillmmnnooppqq334455.it");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldName, "aabbccdd@eeffgghhii.com");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(0, formFieldName);
    } catch (Throwable t) {
        this.deleteTestContent();
        throw t;
    }
}
Also used : AttributeTracer(com.agiletec.aps.system.common.entity.model.AttributeTracer) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 8 with AttributeTracer

use of com.agiletec.aps.system.common.entity.model.AttributeTracer in project entando-core by entando.

the class TestValidateMonotextAttribute method testValidate_MonoListElement.

public void testValidate_MonoListElement() throws Throwable {
    try {
        String contentOnSessionMarker = this.executeCreateNewContent();
        Content content = this.getContentOnEdit(contentOnSessionMarker);
        AttributeTracer tracer = this.getTracer();
        MonoListAttribute monolist = (MonoListAttribute) content.getAttribute("MonoLMonot");
        AttributeInterface attribute = monolist.addAttribute();
        String formFieldPrefix = "Monolist:" + attribute.getType() + ":";
        tracer.setLang(this.getLangManager().getDefaultLang());
        tracer.setListIndex(monolist.getAttributes().size() - 1);
        tracer.setListLang(this.getLangManager().getDefaultLang());
        tracer.setMonoListElement(true);
        tracer.setParentAttribute(monolist);
        String formFieldName = tracer.getFormFieldName(attribute);
        assertEquals(formFieldPrefix + "MonoLMonot_0", formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldName, "MonoLMonotElement0Value");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(0, formFieldName);
        AttributeInterface attribute2 = monolist.addAttribute();
        tracer.setListIndex(monolist.getAttributes().size() - 1);
        String formFieldName2 = tracer.getFormFieldName(attribute2);
        assertEquals(formFieldPrefix + "MonoLMonot_1", formFieldName2);
        this.initSaveContentAction(contentOnSessionMarker);
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName2);
    } catch (Throwable t) {
        this.deleteTestContent();
        throw t;
    }
}
Also used : MonoListAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute) AttributeTracer(com.agiletec.aps.system.common.entity.model.AttributeTracer) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 9 with AttributeTracer

use of com.agiletec.aps.system.common.entity.model.AttributeTracer in project entando-core by entando.

the class TestValidateMonotextAttribute method testValidate_ListElement.

public void testValidate_ListElement() throws Throwable {
    try {
        String contentOnSessionMarker = this.executeCreateNewContent();
        Content content = this.getContentOnEdit(contentOnSessionMarker);
        AttributeTracer tracer = this.getTracer();
        ListAttribute list = (ListAttribute) content.getAttribute("ListMonot");
        AttributeInterface attribute = list.addAttribute("it");
        assertEquals(0, list.getAttributeList("en").size());
        assertEquals(1, list.getAttributeList("it").size());
        tracer.setLang(this.getLangManager().getLang("it"));
        tracer.setListIndex(list.getAttributeList("it").size() - 1);
        tracer.setListLang(this.getLangManager().getLang("it"));
        tracer.setListElement(true);
        tracer.setParentAttribute(list);
        String formFieldName = tracer.getFormFieldName(attribute);
        String formFieldPrefix = "List:" + attribute.getType() + ":";
        assertEquals(formFieldPrefix + "it_ListMonot_0", formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldName, "ListMonotElement0Value");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(0, formFieldName);
        AttributeInterface attribute2 = list.addAttribute("it");
        tracer.setListIndex(list.getAttributes().size() - 1);
        formFieldName = tracer.getFormFieldName(attribute2);
        assertEquals(formFieldPrefix + "it_ListMonot_1", formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
    } catch (Throwable t) {
        this.deleteTestContent();
        throw t;
    }
}
Also used : AttributeTracer(com.agiletec.aps.system.common.entity.model.AttributeTracer) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ListAttribute(com.agiletec.aps.system.common.entity.model.attribute.ListAttribute) MonoListAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 10 with AttributeTracer

use of com.agiletec.aps.system.common.entity.model.AttributeTracer in project entando-core by entando.

the class TestValidateNumberAttribute method testValidate_ListElement.

public void testValidate_ListElement() throws Throwable {
    try {
        String contentOnSessionMarker = this.executeCreateNewContent();
        Content content = this.getContentOnEdit(contentOnSessionMarker);
        AttributeTracer tracerIT = this.getTracer();
        ListAttribute list = (ListAttribute) content.getAttribute("ListNumber");
        AttributeInterface attributeIT = list.addAttribute("it");
        assertEquals(0, list.getAttributeList("en").size());
        assertEquals(1, list.getAttributeList("it").size());
        tracerIT.setListIndex(list.getAttributeList("it").size() - 1);
        tracerIT.setListLang(this.getLangManager().getLang("it"));
        tracerIT.setListElement(true);
        String formFieldItName = tracerIT.getFormFieldName(attributeIT);
        String formFieldPrefix = "List:" + attributeIT.getType() + ":";
        assertEquals(formFieldPrefix + "it_ListNumber_0", formFieldItName);
        AttributeTracer tracerEN = tracerIT.clone();
        tracerEN.setLang(this.getLangManager().getLang("en"));
        tracerEN.setListLang(this.getLangManager().getLang("en"));
        this.initSaveContentAction(contentOnSessionMarker);
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldItName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldItName, "wrongNumber");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldItName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldItName, "27");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(0, formFieldItName);
        AttributeInterface attribute2 = list.addAttribute("it");
        tracerIT.setListIndex(list.getAttributes().size() - 1);
        formFieldItName = tracerIT.getFormFieldName(attribute2);
        assertEquals(formFieldPrefix + "it_ListNumber_1", formFieldItName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldItName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldItName, "26");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(0, formFieldItName);
        AttributeInterface attributeEN = list.addAttribute("en");
        String formFieldEnName = tracerEN.getFormFieldName(attributeEN);
        assertEquals(formFieldPrefix + "en_ListNumber_0", formFieldEnName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldEnName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldEnName, "57");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(0, formFieldEnName);
    } catch (Throwable t) {
        this.deleteTestContent();
        throw t;
    }
}
Also used : AttributeTracer(com.agiletec.aps.system.common.entity.model.AttributeTracer) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ListAttribute(com.agiletec.aps.system.common.entity.model.attribute.ListAttribute) MonoListAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Aggregations

AttributeTracer (com.agiletec.aps.system.common.entity.model.AttributeTracer)51 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)39 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)35 MonoListAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute)18 CompositeAttribute (com.agiletec.aps.system.common.entity.model.attribute.CompositeAttribute)13 AttributeFieldError (com.agiletec.aps.system.common.entity.model.AttributeFieldError)9 Lang (com.agiletec.aps.system.services.lang.Lang)7 ListAttribute (com.agiletec.aps.system.common.entity.model.attribute.ListAttribute)5 ResourceInterface (com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface)5 AbstractResourceAttribute (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.AbstractResourceAttribute)4 IndexableAttributeInterface (com.agiletec.aps.system.common.searchengine.IndexableAttributeInterface)3 ArrayList (java.util.ArrayList)3 AttributeSearchInfo (com.agiletec.aps.system.common.entity.model.AttributeSearchInfo)2 AttributeManagerInterface (com.agiletec.apsadmin.system.entity.attribute.manager.AttributeManagerInterface)1 SymbolicLink (com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)1 ResourceAttributeInterface (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.ResourceAttributeInterface)1 SymbolicLinkValidator (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.util.SymbolicLinkValidator)1 Field (org.apache.lucene.document.Field)1 IntField (org.apache.lucene.document.IntField)1 StringField (org.apache.lucene.document.StringField)1