Author: adubovsky
Date: 2008-11-21 10:01:40 -0500 (Fri, 21 Nov 2008)
New Revision: 11290
Modified:
trunk/test-applications/automator/src/main/java/comboBox/ComboBoxGeneral.java
trunk/test-applications/automator/src/main/java/general/DrawGrids.java
trunk/test-applications/automator/src/main/webapp/component/comboBox.jsp
trunk/test-applications/automator/src/main/webapp/javascripts/common.js
Log:
+ converterMessageCheck
Modified: trunk/test-applications/automator/src/main/java/comboBox/ComboBoxGeneral.java
===================================================================
---
trunk/test-applications/automator/src/main/java/comboBox/ComboBoxGeneral.java 2008-11-21
13:59:26 UTC (rev 11289)
+++
trunk/test-applications/automator/src/main/java/comboBox/ComboBoxGeneral.java 2008-11-21
15:01:40 UTC (rev 11290)
@@ -31,6 +31,7 @@
private boolean required;
private String align;
private String validatorMessage;
+ private String converterMessage;
private SelectItem value;
private boolean statusValidator = false;
@@ -40,6 +41,12 @@
private boolean statusValueChangeListener = false;
private String phaseValueChangeListener = "UNDEFINED";
+ private boolean statusConverterGetAsObject = false;
+ private boolean statusConverterGetAsString = false;
+ private String phaseConverterGetAsObject = "UNDEFINED";
+ private String phaseConverterGetAsString = "UNDEFINED";
+ private String converterMessageTest = "";
+
private TLDParser tldParser = new TLDParser("comboBox");
private AttributesList attrs = tldParser.getAllAttributes();
private ArrayList<Attribute> generalAttrs = attrs.getCommonAttributes();
@@ -49,6 +56,7 @@
required = true;
align = "right";
validatorMessage = "validator test message!";
+ converterMessage = "converter test message!";
selectItems = new ArrayList<SelectItem>();
for (int i = 0; i < 10; i++) {
@@ -62,6 +70,8 @@
this.validatorMessageCheck();
this.bindingCheck();
this.valueChangeListenerCheck();
+ this.converterCheck();
+ this.converterMessageCheck();
DrawGrids.showResultGrid(panelGrid, generalAttrs);
}
@@ -104,7 +114,7 @@
if (value != null) {
SelectItem st = (SelectItem) value;
- if (st.getLabel().equals("Gosha")) {
+ if (st.getLabel().equals("ValidatorCheck")) {
throw new ValidatorException(new FacesMessage(
FacesMessage.SEVERITY_ERROR, "Validation error",
"Incorrect input"));
@@ -146,7 +156,10 @@
UIComponent component, String newValue)
throws ConverterException {
- if (false)
+ statusConverterGetAsObject = true;
+ phaseConverterGetAsObject = PhaseTracker.currentPhase
+ .toString();
+ if (newValue.equals("ConverterCheck"))
throw new ConverterException(new FacesMessage(
FacesMessage.SEVERITY_ERROR, "Converter error",
"Error while convert to Object"));
@@ -158,6 +171,9 @@
UIComponent component, Object value)
throws ConverterException {
+ statusConverterGetAsString = true;
+ phaseConverterGetAsString = PhaseTracker.currentPhase
+ .toString();
if (false)
throw new ConverterException(new FacesMessage(
FacesMessage.SEVERITY_ERROR, "Converter error",
@@ -165,19 +181,66 @@
String result = "";
if (value != null) {
- if(value instanceof SelectItem) {
+ if (value instanceof SelectItem) {
SelectItem st = (SelectItem) value;
result = st.getLabel();
} else {
result = value.toString();
}
}
-
+
return result;
}
};
}
+ private void converterCheck() {
+ int index = generalAttrs.indexOf(new Attribute("converter"));
+ if (index == -1) {
+ generalAttrs.add(new Attribute("converter", "", "",
+ Status.IMPLEMENTED));
+ } else {
+ Attribute attr = generalAttrs.get(index);
+ if ((statusConverterGetAsObject) && (statusConverterGetAsString)) {
+ if (((phaseConverterGetAsObject.equals("PROCESS_VALIDATIONS 3"))
+ && (!immediate) || (phaseValueChangeListener
+ .equals("APPLY_REQUEST_VALUES 2"))
+ && (immediate))
+ && (phaseConverterGetAsString
+ .equals("RENDER_RESPONSE 6"))) {
+ attr.setStatus(Status.PASSED);
+ } else {
+ attr.setStatus(Status.FAILED);
+ attr
+ .setDescription("Converter was triggered on incorrect phase");
+ }
+ } else {
+ attr.setStatus(Status.FAILED);
+ attr.setDescription("Converter was not triggered");
+ }
+ }
+ }
+
+ private void converterMessageCheck() {
+ int index = generalAttrs.indexOf(new Attribute("converterMessage"));
+ if (index == -1) {
+ generalAttrs.add(new Attribute("converterMessage", "",
"",
+ Status.IMPLEMENTED));
+ } else {
+ Attribute attr = generalAttrs.get(index);
+
+ if (converterMessageTest.equals("")) {
+ attr.setStatus(Status.IMPLEMENTED);
+ } else {
+ if (converterMessageTest.indexOf(converterMessage) != -1) {
+ attr.setStatus(Status.PASSED);
+ } else {
+ attr.setStatus(Status.FAILED);
+ }
+ }
+ }
+ }
+
private void alignCheck() {
int index = generalAttrs.indexOf(new Attribute("align"));
if (index == -1) {
@@ -213,10 +276,14 @@
} else {
Attribute attr = generalAttrs.get(index);
- if (validatorMessageTest.indexOf(validatorMessage) != -1) {
- attr.setStatus(Status.PASSED);
+ if (validatorMessageTest.equals("")) {
+ attr.setStatus(Status.IMPLEMENTED);
} else {
- attr.setStatus(Status.FAILED);
+ if (validatorMessageTest.indexOf(validatorMessage) != -1) {
+ attr.setStatus(Status.PASSED);
+ } else {
+ attr.setStatus(Status.FAILED);
+ }
}
}
}
@@ -292,4 +359,20 @@
public void setValue(SelectItem value) {
this.value = value;
}
+
+ public String getConverterMessage() {
+ return converterMessage;
+ }
+
+ public void setConverterMessage(String converterMessage) {
+ this.converterMessage = converterMessage;
+ }
+
+ public String getConverterMessageTest() {
+ return converterMessageTest;
+ }
+
+ public void setConverterMessageTest(String converterMessageTest) {
+ this.converterMessageTest = converterMessageTest;
+ }
}
\ No newline at end of file
Modified: trunk/test-applications/automator/src/main/java/general/DrawGrids.java
===================================================================
--- trunk/test-applications/automator/src/main/java/general/DrawGrids.java 2008-11-21
13:59:26 UTC (rev 11289)
+++ trunk/test-applications/automator/src/main/java/general/DrawGrids.java 2008-11-21
15:01:40 UTC (rev 11290)
@@ -41,6 +41,9 @@
case NOT_READY:
attrStatus.setStyle("color: grey");
break;
+ case IMPLEMENTED:
+ attrStatus.setStyle("color: blue");
+ break;
}
panelGrid.getChildren().add(attrName);
Modified: trunk/test-applications/automator/src/main/webapp/component/comboBox.jsp
===================================================================
--- trunk/test-applications/automator/src/main/webapp/component/comboBox.jsp 2008-11-21
13:59:26 UTC (rev 11289)
+++ trunk/test-applications/automator/src/main/webapp/component/comboBox.jsp 2008-11-21
15:01:40 UTC (rev 11290)
@@ -18,6 +18,7 @@
required="#{comboBoxGeneral.required}"
validatorMessage="#{comboBoxGeneral.validatorMessage}"
converter="#{comboBoxGeneral.convert}"
+ converterMessage="#{comboBoxGeneral.converterMessage}"
onblur="callOnblur('comboBox')"
onmouseover="callOnmouseover('comboBox')"
onclick="callOnclick('comboBox')"
onchange="callOnchange('comboBox')"
@@ -35,11 +36,14 @@
valueChangeListener="#{comboBoxGeneral.valueChangeListener}">
<f:selectItems value="#{comboBoxGeneral.selectItems}" />
- <f:selectItem itemValue="Gosha" itemLabel="Gosha" />
+ <f:selectItem itemValue="ValidatorCheck" itemLabel="Gosha"
/>
+ <f:selectItem itemValue="ConverterCheck" itemLabel="Gosha"
/>
</rich:comboBox>
- <h:inputHidden id="hiddenInput"
+ <h:inputHidden id="hiddenValidatorInput"
value="#{comboBoxGeneral.validatorMessageTest}" />
+ <h:inputHidden id="hiddenConverterInput"
+ value="#{comboBoxGeneral.converterMessageTest}" />
</h:panelGrid>
<rich:spacer height="30"></rich:spacer>
@@ -47,7 +51,8 @@
<f:facet name="header">
<h:outputText value="Results of testing" />
</f:facet>
- <a4j:commandButton value="testGeneralAttrs"
onclick="checkValidatorMessage()"
+ <a4j:commandButton value="testGeneralAttrs"
onmousedown="checkValidatorMessage()"
+ onmouseup="checkConverterMessage()"
actionListener="#{comboBoxGeneral.testGeneralAttributes}"
reRender="generalResult, comboBoxGrid"></a4j:commandButton>
<a4j:commandButton value="testHandlers"
Modified: trunk/test-applications/automator/src/main/webapp/javascripts/common.js
===================================================================
--- trunk/test-applications/automator/src/main/webapp/javascripts/common.js 2008-11-21
13:59:26 UTC (rev 11289)
+++ trunk/test-applications/automator/src/main/webapp/javascripts/common.js 2008-11-21
15:01:40 UTC (rev 11290)
@@ -1,7 +1,15 @@
function checkValidatorMessage(){
var mes = document.getElementById('mainForm:comboBoxSubview:mess');
- var inp = document.getElementById('mainForm:comboBoxSubview:hiddenInput');
+ var inp =
document.getElementById('mainForm:comboBoxSubview:hiddenValidatorInput');
if ((mes != null)&&(inp != null)) {
- inp.value = mes.textContent;
+ if (mes.textContent.indexOf('converter') == -1) inp.value = mes.textContent;
}
+}
+
+function checkConverterMessage(){
+ var mes = document.getElementById('mainForm:comboBoxSubview:mess');
+ var inp =
document.getElementById('mainForm:comboBoxSubview:hiddenConverterInput');
+ if ((mes != null)&&(inp != null)) {
+ if (mes.textContent.indexOf('validator') == -1) inp.value = mes.textContent;
+ }
}
\ No newline at end of file