This repository has been archived by the owner on Sep 5, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
195 additions
and
12 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
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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.alibaba.json.bvt; | ||
|
||
import com.alibaba.fastjson.JSON; | ||
import com.alibaba.fastjson.annotation.JSONField; | ||
import junit.framework.TestCase; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class JSONFeidDemo2 extends TestCase { | ||
|
||
public void test_0() throws Exception { | ||
Z_OA_MM_PR_INFO_IN in = new Z_OA_MM_PR_INFO_IN(); | ||
in.setIM_PREQ_NO("111111"); | ||
TB_PR_INFO t1 = new TB_PR_INFO("t1"); | ||
TB_PR_INFO t2 = new TB_PR_INFO("t2"); | ||
List<TB_PR_INFO> tb_pr_infos = new ArrayList<TB_PR_INFO>(); | ||
tb_pr_infos.add(t1); | ||
tb_pr_infos.add(t2); | ||
in.setTB_PR_INFO(tb_pr_infos); | ||
|
||
String text = JSON.toJSONString(in); | ||
System.out.println(text); | ||
|
||
assertEquals( | ||
"{\"IM_PREQ_NO\":\"111111\",\"TB_PR_INFO\":[{\"PREQ_NO\":\"t1\"},{\"PREQ_NO\":\"t2\"}]}", | ||
text); | ||
|
||
} | ||
|
||
public void test_1() throws Exception { | ||
String text = "{\"IM_PREQ_NO\":\"111111\",\"TB_PR_INFO\":[{\"PREQ_NO\":\"t1\"},{\"PREQ_NO\":\"t2\"}]}"; | ||
Z_OA_MM_PR_INFO_IN in = JSON | ||
.parseObject(text, Z_OA_MM_PR_INFO_IN.class); | ||
assertEquals("111111", in.getIM_PREQ_NO()); | ||
assertNotNull(in.getTB_PR_INFO()); | ||
|
||
} | ||
|
||
public static class Z_OA_MM_PR_INFO_IN { | ||
@JSONField(name = "IM_PREQ_NO") | ||
private String IM_PREQ_NO; | ||
@JSONField(name = "TB_PR_INFO") | ||
private List<TB_PR_INFO> TB_PR_INFO; | ||
|
||
public List<JSONFeidDemo2.TB_PR_INFO> getTB_PR_INFO() { | ||
return TB_PR_INFO; | ||
} | ||
|
||
public void setTB_PR_INFO(List<JSONFeidDemo2.TB_PR_INFO> TB_PR_INFO) { | ||
this.TB_PR_INFO = TB_PR_INFO; | ||
} | ||
|
||
public String getIM_PREQ_NO() { | ||
return IM_PREQ_NO; | ||
} | ||
|
||
public void setIM_PREQ_NO(String IM_PREQ_NO) { | ||
this.IM_PREQ_NO = IM_PREQ_NO; | ||
} | ||
} | ||
|
||
public static class TB_PR_INFO { | ||
@JSONField(name = "PREQ_NO") | ||
private String PREQ_NO; | ||
|
||
public TB_PR_INFO() { | ||
} | ||
|
||
public TB_PR_INFO(String PREQ_NO) { | ||
this.PREQ_NO = PREQ_NO; | ||
} | ||
@JSONField(name = "PREQ_NO") | ||
public String getPREQ_NO() { | ||
return PREQ_NO; | ||
} | ||
|
||
public void setPREQ_NO(String PREQ_NO) { | ||
this.PREQ_NO = PREQ_NO; | ||
} | ||
} | ||
} |
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
95 changes: 95 additions & 0 deletions
95
src/test/java/com/alibaba/json/bvt/bug/Bug_for_Double2Tag.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package com.alibaba.json.bvt.bug; | ||
|
||
import com.alibaba.fastjson.JSON; | ||
|
||
import junit.framework.TestCase; | ||
|
||
public class Bug_for_Double2Tag extends TestCase { | ||
public void test_double() throws Exception { | ||
Double2Tag tag = new Double2Tag(); | ||
String str = JSON.toJSONString(tag); | ||
JSON.parseObject(str, Double2Tag.class); | ||
} | ||
|
||
public static class Double2Tag { | ||
public String data_time; | ||
public String data_id; | ||
public String hour_id; | ||
public String minute_id; | ||
public String tag3_id; | ||
public double ali_fee; | ||
public double total_ali_fee; | ||
public long seller_cnt; | ||
|
||
public Double2Tag() { | ||
ali_fee = 0.0; | ||
total_ali_fee = 0.0; | ||
seller_cnt = 0; | ||
} | ||
|
||
public String getData_time() { | ||
return data_time; | ||
} | ||
|
||
public void setData_time(String data_time) { | ||
this.data_time = data_time; | ||
} | ||
|
||
public String getData_id() { | ||
return data_id; | ||
} | ||
|
||
public void setData_id(String data_id) { | ||
this.data_id = data_id; | ||
} | ||
|
||
public String getHour_id() { | ||
return hour_id; | ||
} | ||
|
||
public void setHour_id(String hour_id) { | ||
this.hour_id = hour_id; | ||
} | ||
|
||
public String getMinute_id() { | ||
return minute_id; | ||
} | ||
|
||
public void setMinute_id(String minute_id) { | ||
this.minute_id = minute_id; | ||
} | ||
|
||
public String getTag3_id() { | ||
return tag3_id; | ||
} | ||
|
||
public void setTag3_id(String tag3_id) { | ||
this.tag3_id = tag3_id; | ||
} | ||
|
||
public double getAli_fee() { | ||
return ali_fee; | ||
} | ||
|
||
public void setAli_fee(double ali_fee) { | ||
this.ali_fee = ali_fee; | ||
} | ||
|
||
public double getTotal_ali_fee() { | ||
return total_ali_fee; | ||
} | ||
|
||
public void setTotal_ali_fee(double total_ali_fee) { | ||
this.total_ali_fee = total_ali_fee; | ||
} | ||
|
||
public long getSeller_cnt() { | ||
return seller_cnt; | ||
} | ||
|
||
public void setSeller_cnt(long seller_cnt) { | ||
this.seller_cnt = seller_cnt; | ||
} | ||
|
||
} | ||
} |
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
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
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export AMPLXE_EXPERIMENTAL=1 | ||
/opt/intel/vtune_amplifier_xe/bin64/amplxe-cl -collect hotspots /opt/taobao/install/jdk-1.7.0_10/bin/java -classpath target/classes/:target/test-classes/ com.alibaba.json.test.benchmark.BenchmarkMain |