Author: dkulp
Date: Fri Mar 21 06:02:57 2008
New Revision: 639617
URL: http://svn.apache.org/viewvc?rev=639617&view=rev
Log:
Fix in/outs of corba primitives
Modified:
incubator/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandler.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitClientTypeTest.java
Modified:
incubator/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandler.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandler.java?rev=639617&r1=639616&r2=639617&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandler.java
(original)
+++
incubator/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandler.java
Fri Mar 21 06:02:57 2008
@@ -42,6 +42,9 @@
public void setIntoAny(Any val, CorbaStreamable stream, boolean output) {
any = val;
+ if (stream != null) {
+ val.insert_Streamable(stream);
+ }
if (output && value != null) {
switch (this.typeCode.kind().value()) {
case TCKind._tk_boolean:
@@ -89,10 +92,7 @@
default:
// Default: assume that whatever stored the data will also
know how to convert it into what
// it needs.
- val.insert_Streamable(stream);
}
- } else {
- val.insert_Streamable(stream);
}
}
@@ -145,10 +145,18 @@
data = ((java.math.BigInteger)value).toString();
break;
case TCKind._tk_float:
- data = ((Float)value).toString();
+ if (((Float)value).isInfinite()) {
+ data = "INF";
+ } else {
+ data = ((Float)value).toString();
+ }
break;
case TCKind._tk_double:
- data = ((Double)value).toString();
+ if (((Double)value).isInfinite()) {
+ data = "INF";
+ } else {
+ data = ((Double)value).toString();
+ }
break;
case TCKind._tk_string:
case TCKind._tk_wstring:
@@ -202,10 +210,22 @@
obj = new java.math.BigInteger(data);
break;
case TCKind._tk_float:
- obj = new Float(data);
+ if ("INF".equals(data)) {
+ obj = Float.POSITIVE_INFINITY;
+ } else if ("-INF".equals(data)) {
+ obj = Float.NEGATIVE_INFINITY;
+ } else {
+ obj = new Float(data);
+ }
break;
case TCKind._tk_double:
- obj = new Double(data);
+ if ("INF".equals(data)) {
+ obj = Double.POSITIVE_INFINITY;
+ } else if ("-INF".equals(data)) {
+ obj = Double.NEGATIVE_INFINITY;
+ } else {
+ obj = new Double(data);
+ }
break;
case TCKind._tk_string:
case TCKind._tk_wstring:
@@ -256,10 +276,18 @@
data =
java.math.BigInteger.valueOf(any.extract_ulonglong()).toString();
break;
case TCKind._tk_float:
- data = Float.toString(any.extract_float());
+ if (Float.isInfinite(any.extract_float())) {
+ data = "INF";
+ } else {
+ data = Float.toString(any.extract_float());
+ }
break;
case TCKind._tk_double:
- data = Double.toString(any.extract_double());
+ if (Double.isInfinite(any.extract_double())) {
+ data = "INF";
+ } else {
+ data = Double.toString(any.extract_double());
+ }
break;
case TCKind._tk_string:
data = any.extract_string();
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient.java?rev=639617&r1=639616&r2=639617&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/AbstractTypeTestClient.java
Fri Mar 21 06:02:57 2008
@@ -361,14 +361,17 @@
}
}
+ protected float[][] getTestFloatData() {
+ return new float[][] {{0.0f, 1.0f}, {-1.0f, (float)java.lang.Math.PI},
{-100.0f, 100.0f},
+ {Float.NEGATIVE_INFINITY,
Float.POSITIVE_INFINITY}, };
+ }
@Test
public void testFloat() throws Exception {
if (!shouldRunTest("Float")) {
return;
}
float delta = 0.0f;
- float valueSets[][] = {{0.0f, 1.0f}, {-1.0f,
(float)java.lang.Math.PI}, {-100.0f, 100.0f},
- {Float.NEGATIVE_INFINITY,
Float.POSITIVE_INFINITY}, };
+ float valueSets[][] = getTestFloatData();
for (int i = 0; i < valueSets.length; i++) {
float x = valueSets[i][0];
@@ -409,6 +412,10 @@
assertTrue("testFloat(): Incorrect return value",
Float.isNaN(ret));
}
}
+ protected double[][] getTestDoubleData() {
+ return new double[][] {{0.0f, 1.0f}, {-1, java.lang.Math.PI}, {-100.0,
100.0},
+ {Double.NEGATIVE_INFINITY,
Double.POSITIVE_INFINITY}};
+ }
@Test
public void testDouble() throws Exception {
@@ -416,11 +423,7 @@
return;
}
double delta = 0.0d;
- double valueSets[][] = {{0.0f, 1.0f}, {-1, java.lang.Math.PI},
{-100.0, 100.0},
- {Double.NEGATIVE_INFINITY,
Double.POSITIVE_INFINITY},
- // {Double.MIN_VALUE, 0},
- // {Double.MAX_VALUE,0},
- };
+ double valueSets[][] = getTestDoubleData();
for (int i = 0; i < valueSets.length; i++) {
double x = valueSets[i][0];
Holder<Double> yOrig = new Holder<Double>(valueSets[i][1]);
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitClientTypeTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitClientTypeTest.java?rev=639617&r1=639616&r2=639617&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitClientTypeTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/type_test/corba/CORBADocLitClientTypeTest.java
Fri Mar 21 06:02:57 2008
@@ -61,15 +61,55 @@
"CompoundArray",
"NestedArray",
"EmptyChoice",
+ "Name",
"Void",
"Oneway",
+ "Byte",
+ "Short",
+ "UnsignedShort",
+ "Int",
+ //"UnsignedInt",
+ "Long",
+ "UnsignedLong",
+ "Float",
+ "Double",
+ //"UnsignedByte",
+ "Boolean",
+ "String",
+ //"StringI18N",
+ "Date",
+ //"DateTime",
+ "Time",
+ "GYear",
+ "GYearMonth",
+ "GMonth",
+ "GMonthDay",
+ "GDay",
+ "Duration",
+ "NormalizedString",
+ "Token",
+ "Language",
+ "NMTOKEN",
+ //"NMTOKENS",
+ "NCName",
+ "ID",
"Decimal",
+ "Integer",
+ "PositiveInteger",
+ "NonPositiveInteger",
+ "NegativeInteger",
+ "NonNegativeInteger",
"HexBinary",
+ "Base64Binary",
+ "AnyURI",
"ColourEnum",
"NumberEnum",
"StringEnum",
+ "DecimalEnum",
"NMTokenEnum",
"AnyURIEnum",
+ "SimpleRestriction",
+ "SimpleRestriction4",
};
WORKING_TESTS.addAll(Arrays.asList(working));
}
@@ -77,7 +117,7 @@
@BeforeClass
public static void startServers() throws Exception {
- boolean ok = launchServer(CORBADocLitServerImpl.class);
+ boolean ok = launchServer(CORBADocLitServerImpl.class, true);
assertTrue("failed to launch server", ok);
initClient(AbstractTypeTestClient5.class, SERVICE_NAME, PORT_NAME,
WSDL_PATH);
}
@@ -101,5 +141,13 @@
@Test
public void testA() throws Exception {
- }
+ }
+
+ protected float[][] getTestFloatData() {
+ return new float[][] {{0.0f, 1.0f}, {-1.0f, (float)java.lang.Math.PI},
{-100.0f, 100.0f}};
+ }
+ protected double[][] getTestDoubleData() {
+ return new double[][] {{0.0f, 1.0f}, {-1, java.lang.Math.PI}, {-100.0,
100.0}};
+ }
+
}