use of com.agiletec.aps.system.common.entity.model.AttributeTracer in project entando-core by entando.
the class TestValidateMonotextAttribute method testValidate_CompositeElement.
public void testValidate_CompositeElement() throws Throwable {
try {
String contentOnSessionMarker = this.executeCreateNewContent();
Content content = this.getContentOnEdit(contentOnSessionMarker);
AttributeTracer tracer = this.getTracer();
CompositeAttribute compositeAttribute = (CompositeAttribute) content.getAttribute("Composite");
AttributeInterface attribute = compositeAttribute.getAttribute("Monotext");
tracer.setCompositeElement(true);
tracer.setParentAttribute(compositeAttribute);
String formFieldName = tracer.getFormFieldName(attribute);
String formFieldPrefix = "Composite:" + attribute.getType() + ":";
assertEquals(formFieldPrefix + "Composite_Monotext", formFieldName);
this.initSaveContentAction(contentOnSessionMarker);
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldName);
this.initSaveContentAction(contentOnSessionMarker);
this.addParameter(formFieldName, "MonotextValue");
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldName);
} catch (Throwable t) {
this.deleteTestContent();
throw t;
}
}
use of com.agiletec.aps.system.common.entity.model.AttributeTracer in project entando-core by entando.
the class TestValidateMonotextAttribute method testValidate_Single_1.
public void testValidate_Single_1() throws Throwable {
try {
String contentOnSessionMarker = this.executeCreateNewContent();
Content content = this.getContentOnEdit(contentOnSessionMarker);
AttributeTracer tracer = this.getTracer();
AttributeInterface monotext = (AttributeInterface) content.getAttribute("Monotext");
String formFieldName = tracer.getFormFieldName(monotext);
this.initSaveContentAction(contentOnSessionMarker);
this.addParameter(formFieldName, "monotextValue");
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldName);
} catch (Throwable t) {
this.deleteTestContent();
throw t;
}
}
use of com.agiletec.aps.system.common.entity.model.AttributeTracer in project entando-core by entando.
the class TestValidateMonotextAttribute method testValidate_MonolistCompositeElement.
public void testValidate_MonolistCompositeElement() throws Throwable {
try {
String contentOnSessionMarker = this.executeCreateNewContent();
Content content = this.getContentOnEdit(contentOnSessionMarker);
AttributeTracer tracer = this.getTracer();
MonoListAttribute monolist = (MonoListAttribute) content.getAttribute("MonoLCom");
CompositeAttribute compositeElement = (CompositeAttribute) monolist.addAttribute();
AttributeInterface attribute = compositeElement.getAttribute("Monotext");
String monolistElementFieldPrefix = "Monolist:Composite:";
String formFieldPrefix = monolistElementFieldPrefix + attribute.getType() + ":";
tracer.setListIndex(monolist.getAttributes().size() - 1);
tracer.setListLang(this.getLangManager().getDefaultLang());
tracer.setMonoListElement(true);
tracer.setCompositeElement(true);
tracer.setParentAttribute(compositeElement);
String formFieldName = tracer.getFormFieldName(attribute);
assertEquals(formFieldPrefix + "MonoLCom_Monotext_0", formFieldName);
String monolistElementName = tracer.getMonolistElementFieldName(compositeElement);
assertEquals(monolistElementFieldPrefix + "MonoLCom_0", monolistElementName);
this.initSaveContentAction(contentOnSessionMarker);
this.executeAction(Action.INPUT);
this.checkFieldErrors(1, monolistElementName);
this.initSaveContentAction(contentOnSessionMarker);
this.addParameter(formFieldName, "MonotextValue");
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldName);
} catch (Throwable t) {
this.deleteTestContent();
throw t;
}
}
use of com.agiletec.aps.system.common.entity.model.AttributeTracer in project entando-core by entando.
the class TestValidateNumberAttribute 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 dateAttribute = (AttributeInterface) content.getAttribute("Number2");
String formFieldName = tracer.getFormFieldName(dateAttribute);
this.initSaveContentAction(contentOnSessionMarker);
// validation: end range 300
this.addParameter(formFieldName, "1011");
this.executeAction(Action.INPUT);
this.checkFieldErrors(1, formFieldName);
this.initSaveContentAction(contentOnSessionMarker);
// validation: end start 50
this.addParameter(formFieldName, "25");
this.executeAction(Action.INPUT);
this.checkFieldErrors(1, formFieldName);
this.initSaveContentAction(contentOnSessionMarker);
this.addParameter(formFieldName, "250");
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldName);
} catch (Throwable t) {
this.deleteTestContent();
throw t;
}
}
use of com.agiletec.aps.system.common.entity.model.AttributeTracer in project entando-core by entando.
the class TestValidateNumberAttribute method testValidate_MonolistCompositeElement.
public void testValidate_MonolistCompositeElement() throws Throwable {
try {
String contentOnSessionMarker = this.executeCreateNewContent();
Content content = this.getContentOnEdit(contentOnSessionMarker);
AttributeTracer tracer = this.getTracer();
MonoListAttribute monolist = (MonoListAttribute) content.getAttribute("MonoLCom");
CompositeAttribute compositeElement = (CompositeAttribute) monolist.addAttribute();
AttributeInterface attribute = compositeElement.getAttribute("Number");
String monolistElementFieldPrefix = "Monolist:Composite:";
String formFieldPrefix = monolistElementFieldPrefix + attribute.getType() + ":";
tracer.setListIndex(monolist.getAttributes().size() - 1);
tracer.setListLang(this.getLangManager().getDefaultLang());
tracer.setMonoListElement(true);
tracer.setCompositeElement(true);
tracer.setParentAttribute(compositeElement);
String formFieldName = tracer.getFormFieldName(attribute);
assertEquals(formFieldPrefix + "MonoLCom_Number_0", formFieldName);
String monolistElementName = tracer.getMonolistElementFieldName(compositeElement);
assertEquals(monolistElementFieldPrefix + "MonoLCom_0", monolistElementName);
this.initSaveContentAction(contentOnSessionMarker);
this.executeAction(Action.INPUT);
this.checkFieldErrors(1, monolistElementName);
this.initSaveContentAction(contentOnSessionMarker);
this.addParameter(formFieldName, "wrongNumberValue");
this.executeAction(Action.INPUT);
this.checkFieldErrors(1, formFieldName);
this.initSaveContentAction(contentOnSessionMarker);
// validation: start range 25
this.addParameter(formFieldName, "10");
this.executeAction(Action.INPUT);
this.checkFieldErrors(1, formFieldName);
this.initSaveContentAction(contentOnSessionMarker);
// validation: start range 25
this.addParameter(formFieldName, "50");
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldName);
this.initSaveContentAction(contentOnSessionMarker);
// validation: end range attribute "Number"
this.addParameter("Number:Number", "40");
this.executeAction(Action.INPUT);
this.checkFieldErrors(1, formFieldName);
this.initSaveContentAction(contentOnSessionMarker);
// validation: end range attribute "Number"
this.addParameter(formFieldName, "35");
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldName);
} catch (Throwable t) {
this.deleteTestContent();
throw t;
}
}
Aggregations