Commit 600b6607 authored by Philippe Merle's avatar Philippe Merle

Migrated this example to EasyBPEL 1.6-SNAPSHOT:

* Updated the signature of the Factorial interface
  moved from type int to type double.
* Updated an xpath expression of the BPEL process.
parent 33c0a1e7
......@@ -55,9 +55,9 @@ public interface Factorial
@GET
@Path("/{value}")
@Produces("text/plain")
int factorial(
double factorial(
@WebParam(partName = "value", name = "FactorialRequest", targetNamespace = "http://frascati.ow2.org/examples/factorial/bpel/api")
@PathParam("value")
int value
double value
);
}
......@@ -66,8 +66,8 @@ public class ObjectFactory
*
*/
@XmlElementDecl(namespace = API_NS, name = "FactorialResponse")
public final JAXBElement<Integer> createFactorialResponse(Integer value) {
return new JAXBElement<Integer>(FACTORIAL_RESPONSE_QNAME, Integer.class, null, value);
public final JAXBElement<Double> createFactorialResponse(Double value) {
return new JAXBElement<Double>(FACTORIAL_RESPONSE_QNAME, Double.class, null, value);
}
/**
......@@ -75,8 +75,8 @@ public class ObjectFactory
*
*/
@XmlElementDecl(namespace = API_NS, name = "FactorialRequest")
public final JAXBElement<Integer> createFactorialRequest(Integer value) {
return new JAXBElement<Integer>(FACTORIAL_REQUEST_QNAME, Integer.class, null, value);
public final JAXBElement<Double> createFactorialRequest(Double value) {
return new JAXBElement<Double>(FACTORIAL_REQUEST_QNAME, Double.class, null, value);
}
}
......@@ -62,11 +62,11 @@ public class FactorialPanel
public final void actionPerformed(ActionEvent e) {
try {
// Get the user's input.
int value = Integer.valueOf(valueField.getText());
double value = Double.valueOf(valueField.getText());
// Call the factorial service.
int result = selected.factorial(value);
double result = selected.factorial(value);
// Display the result.
resultLabel.setText(Integer.toString(result));
resultLabel.setText(Double.toString(result));
} catch(NumberFormatException nfe) {
// Error when input is not an integer.
throw new RuntimeException(nfe);
......
......@@ -65,7 +65,7 @@
partnerLink="invoker" portType="tns:Factorial"/>
<bpws:assign name="multiply" validate="no">
<bpws:copy>
<bpws:from><![CDATA[$input.value * $callOut]]></bpws:from>
<bpws:from><![CDATA[$input.value * $callOut.value]]></bpws:from>
<bpws:to><![CDATA[$output.value]]></bpws:to>
</bpws:copy>
</bpws:assign>
......
......@@ -3,7 +3,7 @@
* ====================================================================
*
* OW2 FraSCAti Examples: Factorial BPEL
* Copyright (C) 2010 INRIA, University of Lille 1
* Copyright (C) 2010-2012 Inria, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -40,8 +40,8 @@
>
<wsdl:types>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://frascati.ow2.org/examples/factorial/bpel/api" xmlns:tns="http://api.bpel.factorial.examples.frascati.ow2.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="FactorialRequest" type="xsd:int"/>
<xsd:element name="FactorialResponse" type="xsd:int"/>
<xsd:element name="FactorialRequest" type="xsd:double"/>
<xsd:element name="FactorialResponse" type="xsd:double"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="FactorialRequest">
......
......@@ -47,9 +47,9 @@ public class FraSCAtiTest
FraSCAti frascati = FraSCAti.newFraSCAti();
Component factorialComposite = frascati.getComposite("factorial.composite");
Factorial factorial = frascati.getService(factorialComposite, "factorial", Factorial.class);
int result = factorial.factorial(5);
double result = factorial.factorial(5);
System.out.println("factorial(5) ==> " + result);
assertEquals("factorial(5) == 120", result, 120);
assertEquals("factorial(5) == 120", 120.0, result, 0.0);
frascati.close(factorialComposite);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment