forked from apache/dubbo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix hessian lite test case fail bug (apache#1394)
* fix hessian lite test case fail bug * update test * remove ignore * Fix time unit problem related with FutureAdapter in UT * revert file
- Loading branch information
Showing
3 changed files
with
14 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
package com.alibaba.com.caucho.hessian.io; | ||
|
||
import com.alibaba.com.caucho.hessian.io.base.SerializeTestBase; | ||
import com.alibaba.com.caucho.hessian.io.beans.Hessian2StringShortType; | ||
import com.alibaba.com.caucho.hessian.io.beans.PersonType; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.ByteArrayOutputStream; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.junit.Test; | ||
|
||
import static junit.framework.TestCase.assertEquals; | ||
|
@@ -15,7 +20,7 @@ | |
/** | ||
* @author [email protected] | ||
*/ | ||
public class Hessian2StringShortTest { | ||
public class Hessian2StringShortTest extends SerializeTestBase { | ||
|
||
@Test | ||
public void serialize_string_short_map_then_deserialize() throws Exception { | ||
|
@@ -26,16 +31,7 @@ public void serialize_string_short_map_then_deserialize() throws Exception { | |
stringShortMap.put("last", (short)60); | ||
stringShort.stringShortMap = stringShortMap; | ||
|
||
ByteArrayOutputStream bout = new ByteArrayOutputStream(); | ||
Hessian2Output out = new Hessian2Output(bout); | ||
|
||
out.writeObject(stringShort); | ||
out.flush(); | ||
|
||
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); | ||
Hessian2Input input = new Hessian2Input(bin); | ||
|
||
Hessian2StringShortType deserialize = (Hessian2StringShortType) input.readObject(); | ||
Hessian2StringShortType deserialize = baseHession2Serialize(stringShort); | ||
assertTrue(deserialize.stringShortMap != null); | ||
assertTrue(deserialize.stringShortMap.size() == 2); | ||
assertTrue(deserialize.stringShortMap.get("last") instanceof Short); | ||
|
@@ -52,16 +48,7 @@ public void serialize_string_byte_map_then_deserialize() throws Exception { | |
stringByteMap.put("last", (byte)60); | ||
stringShort.stringByteMap = stringByteMap; | ||
|
||
ByteArrayOutputStream bout = new ByteArrayOutputStream(); | ||
Hessian2Output out = new Hessian2Output(bout); | ||
|
||
out.writeObject(stringShort); | ||
out.flush(); | ||
|
||
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); | ||
Hessian2Input input = new Hessian2Input(bin); | ||
|
||
Hessian2StringShortType deserialize = (Hessian2StringShortType) input.readObject(); | ||
Hessian2StringShortType deserialize = baseHession2Serialize(stringShort); | ||
assertTrue(deserialize.stringByteMap != null); | ||
assertTrue(deserialize.stringByteMap.size() == 2); | ||
assertTrue(deserialize.stringByteMap.get("last") instanceof Byte); | ||
|
@@ -145,8 +132,7 @@ public void serialize_list_then_deserialize() throws Exception { | |
|
||
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); | ||
Hessian2Input input = new Hessian2Input(bin); | ||
List deserialize = (List) input.readObject(ArrayList.class, Short.class); | ||
// List deserialize = (List) input.readObject(); | ||
List<Short> deserialize = (List) input.readObject(ArrayList.class, Short.class); | ||
assertTrue(deserialize != null); | ||
assertTrue(deserialize.size() == 2); | ||
assertTrue(deserialize.get(1) instanceof Short); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...aba/com/caucho/hessian/io/PersonType.java → ...m/caucho/hessian/io/beans/PersonType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters