public void readThrow(Element throwElem, Throw _throw) { validateNonInitial(throwElem, _throw); // fault name - required QName faultName = XmlUtil.getQNameValue(throwElem.getAttributeNode(BpelConstants.ATTR_FAULT_NAME)); _throw.setFaultName(faultName); // fault variable - optional String variableName = XmlUtil.getAttribute(throwElem, BpelConstants.ATTR_FAULT_VARIABLE); if (variableName != null) { VariableDefinition faultVariable = _throw.getCompositeActivity().findVariable(variableName); if (faultVariable != null) { VariableType variableType = faultVariable.getType(); if (variableType.isMessage() || variableType.isElement()) { _throw.setFaultVariable(faultVariable); } else { bpelReader .getProblemHandler() .add( new ParseProblem( "fault variable must be either wsdl message or element", throwElem)); } } else bpelReader.getProblemHandler().add(new ParseProblem("variable not found", throwElem)); } }
public void testVariable() { // prepare persistent objects // variable VariableDefinition variable = new VariableDefinition(); variable.setName("v"); // process process.getGlobalScope().addVariable(variable); // replier replier.setVariable(variable); // save objects and load them back process = saveAndReload(process); replier = getReplier(process); // verify the retrieved objects assertEquals("v", replier.getVariable().getName()); }
public void testCreateProcessInstance() { VariableDefinition schemaVar = new VariableDefinition(); schemaVar.setName("sv"); schemaVar.setType(type); Scope globalScope = process.getGlobalScope(); globalScope.addVariable(schemaVar); QName messageName = new QName("md"); Message messageDef = new MessageImpl(); messageDef.setQName(messageName); ImportsDefinition imports = process.getImports(); imports.addMessage(messageDef); VariableDefinition messageVar = new VariableDefinition(); messageVar.setName("mv"); messageVar.setType(imports.getMessageType(messageName)); globalScope.addVariable(messageVar); // save objects and load them back process = saveAndReload(process); // verify retrieved object process.createProcessInstance(); }